Plugin Directory

Changeset 3488402


Ignore:
Timestamp:
03/22/2026 08:28:47 PM (2 weeks ago)
Author:
orbemorder
Message:

Update to version 1.3.6 from GitHub

Location:
orbem-studio
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • orbem-studio/tags/1.3.6/assets/build/app.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'e9ffc745a829c37df15b');
     1<?php return array('dependencies' => array(), 'version' => 'c13f0550a34a9ce7e495');
  • orbem-studio/tags/1.3.6/assets/build/app.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911),a(704)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911),a(704)})();
  • orbem-studio/tags/1.3.6/assets/build/devmode.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'eea7ea8d5bd3f005c80c');
     1<?php return array('dependencies' => array(), 'version' => 'eb008462a699a40ed0f6');
  • orbem-studio/tags/1.3.6/assets/build/devmode.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(704)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(704)})();
  • orbem-studio/tags/1.3.6/assets/build/explore.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'c6f3aac55f47483d1e81');
     1<?php return array('dependencies' => array(), 'version' => '2c3f19e559e5f4ca49a2');
  • orbem-studio/tags/1.3.6/assets/build/explore.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911)})();
  • orbem-studio/tags/1.3.6/orbem-studio.php

    r3488361 r3488402  
    66 * Plugin URI: https://orbem.studio/
    77 * Description: Build your own RPG video game using the power of WordPress
    8  * Version: 1.3.5
     8 * Version: 1.3.6
    99 * Author: orbemorder
    1010 * Author URI: https://orbemorder.com/
     
    3434 * Plugin version constant.
    3535 */
    36 const ORBEM_STUDIO_VERSION = '1.3.5';
     36const ORBEM_STUDIO_VERSION = '1.3.6';
    3737
    3838if (version_compare(phpversion(), '8.1.0', '>=')) {
  • orbem-studio/tags/1.3.6/readme.txt

    r3488361 r3488402  
    66Tested up to: 6.9
    77Requires PHP: 8.1
    8 Stable tag: 1.3.5
     8Stable tag: 1.3.6
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    171171== Changelog ==
    172172
     173= 1.3.6 =
     174* allow enemy kill logged out.
     175
    173176= 1.3.5 =
    174177* Remove item after mission.
  • orbem-studio/trunk/assets/build/app.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'e9ffc745a829c37df15b');
     1<?php return array('dependencies' => array(), 'version' => 'c13f0550a34a9ce7e495');
  • orbem-studio/trunk/assets/build/app.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911),a(704)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911),a(704)})();
  • orbem-studio/trunk/assets/build/devmode.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'eea7ea8d5bd3f005c80c');
     1<?php return array('dependencies' => array(), 'version' => 'eb008462a699a40ed0f6');
  • orbem-studio/trunk/assets/build/devmode.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(704)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(704)})();
  • orbem-studio/trunk/assets/build/explore.asset.php

    r3488361 r3488402  
    1 <?php return array('dependencies' => array(), 'version' => 'c6f3aac55f47483d1e81');
     1<?php return array('dependencies' => array(), 'version' => '2c3f19e559e5f4ca49a2');
  • orbem-studio/trunk/assets/build/explore.js

    r3488361 r3488402  
    1 (()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l&&C){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911)})();
     1(()=>{"use strict";var e={295:(e,t,a)=>{function n(){const e=document.querySelectorAll(".upload_image_button");e.length>0&&e.forEach((function(e){o(e)}));const t=document.querySelectorAll(".remove_image_button");t.length>0&&t.forEach((function(e){r(e)}))}function o(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction,a=wp.media({title:"Select Asset",button:{text:"Use This Asset"},multiple:!1});a.on("select",(function(){const n=a.state().get("selection").first().toJSON();let o=document.getElementById(`explore-character-images[${t}]`);if(o&&"image"===n.type)o.value=n.url;else{const t=e.target.closest(".explore-image-field");t&&(o=t.querySelector(".explore-upload-field"))}o&&(o.value=n.url);const r=document.getElementById("_product_video_url");r&&"video"===n.type&&(r.value=n.url);const s=document.getElementById("_product_video_url_thumbnail");s&&"image"===n.type&&(s.value=n.url)})),a.open()}))}function r(e){e.addEventListener("click",(function(e){e.preventDefault();const t=this.dataset.direction;let a=document.getElementById(`explore-character-images[${t}]`);if(a);else{const t=e.target.closest(".explore-image-field");t&&(a=t.querySelector(".explore-upload-field"))}a&&(a.value="")}))}a.d(t,{X:()=>n}),document.addEventListener("DOMContentLoaded",(function(){n()})),window.initExploreUploadButton=o,window.initExploreRemoveButton=r},704:(e,t,a)=>{a.d(t,{S:()=>r});var n=a(295),o=a(911);function r(){let e=!1;window.devmode=!1;let t=1;const a=document.getElementById("zoom-in"),r=document.getElementById("zoom-out");a&&r&&(a.addEventListener("click",(()=>{p("in")})),r.addEventListener("click",(()=>{p("out")})));let s,c=null,i=0,l=0;function d(e){if(clearTimeout(s),e.preventDefault(),c=e.target.closest(".map-item, .enemy-item"),c.style.transition="",c){const t=c.getBoundingClientRect();i=e.clientX-t.left,l=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",u)}}function u(e){if(c){const a=document.querySelector(".game-container").getBoundingClientRect(),n="menu"===c.dataset.type?e.clientX:e.clientX-a.left,o="menu"===c.dataset.type?e.clientY:e.clientY-a.top;c.style.left=n/t-i+"px",c.style.top=o/t-l+"px"}}function m(){c&&(s=setTimeout((()=>{const t=`${OrbemOrder.siteRESTURL}/set-item-position/`,a="true"===c.dataset.trigger||!0===c.classList.contains("drag-dest")?c.id.replace("-t","").replace("-d",""):c.id,n={top:c.style.top.replace("px",""),left:c.style.left.replace("px",""),height:c.style.height.replace("px",""),width:c.style.width.replace("px",""),id:a,meta:c.dataset?.meta};a===e&&(n.walkingPath="true"),fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),c=null}),1e3),document.removeEventListener("mousemove",u))}function p(e){const a=document.querySelector(".game-container"),n=document.getElementById("zoom-amount");if(a){let o=void 0!==a.style.transform&&""!==a.style.transform?a.style.transform:"1";o=parseFloat(o.replace("scale(","").replace(")","")),o="in"===e?+(o+.1).toFixed(10):+(o-.1).toFixed(10),n&&(n.textContent=(100*o).toString()),t=o,a.style.transform="scale("+o+")"}}const g=document.querySelector("#new-addition");g&&(g.addEventListener("click",(e=>{!1===e.target.classList.contains("close-settings")&&!1===e.target.parentNode.classList.contains("character-item")&&g.classList.add("engage")})),g.querySelector(".close-settings").addEventListener("click",(()=>{const e=document.querySelector(".retrieval-points #item-description");g.classList.remove("engage"),e&&(e.innerHTML="")})));const f=document.querySelector(".level-selector"),y=document.getElementById("select-level");f&&y&&y.addEventListener("click",(()=>{f.classList.add("engage"),f.querySelectorAll("img").forEach((e=>{e.addEventListener("click",(()=>{const t=e.src,a=e.dataset.name;(0,o.Z)(),(0,o.U)(a,t)}))}))}));const w=document.querySelector(".dev-mode-menu-toggle");w&&w.addEventListener("click",(()=>{const e=document.querySelector(".dev-mode-menu");if(e){e.classList.toggle("engage"),w.classList.toggle("engage");const t=document.querySelectorAll('.explainer-container, .materialize-item-trigger, [data-genre="explore-wall"], [data-trigger="true"], [data-genre="explore-area"], [data-genre="blockade"]');e.classList.contains("engage")?t&&t.forEach((e=>{e.style.backgroundColor="rgb(0,146,255)",e.style.opacity=.3,e.style.zIndex=1})):t&&t.forEach((e=>{e.style.backgroundColor="",e.style.opacity=""}))}})),setTimeout((()=>{const a=document.querySelectorAll(".map-item, .enemy-item"),o=document.querySelectorAll(".find-explore-item"),r=document.getElementById("map-character"),s=document.querySelectorAll("#add-new-list li"),c=document.getElementById("god-mode"),i=document.getElementById("no-touch"),l=document.getElementById("open-pinpoint"),u=document.querySelector(".pinpoint-container");function p(e){e.stopPropagation();const t=document.getElementById("top-pinpoint"),a=document.getElementById("left-pinpoint");t.value=window.mouseY,a.value=window.mouseX,u.classList.remove("engage"),document.removeEventListener("click",p),document.removeEventListener("mousemove",g),document.body.style.cursor="default"}function g(e){const t=document.querySelector(".game-container").getBoundingClientRect();window.mouseX=parseInt(e.clientX-t.left),window.mouseY=parseInt(e.clientY-t.top)}if(l&&l.addEventListener("click",(()=>{document.body.style.cursor="copy",u.classList.add("engage"),setTimeout((()=>{document.addEventListener("click",p),document.addEventListener("mousemove",g)}),0)})),window.godMode=!1,window.noTouch=!1,c&&i&&(c.addEventListener("change",(()=>{c.checked?window.godMode=!0:window.godMode=!1})),i.addEventListener("change",(()=>{i.checked?(window.noTouch=!0,r.style.zIndex="0"):window.noTouch=!1}))),s&&s.forEach((function(e){e.addEventListener("click",(()=>{const t=e.dataset.type;e.classList.add("engage");const a=`${OrbemOrder.siteRESTURL}/get-new-fields/`,o={type:t};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(o)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.querySelector(".add-new-fields");t&&(t.innerHTML=e.data,"function"==typeof n.X&&((0,n.X)(),function(){const e=document.getElementById("add-new-form");e&&e.addEventListener("submit",(function(t){t.preventDefault();const a=function(e){const t=Object.fromEntries(e.entries()),a={};for(const[e,n]of Object.entries(t)){const t=e.replace(/\]/g,"").split("[");let o=a;for(;t.length>1;){const e=t.shift();e in o||(o[e]={}),o=o[e]}o[t[0]]=n}return a}(new FormData(e)),n=`${OrbemOrder.siteRESTURL}/add-new/`,o=document.querySelector("#add-new-list li.engage");let r="";o&&(r=o.dataset.type);let s=document.querySelector(".game-container");s=s.className.replace("game-container ","");const c={type:r,area:null!=s?s:"",values:a};fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);window.location.reload()}))}))}()))}))}))})),o&&o.length>0){o.forEach((t=>{const a=t.querySelector(".find-title"),n=t.querySelector(".edit-item-button"),o=t.querySelector(".show-hide-item"),s=t.querySelector(".close-item-button");if(n&&o){const a=n.closest(".find-explore-item").id.replace("-f",""),r=document.getElementById(a);o.addEventListener("click",(()=>{!0===o.classList.contains("show")?(r.style.display="none",o.textContent="🫣"):(r.style.display="block",o.textContent="👁️"),o.classList.toggle("show")})),n.addEventListener("click",(()=>{if(!0!==n.classList.contains("created")){const o=document.createElement("div"),c=document.createElement("label"),i=document.createElement("input"),l=document.createElement("label"),d=document.createElement("input"),u=document.createElement("button");let m=r.style.height;m=m?m.replace("px",""):"";let p=r.style.width;if(p=p?p.replace("px",""):"",s.style.display="block",c.textContent="Height",l.textContent="Width",o.classList.add("size-input"),i.type="number",i.value=m&&""!==m?m:r.dataset?.height,d.type="number",d.value=p&&""!==p?p:r.dataset?.width,u.classList.add("submit-size"),u.textContent="submit",c.appendChild(i),l.appendChild(d),o.appendChild(c),o.appendChild(l),o.appendChild(u),"explore-character"===t.dataset.posttype||"explore-enemy"===t.dataset.posttype){const t=document.createElement("label"),n=document.createElement("input");n.type="checkbox",t.textContent="Record Walking Path",t.appendChild(n),o.appendChild(t),n.addEventListener("change",(()=>{e=!!n.checked&&a}))}t.appendChild(o),n.classList.add("created"),u.addEventListener("click",(()=>{const e=`${OrbemOrder.siteRESTURL}/set-item-size/`,c={height:i.value,width:d.value,id:a,meta:t.dataset?.meta};fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(c)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);o.remove(),n.classList.remove("created"),s.style.display="none",r&&(r.style.height=`${i.value}px`,r.style.width=`${d.value}px`)}))})),s.addEventListener("click",(()=>{o.remove(),n.classList.remove("created"),s.style.display="none"}))}}))}a.addEventListener("click",(e=>{const a=e.target.closest(".find-explore-item"),n=document.querySelector("."+a.dataset.class+'[data-genre="'+a.dataset.posttype+'"]'),o=document.querySelector(".map-item.selected"),s=document.querySelector(".find-explore-item.selected");o&&o.classList.remove("selected"),s&&s.classList.remove("selected"),n&&(r.style.left=parseInt(n.style.left.replace("px",""))-200+"px",r.style.top=parseInt(n.style.top.replace("px",""))-200+"px",n.scrollIntoView(),n.classList.add("selected"),t.classList.add("selected"))}))}));const v=document.querySelectorAll(".explore-list-group");v.length>0&&v.forEach((e=>{""===e.textContent&&e.remove();const t=e.querySelector(".item-post-type");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}))}a&&a.length&&a.forEach((e=>{e.draggable=!0,e.addEventListener("dragstart",d),e.addEventListener("mouseup",m)}));const f=document.getElementById("engage-wallbuilder"),y=document.querySelector(".wallbuilder-container"),w=document.querySelector(".default-map");let h=!1;if(f){f.addEventListener("click",(()=>{y.classList.toggle("engage"),y.classList.contains("engage")?(document.body.style.cursor="cell",document.addEventListener("mousedown",L)):(document.body.style.cursor="default",document.removeEventListener("mousedown",L))}));const b=0,S=0;function L(e){h=!0,e.preventDefault();const a=document.createElement("div");a.draggable=!0;const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t;function s(e){if(h&&a){const n=document.querySelector(".game-container").getBoundingClientRect(),o=(e.clientX-n.left)/t,r=(e.clientY-n.top)/t,s=parseFloat(a.style.left.replace("px","")),c=parseFloat(a.style.top.replace("px",""));a.style.width=o-s+"px",a.style.height=r-c+"px"}}a.className="wp-block-group map-item",a.style.left=o-b+"px",a.style.top=r-S+"px",a.style.backgroundColor="rgb(0,146,255)",a.style.opacity="0.3",a.style.zIndex="1",a.dataset.genre="explore-wall",w.appendChild(a),document.addEventListener("mousemove",s),document.addEventListener("mouseup",(function e(){h=!1;const t=`${OrbemOrder.siteRESTURL}/add-new/`;let n=document.querySelector(".game-container");n=n.className.replace("game-container ","");const o=a.style.top.replace("px",""),r=a.style.left.replace("px",""),c=a.style.width.replace("px",""),i=a.style.height.replace("px","");if(0<parseInt(c)&&0<parseInt(i)){const e={type:"explore-wall",area:null!=n?n:"",values:{title:"wall-"+n+"-"+o+"-"+r,"explore-width":c,"explore-height":i,"explore-top":o,"explore-left":r}};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{a.id=e.data,a.className=a.className+" wall-"+n+"-"+o.toString().replace(".","-")+"-"+r.toString().replace(".","-")+"-map-item is-layout-flow wp-block-group-is-layout-flow",a.dataset.width=c,a.dataset.height=i,a.addEventListener("dragstart",d),a.addEventListener("mouseup",m)}))}else a.addEventListener("dragstart",d),a.addEventListener("mouseup",m);document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",e)}))}}}),2500);const h=document.querySelector(".explore-item-list");if(h){const e=document.querySelector(".open-close-item-list");e&&e.addEventListener("click",(()=>{h.classList.toggle("engage")}))}}document.addEventListener("DOMContentLoaded",(function(){document.querySelector("main[data-devmode=true]")&&r()}))},911:(e,t,a)=>{a.d(t,{U:()=>We,Z:()=>ve});var n=a(704);let o,r,s;const c=[];let i=[];const l="";let d,u,m,p,g,f,y,w="",h=!1,v=!1,b=0,S=!1,L=!1,x=!1,q=!1,E=!1,k="",I=!1,O=400,T=400,N=0;const A=OrbemOrder.defaultWeapon;let C=!1,B=!1;function M(){const e=document.getElementById("characters"),t=!!e&&e.querySelectorAll(".character-list .character-item");t&&t.forEach((t=>{t.addEventListener("click",(()=>{!function(e){const t=e.querySelector("img");t.removeAttribute("srcset");const a=document.querySelector("#map-character");if(t&&a){const t=void 0===a.dataset.currentchar?window.mainCharacter:a.dataset.currentchar,n=document.querySelectorAll("#map-character .map-character-icon"),o=e.querySelectorAll(".character-images .character-icon");if(n){n.forEach(((e,t)=>{if(o[t]){const a=e.src;e.src=o[t].src,o[t].src=a}}));const t=a.dataset.ability,r=a.dataset.name;a.dataset.currentchar=e.dataset.charactername,a.dataset.ability=e.dataset.ability,a.dataset.name=e.querySelector(".character-name").textContent,e.dataset.ability=t,e.querySelector(".character-name").textContent=r}switch(a.dataset?.ability){case"speed":window.moveSpeed=5,window.attackMultiplier=5,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]'));break;case"programming":ne(document.querySelector('.storage-item[data-type="weapons"].equipped')),window.moveSpeed=3,window.attackMultiplier=0,Re();break;case"strength":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=10;break;case"hazard":window.moveSpeed=3,Re(),ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),window.attackMultiplier=0;break;case"default":window.moveSpeed=3,ne(document.querySelector('.storage-item[title="'+a.dataset?.weapon+'"]')),Re()}e.dataset.charactername=t||window.mainCharacter}}(t),e.classList.remove("engage")}))}))}function P(){const e=document.querySelectorAll('[data-clickable="true"]');e&&e.forEach((e=>{e.addEventListener("click",(()=>{const t=$e(e.className);H(e),D(e),ke(e),e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")}))}))}function H(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-materializeitem="'+t+'"]');a&&!1===a.classList.contains("enable")&&(a.classList.add("enable"),a.style.display="block")}function D(e){const t=$e(e.className),a=document.querySelector('.cutscene-trigger[data-removeafteritem="'+t+'"]');a&&a.remove()}function W(e,t,a,n){let o;if(e){let r=!1;!1!==t&&(r=e,e=t);const s=e.dataset.path,c=e.dataset.speed,i=void 0===e.dataset?.timebetween?"0":e.dataset.timebetween,l=e.dataset?.repeat,d="yes"===e.dataset?.wanderer;if(!1!==t&&r&&(e=r),s&&!1===d){const t=JSON.parse(s);t.unshift({top:e.style.top.replace("px",""),left:e.style.left.replace("px","")});const r=t.length-1;let d,u,m=0,p=1,g=0,f=0,y=!0,w=!1;const h=$e(e.className);if(t&&1!==t.length){let s,v,b=t[m].left,S=t[m].top,L=!1;o=setInterval((()=>{if("false"!==e.dataset?.canmove){const x=e.querySelector(".character-icon.engage");p=m===r?0:m+1,f=function(e,t,a,n,o,r){o="0"===o?"60":o,r="0"===r?"0.175":r;const s=Math.hypot(e-a,t-n)*parseFloat(r)*o;return Math.ceil(s/250)}(t[m].left,t[m].top,t[p].left,t[p].top,c,i),g===f-1||y?((r>m||y&&r===m)&&(x&&x.classList.remove("engage"),d=ye(t[m].left,t[m].top,t[p].left,t[p].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px",u=e.querySelector("#"+h+d),u&&(u.classList.add("engage"),w=!1)),!1===y?r>p?(g=0,y=!0,0!==p?m++:m=0):"true"===l?(y=!0,m=r,g=0,Ce(n,a)):r===p&&(clearInterval(o),Ce(n,a)):(y=!1,g++)):g++;const q=()=>{parseInt(t[p].left)===e.offsetLeft&&parseInt(t[p].top)===e.offsetTop&&!0!==w&&(z(d,e),w=!0),b=e.offsetLeft,S=e.offsetTop,s=e.offsetLeft,v=e.offsetTop,requestAnimationFrame(q)};q(),L=!1}else!1===L&&(f+=1,m=0<m?m-1:r,z(d,e),e.style.left=b+"px",e.style.top=S+"px",L=!0)}),250)}else ye(e.style.left.replace("px",""),e.style.top.replace("px",""),t[m].left,t[m].top,e,c),e.style.left=t[p].left+"px",e.style.top=t[p].top+"px"}else!0===d&&(j(e,c,i,!1),Ce(n,a));window.allowCutscene=!0}else Ce(n,a)}function R(){const e=document.querySelectorAll(".menu-tabs > div");e&&e.forEach(((e,t)=>{e.addEventListener("click",(()=>{const t=document.querySelector(".menu-tabs .engage"),a=document.getElementById("item-description");a&&(a.innerHTML=""),t&&t.classList.remove("engage");const n=document.querySelector('.retrieval-points [data-menu="'+e.className.replace("-tab","")+'"]');e.classList.add("engage");const o=document.querySelector(".storage-menu.engage");o&&o.classList.remove("engage"),n&&n.classList.add("engage")}))}))}function $(){const e=document.querySelectorAll("#settings, #storage, #characters");e&&e.forEach((e=>{if("storage"===e.id){const e=document.querySelectorAll(".retrieval-points .storage-item");e&&e.forEach((e=>{e.addEventListener("click",(()=>{"true"!==e.dataset.empty&&ae(e)}))}))}e.addEventListener("click",(t=>{!1!==t.target.classList.contains("close-settings")||t.target.closest(".character-item")||e.classList.add("engage")})),e.querySelector(".close-settings").addEventListener("click",(()=>{const t=document.querySelector(".retrieval-points #item-description");e.classList.remove("engage"),t&&(t.innerHTML="")}))}));const t=document.getElementById("update-settings"),a=document.getElementById("music-volume"),n=document.getElementById("sfx-volume"),o=document.getElementById("talking-volume");t&&(n&&a&&o&&(window.sfxVolume=n.value/100,window.talkingVolume=o.value,a.addEventListener("input",(e=>{window.currentMusic.volume=e.target.value/100})),o.addEventListener("input",(e=>{window.talkingVolume=e.target.value})),n.addEventListener("input",(e=>{window.sfxVolume=e.target.value/100}))),t.addEventListener("click",(()=>{a&&n&&o&&function(e,t,a){if(!1===C)return;const n={music:e,sfx:t,talking:a};fetch(`${OrbemOrder.siteRESTURL}/save-settings/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a.value,n.value,o.value)})))}function z(e,t){const a=t.querySelector(".character-icon.engage"),n=$e(t.className);a&&a.classList.remove("engage");const o=document.getElementById(n+"static-"+e);o&&o.classList.add("engage")}function j(e,t,a,n){let o=X([],n,e),r="",s=!1,c=!1,i=!1,l=!1,d=0,u=0,m="",p=0;!1===n&&function t(){const n=Math.floor(10001*Math.random())+15e3;setTimeout((()=>{J(a,e),t()}),n)}(),e._wanderInt=setInterval((()=>{if("true"!==e.dataset?.break&&"true"!==e.dataset?.cutscenebreak){!0===n&&""===r&&(o=X(o,!0,e));const t=e.style.left.replace("px",""),g=e.style.top.replace("px",""),f=Je(g,t,e,n),y=document.getElementById("map-character"),w=document.querySelector(".map-character-icon.engage"),h=parseInt(y.style.left.replace("px",""),10)+(400-w.width/2)-t,v=parseInt(y.style.top.replace("px",""),10)+(400-w.height/2)-g,b=Math.abs(h),S=Math.abs(v);let L=e.dataset.currentDirection||"down";const x=2;switch(S>b+x?L=v>0?"down":"up":b>S+x&&(L=h>0?"right":"left"),L!==e.dataset.currentDirection&&(e.dataset.currentDirection=L,function(e,t){if(!e||!t)return;const a=e.querySelectorAll(".character-icon"),n=$e(e.className),o=e.querySelector("#"+n+t);a.forEach((e=>{e.classList.remove("engage")})),o&&(e.dataset.currentDirection=t,o.classList.add("engage"))}(e,L)),o){case"down":e.style.top=f.top+1+"px";break;case"up":e.style.top=f.top-1+"px";break;case"left":e.style.left=f.left-1+"px";break;case"right":e.style.left=f.left+1+"px"}switch(m=r,((f.left>t||f.left<t)&&!0===f.collide&&!1===s&&("left"===o||"right"===o)||!0===f.collide&&f.top>g)&&(r=p%2==0?"down":"up"),(("down"===r&&f.top<g||"up"===r&&f.top>g)&&!0===f.collide&&("left"===o||"right"===o)||f.left>t&&!0===s)&&(r="down"===r?"up":"down",s=!0),f.top>g&&!0===f.collide&&!0===s&&("left"===o||"right"===o)&&(l=!0),!(f.top>g||f.top<g)||!0!==f.collide||!1!==c||"up"!==o&&"down"!==o||(r=p%2==0?"left":"right"),(("left"===r&&f.left>t||"right"===r&&f.left<t)&&!0===f.collide&&("up"===o||"down"===o)||f.top>g&&!0===c)&&(r="left"===r||"down"===r?"right":"left",c=!0),f.left<t&&!0===f.collide&&!0===c&&(i=!0),(!0===c&&!0===i||!0===l&&!0===s)&&(r="",o=X(o,n,e),c=!1,i=!1,l=!1,s=!1,p++),r){case"down":"up"!==o?e.style.top=f.top+1+"px":r="";break;case"up":"down"!==o?e.style.top=f.top-1+"px":r="";break;case"left":"right"!==o?e.style.left=f.left-1+"px":r="";break;case"right":"left"!==o?e.style.left=f.left+1+"px":r=""}!1===f.collide?d++:(d=0,m!==r&&u++),u>100&&(!1===n&&J(a,e),r="",s=!1,l=!1,c=!1,i=!1,p++),d>20&&(u=0,s=!1,l=!1,c=!1,i=!1,r="",p++)}else!1===n&&(o=X(o,n,e))}),t)}function J(e,t){t.dataset.break="true",setTimeout((()=>{t.dataset.break="false"}),e)}function X(e,t,a){if(!0===t&&a){const e=document.getElementById("map-character"),t=document.querySelector(".map-character-icon.engage");if(e&&t){const n=parseInt(a.style.left.replace("px",""),10),o=parseInt(a.style.top.replace("px",""),10),r=parseInt(e.style.left.replace("px",""),10)+(400-t.width/2)-n,s=parseInt(e.style.top.replace("px",""),10)+(400-t.height/2)-o,c=Math.abs(r);if(Math.abs(s)>c)return s>0?"down":"up";if(0<c)return r>0?"right":"left"}}const n=Array.isArray(e)?e:[e],o=["up","down","left","right"].filter((e=>!n.includes(e)));return 0===o.length?null:o[Math.floor(Math.random()*o.length)]}function U(e,t,a,n,o){!0===n&&G(a,t),e>100&&"point"!==t&&"money"!==t&&(e=100),e<0&&"health"===t&&(e=0);const r=document.querySelector(`.${t}-amount`);let s=!1;r&&(s=r.querySelector(".gauge")),OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!1===Array.isArray(a)?OrbemOrder.explorePoints[t].positions.push(a):OrbemOrder.explorePoints&&OrbemOrder.explorePoints[t]&&!1===OrbemOrder.explorePoints[t].positions.includes(a)&&!0===Array.isArray(a)&&a.forEach((e=>{OrbemOrder.explorePoints[t].positions.push(e)})),s&&"point"!==t&&"money"!==t?(r.setAttribute("data-amount",e),s.style.width=e+"px"):"point"===t?(r.setAttribute("data-amount",e),s.style.width=V(e),function(e){const t=document.querySelectorAll("[data-unlockable]");t&&t.forEach((t=>{const a=t.dataset.unlockable;parseInt(e)>=parseInt(a)&&"explore-magic"===t.dataset.genre&&(navigator.vibrate(1e3),function(e){const t=`${OrbemOrder.siteRESTURL}/addspell/`,a={spellid:e};!1!==C&&fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(t.id),t.remove())}))}(e)):"money"===t&&(r.setAttribute("data-amount",e),r.querySelector(".money-text").textContent=e),"health"===t&&0===e&&function(){const e=document.querySelector(".game-over-notice");if(e){clearInterval(m);const t=document.querySelector(".try-again"),a=document.querySelector(".default-map");e.style.display="block",window.allowMovement=!1,q=!1,E=!1,_("projectile","health",100,0,"true",!1),a&&Q(a.dataset.startleft,a.dataset.starttop),t&&t.addEventListener("click",(()=>{window.location.reload()}))}}(),""!==a&&!0===["money","point","health","mana"].includes(t)&&a!==o&&_(a,t,e,2e3,"",!1)}function _(e,t,a,n,r,s){if(!1===C)return;const c=`${OrbemOrder.siteRESTURL}/add-explore-points/`;"health"===t&&0===a||""!==e&&(clearTimeout(o),!1===Array.isArray(e)?i.push(e):i=e.concat(i),"health"===t&&(i=["projectile"]),i=Array.from(new Set(i)),!0===s&&(a="health"!==t?re(t)+a:V(t)-a),o=setTimeout((()=>{const e={type:t,item:i,amount:a,reset:r};fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);"communicate"!==t&&"money"!==t||(t="point"),OrbemOrder.explorePoints&&t&&(OrbemOrder.explorePoints[t].positions&&Array.isArray(OrbemOrder.explorePoints[t].positions)?OrbemOrder.explorePoints[t].positions=OrbemOrder.explorePoints[t].positions.concat(i):OrbemOrder.explorePoints[t].positions=i),i=[]}))}),n))}function V(e){return e/window.nextLevelPointAmount*100+"%"}function F(e,t,a){clearTimeout(r),r=setTimeout((()=>{const n=document.querySelector("."+e+"-mission-item"),o=document.querySelectorAll('[data-materializemission="'+e+'"]');if(o&&o.forEach((e=>{e.classList.contains("cutscene-trigger")&&!e.classList.contains("enable")?(e.classList.add("enable"),e.style.display="block"):e.style.display="block"})),n){const o=parseInt(n.dataset.points),r=n.dataset.hazardremove,s=n.dataset.ability;Y(n);const i=n.dataset.blockade;if(""!==i&&"0"!==JSON.parse(i).top&&document.querySelector("."+n.className.replace("engage","").replace("next-mission","").replace("mission-item","").replace(/\s+/g,"")+"-blockade").remove(),n.style.textDecoration="line-through",null!==r&&r&&"none"!==r){const e=r.split(",");e&&e.forEach((e=>{const t=document.querySelector("."+e+"-drag-dest-map-item");document.querySelector("."+e+"-map-item").remove(),t&&t.remove(),(!0===Array.isArray(a)&&!1===a.includes(e)||!1===Array.isArray(a)&&a!==e)&&_(e,"point",0,2e3,"",!0)}))}setTimeout((()=>{n.remove(),s&&"transportation"===s&&(Ve(),function(){if(!1===C)return;const e={slug:"transportation"};fetch(`${OrbemOrder.siteRESTURL}/enable-ability/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}());const t=document.querySelectorAll("[data-removeaftermission]");t&&function(e,t){e.forEach((e=>{if(e.dataset?.removeaftermission&&""!==e.dataset.removeaftermission){const a=e.dataset.removeaftermission;t===a&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}}))}(t,e);const a=document.querySelectorAll('[data-showaftermission="'+e+'"]');a&&(a.forEach((e=>{c.push($e(e.className)),e.classList.add("materialized"),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c))}),500);const l=document.querySelector(`.map-cutscene[data-mission="${e}"]`);l&&Me($e(l.className),!1),t&&o>0?_e(t,a,!0,o,e):t&&0===o&&_(a,"point",0,2e3,"",!0)}const r=`${OrbemOrder.siteRESTURL}/mission/`,s={mission:e};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}),500)}function Y(e){const t=""!==e.dataset.nextmission&&e.dataset.nextmission.split(",");!1!==t&&t.forEach((e=>{if(1===document.querySelectorAll('[data-nextmission*="'+e+'"]').length){const t=document.querySelector("."+e+"-mission-item");if(t){const e=t.dataset.blockade;""!==e&&"0"!==JSON.parse(e).top&&(document.querySelector("."+t.className.replace("mission-item ","").replace("next-mission ","")+"-blockade").style.display="block"),t.classList.add("engage")}}}))}function Z(e,t,a,n,o){const r={type:e,itemid:t,amount:a,unequip:n};"weapons"===e&&(window.currentWeapon=A!==o?"-"+o:""),!1!==C&&fetch(`${OrbemOrder.siteRESTURL}/equip-explore-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);const t=document.getElementById("item-description");t&&(t.innerHTML=""),ze(document.getElementById("map-character"),"down",!0)}))}function G(e,t){const a=document.querySelector('.retrieval-points span[title="'+e+'"]'),n=a.getAttribute("data-count");a&&(n&&1<n?a.setAttribute("data-count",n-1):(a.setAttribute("data-type",""),a.setAttribute("data-id",""),a.setAttribute("data-value",""),a.setAttribute("title",""),a.setAttribute("data-empty","true"),a.setAttribute("data-count","")),K(0,e,t,0,!0))}function K(e,t,a,n,o){const r=`${OrbemOrder.siteRESTURL}/save-storage-item/`,s={id:e,name:t,value:n,type:a,remove:o};!1!==C&&fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(s)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Q(e,t){if(!1===C)return;const a=`${OrbemOrder.siteRESTURL}/coordinates/`,n={left:e.replace("px",""),top:t.replace("px","")};fetch(a,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}window.mainCharacter="",window.godMode=!1,window.noTouch=!1,window.isDragging="",window.hazardTime=600,window.globalLeftPositionOffset=400,window.nextDialogue=!1,window.crewCharacters=[],window.playerName="",window.mcHurtCooldown=!1,document.addEventListener("DOMContentLoaded",(function(){500>window.innerWidth&&(window.globalLeftPositionOffset=150,T=window.globalLeftPositionOffset,B=!0),k=document.querySelector(".game-container"),window.mainCharacter=k.dataset?.main,k=k.className.replace("game-container ",""),window.history.pushState({},document.title,window.location.pathname);const e=document.getElementById("intro-video");if(e){const t=document.querySelector(".intro-video.engage");e.play();const a=document.getElementById("unmute");a&&a.addEventListener("click",(()=>{e.muted=!e.muted,a.textContent=e.muted?"🔇":"🔉"})),e.addEventListener("ended",(()=>{t&&(t.remove(),Qe(!0))}));const n=document.getElementById("skip-intro-video");n&&n.addEventListener("click",(()=>{e.pause(),t&&t.remove(),Qe(!0)}))}else Qe(!0);const t=document.getElementById("explore-create-account"),a=document.getElementById("explore-login-account"),n=document.querySelector(".login-form"),o=document.querySelector(".register-form");t&&n&&a&&(t.addEventListener("click",(()=>{n.style.display="none",o.style.display="block",t.style.display="none",a.style.display="block"})),a.addEventListener("click",(()=>{n.style.display="block",o.style.display="none",a.style.display="none",t.style.display="block"}))),void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")&&Ve(),document.addEventListener("keydown",Fe),document.querySelector(".action-key").addEventListener("click",Fe);const r=document.querySelectorAll(".spell"),s=document.getElementById("weapon"),c=document.querySelector(".map-weapon");window.currentWeapon=A!==c.dataset.weapon?"-"+c.dataset.weapon:"",r&&s&&(r.forEach((e=>{e.addEventListener("click",(()=>{const t=document.querySelector(".spell.engage"),a=document.querySelector("#weapon"),n=document.querySelector(".map-weapon"),o=e.getAttribute("data-type"),r=e.getAttribute("title"),s=e.getAttribute("data-value");a.classList.remove("engage"),t&&t.classList.remove("engage"),e.classList.add("engage"),n.className="map-weapon",n.classList.add(o),n.classList.add(r),n.classList.add("spell"),n.setAttribute("data-value",s),window.weaponTime=s}))})),s.addEventListener("click",(()=>{const e=document.querySelector(".spell.engage"),t=document.querySelector(".map-weapon");e&&(e.classList.remove("engage"),t.className="map-weapon",window.weaponTime=400),s.classList.add("engage")})));const i=document.querySelector(".character-item > img");i?(he(),i.classList.remove("engage")):he();const l=document.querySelectorAll("#explore-points .point-bar");l&&l.forEach((e=>{const t=e.getAttribute("data-amount"),a=e.querySelector(".gauge");if(a&&!1===e.classList.contains("point-amount")&&!1===e.classList.contains("money-amount"))e.setAttribute("data-amount",t),a.style.width=t+"px";else if(!0===e.classList.contains("point-amount")){const n=Ge(t);OrbemOrder.levelMaps&&(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[n],e.setAttribute("data-amount",t),a.style.width=V(t))}else!0===e.classList.contains("money-amount")&&(e.dataset.amount=t,e.querySelector(".money-text").textContent=t)})),document.body.style.position="fixed";const d=document.getElementById("engage-explore"),u=document.getElementById("try-engage-explore"),m=document.querySelectorAll("#login-register"),p=document.querySelector(".non-login-warning"),g=document.querySelector(".game-login-create-container");d&&d.addEventListener("click",(function(){ve()})),u&&p&&u.addEventListener("click",(function(){p.classList.add("engage")})),m&&p&&m.forEach((e=>{e.addEventListener("click",(function(){g.classList.add("engage"),p.classList.remove("engage")}))})),$(),R();const f=document.getElementById("new-explore");f&&f.addEventListener("click",(async()=>{window.confirm("Are you sure you want to start a new game? All your previously saved data will be lost.")&&(function(){var e;if(C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e,!1===C)return;const t=`${OrbemOrder.siteRESTURL}/resetexplore/`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify({})}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(),setTimeout((()=>{window.location.href=OrbemOrder.gameURL}),1e3))}))}));const ee=function(e,t){if(t&&e&&Ue(e,t,0)){const n=Date.now();if(n<parseInt(t.dataset.nextAllowedHit||"0",10))return;if("explore-enemy"===t.dataset.genre&&!1===e.classList.contains("protection")){var a;const o=t.dataset.health,r=t.dataset.healthamount,s=t.dataset.mission;let c=!0===e.classList.contains("heavy-engage")?"heavy":"normal";c=!0===e.classList.contains("charge-attack-engage")?"charged":c;const i=parseInt(JSON.parse(e.dataset.strength)[c])+window.attackMultiplier,l=0<=o-i?o-i:0,d=null!==(a=t.dataset.weapon)&&void 0!==a?a:"";if(""!==d&&e.dataset.weapon===d||""===d){t.dataset.nextAllowedHit=String(n+1e3),t.setAttribute("data-health",l),function(e,t){if(!1===e.classList.contains("hurt")){e.classList.add("hurt"),setTimeout((()=>{e.classList.remove("hurt")}),700);const a=e.dataset.currentDirection||"down",n=parseInt(e.style.left,10),o=parseInt(e.style.top,10);let r=n,s=o;switch(a){case"left":r=n+2*t;break;case"right":r=n-2*t;break;case"up":s=o+2*t;break;case"down":s=o-2*t}const c=Xe(document.querySelectorAll('.map-character-icon.engage, .default-map svg rect, .map-item:not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"])'),e,s,r,!0,!1);e.style.left=c.left+"px",e.style.top=c.top+"px"}}(t,i);const e=t.querySelector(".enemy-health-bar-wrapper");if(e){"block"!==e.style.display&&(e.style.display="block");const a=parseInt(parseInt(t.dataset.health)/parseInt(t.dataset.healthamount)*100);a&&(e.querySelector(".enemy-health-bar").style.width=a+"%")}}if("boss"===t.getAttribute("data-enemy-type")&&(l<=.75*r&&!1===S?(S=!0,de(t)):l<=.5*r&&!1===L?(L=!0,de(t)):l<=.25*r&&!1===x&&(x=!0,de(t))),0===l){clearInterval(window.shooterInt),ie(t),t.remove();const e=$e(t.className),a=`${OrbemOrder.siteRESTURL}/enemy/`,n={health:0,position:e};!1!==C&&fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)})),s&&qe(s)&&F(s,t,s)}}}},te=function(){window.runningPointFunction=!1;let e=!1;return function(t,a,o,r,s){var i,l;!function(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="true")}(),C=null!==(i=document.querySelector("main").dataset?.loggedin)&&void 0!==i&&i,window.previousCutsceneArea=""===window.previousCutsceneArea?null!==(l=OrbemOrder.previousCutsceneArea)&&void 0!==l?l:"":window.previousCutsceneArea,Qe(!1),window.allowMovement=!1;const d=document.querySelectorAll('.enemy-item[data-enemy-type="runner"]');d&&d.forEach((e=>{ie(e)})),clearInterval(window.shooterInt);const u=document.querySelectorAll(".game-container > .explainer-container, .game-container > .explainer-trigger");u&&u.forEach((e=>{e.remove()}));const m=document.querySelector(".right-bottom-devmode"),p=document.querySelector(".dev-mode-menu");p&&m&&(p.remove(),m.remove());const g=document.querySelector(".explore-item-list");g&&(g.innerHTML="");const f=document.querySelector(".default-map");if(f&&f.remove(),!1===e){const a=`${OrbemOrder.siteRESTURL}/area/`;let i="";OrbemOrder.musicNames&&(i=JSON.parse(OrbemOrder.musicNames)[t]);const l={position:t,characters:s};fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(l)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{let a=e;a=a.data;const s=document.getElementById("map-item-styles"),l=document.querySelector(".site-main"),d=document.querySelector("head");let u="";a["dev-mode"]&&""!==a["dev-mode"]&&(u=a["dev-mode"]),""!==u&&(l.innerHTML=u+l.innerHTML),s&&s.remove();const m=document.createElement("style");m.id="map-item-styles",m.innerHTML=a["map-item-styles-scripts"];const p=document.querySelector(".missions-content");if(p&&(p.innerHTML=a["map-missions"],""!==window.nextAreaMissionComplete)){const e=document.querySelector("."+window.nextAreaMissionComplete+"-mission-item");e&&(e.style.textDecoration="line-through",setTimeout((()=>{Y(e),e.remove()}),500))}d&&d.append(m),f&&setTimeout((()=>{const e=document.querySelector(".game-container"),t=document.createElement("div");t.className="default-map",t.dataset.starttop=a["start-top"],t.dataset.startleft=a["start-left"],t.innerHTML=a["map-explainers"]+a["map-items"]+a["map-cutscenes"]+a.minigames+a["map-svg"]+a["map-communicate"],"yes"===a["is-cutscene"]&&(t.dataset.iscutscene="yes"),e.innerHTML=a["menu-explainers"]+a["fullscreen-explainers"]+e.innerHTML+t.outerHTML,Re(),document.querySelector(".action-key").addEventListener("click",Fe),document.querySelector(".action-key").addEventListener("click",je),$(),R();const o=document.querySelector(".characters-content");if(o){o.innerHTML=a["map-characters"],0<o.querySelectorAll(".character-item").length&&(document.getElementById("characters").style.display="block"),M(),et(),document.querySelector('main[data-devmode="true"]')&&(0,n.S)();const e=document.getElementById("characters"),t=e.querySelector(".close-settings");t&&t.addEventListener("click",(()=>{e.classList.remove("engage")}))}const r=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');r&&r.forEach((e=>{W(e,!1,!1,!1)})),be(),Se(),Be();const s=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .message-wrapper .wp-block-orbem-paragraph-mp3");if(s&&s.forEach((e=>{e.classList.add("engage")})),""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}if("yes"===a["is-cutscene"]){const e=$e(document.querySelector(".map-cutscene").className);Me(e,!0),window.previousCutsceneArea=e,Ae(window.previousCutsceneArea)}else De();const i=document.querySelectorAll('[data-crewmate="yes"]');if(0<i.length){let e=0;const t=setInterval((()=>{e===i.length-1&&clearInterval(t);const a=$e(i[e].className);!1===C?window.crewCharacters.push(a):function(e){const t=`${OrbemOrder.siteRESTURL}/add-character/`,a={slug:e};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}(a),e++}),1e3)}he()}),700),setTimeout((()=>{const e=document.querySelector(".game-container"),n=document.getElementById("map-character"),s=document.querySelector(".map-weapon");r&&(a["start-top"]=JSON.parse(r).top,a["start-left"]=JSON.parse(r).left),B&&(a["start-left"]=parseInt(a["start-left"])+240),n.style.top=a["start-top"]+"px",n.style.left=a["start-left"]+"px",n.className=a["start-direction"]+"-dir",n.scrollIntoView({behavior:"instant",block:"center",inline:"center"}),ze(n,a["start-direction"],!1),e.className="game-container "+t,e.style.backgroundImage="url("+o+")",k=t,se(i,t),window.allowMovement=!0,s.style.display="block",P(),(void 0!==OrbemOrder.exploreAbilities&&0<OrbemOrder.exploreAbilities.length&&OrbemOrder.exploreAbilities.includes("transportation")||a["explore-ability"]&&a["explore-ability"].includes("transportation"))&&Ve();const c=document.querySelector("#map-character .map-character-icon").alt.replace(" static","");ot("{{playerName}}",""!==window.playerName?window.playerName:c)}),100)})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}(),ae=function(){let e=!1;return function(t){const a=t.getAttribute("data-id"),n=document.querySelector(".storage-item.engage");if(n&&n.classList.remove("engage"),t.classList.add("engage"),!1===e){const t=`${OrbemOrder.siteRESTURL}/get-item-description/`,n={id:a};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{const t=document.getElementById("item-description");t&&(t.innerHTML="");let a=e;a=a.data;const n=document.querySelector(".retrieval-points #item-description"),o=document.querySelector(".storage-item.engage"),r=document.createElement("button");r.classList.add("storage-item-button"),r.textContent="Equip";const s=document.createElement("button");s.textContent="Unequip",s.classList.add("storage-item-button");const c=document.createElement("button");c.textContent="Drop",c.classList.add("storage-item-button"),n.innerHTML=a,n.appendChild(c),n.appendChild(s),n.appendChild(r);const i=n.querySelector(".use-button"),l=o.getAttribute("data-id"),d=o.getAttribute("title"),u=o.getAttribute("data-value"),m=o.getAttribute("data-type");i&&o&&100>re(m)&&i.addEventListener("click",(()=>{_e(o,d),n.innerHTML=""})),c&&c.addEventListener("click",(()=>{G(d,m),n.innerHTML="";const e=document.getElementById("item-description");e&&(e.innerHTML="")})),r&&r.addEventListener("click",(()=>{const e=document.querySelector(".map-character-icon.engage").dataset.currentchar,t=document.querySelector(".storage-item.engage");if(t&&t.dataset.character===e||t&&(""===t.dataset.character||void 0===t.dataset.character||null===t.dataset.character)){const e=t.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img");a&&n&&(n.src=e.src,a.dataset.weapon=t.title,a.dataset.strength=t.dataset.strength),t.classList.add("equipped"),t.classList.add("being-equipped")}oe(!1),n.innerHTML="",Z(m,l,u,!1,t.title)})),s&&s.addEventListener("click",(()=>{const e=document.querySelector(".storage-item.engage");e&&(e.classList.remove("equipped"),e.classList.add("unequip")),oe(!0),n.innerHTML="",Z(m,l,u,!0,e.title)}))})),e=!0,setTimeout((()=>{e=!1}),1e3)}}}();function ne(e){if(e){const t=e.querySelector("img"),a=document.querySelector(".map-weapon"),n=document.querySelector(".weapon-content img"),o=a.querySelector("img");a&&n&&(o.src=t.src,n.src=t.src,a.dataset.weapon=e.title,o.style.width=e.dataset.width+"px",o.style.height=e.dataset.height+"px",a.dataset.strength=e.dataset.strength,a.dataset.projectile=e.dataset.projectile,window.currentWeapon=A!==e.title?"-"+e.title:"")}}function oe(e){const t=document.querySelector('.storage-item.being-equipped[data-type="gear"]'),a=document.querySelector("#explore-points .health-amount"),n=document.querySelector("#explore-points .mana-amount");let o=parseInt(n.dataset.amount),r=parseInt(a.dataset.amount),s=parseInt(n.style.width.replace("px","")),c=parseInt(a.style.width.replace("px",""));if(t&&!1===e){const e=t.getAttribute("data-value"),a=t.getAttribute("data-subtype");"health"===a&&(r+=parseInt(e),c+=parseInt(e)),"mana"===a&&(o+=parseInt(e),s+=parseInt(e))}else if(t&&!1!==e){const e=document.querySelector('.storage-item.unequip[data-type="gear"]'),t=e.getAttribute("data-value"),a=e.getAttribute("data-subtype");"health"===a&&(r-=parseInt(t),c-=parseInt(t)),"mana"===a&&(o-=parseInt(t),s-=parseInt(t))}t&&(a.style.width=c+"px",a.setAttribute("data-amount",r),a.querySelector(".gauge").style.width=r+"px",n.style.width=s+"px",n.setAttribute("data-amount",o),n.querySelector(".gauge").style.width=o+"px");const i=document.querySelector(".being-equipped"),l=document.querySelector(".unequip");i&&i.classList.remove("being-equipped"),l&&l.classList.remove("unequip")}function re(e){const t=document.querySelector(`#explore-points .${e}-amount`);return t?parseInt(t.getAttribute("data-amount")):0}function se(e,t){if(!e||""===e)return;const a=document.createElement("audio");a.setAttribute("loop",""),a.src=e,a.id=t,document.body.appendChild(a);const n=document.getElementById("music-volume");n&&a&&(a.volume=n.value/100),window.currentMusic&&window.currentMusic.pause(),a&&(a.play(),window.currentMusic=a)}function ce(e){e&&e._runnerPunchInt&&(clearInterval(e._runnerPunchInt),e._runnerPunchInt=null)}function ie(e){e&&e._wanderInt&&(clearInterval(e._wanderInt),e._wanderInt=null,ce(e))}function le(e,t){const a=e.getAttribute("data-enemy-type"),n=e.querySelector("audio");n&&(n.volume=window.sfxVolume,setInterval((()=>{n.volume=window.sfxVolume}),1e3),n.play()),t&&t.remove(),"shooter"===a&&ue(e),"runner"===a&&j(e,e.dataset.speed,0,!0)}function de(e){const t=e.dataset.waves.split(",");t&&(t.forEach((t=>{e.classList.remove(t+"-wave-engage")})),e.classList.add(t[b]+"-wave-engage"),"pulse-wave"===t[b]?p=setInterval((()=>{e.classList.toggle("pulse-in")}),13e3):p&&(clearInterval(p),e.classList.remove("pulse-in")),"projectile"===t[b]?ue(e):clearInterval(m)),b++}function ue(e){const t=e.dataset.enemyspeed;m=window.shooterInt=setInterval((()=>{const a=document.querySelector(".map-character-icon.engage"),n=a.getBoundingClientRect().left+a.width/2,o=a.getBoundingClientRect().top+a.width/2,r=e.querySelector(".projectile");r&&me(r,n,o,e,t,!1,".projectile","no")}),5e3)}function me(e,t,a,n,o,r,s,c){const i=e.cloneNode(!0);i.classList.remove("engage"),i.style.transition="",!0!==r&&"no"===c?function(e,t,a,n,o){let r,s;const c=e.getBoundingClientRect(),i=document.getElementById("map-character"),l=we(o),d=we(i);ye(d.x,d.y,l.x,l.y,e,n);const u=Math.atan2(a-c.top,t-c.left),m=t+800*Math.cos(u),p=a+800*Math.sin(u);r=m-c.left,s=p-c.top,e.style.transform="translate("+r+"px, "+s+"px)"}(e,t,a,o,n):!0===r?(e.classList.remove("map-weapon"),e.classList.add("magic-weapon"),fe(e,t,a),n=document.querySelector(".game-container")):"yes"===c&&(fe(e,t,a),n=document.querySelector(".game-container"));const l=setInterval((function(){const e=n.querySelector(s);let t=document.querySelectorAll(".default-map svg rect, .protection, .map-character-icon.engage, #map-weapon img");!0!==r&&"yes"!==c||(t=document.querySelectorAll(".default-map svg rect, .enemy-item, .map-item")),t&&e&&function(e,t){const a=document.querySelector(".game-container");requestAnimationFrame((function n(){if(document.body.contains(e)){for(const n of t)if(pe(e,n,a)){if(!0===n.classList.contains("map-character-icon")&&!1===e.classList.contains("map-weapon")){const t=parseInt(e.dataset.value),a=document.querySelector("#explore-points .health-amount"),n=parseInt(a.getAttribute("data-amount"));if(a&&0<=n){const e=n>=t?n-t:0;tt(),U(e,"health","projectile",!1,"")}}e.remove(),window.weaponConnection=!0}requestAnimationFrame(n)}}))}(e,t)}),20);setTimeout((()=>{if(!0===r||"true"===c){const e=document.getElementById("map-character").className.replace("-dir","");i.setAttribute("data-direction",e)}n.appendChild(i),e.remove(),window.weaponConnection=!0,clearInterval(l)}),4500)}function pe(e,t,a){const n=ge(e,a),o=ge(t,a);return!(n.right<o.left||n.left>o.right||n.bottom<o.top||n.top>o.bottom)}function ge(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return{top:a.top-n.top,left:a.left-n.left,width:a.width,height:a.height,right:a.right-n.left,bottom:a.bottom-n.top}}function fe(e,t,a){window.weaponConnection=!1,e.style.transition="all 3s",e.style.left=t+"px",e.style.top=a+"px"}function ye(e,t,a,n,o,r){const s=.075*Math.hypot(e-a,t-n)*r;let c="down";const i=Math.abs(t-n),l=Math.abs(e-a);return o.style.transition="all "+s+"ms linear 0s",t>n&&i>l?c="up":t<n&&i>l?c="down":e<a&&l>i?c="right":e>a&&l>i&&(c="left"),c}function we(e){const{top:t,left:a,width:n,height:o}=e.getBoundingClientRect();return{x:a+n/2,y:t+o/2}}function he(){["health","mana","point","gear","weapons","money"].forEach((e=>{const t=void 0!==OrbemOrder.explorePoints[e]?OrbemOrder.explorePoints[e].positions:[];t&&t.forEach((e=>{const t=parseInt(e)>0,a=t?null:document.querySelector("."+e+"-map-item"),n=t?null:document.querySelector("."+e+"-map-cutscene"),o=t?null:document.querySelector("."+e+"-explainer-trigger-map-item"),r=t?null:document.querySelector("."+e+"-materialize-item-map-item"),s=t?null:document.querySelector("."+e+"-drag-dest-map-item"),c=document.getElementById(e+"-t");if(c){const t=document.getElementById(e),a=t.parentNode;t&&(t.classList.add("engage"),c.remove()),a&&!1===a.classList.contains("dependent")&&a.classList.add("dependent")}n&&n.classList.add("been-viewed"),o&&o.classList.add("already-hit"),a&&(function(e){return void 0!==e.dataset.timer&&null!==e.dataset.timer||"explore-character"===e.dataset.genre||"true"===e.dataset.hazard||"true"===e.dataset.collectable||("true"===e.dataset.breakable||"true"===e.dataset.collectable||"true"===e.dataset.clickable)&&"no"!==e.dataset?.disappear||"true"===e.dataset.removable&&"no"!==e.dataset?.disappear||"true"===e.dataset.draggable&&"yes"===e.dataset?.disappear||void 0!==e.dataset?.removeaftercutscene||void 0!==e.dataset?.removeaftermission}(a)&&(a.remove(),r&&r.remove()),s&&"true"===s.dataset.removable&&s.remove(),"no"===a.dataset?.disappear&&Ie(a),a.classList.add("no-point"))}));const a=document.querySelectorAll(".map-item-modal.graeme"),n=document.querySelectorAll(".map-item-modal");n&&n.forEach((e=>{e.classList.remove("engage")})),a&&a.forEach((e=>{e.classList.add("engage")}))})),OrbemOrder?.exploreMaterializedItems[k]&&0<OrbemOrder.exploreMaterializedItems[k].length&&OrbemOrder.exploreMaterializedItems[k].forEach((e=>{const t=document.querySelector("."+e+"-map-item");t&&t.classList.add("materialized")}))}function ve(){var e,t;C=null!==(e=document.querySelector("main").dataset?.loggedin)&&void 0!==e&&e;const a=document.querySelector("#orbem-studio-play-name"),n=document.querySelector(".game-container"),o=document.querySelector(".touch-buttons");if(window.previousCutsceneArea=null!==(t=OrbemOrder.previousCutsceneArea)&&void 0!==t?t:"",a&&""!==a.value){const e=a.value;window.playerName=e,ot("{{playerName}}",e)}else ot("{{playerName}}",document.querySelector("#map-character .map-character-icon").alt.replace(" static",""));const r=document.querySelectorAll(".map-cutscene .wp-block-orbem-paragraph-mp3:first-of-type, .map-communicate .wp-block-orbem-paragraph-mp3");r&&r.forEach((e=>{e.classList.add("engage")})),Qe(!1),Be(),P(),window.weaponConnection=!0,window.allowHit=!0,window.allowIndicate=!0,window.attackMultiplier=0,window.runningPointFunction=!1,window.moveSpeed=3,window.currentCharacterAutoDirection="",M(),be();const s=document.getElementById("characters"),i=!!s&&s.querySelectorAll(".character-item");s&&0<i.length&&(s.style.display="block"),document.querySelector(".explore-overlay")&&document.querySelector(".explore-overlay").remove(),document.body.style.position="unset",o&&B&&o.classList.add("do-mobile");let l="";OrbemOrder.musicNames&&k&&(l=JSON.parse(OrbemOrder.musicNames)[k]),se(l,k);const d=document.getElementById("explore-points"),m=document.getElementById("missions");d&&(d.style.opacity="1"),m&&(m.style.opacity="1");const p=document.getElementById("key-guide");at(p,"engage"),window.buttonShow=setInterval((function(){at(p,"engage")}),1e4);const g=document.querySelectorAll('.path-onload[data-path]:not([data-path=""]), [data-wanderer="yes"]');if(g&&g.forEach((e=>{W(e,!1,!1,!1)})),Se(),function(){let e=!1;document.addEventListener("keydown",(t=>{const a=document.querySelector(".map-weapon");!1!==window.allowHit&&(!0===["ShiftLeft","ShiftRight"].includes(t.code)&&(h=!0),"Space"===t.code&&(v=!0,u=setTimeout((()=>{!0===v&&(a.classList.add("charge-engage"),e=!0)}),1e3)))})),document.addEventListener("keyup",je),document.querySelector(".action-key").addEventListener("click",je)}(),Re(),"yes"===document.querySelector(".default-map").dataset.iscutscene&&k){const e=$e(document.querySelector(".map-cutscene").className);window.previousCutsceneArea=e,Ae(window.previousCutsceneArea),Me(e,!0)}if(""!==window.previousCutsceneArea){He(document.querySelectorAll("[data-removeaftercutscene]"),window.previousCutsceneArea);const e=document.querySelectorAll("[data-showaftercutscene="+window.previousCutsceneArea+"]");e&&(e.forEach((e=>{c.push($e(e.className)),e.classList.add("no-point")})),Oe(k,c))}et(),n&&(n.style.display="block");const f=document.getElementById("map-character");f&&(B&&f.style.left.replace("px","")===f.dataset.startLeft&&(f.style.left=parseInt(f.style.left.replace("px",""))+240+"px"),f.scrollIntoView({behavior:"instant",block:"center",inline:"center"})),setTimeout((()=>{De()}),1e3)}function be(){const e=document.querySelectorAll(".materialize-item-trigger");e&&e.forEach((e=>{const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="none"),n&&(n.style.display="none")}))}function Se(){const e=document.querySelectorAll(".mission-list .mission-item");e&&e.forEach((e=>{const t=e.dataset.blockade,a=$e(e.className),n=document.querySelectorAll('[data-materializemission="'+a+'"]');if(n&&n.forEach((e=>{e.style.display="none"})),t&&""!==t){const a=JSON.parse(t);if("0"!==a.height){const t=document.createElement("div"),n=e.className.replace("mission-item ",""),o=document.querySelector(".default-map");t.className="wp-block-group map-item is-layout-flow wp-block-group-is-layout-flow "+n+"-blockade",t.style.top=a.top+"px",t.style.left=a.left+"px",t.style.width=a.width+"px",t.style.height=a.height+"px",t.dataset.genre="blockade",t.id=e.id,t.draggable=!0,!1===e.classList.contains("engage")&&!0===e.classList.contains("next-mission")&&(t.style.display="none"),o&&o.append(t)}}}))}function Le(e,t,a,n,o,r){const i=document.querySelector(".game-container"),l=document.querySelector("#map-character"),d=l.querySelector(".map-character-icon.engage"),u=document.querySelectorAll('.map-item:not(.drag-dest), .projectile, .enemy-item, [data-hazard="true"]');let m=document.querySelector(".map-weapon");const p=document.querySelector(".magic-weapon"),f=document.querySelector(".game-container").className.replace("game-container ",""),w=l.querySelector(".misc-gauge-wrap");if(p&&(m=p),0<u.length&&!1===window.noTouch&&u.forEach((e=>{let t=$e(e.className);e.classList.contains("enemy-item")&&m.classList.contains("engage")&&ee(m,e);const a=document.querySelector("."+t+"-drag-dest-map-item");let n=!1;a&&!1===e.classList.contains("no-point")&&(n=document.querySelector("."+a.dataset.mission+"-mission-item"),null===n&&e.classList.add("no-point"));const o=document.querySelector(".indicator-icon"),r=$e(e.className),i=document.querySelector(`.map-cutscene[data-character="${r}"]`),u={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2),offsetWidth:d.offsetWidth,offsetTop:l.offsetTop+(400-d.offsetHeight/2),offsetHeight:d.offsetHeight};if(e&&d&&Ue(u,e,5)?("explore-character"===e.dataset.genre&&""!==e.dataset.path&&i&&(!1===e.classList.contains("passable")&&(e.dataset.canmove="false"),!document.getElementById(i.id+"-t")&&i&&!1===i.classList.contains("been-viewed")&&"engagement"!==i.dataset.triggertype&&Me(i,!1)),!0===e.classList.contains("communicate-trigger")&&function(e,t){const a=document.querySelector("."+e+"-map-communicate"),n=a.parentNode;n.classList.add("notify"),t&&(t.remove(),_(a.id,"communicate",n.id,2e3,"",!1)),a.classList.add("engage")}(e?.dataset.triggee,e)):"false"===e.dataset?.canmove&&(e.dataset.canmove="true"),e&&d&&Ue(u,e,0)){if("explore-sign"===e.dataset.genre&&!1===e.classList.contains("engage")&&(Te(e,!1,!1,!1),e.classList.add("engage"),window.allowHit=!1),!0===e.classList.contains("no-point")&&void 0!==e.dataset?.minigame&&(Te(e,!1,!1,!0),e.classList.add("engage")),"explore-area"===e.getAttribute("data-genre"))return void We(e,"false");if("true"===e.dataset.hazard&&!1===Ee(e,l,"hazard")){if(100<=N||0===N){var p;const t=e.dataset.value,a=re("health")-parseInt(t);tt(),U(a,"health","hazard",!1,""),xe(25,null!==(p=e.closest(".enemy-item"))&&void 0!==p?p:e,l),N=0}N++}else if("true"===e.dataset.hazard&&!0===Ee(e,l,"hazard")){w&&w.classList.add("engage");const t=w.querySelector(".misc-gauge");var h;window.hazardTime<=N?(q=!0,window.theHazardValue=e.dataset.value,E=null!==(h=e.closest(".enemy-item"))&&void 0!==h?h:e,t.style.width="100%",w.classList.remove("engage")):t.style.width=(window.hazardTime-N)/window.hazardTime*100+"%",N++}if(a&&(n=document.querySelector("."+a.dataset.mission+"-mission-item")),"true"===e.dataset.draggable&&!1===e.classList.contains("dragme")&&!document.querySelector(".dragme")&&Ee(e,l,"strength")&&n&&e.classList.add("dragme"),"true"===e.dataset.trigger&&!1===e.classList.contains("cutscene-trigger")){const t=document.querySelector("."+e.dataset.triggee);t&&"explore-enemy"===t.dataset.genre&&le(t,e)}if(!0===e.classList.contains("explainer-trigger")&&!1===e.classList.contains("already-hit")){const t=document.querySelector("."+e.dataset.triggee+"-explainer-item"),a=n=>{const o="1"===t.dataset?.clickclose||!t.contains(n.target);if(("keydown"===n.type&&"Space"===n.code||"click"===n.type)&&o){window.allowMovement=!0,window.allowHit=!0,t.classList.remove("show-explainer"),document.removeEventListener("keydown",a);const n=document.querySelector('.cutscene-trigger[data-materializeexplainer="'+e.dataset.triggee+'"]');n&&n.classList.add("enable")}};if(t){t.classList.add("show-explainer"),e.classList.add("already-hit"),window.allowMovement=!1,window.allowHit=!1;const n=t.querySelector("p");var v;if(n)Ke(Array.from(n.childNodes).filter((e=>e.nodeType===Node.TEXT_NODE)).map((e=>e.textContent)).join(""),l.dataset.voice,null!==(v=document.getElementById(t.id+"-s"))&&void 0!==v&&v,!0);const o=t.querySelector("img");if(o){const e=parseInt(o.dataset.rotate);let t=!1,a=!1,n=!1;if(o&&e&&0<e&&(0<e&&90>=e&&(t=`rotate(${e}deg) translate( 10px, -10px )`,a=`rotate(${e}deg) translate( 10px, 10px )`,n=`rotate(${e}deg) translate( 10px, -10px )`),91<e&&180>=e&&(t=`rotate(${e}deg) translate( 0, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( 0, 10px )`),181<e&&270>=e&&(t=`rotate(${e}deg) translate( -10px, 10px )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 10px )`),271<e&&360>=e&&(t=`rotate(${e}deg) translate( -10px, 0 )`,a=`rotate(${e}deg) translate( -10px, -10px )`,n=`rotate(${e}deg) translate( -10px, 0 )`),!1!==t)){const e=[{transform:t},{transform:a},{transform:n}],r={duration:1e3,iterations:1/0};o.animate(e,r)}}document.addEventListener("click",a),document.addEventListener("keydown",a),_(e.dataset.triggee,"point",0,2e3,"",!0)}}!0===e.classList.contains("path-trigger")&&!1===e.classList.contains("already-hit")&&(W(document.querySelector("."+e.getAttribute("data-triggee")),!1,!1,!1),e.remove()),"true"===e.dataset?.collectable&&(e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Ne(e),H(e),D(e),"point"===e.dataset.type&&e.dataset?.value&&0<e.dataset.value&&_e(e,$e(e.className),!1,e.dataset.value,"")),!0===e.classList.contains("mission-trigger")&&(e.dataset.triggee&&""!==e.dataset.triggee&&F(e.dataset.triggee,e,t),e.remove());const o=e.dataset.triggee;t=o&&""!==o?$e(o):t;const r=o&&""!==o?document.getElementById(e.id.replace("-t","")):document.querySelector("."+t+"-map-cutscene");if(!1===e.classList.contains("engage")&&r&&!1===r.classList.contains("been-viewed")&&!0===e.classList.contains("cutscene-trigger"))if("engagement"!==e.dataset.triggertype)e.dataset.mission&&""!==e.dataset.mission&&F(e.dataset.mission,e,t),Me(t,!1),""===t&&Oe(f,[$e(e.className)]),e.remove();else{e.classList.add("engage");let t="."+r.dataset?.character+"-map-item";r.dataset?.character===window.mainCharacter&&(t="#map-character .map-character-icon.engage"),Te(document.querySelector(t),!0,e,!1)}if(!0===e.classList.contains("materialize-item-trigger")){clearTimeout(s);const t=$e(e.className),a=document.querySelector("."+t+"-map-item"),n=document.querySelector("."+t+"-drag-dest-map-item");a&&(a.style.display="block"),n&&(n.style.display="block"),c.push(t),s=setTimeout((()=>{Oe(f,c)}),1e3),e.remove()}"true"===e.dataset.collectable&&"no"!==e.dataset.disappear?e.remove():"true"===e.dataset.collectable&&"no"===e.dataset.disappear&&ke(e),clearTimeout(g),g=setTimeout((()=>{q=!1,E=!1,N=0,w.classList.remove("engage")}),100)}else!0!==e.classList.contains("engage")&&!0!==e.classList.contains("dragme")||(e.classList.remove("engage"),e.classList.remove("dragme"),o&&(o.classList.remove("engage"),window.allowHit=!0));if(m&&"none"!==m.style.display&&Ue(m,e,0)){const a=$e(e.className),n=document.querySelector('[data-timertriggee="'+a+'"]'),o=e.dataset?.timertriggee,r=document.querySelector(".start-timer");if((n||void 0!==o)&&r&&!1===e.classList.contains("start-timer")){const a="true"===r.dataset.removable?"":[t,$e(r.className)];F(e.dataset.mission,e,a),r.style.display="none",e.style.display="none"}else if(n||void 0!==o){e.classList.add("start-timer");const t=void 0!==o?parseInt(e.dataset.timer):parseInt(n.dataset.timer);0<t&&(setTimeout((()=>{e.classList.remove("start-timer")}),1e3*t),function(e){if(!1===I){I=!0;const t=document.createElement("div");t.className="timer-countdown";let a=parseInt(e/1e3).toString();t.style.position="fixed",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.top="1rem",t.style.fontSize="2rem",t.style.zIndex="99999",t.textContent=a;const n=document.querySelector(".game-container");n&&n.appendChild(t),y=setInterval((()=>{const e=document.querySelector(".timer-countdown"),t=parseInt(e.textContent);0!==t&&(a=t),e.textContent=0<a?a-1:0,"0"===e.textContent&&(e.remove(),clearInterval(y),I=!1)}),1e3)}}(1e3*t))}else if(("true"===e.dataset.breakable||"true"===e.dataset.collectable)&&e.dataset.mission&&""!==e.dataset.mission&&Ee(e,l,"strength")&&null===n&&void 0===o&&qe(e.dataset.mission)){const a=document.querySelectorAll(`.map-item[data-mission="${e.dataset.mission}"]`);a&&(t=[],a.forEach((e=>{t.push($e(e.className))}))),F(e.dataset.mission,e,t)}"true"===e.dataset.breakable&&!1===e.classList.contains("interacted-with")&&!1===e.classList.contains("no-point")&&(Ne(e),"point"===e.dataset.type&&_e(e,$e(e.className),!1,e.dataset.value,""),e.classList.add("interacted-with")),!0!==qe(e.dataset.mission)||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable||"explore-sign"===e.dataset.genre||!Ee(e,l,"strength")||null!==e.dataset.minigame&&void 0!==e.dataset.minigame||null!==e.dataset.disappear&&void 0!==e.dataset.disappear||"no"===e.dataset?.disappear?e&&"true"!==e.dataset.clickable&&ke(e):e.remove()}})),n[37]||n[38]||n[39]||n[40]||n[87]||n[65]||n[68]||n[83]){const e=!0===n[r]?r:parseInt(function(e){for(const t in e)if(e.hasOwnProperty(t)&&true===e[t])return t;return null}(n)),t=window.isDragging;let a,o;if(!1===d.classList.contains("fight-image")&&!0===window.allowMovement)switch(e){case 38:case 87:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"up",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("top-dir"),m&&m.setAttribute("data-direction","top");break;case 37:case 65:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"left",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("left-dir"),m&&m.setAttribute("data-direction","left");break;case 39:case 68:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"right",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("right-dir"),m&&m.setAttribute("data-direction","right");break;case 40:case 83:d.classList.remove("engage"),a=""!==t?window.draggingDirection:"down",o=document.getElementById(window.mainCharacter+"-"+a+t+window.currentWeapon),o&&o.classList.add("engage"),l.className="",l.classList.add("down-dir"),m&&m.setAttribute("data-direction","down")}!function(){const e=document.getElementById("walking");e&&void 0!==e?.src&&""!==e.src&&(e.loop=!0,window.sfxVolume&&(e.volume=window.sfxVolume),e.play())}(),window.amwalking=!0}else window.amwalking&&function(){const e=document.getElementById("walking");e&&(e.pause(),e.currentTime=0),window.amwalking=!1}();const h=i.offsetWidth-d.offsetWidth,v=parseInt(e,10)-(n[t]?o:0)+(n[a]?o:0);return v<0?0:v>h?h:v}function xe(e,t,a){let n=parseInt(a.style.left.replace("px","")),o=parseInt(a.style.top.replace("px",""));t&&(n=n+400<parseInt(t.style.left.replace("px"))?n-e:n+e,o=o+400<parseInt(t.style.top.replace("px"))?o-e:o+e,a.style.left=n+"px",a.style.top=o+"px")}function qe(e){const t=document.querySelectorAll(`.map-item[data-mission="${e}"]`),a=document.querySelectorAll(`.enemy-item[data-mission="${e}"]`);return 1>=t.length&&0===a.length}function Ee(e,t,a){return"strength"===a?"yes"===e.dataset.isstrong&&"strength"===t.dataset.ability||void 0===e.dataset.isstrong||"no"===e.dataset.isstrong:a===t.dataset.ability}function ke(e){"no"===e.dataset?.disappear||"true"!==e.dataset.breakable&&"true"!==e.dataset.collectable&&"true"!==e.dataset.clickable||"explore-sign"===e.dataset.genre||(e.style.display="none"),"no"===e.dataset?.disappear&&Ie(e)}function Ie(e){const t=e.dataset?.interacted;t&&""!==t&&(e.style.background=`url(${t}) no-repeat`,e.style.backgroundSize="cover","true"===e.dataset.passable&&e.classList.add("passable"))}function Oe(e,t){if(!1===C)return;const a={area:e,item:t};fetch(`${OrbemOrder.siteRESTURL}/save-materialized-item/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(a)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Te(e,t,a,n){window.allowHit=!1;const o=document.querySelector(".indicator-icon");if(window.allowIndicate&&e&&o&&!1===o.classList.contains("engage")){let r=e.style.left.replace("px",""),s=e.style.top.replace("px","");!0===e.classList.contains("map-character-icon")&&(s=parseInt(e.parentElement.style.top.replace("px",""))+400-e.offsetHeight/2,r=parseInt(e.parentElement.style.left.replace("px",""))+window.globalLeftPositionOffset-e.offsetWidth/2);const c=e.getBoundingClientRect().width/2-7.5,i=$e(e.className);o&&(o.classList.add("engage"),o.style.left=c+parseInt(r)+"px",o.style.top=parseInt(s)-25+"px",!0===t&&(o.dataset.sign="",o.dataset.minigame="",o.dataset.cutscene=a.dataset.triggee),!1===t&&(o.dataset.cutscene="",o.dataset.minigame="",o.dataset.sign=i),!0===n&&(o.dataset.cutscene="",o.dataset.sign="",o.dataset.minigame=e.dataset.minigame))}}function Ne(e){const t=e.getAttribute("data-type"),a=e.getAttribute("data-value"),n=e.id,o=$e(e.className),r=document.createElement("span"),s=function(e){return{health:"items",mana:"items",gear:"gear",weapons:"weapons"}[e]}(t),c=document.querySelector('[data-menu="'+s+'"]'),i=document.querySelector(`#explore-points .${t}-amount`);let l=100;if(i&&(l=i?i.getAttribute("data-amount"):0),"gear"===t||"health"!==t&&"mana"!==t||!(100>l)){if(r.setAttribute("data-type",t),r.setAttribute("data-id",n),r.setAttribute("data-value",a),r.setAttribute("title",o),r.setAttribute("data-empty","false"),"gear"===t||"weapons"===t){const t=getComputedStyle(e);r.setAttribute("data-width",t.width.replace("px","")),r.setAttribute("data-height",t.height.replace("px","")),r.setAttribute("data-strength",e.dataset.strength);const a=document.createElement("img");a.setAttribute("src",e.dataset.image),a.setAttribute("width","80px"),a.style.objectFit="contain",r.append(a)}if(r.className="storage-item",c){const e=c.querySelector('.storage-item[data-empty="true"]'),s=c.querySelectorAll('.storage-item[data-empty="false"]');let i=!0;e&&(e.remove(),s&&s.forEach((e=>{if(e.getAttribute("title")===o){let t=e.getAttribute("data-count");t=null!==t?parseInt(t)+1:2,e.setAttribute("data-count",t),i=!1}})),!0===i&&(c.prepend(r),r.addEventListener("click",(()=>{"true"!==r.dataset.empty&&ae(r)}))),K(n,o,t,a,!1))}}}function Ae(e){if(!1===C)return;const t={cutscene:e};fetch(`${OrbemOrder.siteRESTURL}/set-previous-cutscene-area/`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(t)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}function Ce(e,t){if(!1===e&&!1===t)return;const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e;if(e=void 0===e?.className?e:$e(e.className),!a||void 0!==a.dataset?.video&&"false"!==a.dataset?.video){if(a&&"true"===a.dataset?.video&&!1===a.classList.contains("been-viewed")){const e=a.querySelector("video");if(window.allowMovement=!1,a.classList.add("engage"),e){"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),e.play(),e.muted=!1,e.addEventListener("ended",(()=>{window.allowMovement=!0,Pe(a,0,!1)}));const t=document.getElementById("skip-cutscene-video");t&&t.addEventListener("click",(()=>{window.allowMovement=!0,e.pause(),Pe(a,0,!1)}))}}}else{const n=a.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),o=document.getElementById("map-character"),r=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+o?.dataset?.mainid+")")?.className),s=document.getElementById(r);if(!1===a.classList.contains("been-viewed")){window.allowMovement=!1,window.allowHit=!1,s&&(setTimeout((()=>{s.scrollIntoView({behavior:"smooth",block:"nearest"})}),500),s.dataset.cutscenebreak="true"),a.classList.add("engage"),a.dataset.music&&""!==a.dataset.music&&se(a.dataset.music,e),"yes"===a.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause(),function(){const e=document.getElementById("walking");if(e&&void 0!==e?.src&&""!==e.src){const t=e.src;e.src="",setTimeout((()=>{e.src=t}),100)}}();let c=n[0];n[0]&&n[0].classList.contains("wp-block-orbem-paragraph-mp3")&&(c=n[0].querySelector("p"));const i=c.innerText;c.innerText="";let u=0;const m=(e,t,a)=>{clearTimeout(d),a<t.length?(e.innerHTML+=t.charAt(a),a++,d=setTimeout((function(){u++,!1===/^[a-zA-Z]+$/.test(t.charAt(a))&&(u=0),m(e,t,a)}),50)):window.nextDialogueTimeout=setInterval((()=>{!0===window.nextDialogue&&(p(),clearInterval(window.nextDialogueTimeout),window.nextDialogue=!1)}),500)};m(c,i,0);const p=()=>{""!==l&&l.stop(),""!==w&&(w.pause(),w.currentTime=0),clearInterval(window.nextDialogueTimeout);const e=a.querySelector("p.engage, .wp-block-orbem-paragraph-mp3.engage").nextElementSibling;if(n.forEach((e=>{e.classList.remove("engage")})),e){e.classList.add("engage");let t=e.querySelector("audio");t=null!=t&&t;const a=e.querySelector("p"),n=a.innerText;a.innerText="",m(a,n,0),f(),Ke(n,e.dataset.voice,t,!1)}else{if(clearTimeout(d),clearInterval(window.nextDialogueTimeout),a.classList.remove("engage"),a.removeEventListener("click",g),document.removeEventListener("keydown",g),"yes"!==document.querySelector(".default-map").dataset.iscutscene){const e=document.getElementById("map-character");if(e){const t=document.querySelector('div[data-character="'+e.dataset?.mainid+'"].cut-character');t&&t.classList.remove("engage")}}window.allowMovement=!0,n[0].classList.add("engage"),Pe(a,0,r),a.style.removeProperty("position"),a.style.removeProperty("display"),a.style.removeProperty("width"),a.style.removeProperty("max-height"),a.style.removeProperty("height"),a.style.removeProperty("transform"),a.style.removeProperty("left"),a.style.removeProperty("top")}},g=e=>{!0===window.allowCutscene&&("Space"===e.code||e.target.classList.contains("action-key")||e.target.classList.contains("wp-block-orbem-paragraph-mp3"))&&n&&a.classList.contains("engage")&&p()};a.classList.add("been-viewed"),window.allowCutscene=!0;const f=(e="")=>{const n=a.querySelector(".wp-block-orbem-paragraph-mp3.engage");let r=n.querySelector("audio");r=null!=r&&r;const s=$e(n.className),c=o.dataset?.mainid!==s?document.getElementById(s):o,i=n.dataset.voice,l=n.dataset?.triggerpath;let d=document.getElementById(s);const u=a.querySelector('.cut-character[data-character="'+s+'"]'),m=a.querySelector('.character-name[data-character="'+s+'"]');if(o&&(d=o.dataset.mainid===s?o:d),!0===t){if(c&&a){let e=parseInt(c.style.left.replace("px",""))-a.offsetWidth/2;const t=parseInt(c.style.top.replace("px",""))+c.offsetHeight/2;o.dataset?.mainid===s&&(e+=o.offsetWidth/2),a.style.left=e+"px",a.style.top=t+"px";const n=document.querySelector(".engage.character-name");n&&(n.classList.remove("engage"),m.classList.add("engage"))}}else if(o){const e=a.querySelector(".engage.cut-character"),t=a.querySelector(".engage.character-name");e&&t&&(t.classList.remove("engage"),e.classList.remove("engage"),u.classList.add("engage"),m.classList.add("engage"),setTimeout((()=>{e.scrollIntoView({behavior:"smooth",block:"nearest"})}),500))}l&&d&&W(d,!1,!1,!1),""!==e&&(Ke(e,i,r,!1),o&&u&&u.classList.add("engage"),o&&m&&m.classList.add("engage"))};f(i),document.addEventListener("keydown",g),document.querySelector(".action-key").addEventListener("click",g),a.addEventListener("click",g),!0===t&&De()}}}function Be(){const e=document.querySelectorAll(".communication-wrapper");e&&e.forEach((e=>{e.addEventListener("click",(t=>{(!t.target.closest(".map-communicate")&&!1===t.target.classList.contains("map-communicate")||!1===e.classList.contains("engage"))&&(!1===e.classList.contains("engage")?(e.classList.add("engage"),e.classList.remove("notify")):e.classList.remove("engage"))}));const t=e.querySelectorAll(".map-communicate");t&&t.forEach((t=>{const a=t.querySelectorAll("p, .wp-block-orbem-paragraph-mp3"),n=t.dataset.type;t.addEventListener("click",(()=>{"voicemail"===n&&!0===e.classList.contains("engage")?((e="")=>{const a=t.querySelector(".wp-block-orbem-paragraph-mp3.engage");let n=a.querySelector("audio");n=null!=n&&n;const o=a.dataset.voice;""!==e&&Ke(e,o,n,!1)})(a[0].innerText):!0===e.classList.contains("engage")&&t.classList.toggle("show")})),t.dataset.music&&""!==t.dataset.music&&se(t.dataset.music,$e(t.className)),"yes"===t.dataset?.mutemusic&&window.currentMusic&&window.currentMusic.pause()}))}))}function Me(e,t){const a=void 0===e?.className?document.querySelector("."+e+"-map-cutscene"):e,n=document.getElementById("map-character"),o=$e(a.querySelector(".wp-block-orbem-paragraph-mp3:not(.explore-character-"+n?.dataset?.mainid+")")?.className),r=JSON.parse(a.getAttribute("data-character-position")),s=$e(a.className).replace(" ",""),c=!!o&&document.getElementById(o),i=document.getElementById("map-character");if(function(e,t,a){const n=document.querySelector("."+t+"-map-item"),o=e.querySelector(".map-character-icon.engage");if(n){const t=parseInt(n.style.left.replace("px",""))+25,r=parseInt(n.style.top.replace("px",""))+25,s=t+n.offsetWidth-50,c=r+n.offsetHeight-50,i=parseInt(e.style.left.replace("px","")),l=parseInt(e.style.top.replace("px","")),d=i+(400-o.offsetWidth/2),u=d+o.offsetWidth,m=l+(400-o.offsetHeight/2);let p,g=!1;switch(p=d>s&&"left",p=u<t?"right":p,p=m>c?"up":p,p=m+o.offsetHeight<r?"down":p,p){case"left":g="right";break;case"right":g="left";break;case"up":g="down";break;case"down":g="up"}!1!==p&&(ze(e,p,!1),"no"!==a.dataset?.npcfaceme&&z(g,n))}}(i,a.dataset.character,a),r&&0<r.length&&void 0!==r[0]&&"before"===r[0]?.trigger){window.allowCutscene=!1,"0"!==r[0]?.top&&Ze(i,r[0].top,r[0].left,!0,a,t,e);const n=document.querySelector('[data-trigger-cutscene="'+s+'"]'),o=void 0!==a.dataset?.path;(n||o)&&nt(30),n&&W(n,!1,t,e),o&&W(c,a,t,e)}else Ce(e,t)}function Pe(e,t,a){var n;e.classList.remove("engage"),window.nextAreaMissionComplete="";const o=$e(e.className).replace(" ",""),r=e.dataset.boss,s=null!==(n=e.dataset?.character)&&void 0!==n?n:a,i=!!s&&document.querySelector("."+s+"-map-item"),l=document.querySelector(".indicator-icon"),d=e.dataset?.communicate,u=document.querySelectorAll('[data-materializecutscene="'+o+'"]');if(u&&0<u.length&&u.forEach((e=>{!1===e.classList.contains("enable")&&e.classList.add("enable")})),d&&""!==d){const e=document.querySelector("."+d+"-map-item");e&&e.classList.add("dependent")}l&&l.classList.remove("engage"),""!==e.dataset?.type&&void 0!==e.dataset?.type&&_e(e,o,!1,e.dataset.value,"");const m=document.querySelector('[data-character="'+window.mainCharacter+'"]');m&&m.classList.remove("engage");let p="";OrbemOrder.musicNames&&(p=JSON.parse(OrbemOrder.musicNames)[k]),("yes"===e.dataset.mutemusic||e.dataset.music&&""!==e.dataset.music)&&p&&se(p,k),""!==w&&(w.pause(),w.currentTime=0);const g=JSON.parse(e.getAttribute("data-character-position")),f=document.querySelector('[data-trigger-cutscene="'+o+'"]');if(g&&0<g.length&&void 0!==g[0]&&"after"===g[0]?.trigger){const t=void 0!==e.dataset?.path;(f||t)&&nt(30),f&&W(f,!1,!1,!1),t&&W(i,e,!1,!1)}const y=document.querySelectorAll("[data-removeaftercutscene]");y&&He(y,o);const h=document.querySelectorAll('[data-showaftercutscene="'+o+'"]');h&&(h.forEach((e=>{e.classList.add("no-point"),c.push($e(e.className)),"explore-enemy"===e.dataset.genre&&le(e,!1)})),Oe(k,c));const v=e.dataset.nextarea,b=e.getAttribute("data-nextarea-position"),S=e.dataset.mapurl,L=document.querySelector(".map-weapon"),x=e.dataset.missioncomplete;x&&(F(x,document.querySelector("."+x+"-mission-item"),x),window.nextAreaMissionComplete=x),v&&te(v,L,S,b,window.crewCharacters),setTimeout((()=>{if(window.allowHit=!0,window.faceNPC="",f&&"true"===f.dataset?.cutscenebreak&&(f.dataset.cutscenebreak="false"),i&&"true"===i.dataset?.cutscenebreak&&(i.dataset.cutscenebreak="false"),r&&""!==r){const e=document.querySelector("."+r+"-map-item");e&&le(e)}}),100)}function He(e,t){e.forEach((e=>{e.dataset?.removeaftercutscene&&""!==e.dataset.removeaftercutscene&&JSON.parse(e.dataset.removeaftercutscene)[t]&&(e.remove(),_($e(e.className),"point",0,2e3,"",!0))}))}function De(){const e=document.querySelector(".game-container");e&&(e.dataset.fadeout="",setTimeout((()=>{e.dataset.fadeout="false"}),1e3))}function We(e,t){const a=void 0!==e.className?$e(e.className):e;t="false"!==t?t:e.getAttribute("data-map-url");const n=document.querySelector(".map-weapon");n&&(n.style.display="none"),te(a,n,t,!1,window.crewCharacters)}function Re(){const e={};let t=!1;function a(t,a){const n=document.querySelector("#map-character");e[t.which]=!1,window.keyDown=!1,clearInterval(window.buttonShow),!0!==[37,38,39,40,87,65,83,68].includes(t.which)&&!0!==a||(window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character"),t=e.style.left,a=e.style.top;!1!==window.keyDown||t===window.charCurrentLeft&&a===window.charCurrentTop||(Q(t,a),window.charCurrentLeft=t,window.charCurrentTop=a,clearInterval(window.coordinateTimeout))}),1e3),ze(n,"",!1))}window.allowMovement=!0,window.keyDown=!1,clearInterval(window.movementInt),document.addEventListener("keydown",(function(a){e[a.which]=!0,t=a.which,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.addEventListener("keyup",(function(e){a(e,!1)})),document.addEventListener("touchend",(function(e){a(e,!0)})),document.querySelector(".top-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[38]=!0,clearInterval(window.buttonShow),clearTimeout(window.coordinateTimeout)})),document.querySelector(".top-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[38]=!1,clearInterval(window.buttonShow),window.coordinateTimeout=setTimeout((()=>{const e=document.querySelector("#map-character");Q(e.style.left,e.style.top)}),1e3)})),document.querySelector(".top-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[38]=!0,e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".top-right").addEventListener("touchend",(function(t){t.preventDefault(),e[38]=!1,e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,clearInterval(window.buttonShow)})),document.querySelector(".middle-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchstart",(function(t){t.preventDefault(),e[37]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-left").addEventListener("touchend",(function(t){t.preventDefault(),e[37]=!1,e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchstart",(function(t){t.preventDefault(),e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-middle").addEventListener("touchend",(function(t){t.preventDefault(),e[40]=!1,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchstart",(function(t){t.preventDefault(),e[39]=!0,e[40]=!0,clearInterval(window.buttonShow)})),document.querySelector(".bottom-right").addEventListener("touchend",(function(t){t.preventDefault(),e[39]=!1,e[40]=!1,clearInterval(window.buttonShow)})),window.movementInt=setInterval((function(){const a=document.getElementById("map-character"),n=document.querySelector(".map-weapon"),o=a.style.left,r=a.style.top,s=parseInt(o,10),c=Je(parseInt(r,10),s,!1,!1),i=document.querySelector(".dragme");if(window.allowMovement){Object.values(e).includes(!0)&&(window.keyDown=!0);const o=Le(c.top,e[87]?87:38,e[83]?83:40,e,window.moveSpeed,t),r=Le(c.left,e[65]?65:37,e[68]?68:39,e,window.moveSpeed,t);a.style.top=o+"px",a.style.left=r+"px",n&&!0===window.weaponConnection&&(n.style.top=o+O+"px",n.style.left=r+T+"px"),i&&(window.dragTop&&!1!==window.dragTop&&(i.style.top=window.dragTop.higher?o+450-window.dragTop.offset+"px":o+450+window.dragTop.offset+"px"),window.dragLeft&&!1!==window.dragLeft&&(i.style.left=window.dragLeft.left?r+450-window.dragLeft.offset+"px":r+450+window.dragLeft.offset+"px")),a.scrollIntoView({block:"nearest"})}}),16)}function $e(e){if("string"==typeof e)return e.replace("wp-block-group map-item ","").replace("-map-item","").replace("drag-dest ","").replace(" completed-mission","").replace("wp-block-group enemy-item ","").replace(" no-point","").replace(" is-layout-flow","").replace(" wp-block-group-is-layout-flow","").replace(" engage","").replace("wp-block-group map-cutscene ","").replace("-map-cutscene","").replace("been-viewed","").replace(" path-onload","").replace(" start-timer","").replace("materialize-item-trigger ","").replace("-materialize-item","").replace(" materialized","").replace("mission-trigger ","").replace(" hit","").replace(" hurt","").replace("-minigame-item","").replace(" passable","").replace("minigame ","").replace(" pulse-wave-engage","").replace(" barage-wave-engage","").replace(" selected","").replace("-cutscene-trigger","").replace("cutscene-trigger ","").replace("next-mission ","").replace("-mission-item","").replace("mission-item ","").replace("wp-block-orbem-paragraph-mp3 ","").replace("explore-character-","")}function ze(e,t,a){const n=document.querySelector(".map-character-icon.engage");if(n&&""===window.currentCharacterAutoDirection||n&&""!==t){let o=n.id.replace("left-punch","left").replace("right-punch","right").replace("up-punch","up").replace("down-punch","down").replace(window.mainCharacter+"-",window.mainCharacter+"-static-");""!==(t=""!==window.isDragging?window.draggingDirection:t)&&(o=window.mainCharacter+"-static-"+t+window.isDragging);const r=a&&A!==window.currentWeapon?window.currentWeapon:"",s=document.getElementById(o+r);s&&(n.classList.remove("engage"),s.classList.add("engage"),e.dataset.static="true")}}function je(e){let t=!1,a=200,n=!1;const o=document.querySelector(".map-weapon"),r=A===o.dataset.weapon?"":"-"+o.dataset.weapon,s="top"===o.dataset.direction?"up":o.dataset.direction,c=document.querySelector("#map-character"),i=c.querySelector(".map-character-icon.engage"),l=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);if(!1!==window.allowHit){const d=document.querySelector("#explore-points .mana-amount"),m=d?d.dataset.amount:0;if(!0===["ShiftLeft","ShiftRight"].includes(e.code)&&(h=!1),("Space"===e.code||e.target.classList.contains("action-key"))&&(v=!1,clearTimeout(u),o&&!1===n)){const e=o.classList.contains("spell");if(a=o.classList.contains("protection")?8e3:100,"true"===o.dataset.projectile||!0===e&&0<m||!1===e&&!1===t){o.classList.add("engage");let e=0;switch(B&&(e=window.globalLeftPositionOffset-50),s){case"up":O=300;break;case"down":O=500;break;case"left":T=350-e;break;case"right":T=450-e}i&&(i.classList.add("punched"),l.classList.add("engage"),function(e){const t=e?.querySelector("audio");t&&(t.volume=window.sfxVolume,t.play())}(o))}if(0<m&&!0===e){const e=o.getAttribute("data-value");d.setAttribute("data-amount",parseInt(m)-parseInt(e)),d.classList.add("engage");let t=parseInt(m)-parseInt(e);t=0>t?0:t,U(t,"mana","magic",!1,""),setTimeout((()=>{d.classList.remove("engage")}),500)}if("true"===o.dataset.projectile||!0===e||!1===e&&!1===n&&!1===h)setTimeout((()=>{if(!1===o.classList.contains("heavy-engage"))switch(o.classList.remove("engage"),i.classList.remove("punched"),l.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}}),a);else if(!0===h){const e=c.querySelector(`#${window.mainCharacter}-${s}-punch${r}`);o.classList.add("heavy-engage"),n=!0,setTimeout((()=>{switch(n=!1,o.classList.remove("heavy-engage"),o.classList.remove("engage"),i.classList.remove("punched"),e.classList.remove("engage"),s){case"up":case"down":O=400;break;case"left":case"right":T=window.globalLeftPositionOffset-50}h=!1}),500)}if(0<m&&o&&("yes"===o.dataset.projectile||!0===e)){let t=parseInt(o.style.left.replace("px","")),a=parseInt(o.style.top.replace("px",""));const n=!0===e?".magic-weapon":".map-weapon";switch(o.getAttribute("data-direction")){case"down":a+=1e4;break;case"top":a-=1e4;break;case"left":t-=1e4;break;case"right":t+=1e4}me(o,t,a,document,2,e,n,o.dataset.projectile)}!0===t&&(t=!1,o.classList.remove("charge-engage"),o.classList.add("charge-attack-engage"),setTimeout((()=>{o.classList.remove("charge-attack-engage"),i.classList.remove("punched"),l.classList.remove("engage")}),700))}}else if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".indicator-icon");if(e&&!0===e.classList.contains("engage")){const t=e.dataset?.cutscene,a=e.dataset?.sign,n=e.dataset?.minigame,o=!!n&&document.querySelector("[data-minigame="+n+"]");t&&""!==t&&(Me(t,!1),e.dataset.cutscene=""),a&&""!==a&&(function(e){const t=document.querySelector("."+e+"-map-item");function a(e){if("Space"===e.code||"click"===e.type){t.classList.remove("open-up"),document.removeEventListener("keydown",a);const e=$e(t.className),n=document.querySelector('.cutscene-trigger[data-materializefocus="'+e+'"]'),o=document.querySelector('.cutscene-trigger[data-removeafterfocus="'+e+'"]');n&&n.classList.add("enable"),o&&o.remove(),t.dataset.mission&&""!==t.dataset.mission&&F(t.dataset.mission,t,e)}}t.classList.add("open-up"),setTimeout((()=>{document.addEventListener("click",a)}),0),document.addEventListener("keydown",a)}(a),e.dataset.sign=""),n&&o&&""!==n&&(function(e){const t=document.querySelector("."+e.dataset.minigame+"-minigame-item");if(t){const a=t.dataset.music;let n=!1;const o=t.dataset.mission;let r=!1;if(o&&""!==o&&(r=document.querySelector("."+o+"-mission-item"),r&&(n=r.classList.contains("engage"))),n){window.allowMovement=!1,t.classList.add("engage"),e.classList.add("hit"),a&&""!==a&&se(a,o);let n=null,s=0,c=0;const i=e=>{if(e.preventDefault(),n=e.target,n){const t=n.getBoundingClientRect();s=e.clientX-t.left,c=e.clientY-t.top,e.dataTransfer.setData("text/plain",""),document.addEventListener("mousemove",l)}},l=e=>{if(n){const a=t.getBoundingClientRect(),o=e.clientX-a.left,r=e.clientY-a.top;n.style.position="fixed",n.style.zIndex="9",n.style.left=o-s+"px",n.style.top=r-c+"px"}},d=()=>{if(n){n=null,document.removeEventListener("mousemove",l);const e=document.querySelectorAll(".minigame");e&&e.forEach((e=>{const t=e.querySelector(".computer-chip"),a=t.querySelectorAll("ellipse"),n=e.querySelector(".draggable-images");function s(e,t){const a=e.getBoundingClientRect(),n=t.getBoundingClientRect();return!(a.right<n.left||a.left>n.right||a.bottom<n.top||a.top>n.bottom)}(function(e,t){for(const a of t){let t=!1;for(const n of e)if(s(n,a)){t=!0;break}if(!t)return!1}return!0})(n.querySelectorAll(".minigame-draggable-image"),a)&&(t.style.display="none",n.style.display="none",function(e,t,a){const n=a.querySelector(".programming-output"),o=a.querySelector(".minigame-programming"),r=a.querySelector(".programming-subject"),s=n.querySelector("textarea");if(o&&r&&(o.classList.add("engage"),r.classList.add("engage")),n&&r&&s){n.prepend(r),s.focus();const o=function(e){let t="";return e.split("").forEach((e=>{const a=e.charCodeAt(0).toString(2);t+=("00000"+a).slice(-5).concat("")})),t}(r.querySelector("strong").textContent);s.addEventListener("keyup",(r=>{if(13===r.which){const r=n.querySelector("textarea");parseInt(r.value)===parseInt(o)&&(F(e,t,e),a.classList.remove("engage"),window.allowMovement=!0,function(e){const t=$e(e.className),a=document.querySelector('.map-cutscene[data-minigame="'+t+'"]');a&&Me($e(a.className),!1);let n="";OrbemOrder.musicNames&&(n=JSON.parse(OrbemOrder.musicNames)[k]),e.dataset.music&&""!==e.dataset.music&&n&&se(n,k)}(a))}}))}}(o,r,e))}))}};document.querySelectorAll(".minigame-draggable-image").forEach((e=>{e.addEventListener("dragstart",i),e.addEventListener("mouseup",d)}))}}}(o),e.dataset.minigame="")}}}function Je(e,t,a,n){const o=e,r=t,s=!1!==a?".map-character-icon.engage, ":"",c=document.getElementById("map-character"),i=!1!==(a=a||document.querySelector(".map-character-icon.engage"))&&"hazard"===c.dataset.ability?':not([data-hazard="true"])':"";return Xe(document.querySelectorAll(s+".default-map svg rect, .map-item"+i+':not([data-wanderer="yes"]):not(.explainer-container):not(.materialize-item-trigger):not(.drag-dest):not([data-trigger="true"]):not(.currently-dragging):not([data-passable="true"].no-point):not(.passable):not([data-genre="explore-sign"]):not([data-foreground="true"]):not([data-background="true"]), .enemy-item:not([data-enemy-type="runner"])'),a,parseInt(o),parseInt(r),n,""!==s)}function Xe(e,t,a,n,o,r){const s=n,c=a,i={top:a,left:n,collide:!1},l=document.getElementById("map-character"),d=l.querySelector(".map-character-icon.engage"),u=t.querySelector(".character-icon.engage")||t,m=!0===o?28:0;let p="center";if(!0===o){if(!t.dataset.targetCorner){const e=["top-left","top-right","bottom-left","bottom-right"];t.dataset.targetCorner=e[Math.floor(Math.random()*e.length)]}p=t.dataset.targetCorner}let g=window.globalLeftPositionOffset-t.offsetWidth/2,f=400-t.offsetHeight/2;if(!0===o)switch(p){case"top-left":g-=30,f-=30;break;case"top-right":g+=30,f-=30;break;case"bottom-left":g-=30,f+=30;break;case"bottom-right":g+=30,f+=30}const y={offsetLeft:l.offsetLeft+g,offsetWidth:t.offsetWidth,offsetTop:l.offsetTop+f,offsetHeight:t.offsetHeight},w={offsetLeft:l.offsetLeft+(window.globalLeftPositionOffset-d.offsetWidth/2)+0,offsetWidth:Math.max(10,d.offsetWidth-0),offsetTop:l.offsetTop+(400-d.offsetHeight/2)+0,offsetHeight:Math.max(10,d.offsetHeight-0)},h=!0===r||!0===o?{offsetLeft:n+(!0===o?m:0),offsetTop:a+(!0===o?m:0),offsetWidth:!0===o?Math.max(10,u.offsetWidth-2*m):t.offsetWidth,offsetHeight:!0===o?Math.max(10,u.offsetHeight-2*m):t.offsetHeight}:y;let v=!1;return e&&(!1===window.godMode&&!0!==r&&!0!==o||!0===r||!0===o)&&e.forEach((e=>{let a=e;if(d.id===a.id&&(a=!0===o?w:y),t!==e&&Ue(h,a,0)){const e=a.offsetLeft+a.offsetWidth,n=a.offsetLeft,l=a.offsetTop,d=a.offsetTop+a.offsetHeight,u=h.offsetLeft+h.offsetWidth,m=h.offsetLeft,p=h.offsetTop,g=h.offsetTop+h.offsetHeight;i.collide=!0;const f=d>p&&l<p&&d<p+10,y=l<g&&d>g&&l>g-10,b=e>m&&n<m,S=n<u&&e>u;let L=!0===o?5:window.moveSpeed;L=!0===r?1:L,!0===o&&a===w&&(v=!0,function(e){if(!e||e._runnerPunchInt)return;let t=!1;e._runnerPunchInt=setInterval((()=>{const a=e.dataset.currentDirection||"down",n=$e(e.className),o=e.querySelector("#"+n+a),r=e.dataset.value,s=e.querySelector("#"+n+a+"-punch"),c=e.querySelectorAll(".character-icon"),i=t&&s?s:o;if(i){if(c.forEach((e=>{e.classList.remove("engage")})),i.classList.add("engage"),t&&!window.mcHurtCooldown){window.mcHurtCooldown=!0;const e=re("health"),t=parseInt(e,10)-parseInt(r,10);tt(),U(t,"health","enemy",""),setTimeout((()=>{window.mcHurtCooldown=!1}),1e3)}t=!t}}),800)}(t)),!b||S||f||y||(i.left=s+L,i.collide=!0),!S||b||f||y||(i.left=s-L,i.collide=!0),f&&!y&&(i.top=c+L,i.collide=!0),y&&!f&&(i.top=c-L,i.collide=!0)}})),!0===o&&!1===v&&ce(t),i}function Ue(e,t,a){const n=e.offsetLeft+e.offsetWidth,o=e.offsetLeft,r=e.offsetTop,s=e.offsetTop+e.offsetHeight,c=t.offsetLeft+t.offsetWidth,i=t.offsetLeft,l=t.offsetTop,d=t.offsetTop+t.offsetHeight;return 0==(n+a<i-a||o+a>c-a||s+a<l-a||r-a>d+a)}function _e(e,t,a,n,o){let r=e.dataset.type;r=r&&""!==r?r:"point",!1===e.classList.contains("map-cutscene")&&e.classList.add("engage");const s=document.querySelector(`#explore-points .${r}-amount`);let c=100;const i=!0===a?parseInt(n):parseInt(e.dataset?.value);if(s&&0<i){if(c=s.dataset.amount,"point"===r){const e=parseInt(c)+parseInt(null!=i?i:"0");s.setAttribute("data-amount",e);const t=Ge(c),a=Ge(e);if(window.nextLevelPointAmount=JSON.parse(OrbemOrder.levelMaps)[a],t!==a){const e=document.querySelector(".current-level");e&&(e.textContent="lvl. "+a,document.querySelector(".next-level-points").textContent=window.nextLevelPointAmount)}const n=document.querySelector(".my-points");n&&(n.textContent=e)}s.classList.add("engage"),setTimeout((function(){s.classList.remove("engage")}),2e3);const a=e.classList.contains("storage-item");!function(e){const t=document.getElementById("map-character");t.classList.add("point"),""!==e&&t.classList.add(e),setTimeout((function(){t.classList.add("over"),setTimeout((function(){""!==e&&t.classList.remove(e),t.classList.remove("point"),t.classList.remove("over")}),500)}),1e3);const a=document.getElementById("ching");a&&(a.volume=window.sfxVolume,a.play())}(r),U(parseInt(c)+parseInt(i),r,t,a,o)}}function Ve(){const e=document.querySelector(".game-container"),t=document.querySelector("#map-character");document.addEventListener("keydown",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.addEventListener("click",Ye)})),document.addEventListener("keyup",(a=>{16===a.keyCode&&Ee("",t,"programming")&&e.removeEventListener("click",Ye)}))}function Fe(e){if("Space"===e.code||e.target.classList.contains("action-key")){const e=document.querySelector(".dragme");if(e&&!0===e.classList.contains("currently-dragging")){setTimeout((()=>{window.allowHit=!0}),100);const t=parseInt(e.style.top.replace("px",""));e.classList.remove("currently-dragging"),e.classList.remove("dragme"),e.style.left=window.dragLeft.left?parseInt(e.style.left.replace("px",""))-2+"px":parseInt(e.style.left.replace("px",""))+2+"px",e.style.top=window.dragTop.higher?t-2+"px":t+2+"px",window.dragLeft=!1,window.dragTop=!1,window.isDragging="",window.draggingDirection="";const a=$e(e.className),n=document.querySelector("."+a+"-drag-dest-map-item");if(n){const o=parseInt(n.style.left.replace("px",""))+n.offsetWidth/2,r=parseInt(n.style.top.replace("px",""))+n.offsetHeight/2,s=parseInt(e.style.left.replace("px",""))+n.offsetWidth/2,c=t+e.offsetHeight/2,i=s<o?o-s:s-o;(c<r?r-c:c-r)<parseInt(n.dataset.offset)&&i<parseInt(n.dataset.offset)&&!1===n.classList.contains("completed-mission")&&(F(n.dataset.mission,document.querySelector("."+n.dataset.mission+"-mission-item"),a),n.classList.add("completed-mission"),e.classList.add("no-point"),"true"===n.dataset.removable&&(n.remove(),_($e(n.className),"point",0,2e3,"",!0)),"yes"===e.dataset.disappear&&(e.remove(),_(a,"point",0,2e3,"",!0)))}const o=`${OrbemOrder.siteRESTURL}/save-drag/`,r={slug:a,top:e.style.top.replace("px",""),left:e.style.left.replace("px","")};!1!==C&&fetch(o,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(r)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText)}))}else!function(){const e=document.querySelector(".dragme"),t=document.querySelector("#map-character"),a=document.querySelector(".currently-dragging"),n=t.querySelector(".map-character-icon.engage");let o;if(e){window.allowHit=!1;const r=parseInt(e.style.top.replace("px","")),s=parseInt(e.style.left.replace("px","")),c=parseInt(t.style.top.replace("px",""))+450,i=parseInt(t.style.left.replace("px",""))+450,l=r<c,d=s<i,u=l?c-r:r-c,m=d?i-s:s-i,p=r<c-50,g=s<i-50,f=p?c-50-r:r-(c-50),y=g?i-(45+n.offsetWidth/2)-s:s-(i-(55+n.offsetWidth/2));if(window.dragTop={offset:u,higher:l},window.dragLeft={offset:m,left:d},o=p&&f>=e.offsetHeight?"up":o,o=!1===p&&f>=n.offsetHeight?"down":o,o=g&&y>=e.offsetWidth?"left":o,o=!1===g&&y>=n.offsetWidth?"right":o,void 0===o)return window.dragTop=!1,void(window.dragLeft=!1);a&&a.classList.remove("currently-dragging"),e.classList.add("currently-dragging"),window.isDragging="-drag",window.draggingDirection=o}else window.dragTop=!1,window.dragLeft=!1}()}}function Ye(e){const t=document.querySelector(".game-container").getBoundingClientRect(),a=e.clientX-t.left-400,n=e.clientY-t.top-400,o=document.getElementById("map-character"),r=document.querySelector(".power-amount"),s=r.querySelector(".gauge"),c=r?r.getAttribute("data-amount"):0;if(clearInterval(window.rechargeInterval),0<c){!o||"rect"===e.target.tagName||"true"!==e.target.dataset.collectable&&!1!==e.target.classList.contains("map-item")&&"true"!==e.target.dataset.hazard||Ze(o,n,a,!1,!1,!1,!1);const t=c<0?0:c-25;r.setAttribute("data-amount",t),s.style.width=t+"px"}26>c&&function(e,t){window.rechargeInterval=setInterval((()=>{const a=parseInt(t.getAttribute("data-amount"));100<=a?clearInterval(window.rechargeInterval):(t.setAttribute("data-amount",a+1),e.style.width=a+1+"px")}),1500)}(s,r)}function Ze(e,t,a,n,o,r,s){const c=parseInt(e.style.left.replace("px","")),i=parseInt(e.style.top.replace("px","")),l=c>a,d=i>t,u=l?c-a:a-c,m=d?i-t:t-i;let p=0;const g=document.querySelector(".map-weapon");if(n){clearInterval(window.movementInt),e.classList.add("auto-move");const n=Math.max(m,u),f=setInterval((()=>{if(p<=n){let n="",o="";d?(e.style.top=p<=m?i-p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="up"):(e.style.top=p<=m?i+p+"px":t+"px",g.style.top=parseInt(e.style.top.replace("px",""))+400+"px",n="down"),l?(e.style.left=p<=u?c-p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="left"):(e.style.left=p<=u?c+p+"px":a+"px",g.style.left=parseInt(e.style.left.replace("px",""))+400+"px",o="right"),function(e,t,a){const n=""===e?t:e,o=a.querySelector(".map-character-icon.engage");if(n!==window.currentCharacterAutoDirection){const e=a.querySelector("#"+window.mainCharacter+"-"+n+window.currentWeapon);window.currentCharacterAutoDirection=n,a.classList.add(n+"-dir"),o&&o.classList.remove("engage"),e&&e.classList.add("engage"),a.className=""}}(n,o,e)}else{window.allowCutscene=!0;const t=e.querySelector(".map-character-icon.engage");if(t&&!1===t.id.includes("static")){t.classList.remove("engage");const e=document.getElementById(t.id.replace(window.mainCharacter,window.mainCharacter+"-static"+window.currentWeapon));e&&(e.classList.add("engage"),window.currentCharacterAutoDirection="")}!1!==o&&!1!==o.classList.contains("engage")||(clearInterval(f),Re()),Ce(s,r)}p++}),window.moveSpeed)}else e.style.left=a+"px",e.style.top=t+"px"}function Ge(e){if(OrbemOrder.levelMaps){const t=JSON.parse(OrbemOrder.levelMaps);for(const a in t)if(e>t[a]&&e<t[parseInt(a)+1]||e===t[a])return parseInt(a)+1}return 1}async function Ke(e,t,a,n){var o;let r=!1;const s=document.querySelector("main").dataset?.autoplaycutscene;if(!0===e.includes("**")||""===e||"…"===e||"..."===e)return void setTimeout((()=>{window.nextDialogue=!0}),1500);!1!==a?(w=a,w.volume=function(e,t=-40,a=16){return(parseInt(window.talkingVolume)-t)/(a-t)}(),w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))):r=!0;const c=null!==(o=OrbemOrder.TTSAPIKEY)&&void 0!==o?o:"";if(!1===a&&""!==c&&t&&""!==t){r=!1;const a=`https://texttospeech.googleapis.com/v1/text:synthesize?key=${c}`,o=0,i=1.2,l={input:{ssml:"<speak>"+e+"</speak>"},voice:{name:t,languageCode:"en-US"},audioConfig:{audioEncoding:"MP3",volumeGainDb:parseInt(window.talkingVolume)+7}};o&&i&&(l.audioConfig.pitch=o,l.audioConfig.speakingRate=i);try{const e=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!e.ok)return;const t=await e.json(),o=t?.audioContent;w=new Audio(`data:audio/mp3;base64,${o}`),w.volume=.5,await w.play(),w.addEventListener("ended",(()=>{!1===n&&"false"!==s&&(window.nextDialogue=!0)}))}catch(e){window.audioError=e.message}}r&&"false"!==s&&(window.nextDialogue=!0)}function Qe(e){const t=document.getElementById("start-screen-music"),a=document.getElementById("music-unmute");if(t&&!1!==e){t.volume=0,t.play(),t.muted=!1,a&&(a.textContent="🔉",a.addEventListener("click",(()=>{t.muted=!t.muted,a.textContent=t.muted?"🔇":"🔉"})));const e=setInterval((()=>{t.volume<.7?t.volume+=.1:clearInterval(e)}),300)}else t&&(t.remove(),a.remove())}function et(){setInterval((()=>{if(!0===q){const e=window.theHazardValue,t=re("health"),a=parseInt(t)-parseInt(e);tt(),U(a,"health","hazard","")}if(!1!==E){const e=document.getElementById("map-character");xe(25,E,e)}}),1e3)}function tt(){clearTimeout(f);const e=document.getElementById("map-character");e&&(e.dataset.hurt=!0,f=setTimeout((()=>{e.dataset.hurt=!1}),500))}function at(e,t){e&&(e.classList.add(t),setTimeout((function(){e.classList.remove(t)}),1e3))}function nt(e){const t=document.getElementById("map-character"),a=parseInt(t.style.left.replace("px","")),n=parseInt(t.style.top.replace("px",""));switch(t.className.replace("-dir","")){case"right":t.style.left=a-e+"px";break;case"left":t.style.left=a+e+"px";break;case"top":t.style.top=n+e+"px";break;case"down":t.style.top=n-e+"px"}}function ot(e,t,{caseInsensitive:a=!1,includeEventHandlerAttributes:n=!1}={}){if(null==e||""===e)return;const o="g"+(a?"i":""),r=new RegExp(String(e).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o),s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let c;for(;c=s.nextNode();){const e=c.nodeValue;e&&r.test(e)?(c.nodeValue=e.replace(r,t),r.lastIndex=0):r.lastIndex=0}const i=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT);let l;for(;l=i.nextNode();)for(const e of Array.from(l.attributes)){const a=e.name,o=e.value;!n&&/^on/i.test(a)||(o&&r.test(o)?(l.setAttribute(a,o.replace(r,t)),r.lastIndex=0):r.lastIndex=0)}}"function"!=typeof window.exploreHandleCredentialResponse&&(window.exploreHandleCredentialResponse=function(e){const t=`${OrbemOrder.siteRESTURL}/google-oauth-callback/`,a=document.getElementById("g_id_onload"),n={credential:e.credential,nonce:a?.dataset?.nonce||""};fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":OrbemOrder.orbemNonce},body:JSON.stringify(n)}).then((e=>{if(!e.ok)throw new Error("Network response was not ok "+e.statusText);return e.json()})).then((e=>{e.success&&window.location.reload()}))})}},t={};function a(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a(911)})();
  • orbem-studio/trunk/orbem-studio.php

    r3488361 r3488402  
    66 * Plugin URI: https://orbem.studio/
    77 * Description: Build your own RPG video game using the power of WordPress
    8  * Version: 1.3.5
     8 * Version: 1.3.6
    99 * Author: orbemorder
    1010 * Author URI: https://orbemorder.com/
     
    3434 * Plugin version constant.
    3535 */
    36 const ORBEM_STUDIO_VERSION = '1.3.5';
     36const ORBEM_STUDIO_VERSION = '1.3.6';
    3737
    3838if (version_compare(phpversion(), '8.1.0', '>=')) {
  • orbem-studio/trunk/readme.txt

    r3488361 r3488402  
    66Tested up to: 6.9
    77Requires PHP: 8.1
    8 Stable tag: 1.3.5
     8Stable tag: 1.3.6
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    171171== Changelog ==
    172172
     173= 1.3.6 =
     174* allow enemy kill logged out.
     175
    173176= 1.3.5 =
    174177* Remove item after mission.
Note: See TracChangeset for help on using the changeset viewer.