From b6b45f025c3c0c7ad6009b6c502fb47c6f01f3ac Mon Sep 17 00:00:00 2001 From: amcolash Date: Fri, 10 Jan 2025 08:21:43 +0000 Subject: [PATCH] deploy: 642ddbb930a2ff71b1697e27e4faa64b3069f46c --- assets/{index-Cf9D1TsC.js => index-J3kh8FpM.js} | 2 +- build.json | 2 +- index.html | 2 +- sw.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename assets/{index-Cf9D1TsC.js => index-J3kh8FpM.js} (99%) diff --git a/assets/index-Cf9D1TsC.js b/assets/index-J3kh8FpM.js similarity index 99% rename from assets/index-Cf9D1TsC.js rename to assets/index-J3kh8FpM.js index de79687..ad3f5dc 100644 --- a/assets/index-Cf9D1TsC.js +++ b/assets/index-J3kh8FpM.js @@ -1 +1 @@ -var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s)(t,"symbol"!=typeof i?i+"":i,s);import{r as i,g as s,c as n,a as o}from"./phaser-BZMViRUx.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const r={};var a=i();const l={width:1280,height:720},h={width:960,height:540};let c=!1,u=!1,d=!1;d=!0;let p=!0;const y=localStorage.getItem("chrono-sleuth-prod");let g;null!==y&&(p="true"===y);let f=p;f=!0;let m=!1;p&&(m=!1);const{width:b,height:v}=h;p&&(c=!1,d=!1,p=!0,g=void 0,u=!1);const w={debug:c,phaserInspector:u,prod:p,bootDialog:g,useShader:!0,width:b,height:v,cameraOffset:v/3,zoomed:!0,dayMinutes:.25,rewindEnabled:!1,fastMode:d,perfTest:m};var x=(e=>(e[e.None=0]="None",e[e.Teleported=1]="Teleported",e[e.Talked=2]="Talked",e[e.Item=3]="Item",e[e.Prop=4]="Prop",e))(x||{}),S=(e=>(e[e.Underground=0]="Underground",e[e.Town=1]="Town",e[e.TownEast=2]="TownEast",e[e.Forest=3]="Forest",e[e.ForestEast=4]="ForestEast",e[e.Lake=5]="Lake",e[e.TownNorth=6]="TownNorth",e[e.ClockSquare=7]="ClockSquare",e[e.ClockSquareNorth=8]="ClockSquareNorth",e[e.ClockEntrance=9]="ClockEntrance",e[e.ClockStairs=10]="ClockStairs",e[e.ClockTop=11]="ClockTop",e[e.TownWest=12]="TownWest",e[e.MansionGrounds=13]="MansionGrounds",e[e.MansionEntrance=14]="MansionEntrance",e[e.Mansion=15]="Mansion",e[e.LabHatch=16]="LabHatch",e[e.Lab=17]="Lab",e[e.LibraryEntrance=18]="LibraryEntrance",e[e.Library=19]="Library",e))(S||{}),k=(e=>(e[e.Wrench=0]="Wrench",e[e.Gear1=1]="Gear1",e[e.Key=2]="Key",e[e.HerbRed=3]="HerbRed",e[e.HerbGreen=4]="HerbGreen",e[e.HerbBlue=5]="HerbBlue",e[e.Potion=6]="Potion",e[e.Gear2=7]="Gear2",e))(k||{}),I=(e=>(e[e.ForestGear=0]="ForestGear",e[e.SphinxRiddle=1]="SphinxRiddle",e[e.InvestigateTownWest=2]="InvestigateTownWest",e[e.ExploreLab=3]="ExploreLab",e[e.FindPotionIngredients=4]="FindPotionIngredients",e))(I||{}),P=(e=>(e[e.Inventor=0]="Inventor",e[e.Stranger=1]="Stranger",e[e.Sphinx=2]="Sphinx",e[e.Mayor=3]="Mayor",e[e.ClockTower=4]="ClockTower",e))(P||{}),T=(e=>(e[e.Sphinx=0]="Sphinx",e))(T||{}),C=(e=>(e[e.FixTheClock=0]="FixTheClock",e[e.MetTheMayor=1]="MetTheMayor",e[e.ClockFirstGear=2]="ClockFirstGear",e[e.AlchemyLabFound=3]="AlchemyLabFound",e[e.AlchemySetFixed=4]="AlchemySetFixed",e[e.ExtraPotionInformation=5]="ExtraPotionInformation",e[e.SafeDiscovered=6]="SafeDiscovered",e[e.ClockSecondGear=7]="ClockSecondGear",e))(C||{}),O=(e=>(e[e.Chest=0]="Chest",e[e.LabHatch=1]="LabHatch",e[e.LabBook=2]="LabBook",e[e.AlchemySet=3]="AlchemySet",e[e.LabBookshelf1=4]="LabBookshelf1",e[e.LabBookshelf2=5]="LabBookshelf2",e[e.LabBookshelf3=6]="LabBookshelf3",e[e.LabPotionShelf1=7]="LabPotionShelf1",e[e.MansionPicture=8]="MansionPicture",e[e.MansionHole=9]="MansionHole",e))(O||{}),j=(e=>(e[e.LabStairs=0]="LabStairs",e))(j||{}),A=(e=>(e[e.Town=0]="Town",e[e.ClockOutside=1]="ClockOutside",e[e.ClockInner=2]="ClockInner",e[e.Forest=3]="Forest",e[e.Lake=4]="Lake",e[e.MansionOutside=5]="MansionOutside",e[e.MansionInside=6]="MansionInside",e[e.AlchemyLab=7]="AlchemyLab",e[e.Library=8]="Library",e))(A||{}),E=(e=>(e.Intro="music-intro",e.Town="music-town",e.Mansion="music-mansion",e.Forest="music-forest",e.Clock="music-clock",e))(E||{});const M={[E.Intro]:{locations:[],volume:.5},[E.Town]:{locations:[A.Town],volume:.5},[E.Clock]:{locations:[A.ClockInner,A.ClockOutside],volume:.5},[E.Forest]:{locations:[A.Forest,A.Lake],volume:.5},[E.Mansion]:{locations:[A.MansionInside,A.MansionOutside,A.AlchemyLab],volume:.5}};let z;class D{constructor(e){t(this,"sound"),t(this,"music"),t(this,"volume",.5),t(this,"scene"),this.sound=e,e.on("mute",((e,t)=>{this.music&&(t?L(this.scene,this.music):F(this.scene,this.music,this.volume))})),e.once("unlocked",(()=>{this.music&&!this.music.isPlaying&&F(this.scene,this.music,this.volume)}))}start(e,t){var i,s;(null==(i=this.music)?void 0:i.key)===e&&(null==(s=this.music)?void 0:s.isPlaying)||(this.stop(),this.volume=t||M[e].volume||.5,this.music=this.sound.get(e)||this.sound.add(e,{loop:!0,volume:this.volume}),this.sound.mute||this.sound.locked||F(this.scene,this.music,this.volume))}stop(){this.music&&L(this.scene,this.music),this.music=void 0}setScene(e){this.scene=e}}function F(e,t,i=.5,s=500){e&&t&&!t.pendingRemove&&(t.play({volume:0}),e.tweens.getTweensOf(t).forEach((e=>e.stop())),e.tweens.add({targets:t,volume:i,duration:s}))}function L(e,t,i=500){e&&t.isPlaying?(e.tweens.getTweensOf(t).forEach((e=>e.stop())),e.tweens.add({targets:t,volume:0,duration:i,onComplete:()=>t.stop()})):t.stop()}var B=(e=>(e[e.Backgrounds=-1]="Backgrounds",e[e.Warpers=0]="Warpers",e[e.Npcs=1]="Npcs",e[e.Items=2]="Items",e[e.Player=3]="Player",e[e.Shader=4]="Shader",e[e.Ui=5]="Ui",e[e.Ui2=6]="Ui2",e[e.Debug=7]="Debug",e[e.Overlay=8]="Overlay",e))(B||{});const G={[P.Inventor]:{x:550,y:635,scale:.75,image:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[P.Stranger]:{x:750,y:865,scale:1.35,image:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[P.Sphinx]:{x:3520,y:790,scale:1,image:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:e=>No(e.scene,e.scene.player.gameState.data.sphinxMoved,!0),light:1.85,initializeOnStart:!0},[P.Mayor]:{x:1065,y:-340,scale:.9,image:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[P.ClockTower]:{x:880,y:-2090,scale:.5,image:"warp",portrait:"clock_portrait",name:"Clock Tower",particles:{texture:"warp",scale:{start:0,end:1.1},alpha:{start:1,end:0},lifespan:2e3,delay:1e3,maxAliveParticles:1,tint:[13067088]},onCreate:e=>{e.setOffset(150,-40)}}},R="fcfee9",W="e6c99d",N="303646",_="1c1831",H="993333",U="339933",$="ffccaa",V="335588",q="111111",X="ddaaee";function K(e){return a.Display.Color.HexStringToColor(e).color}function Y(e){return K(a.Display.Color.RGBToString(255*e.r,255*e.g,255*e.b))}function Q(e){const t=a.Display.Color.ColorToRGBA(e);return new a.Display.Color(t.r,t.g,t.b,t.a)}function J(e,t,i,s,n){const o=.3*(n.duration||100);return e.tweens.addCounter({from:0,to:o,onUpdate:e=>{const n=a.Display.Color.Interpolate.ColorWithColor(t,i,o,e.getValue());var r;s((r=n,K(a.Display.Color.RGBToString(r.r,r.g,r.b))))},...n})}const Z=1200;let ee=!1;function te(e){return Y(e.lights.ambientColor)===K(R)}function ie(e,t=!0){ee||(se(e,R,t),t?e.time.delayedCall(Z,(()=>ne(e,.5))):ne(e,.5),e.lights.lights.forEach((i=>{const s=i.intensity;t?e.tweens.add({targets:i,duration:Z,intensity:0,onComplete:()=>{i.setVisible(!1),i.setIntensity(s)}}):i.setVisible(!1)})))}function se(e,t,i){if(!i)return void e.lights.setAmbientColor(K(t));ee=!0;const s=Y(e.lights.ambientColor),n=a.Display.Color.ValueToColor(s),o=a.Display.Color.ValueToColor(t);J(e,n,o,(t=>e.lights.setAmbientColor(t)),{duration:Z,onComplete:()=>{ee=!1}})}function ne(e,t){e.children.getAll("name","DebugLightGraphics").forEach((e=>e.setAlpha(t)))}const oe=Q(K(q));function re(e,t,i){e.cameras.main.fadeIn(t,oe.red,oe.green,oe.blue,((e,t)=>{t>=1&&i&&i()}))}function ae(e,t,i){e.cameras.main.fadeOut(t,oe.red,oe.green,oe.blue,((e,t)=>{t>=1&&i&&i()}))}function le(e,t,i){return!!(t.inventory.initialized&&t.quests.initialized&&t.journal.initialized)&&a.Math.Distance.BetweenPointsSquared(e,t)<(i||1e3)**2}function he(e,t,i){var s,n;null==(s=e.gamepad)||s.setAlpha(0),null==(n=e.gamepad)||n.resetButtons(),e.scene.pause(),e.scene.launch(t,{player:e.player,...i})}function ce(e,t,i){return t&&Object.values(t).includes(e)?`${i}.${Object.keys(t).find((i=>t[i]===e))}`:e}function ue(e){return e.replace(/([A-Z]+|[0-9]+)/g," $1").trim()}let de;const pe=document.documentElement;class ye extends a.GameObjects.GameObject{constructor(e,i,s,n,o,r){super(e,"DebugLight"),t(this,"x"),t(this,"y"),t(this,"light"),t(this,"debug"),e.add.existing(this),this.light=e.lights.addLight(i,s,n,o,r),this.debug=e.add.graphics({x:i,y:s}).setDepth(B.Debug),this.debug.lineStyle(3,65280),this.debug.name="DebugLightGraphics",this.x=i,this.y=s,w.debug&&this.debug.strokeCircle(0,0,n)}setPosition(e,t){this.light.setPosition(e,t),this.debug.setPosition(e,t),this.x=e,this.y=t}destroy(e){var t,i;super.destroy(e),this.debug.destroy(),null==(i=null==(t=this.scene)?void 0:t.lights)||i.removeLight(this.light)}}const ge=2*Math.PI;class fe extends a.GameObjects.Graphics{constructor(e,i){super(e),t(this,"player"),t(this,"angle1",0),t(this,"angle2",1),t(this,"angle3",4),t(this,"update1",!1),t(this,"update2",!1),t(this,"update3",!1),this.name="ClockHands",e.add.existing(this),this.player=i,this.setPosition(842,-2107),this.setDepth(B.Npcs),this.updateHands()}update(e){if(this.scene.cameras.main.worldView.contains(this.x,this.y))this.setVisible(!1);else{this.setVisible(!0),this.update1&&(this.angle1=ge*(e/6e4)*35),this.update2&&(this.angle2=ge*(e/36e5)*35),this.update3&&(this.angle3=ge*(e/432e5)*35),this.clear(),this.fillStyle(K("#224477")),this.fillCircle(0,0,6),[8,6].forEach((e=>{this.lineStyle(e,K(6===e?"#224477":_)),this.lineBetween(0,0,50*Math.cos(this.angle1),50*Math.sin(this.angle1)),this.lineBetween(0,0,40*Math.cos(this.angle2),40*Math.sin(this.angle2)),this.lineBetween(0,0,25*Math.cos(this.angle3),25*Math.sin(this.angle3))})),this.lineStyle(5,K(_));for(let e=0;e<12;e++){const t=ge*(e/12),i=50*Math.cos(t),s=50*Math.sin(t);this.lineBetween(i,s,1.5*i,1.5*s)}}}updateHands(){De(this.player,C.ClockFirstGear)&&(this.update1=!0),De(this.player,C.ClockSecondGear)&&(this.update2=!0)}}var me=(e=>(e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.Continue=4]="Continue",e[e.Back=5]="Back",e[e.Shift=6]="Shift",e))(me||{});class be{constructor(e){t(this,"scene"),t(this,"keys",Object.keys(me).map(Number).reduce(((e,t)=>({...e,[t]:!1})),{})),this.scene=e,this.listener(2,"LEFT"),this.listener(3,"RIGHT"),this.listener(0,"UP"),this.listener(1,"DOWN"),this.listener(0,"W"),this.listener(2,"A"),this.listener(1,"S"),this.listener(3,"D"),this.listener(4,"SPACE"),this.listener(4,"ENTER"),this.listener(5,"BACKSPACE"),this.listener(6,"SHIFT")}listener(e,t){var i,s;null==(i=this.scene.input.keyboard)||i.on(`keydown-${t}`,(()=>this.keys[e]=!0)),null==(s=this.scene.input.keyboard)||s.on(`keyup-${t}`,(()=>this.keys[e]=!1))}resetKeys(){Object.entries(this.keys).forEach((([e,t])=>this.keys[Number(e)]=!1))}}class ve extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=G[i];super(e,n,o,r),t(this,"npcType"),t(this,"player"),t(this,"light"),t(this,"particles"),t(this,"lastPos",new a.Math.Vector2),t(this,"clock"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`NPC-${i}`,this.npcType=i,this.player=s,this.setDepth(B.Npcs),"warp"===r&&this.setAlpha(0),We(this,G[i])}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const{x:t,y:i,light:s,particles:n,onCreate:o}=G[this.npcType],r=s||1,a=!te(this.scene);w.debug?(this.light=new ye(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,r),this.light.light.setVisible(a)):(this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,r),this.light.setVisible(a)),n&&(this.particles=this.scene.add.particles(t,i,"",n).setName(`NPC-${this.npcType}-Particles`)),this.npcType===P.ClockTower&&(this.clock=new fe(this.scene,this.player)),o&&o(this),this.initialized=!0}update(e,t){this.lazyInit(),!this.light||this.x===this.lastPos.x&&this.y===this.lastPos.y||this.light.setPosition(this.x,this.y),this.lastPos.set(this.x,this.y),this.clock&&this.clock.update(e)}onInteract(e){if(this.player.message.visible||Date.now()0){const t=G[this.npcType].portrait.length>0;return this.player.message.setDialog(e,t?this:void 0),x.Talked}}return x.None}getButtonPrompt(){return this.npcType===P.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${G[this.npcType].name}`,"Press [CONTINUE]"]}}const we={[O.Chest]:{x:5110,y:915,image:"chest",scale:{x:4.5,y:3}},[O.LabHatch]:{x:-1910,y:640},[O.LabBook]:{x:-700,y:1630,image:"book"},[O.AlchemySet]:{x:-2650,y:1600,image:"alchemy_empty",initializeOnStart:!0,skipLighting:!0,particles:{scale:{min:.05,max:.15},speed:{min:30,max:120},alpha:{values:[0,.5,0]},gravityY:100,lifespan:{min:250,max:500},emitting:!1,stopAfter:60}},[O.LabBookshelf1]:{x:-2025,y:1700},[O.LabBookshelf2]:{x:-1290,y:1700},[O.LabBookshelf3]:{x:-1115,y:1700},[O.LabPotionShelf1]:{x:-1790,y:1700},[O.MansionPicture]:{x:-1233,y:-580,scale:1.2,angle:5,image:"picture",origin:{x:0,y:0},initializeOnStart:!0,skipLighting:!0},[O.MansionHole]:{x:-1870,y:-490}};class xe extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=we[i];super(e,n,o,r||""),t(this,"propType"),t(this,"player"),t(this,"particles"),t(this,"initialized",!1),t(this,"disabled",!1),this.name=`Prop-${i}`,this.propType=i,this.player=s,this.setScale(r?.35:2).setDepth(B.Items),r||w.debug||this.setAlpha(0),We(this,we[i]),i===O.MansionPicture&&this.resetPostPipeline()}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;if(this.checkDestroyed())return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const t=we[this.propType].particles;t&&(this.particles=this.scene.add.particles(this.x,this.y,"warp",t).setDepth(B.Items).setName(`Prop-${this.propType}-Particles`)),this.propType===O.MansionPicture&&this.scene.add.image(this.x,this.y,"safe").setOrigin(0,0).setScale(.9).setName("Prop-Safe"),this.initialized=!0}onInteract(e){if(this.player.message.visible||Date.now()0)return this.player.message.setDialog(e,this,we[this.propType].portrait||"player_portrait"),x.Prop}return x.None}checkDestroyed(){let e=!1;return this.propType===O.LabHatch&&De(this.player,C.AlchemyLabFound)&&(e=!0),this.propType===O.Chest&&je(this.player,k.Gear1)&&(e=!0),e&&this.destroy(),e}getButtonPrompt(){const e=Ro(Go[this.propType]||[],this.player,this);let t=O[this.propType];return t=ue(t),this.propType===O.MansionPicture&&De(this.player,C.SafeDiscovered)&&(t="Safe"),e&&(null==e?void 0:e.messages.length)>0?[`Inspect ${t}`,"Press [CONTINUE]"]:""}update(){this.lazyInit()}}const Se={[C.FixTheClock]:{description:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it."},[C.MetTheMayor]:{description:"I have met the mayor of the town. She told me about the old clock tower. I should see if I can use the gear I found to try and fix it.",warpAdd:S.ClockSquareNorth},[C.ClockFirstGear]:{description:"I found the first gear for the clock tower and placed it into the clock face. I still need two more gears to fix it."},[C.AlchemyLabFound]:{description:"I found a secret alchemy lab. I wonder what the previous alchemist was brewing up.",warpAdd:S.LabHatch},[C.AlchemySetFixed]:{description:"With the alchemy set fixed, I can now attempt to create the brew mentioned in the old journal."},[C.ExtraPotionInformation]:{description:'I found an extra journal entry with more information on the potion. It stated the name of the potion was the "Exlixir of Sight". This potion must be the key to finding a gear.'},[C.SafeDiscovered]:{description:"I discovered a safe in the abandonded mansion. I wonder what secrets it holds."},[C.ClockSecondGear]:{description:"I found the second gear for the clock tower inside a safe, which was located within the abandoned mansion. I still need one more gear to fix it."}},ke={[I.ForestGear]:{description:"Find the gear in the forest",warpAdd:S.TownEast,warpComplete:S.TownNorth},[I.SphinxRiddle]:{description:"Solve the Sphinx riddle"},[I.InvestigateTownWest]:{description:"Investigate the west side of town",warpAdd:S.TownWest},[I.ExploreLab]:{description:"Explore the hidden alchemy lab"},[I.FindPotionIngredients]:{description:"Find the 3 potion ingredients"}};var Ie=(e=>(e[e.Ladder=0]="Ladder",e[e.Warp=1]="Warp",e[e.Invisible=2]="Invisible",e[e.WarpLocked=3]="WarpLocked",e[e.InvisibleLocked=4]="InvisibleLocked",e))(Ie||{});const Pe={[S.Town]:{x:300,y:650,key:me.Down,warpTo:S.Underground,visual:0},[S.Underground]:{x:301,y:875,key:me.Up,warpTo:S.Town,visual:0},[S.TownEast]:{x:1720,y:650,key:me.Right,warpTo:S.Forest,visual:3},[S.Forest]:{x:2650,y:815,key:me.Left,warpTo:S.TownEast,visual:1},[S.TownNorth]:{x:775,y:650,key:me.Up,warpTo:S.ClockSquare,visual:3},[S.ClockSquare]:{x:610,y:-330,key:me.Left,warpTo:S.TownNorth,visual:1},[S.ClockSquareNorth]:{x:915,y:-330,key:me.Up,warpTo:S.ClockEntrance,visual:3},[S.ClockEntrance]:{x:690,y:-1320,range:15,key:me.Left,warpTo:S.ClockSquareNorth,visual:1,skipLighting:!0},[S.ClockStairs]:{x:910,y:-1400,range:20,key:me.Right,warpTo:S.ClockTop,visual:2,sound:"ladder"},[S.ClockTop]:{x:780,y:-1970,range:10,key:me.Left,warpTo:S.ClockStairs,visual:2,sound:"ladder"},[S.ForestEast]:{x:3590,y:815,key:me.Right,warpTo:S.Lake,visual:3,initializeOnStart:!0},[S.Lake]:{x:4625,y:915,key:me.Left,warpTo:S.ForestEast,visual:1},[S.TownWest]:{x:90,y:650,key:me.Left,warpTo:S.MansionGrounds,visual:3},[S.MansionGrounds]:{x:-620,y:640,key:me.Right,warpTo:S.TownWest,visual:1},[S.MansionEntrance]:{x:-1290,y:640,key:me.Up,warpTo:S.Mansion,visual:1,sound:"door"},[S.Mansion]:{x:-1405,y:-420,key:me.Down,warpTo:S.MansionEntrance,visual:2},[S.LabHatch]:{x:-1920,y:640,key:me.Down,warpTo:S.Lab,visual:4},[S.Lab]:{x:-1380,y:1545,key:me.Right,warpTo:S.LabHatch,visual:2,range:15,skipLighting:!0},[S.LibraryEntrance]:{x:1420,y:650,key:me.Up,warpTo:S.Library,visual:3},[S.Library]:{x:1730,y:-120,key:me.Left,warpTo:S.LibraryEntrance,visual:1}},Te=[];Object.values(ke).forEach((e=>{e.warpAdd&&Te.push(e.warpAdd),e.warpComplete&&Te.push(e.warpComplete)})),Object.values(Se).forEach((e=>{e.warpAdd&&Te.push(e.warpAdd)}));class Ce extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,visual:r,range:a}=Pe[i];super(e,n,o,r===Ie.Ladder?"ladder":"warp"),t(this,"warpType"),t(this,"player"),t(this,"locked"),t(this,"graphics"),t(this,"portal1"),t(this,"portal2"),t(this,"range"),t(this,"initialized",!1),this.name=`Warp-${i}`,this.warpType=i,this.player=s,this.range=a||30,this.setScale(.6).setDepth(B.Warpers),r!==Ie.Warp&&r!==Ie.WarpLocked||(this.setScale(.6,1),this.setPosition(n,o-12)),w.debug||(this.updateLocked(r===Ie.WarpLocked||r===Ie.InvisibleLocked),r!==Ie.Invisible&&r!==Ie.InvisibleLocked||this.setAlpha(0)),We(this,Pe[i]),Te.includes(i)&&e.add.existing(this)}lazyInit(e){(e||!this.initialized&&le(this,this.player))&&(Te.includes(this.warpType)||this.scene.add.existing(this),this.scene.physics.add.existing(this),this.createParticles(),this.createDebug(),this.warpType===S.Underground&&this.createLadder(),this.hasExtendedBounds()&&this.body&&this.setBodySize(this.body.width*(this.range/30*4),this.body.height),this.updateLocked(),this.initialized=!0)}createParticles(){const{visual:e,skipLighting:t}=Pe[this.warpType];e!==Ie.Warp&&e!==Ie.WarpLocked||(this.setAlpha(.1),this.scene.anims.exists("portal")||this.scene.anims.create({key:"portal",frames:this.scene.anims.generateFrameNumbers("portal",{start:0,end:63}),frameRate:10,repeat:-1}),this.portal1=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.45,1).setAlpha(.9).play("portal").setName(`${this.name}-1`),this.portal1.postFX.addPixelate(1),this.portal1.postFX.addShadow(0,0,.1,1,3355562,6,.5),this.portal2=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.35,1).setAlpha(.65).setFlipX(!0).setName(`${this.name}-2`),this.portal2.postFX.addPixelate(1),this.portal2.play("portal"),this.portal2.setFrame(Math.floor(30*Math.random())),t||(this.portal1.setPipeline("Light2D"),this.portal2.setPipeline("Light2D")),this.portal1.setPostPipeline("XRayPipeline"),this.portal2.setPostPipeline("XRayPipeline"))}createDebug(){if(w.debug&&(this.setInteractive({draggable:!0}),this.graphics=this.scene.add.graphics(),this.hasExtendedBounds())){this.graphics.lineStyle(2,16711935).setPosition(this.x,this.y);const e=this.body;this.graphics.lineBetween(-this.range,-e.halfHeight,-this.range,e.halfHeight),this.graphics.lineBetween(this.range,-e.halfHeight,this.range,e.halfHeight),this.graphics.strokeCircle(0,0,5)}}createLadder(){this.scene.add.image(this.x,this.y-60,"ladder").setScale(.6).setDepth(B.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder1"),this.scene.add.image(this.x,this.y-105,"ladder").setScale(.6).setDepth(B.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder2")}hasExtendedBounds(){const{visual:e,key:t}=Pe[this.warpType];return!(e!==Ie.Warp&&e!==Ie.WarpLocked&&e!==Ie.Invisible||t!==me.Left&&t!==me.Right)}onInteract(e){const t=!this.hasExtendedBounds()||Math.abs(this.player.x-this.x){t>=1&&l.time.delayedCall(300,(()=>l.cameras.main.fadeIn(1e3,0,0,0)))})),l.cameras.main.stopFollow(),l.tweens.add({targets:l.cameras.main,scrollX:h,scrollY:c-w.cameraOffset,duration:600,delay:100,ease:"Power1",onComplete:()=>{l.cameras.main.startFollow(t,!0),l.cameras.main.setFollowOffset(0,w.cameraOffset)}}),t.setActive(!1),t.buttonPrompt.setVisible(!1),l.tweens.add({targets:t,alpha:0,duration:500,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{t.setPosition(n,o),t.previousPosition.set(n,o)},onComplete:()=>{t.alpha=1,t.setActive(!0)}}),l.tweens.add({targets:t.light,intensity:0,duration:50,hold:600,yoyo:!0,repeat:0});const d=t.light instanceof a.GameObjects.Light?t.light:t.light.light;l.tweens.add({targets:d,x:n,y:o,duration:400,ease:"Power1"})}function je(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t))}function Ae(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&!e.used))}function Ee(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&e.used))}function Me(e,t){return e.quests.quests.some((e=>e.id===t&&!e.completed))}function ze(e,t){return e.quests.quests.some((e=>e.id===t&&e.completed))}function De(e,t){return e.journal.journal.includes(t)}function Fe(e,t){return e.children.getAll().filter((e=>e instanceof t))}function Le(e,t,i){const s=function(e,t){return Fe(e,Ce).find((e=>e.warpType===t))}(e,t);s&&s.updateLocked(i)}function Be(e,t){return Fe(e,ve).find((e=>e.npcType===t))}function Ge(e,t){return Fe(e,Wo).find((e=>e.itemType===t))}function Re(e,t){return Fe(e,xe).find((e=>e.propType===t))}function We(e,t){const{scale:i,alpha:s,angle:n,depth:o,skipLighting:r,origin:a,initializeOnStart:l}=t;i&&("object"==typeof i?e.setScale(i.x,i.y):e.setScale(i)),s&&e.setAlpha(s),n&&e.setAngle(n),o&&e.setDepth(o),a&&e.setOrigin(a.x,a.y),r||e.setPipeline("Light2D"),e.setPostPipeline("XRayPipeline"),l&&e.lazyInit(!0)}var Ne,_e,He,Ue,$e,Ve,qe,Xe,Ke,Ye,Qe,Je,Ze,et,tt,it,st,nt,ot,rt,at,lt,ht,ct,ut,dt,pt,yt,gt,ft,mt,bt,vt,wt,xt,St,kt,It,Pt,Tt,Ct,Ot,jt,At;function Et(){if(_e)return Ne;_e=1;var e=Object.prototype.toString;return Ne=function(t){var i=e.call(t),s="[object Arguments]"===i;return s||(s="[object Array]"!==i&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),s}}function Mt(){if(Ve)return $e;Ve=1;var e=Array.prototype.slice,t=Et(),i=Object.keys,s=i?function(e){return i(e)}:function(){if(Ue)return He;var e;if(Ue=1,!Object.keys){var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Et(),n=Object.prototype.propertyIsEnumerable,o=!n.call({toString:null},"toString"),r=n.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{l(window[e])}catch(i){return!0}}catch(i){return!0}return!1}();e=function(e){var n=null!==e&&"object"==typeof e,h="[object Function]"===i.call(e),u=s(e),d=n&&"[object String]"===i.call(e),p=[];if(!n&&!h&&!u)throw new TypeError("Object.keys called on a non-object");var y=r&&h;if(d&&e.length>0&&!t.call(e,0))for(var g=0;g0)for(var f=0;f1&&"boolean"!=typeof t)throw new r('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=C(e,0,1),i=C(e,-1);if("%"===t&&"%"!==i)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var s=[];return T(e,j,(function(e,t,i,n){s[s.length]=i?T(n,A,"$1"):t||e})),s}(e),s=i.length>0?i[0]:"",n=E("%"+s+"%",t),a=n.name,l=n.value,h=!1,u=n.alias;u&&(s=u[0],P(i,I([0,1],u)));for(var d=1,p=!0;d=i.length){var m=c(l,y);l=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:l[y]}else p=k(l,y),l=l[y];p&&!h&&(b[a]=l)}}return l},vt}function Vt(){if(St)return xt;St=1;var e=$t()("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return xt=e}function qt(){if(It)return kt;It=1;var e=$t()("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch(t){e=null}return kt=e}function Xt(){if(Tt)return Pt;Tt=1;var e=Vt(),t=Bt(),i=Gt(),s=qt();return Pt=function(n,o,r){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new i("`obj` must be an object or a function`");if("string"!=typeof o&&"symbol"!=typeof o)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],u=!!s&&s(n,o);if(e)e(n,o,{configurable:null===h&&u?u.configurable:!h,enumerable:null===a&&u?u.enumerable:!a,value:r,writable:null===l&&u?u.writable:!l});else{if(!c&&(a||l||h))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[o]=r}},Pt}function Kt(){if(Ot)return Ct;Ot=1;var e=Vt(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},Ct=t}function Yt(){if(At)return jt;At=1;var e=Mt(),t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,n=Xt(),o=Kt()(),r=function(e,t,s,r){if(t in e)if(!0===r){if(e[t]===s)return}else if("function"!=typeof(a=r)||"[object Function]"!==i.call(a)||!r())return;var a;o?n(e,t,s,!0):n(e,t,s)},a=function(i,n){var o=arguments.length>2?arguments[2]:{},a=e(n);t&&(a=s.call(a,Object.getOwnPropertySymbols(n)));for(var l=0;l4294967295||o(r)!==r)throw new n("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(l=!1),c&&!c.writable&&(h=!1)}return(l||h||!a)&&(i?t(e,"length",r,!0,!0):t(e,"length",r)),e},Qt}function Ii(){return Zt||(Zt=1,function(e){var t=Ht(),i=$t(),s=ki(),n=Gt(),o=i("%Function.prototype.apply%"),r=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||t.call(r,o),l=Vt(),h=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new n("a function is required");var i=a(t,r,arguments);return s(i,1+h(0,e.length-(arguments.length-1)),!0)};var c=function(){return a(t,o,arguments)};l?l(e.exports,"apply",{value:c}):e.exports.apply=c}(Si)),Si.exports}function Pi(){if(ti)return ei;ti=1;var e=$t(),t=Ii(),i=t(e("String.prototype.indexOf"));return ei=function(s,n){var o=e(s,!!n);return"function"==typeof o&&i(s,".prototype.")>-1?t(o):o}}function Ti(){if(si)return ii;si=1;var e=Mt(),t=Wt()(),i=Pi(),s=Object,n=i("Array.prototype.push"),o=i("Object.prototype.propertyIsEnumerable"),r=t?Object.getOwnPropertySymbols:null;return ii=function(i,a){if(null==i)throw new TypeError("target must be an object");var l=s(i);if(1===arguments.length)return l;for(var h=1;h2&&!!arguments[2]&&!i||(t?e(n,"name",o,!0,!0):e(n,"name",o)),n},di}(),t=Gt(),i=Object;return yi=e((function(){if(null==this||this!==i(this))throw new t("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)}function ji(){if(mi)return fi;mi=1;var e=Oi(),t=Yt().supportsDescriptors,i=Object.getOwnPropertyDescriptor;return fi=function(){if(t&&"gim"===/a/gim.flags){var s=i(RegExp.prototype,"flags");if(s&&"function"==typeof s.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(o,"sticky",{get:function(){n+="y"}}),s.get.call(o),"dy"===n)return s.get}}return e}}var Ai,Ei,Mi,zi,Di={exports:{}};function Fi(){if(Ei)return Ai;Ei=1;var e=Wt();return Ai=function(){return e()&&!!Symbol.toStringTag}}function Li(){if(zi)return Mi;zi=1;var e=Fi()(),t=Pi()("Object.prototype.toString"),i=function(i){return!(e&&i&&"object"==typeof i&&Symbol.toStringTag in i)&&"[object Arguments]"===t(i)},s=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"[object Function]"===t(e.callee)},n=function(){return i(arguments)}();return i.isLegacyArguments=s,Mi=n?i:s}const Bi=s(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Gi,Ri,Wi,Ni,_i,Hi,Ui,$i,Vi,qi,Xi,Ki,Yi,Qi,Ji,Zi,es,ts,is,ss,ns,os,rs,as,ls,hs,cs,us,ds,ps,ys,gs,fs,ms,bs,vs,ws;function xs(){if(Ri)return Gi;Ri=1;var e="function"==typeof Map&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=e&&t&&"function"==typeof t.get?t.get:null,s=e&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,r=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=o&&r&&"function"==typeof r.get?r.get:null,l=o&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,u="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,p=Object.prototype.toString,y=Function.prototype.toString,g=String.prototype.match,f=String.prototype.slice,m=String.prototype.replace,b=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,x=Array.prototype.concat,S=Array.prototype.join,k=Array.prototype.slice,I=Math.floor,P="function"==typeof BigInt?BigInt.prototype.valueOf:null,T=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,O="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,A=Object.prototype.propertyIsEnumerable,E=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function M(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var s=e<0?-I(-e):I(e);if(s!==e){var n=String(s),o=f.call(t,n.length+1);return m.call(n,i,"$&_")+"."+m.call(m.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return m.call(t,i,"$&_")}var z=Bi,D=z.custom,F=_(D)?D:null,L={__proto__:null,double:'"',single:"'"},B={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function G(e,t,i){var s=i.quoteStyle||t,n=L[s];return n+e+n}function R(e){return m.call(String(e),/"/g,""")}function W(e){return!("[object Array]"!==$(e)||j&&"object"==typeof e&&j in e)}function N(e){return!("[object RegExp]"!==$(e)||j&&"object"==typeof e&&j in e)}function _(e){if(O)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(t){}return!1}Gi=function e(t,o,r,p){var b=o||{};if(U(b,"quoteStyle")&&!U(L,b.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(U(b,"maxStringLength")&&("number"==typeof b.maxStringLength?b.maxStringLength<0&&b.maxStringLength!==1/0:null!==b.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!U(b,"customInspect")||b.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(U(b,"indent")&&null!==b.indent&&"\t"!==b.indent&&!(parseInt(b.indent,10)===b.indent&&b.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(U(b,"numericSeparator")&&"boolean"!=typeof b.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var I=b.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return q(t,b);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var T=String(t);return I?M(t,T):T}if("bigint"==typeof t){var D=String(t)+"n";return I?M(t,D):D}var B=void 0===b.depth?5:b.depth;if(void 0===r&&(r=0),r>=B&&B>0&&"object"==typeof t)return W(t)?"[Array]":"[Object]";var H,X=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=S.call(Array(e.indent+1)," ")}return{base:i,prev:S.call(Array(t+1),i)}}(b,r);if(void 0===p)p=[];else if(V(p,t)>=0)return"[Circular]";function ee(t,i,s){if(i&&(p=k.call(p)).push(i),s){var n={depth:b.depth};return U(b,"quoteStyle")&&(n.quoteStyle=b.quoteStyle),e(t,n,r+1,p)}return e(t,b,r+1,p)}if("function"==typeof t&&!N(t)){var te=function(e){if(e.name)return e.name;var t=g.call(y.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ie=Z(t,ee);return"[Function"+(te?": "+te:" (anonymous)")+"]"+(ie.length>0?" { "+S.call(ie,", ")+" }":"")}if(_(t)){var se=O?m.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||O?se:K(se)}if((H=t)&&"object"==typeof H&&("undefined"!=typeof HTMLElement&&H instanceof HTMLElement||"string"==typeof H.nodeName&&"function"==typeof H.getAttribute)){for(var ne="<"+v.call(String(t.nodeName)),oe=t.attributes||[],re=0;re"}if(W(t)){if(0===t.length)return"[]";var ae=Z(t,ee);return X&&!function(e){for(var t=0;t=0)return!1;return!0}(ae)?"["+J(ae,X)+"]":"[ "+S.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==$(e)||j&&"object"==typeof e&&j in e)}(t)){var le=Z(t,ee);return"cause"in Error.prototype||!("cause"in t)||A.call(t,"cause")?0===le.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(le,", ")+" }":"{ ["+String(t)+"] "+S.call(x.call("[cause]: "+ee(t.cause),le),", ")+" }"}if("object"==typeof t&&w){if(F&&"function"==typeof t[F]&&z)return z(t,{depth:B-r});if("symbol"!==w&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{a.call(e)}catch(ne){return!0}return e instanceof Map}catch(t){}return!1}(t)){var he=[];return s&&s.call(t,(function(e,i){he.push(ee(i,t,!0)+" => "+ee(e,t))})),Q("Map",i.call(t),he,X)}if(function(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(s){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e){ce.push(ee(e,t))})),Q("Set",a.call(t),ce,X)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{c.call(e,c)}catch(ne){return!0}return e instanceof WeakMap}catch(t){}return!1}(t))return Y("WeakMap");if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e,c);try{h.call(e,h)}catch(ne){return!0}return e instanceof WeakSet}catch(t){}return!1}(t))return Y("WeakSet");if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{return u.call(e),!0}catch(t){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(ee(Number(t)));if(function(e){if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(t){}return!1}(t))return K(ee(P.call(t)));if(function(e){return!("[object Boolean]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(d.call(t));if(function(e){return!("[object String]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(ee(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==n&&t===n)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==$(e)||j&&"object"==typeof e&&j in e)}(t)&&!N(t)){var ue=Z(t,ee),de=E?E(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",ye=!de&&j&&Object(t)===t&&j in t?f.call($(t),8,-1):pe?"Object":"",ge=(de||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ye||pe?"["+S.call(x.call([],ye||[],pe||[]),": ")+"] ":"");return 0===ue.length?ge+"{}":X?ge+"{"+J(ue,X)+"}":ge+"{ "+S.call(ue,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function U(e,t){return H.call(e,t)}function $(e){return p.call(e)}function V(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,s=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,s="... "+i+" more character"+(i>1?"s":"");return q(f.call(e,0,t.maxStringLength),t)+s}var n=B[t.quoteStyle||"single"];return n.lastIndex=0,G(m.call(m.call(e,n,"\\$1"),/[\x00-\x1f]/g,X),"single",t)}function X(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+b.call(t.toString(16))}function K(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function Q(e,t,i,s){return e+" ("+t+") {"+(s?J(i,s):S.call(i,", "))+"}"}function J(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+S.call(e,","+i)+"\n"+t.prev}function Z(e,t){var i=W(e),s=[];if(i){s.length=e.length;for(var n=0;n=e.length;return s||(i=e[t],t+=1),{done:s,value:i}}}},p=function(t,i){if(s(t)||e(t))return d(t);if(n(t)){var o=0;return{next:function(){var e=function(e,t){if(t+1>=e.length)return t+1;var i=c(e,t);if(i<55296||i>56319)return t+1;var s=c(e,t+1);return s<56320||s>57343?t+1:t+2}(t,o),i=u(t,o,e);return o=e,{done:e>t.length,value:i}}}}return i&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(r||a){var y=Ps(),g=Ts(),f=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var b=l("Map.prototype.iterator",!0),v=l("Set.prototype.iterator",!0);var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),x=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);Di.exports=function(e){return function(e){if(y(e)){if(b)return t(b(e));if(w)return w(e);if(f){var i=[];return f(e,(function(e,t){h(i,[t,e])})),d(i)}}if(g(e)){if(v)return t(v(e));if(x)return x(e);if(m){var s=[];return m(e,(function(e){h(s,e)})),d(s)}}}(e)||p(e)}}else Di.exports=function(e){if(null!=e)return p(e,!0)}}return Di.exports}function Os(){if(is)return ts;is=1;var e=function(e){return e!=e};return ts=function(t,i){return 0===t&&0===i?1/t==1/i:t===i||!(!e(t)||!e(i))}}function js(){if(ns)return ss;ns=1;var e=Os();return ss=function(){return"function"==typeof Object.is?Object.is:e}}function As(){if(cs)return hs;cs=1;var e=Ii(),t=Pi(),i=$t()("%ArrayBuffer%",!0),s=t("ArrayBuffer.prototype.byteLength",!0),n=t("Object.prototype.toString"),o=!!i&&!s&&new i(0).slice,r=!!o&&e(o);return hs=s||r?function(e){if(!e||"object"!=typeof e)return!1;try{return s?s(e):r(e,0),!0}catch(t){return!1}}:i?function(e){return"[object ArrayBuffer]"===n(e)}:function(e){return!1}}function Es(){if(fs)return gs;fs=1;var e=Pi()("SharedArrayBuffer.prototype.byteLength",!0);return gs=e?function(t){if(!t||"object"!=typeof t)return!1;try{return e(t),!0}catch(i){return!1}}:function(e){return!1}}var Ms,zs={exports:{}};var Ds,Fs,Ls,Bs,Gs,Rs,Ws,Ns={exports:{}};var _s,Hs,Us,$s,Vs,qs,Xs,Ks,Ys,Qs,Js,Zs,en,tn,sn,nn,on,rn={exports:{}};function an(){if(_s)return rn.exports;_s=1;var e=$t(),t=Pi(),i=e("%WeakSet%",!0),s=t("WeakSet.prototype.has",!0);if(s){var n=t("WeakMap.prototype.has",!0);rn.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(s(e,s),n)try{n(e,n)}catch(t){return!0}return e instanceof i}catch(t){}return!1}}else rn.exports=function(e){return!1};return rn.exports}function ln(){if(Us)return Hs;Us=1;var e=Ps(),t=Ts(),i=function(){if(Ws)return Rs;Ws=1;var e,t="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;t||(e=function(e){return!1});var s=t?t.prototype.has:null,n=i?i.prototype.has:null;return e||s||(e=function(e){return!1}),Rs=e||function(e){if(!e||"object"!=typeof e)return!1;try{if(s.call(e,s),n)try{n.call(e,n)}catch(i){return!0}return e instanceof t}catch(i){}return!1}}(),s=an();return Hs=function(n){if(n&&"object"==typeof n){if(e(n))return"Map";if(t(n))return"Set";if(i(n))return"WeakMap";if(s(n))return"WeakSet"}return!1}}function hn(){return Ys?Ks:(Ys=1,Ks=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function cn(){if(Js)return Qs;Js=1;var e=hn(),t="undefined"==typeof globalThis?n:globalThis;return Qs=function(){for(var i=[],s=0;s=3&&(r=o),"[object Array]"===t.call(s)?function(e,t,s){for(var n=0,o=e.length;n-1?i:"Object"===i&&function(t){var i=!1;return e(p,(function(e,s){if(!i)try{e(t),i=c(s,1)}catch(n){}})),i}(t)}return o?function(t){var i=!1;return e(p,(function(e,s){if(!i)try{"$"+e(t)===s&&(i=c(s,1))}catch(n){}})),i}(t):null}}function dn(){if(sn)return tn;sn=1;var e=Pi()("ArrayBuffer.prototype.byteLength",!0),t=As();return tn=function(i){return t(i)?e?e(i):i.byteLength:NaN}}const pn=o(function(){if(on)return nn;on=1;var e=function(){if(hi)return li;hi=1;var e=Yt(),t=Ii(),i=Ti(),s=Ci(),n=function(){if(ai)return ri;ai=1;var e=Yt(),t=Ci();return ri=function(){var i=t();return e(Object,{assign:i},{assign:function(){return Object.assign!==i}}),i}}(),o=t.apply(s()),r=function(e,t){return o(Object,arguments)};return e(r,{getPolyfill:s,implementation:i,shim:n}),li=r}(),t=Pi(),i=function(){if(xi)return wi;xi=1;var e=Yt(),t=Ii(),i=Oi(),s=ji(),n=function(){if(vi)return bi;vi=1;var e=Yt().supportsDescriptors,t=ji(),i=Object.getOwnPropertyDescriptor,s=Object.defineProperty,n=TypeError,o=Object.getPrototypeOf,r=/a/;return bi=function(){if(!e||!o)throw new n("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=t(),l=o(r),h=i(l,"flags");return h&&h.get===a||s(l,"flags",{configurable:!0,enumerable:!1,get:a}),a}}(),o=t(s());return e(o,{getPolyfill:s,implementation:i,shim:n}),wi=o}(),s=$t(),n=Cs(),o=Ss(),r=function(){if(ls)return as;ls=1;var e=Yt(),t=Ii(),i=Os(),s=js(),n=function(){if(rs)return os;rs=1;var e=js(),t=Yt();return os=function(){var i=e();return t(Object,{is:i},{is:function(){return Object.is!==i}}),i}}(),o=t(s(),Object);return e(o,{getPolyfill:s,implementation:i,shim:n}),as=o}(),a=Li(),l=ks(),h=As(),c=function(){if(ds)return us;ds=1;var e=Date.prototype.getDay,t=Object.prototype.toString,i=Fi()();return us=function(s){return"object"==typeof s&&null!==s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Date]"===t.call(s))}}(),u=function(){if(ys)return ps;ys=1;var e,t,i,s,n=Pi(),o=Fi()();if(o){e=n("Object.prototype.hasOwnProperty"),t=n("RegExp.prototype.exec"),i={};var r=function(){throw i};s={toString:r,valueOf:r},"symbol"==typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=r)}var a=n("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor;return ps=o?function(n){if(!n||"object"!=typeof n)return!1;var o=l(n,"lastIndex");if(!o||!e(o,"value"))return!1;try{t(n,s)}catch(r){return r===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===a(e)}}(),d=Es(),p=Mt(),y=function(){if(Gs)return Bs;Gs=1;var e=Is(),t=function(){if(bs)return ms;bs=1;var e=Number.prototype.toString,t=Object.prototype.toString,i=Fi()();return ms=function(s){return"number"==typeof s||"object"==typeof s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Number]"===t.call(s))}}(),i=function(){if(ws)return vs;ws=1;var e=Pi(),t=e("Boolean.prototype.toString"),i=e("Object.prototype.toString"),s=Fi()();return vs=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(s&&Symbol.toStringTag in e?function(e){try{return t(e),!0}catch(i){return!1}}(e):"[object Boolean]"===i(e))}}(),s=function(){if(Ms)return zs.exports;Ms=1;var e=Object.prototype.toString;if(Nt()()){var t=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;zs.exports=function(s){if("symbol"==typeof s)return!0;if("[object Symbol]"!==e.call(s))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&i.test(t.call(e))}(s)}catch(n){return!1}}}else zs.exports=function(e){return!1};return zs.exports}(),n=function(){if(Ls)return Ns.exports;if(Ls=1,function(){if(Fs)return Ds;Fs=1;var e="undefined"!=typeof BigInt&&BigInt;return Ds=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}}()()){var e=BigInt.prototype.valueOf;Ns.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return e.call(t),!0}catch(i){}return!1}(t))}}else Ns.exports=function(e){return!1};return Ns.exports}();return Bs=function(o){return null==o||"object"!=typeof o&&"function"!=typeof o?null:e(o)?"String":t(o)?"Number":i(o)?"Boolean":s(o)?"Symbol":n(o)?"BigInt":void 0}}(),g=ln(),f=un(),m=dn(),b=t("SharedArrayBuffer.prototype.byteLength",!0),v=t("Date.prototype.getTime"),w=Object.getPrototypeOf,x=t("Object.prototype.toString"),S=s("%Set%",!0),k=t("Map.prototype.has",!0),I=t("Map.prototype.get",!0),P=t("Map.prototype.size",!0),T=t("Set.prototype.add",!0),C=t("Set.prototype.delete",!0),O=t("Set.prototype.has",!0),j=t("Set.prototype.size",!0);function A(e,t,i,s){for(var o,r=n(e);(o=r.next())&&!o.done;)if(F(t,o.value,i,s))return C(e,o.value),!0;return!1}function E(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function M(t,i,s,n,o,r){var a=E(s);if(null!=a)return a;var l=I(i,a),h=e({},o,{strict:!1});return!(void 0===l&&!k(i,a)||!F(n,l,h,r))&&!k(t,a)&&F(n,l,h,r)}function z(e,t,i){var s=E(i);return null!=s?s:O(t,s)&&!O(e,s)}function D(e,t,i,s,o,r){for(var a,l,h=n(e);(a=h.next())&&!a.done;)if(F(i,l=a.value,o,r)&&F(s,I(t,l),o,r))return C(e,l),!0;return!1}function F(t,s,o,C){var E=o||{};if(E.strict?r(t,s):t===s)return!0;if(y(t)!==y(s))return!1;if(!t||!s||"object"!=typeof t&&"object"!=typeof s)return E.strict?r(t,s):t==s;var B,G=C.has(t),R=C.has(s);if(G&&R){if(C.get(t)===C.get(s))return!0}else B={};return G||C.set(t,B),R||C.set(s,B),function(t,s,o,r){var y,C;if(typeof t!=typeof s)return!1;if(null==t||null==s)return!1;if(x(t)!==x(s))return!1;if(a(t)!==a(s))return!1;if(l(t)!==l(s))return!1;var E=t instanceof Error,B=s instanceof Error;if(E!==B)return!1;if((E||B)&&(t.name!==s.name||t.message!==s.message))return!1;var G=u(t),R=u(s);if(G!==R)return!1;if((G||R)&&(t.source!==s.source||i(t)!==i(s)))return!1;var W=c(t),N=c(s);if(W!==N)return!1;if((W||N)&&v(t)!==v(s))return!1;if(o.strict&&w&&w(t)!==w(s))return!1;var _=f(t),H=f(s);if(_!==H)return!1;if(_||H){if(t.length!==s.length)return!1;for(y=0;y=0;y--)if(Y[y]!=Q[y])return!1;for(y=Y.length-1;y>=0;y--)if(!F(t[C=Y[y]],s[C],o,r))return!1;var J=g(t),Z=g(s);return J===Z&&("Set"===J||"Set"===Z?function(e,t,i,s){if(j(e)!==j(t))return!1;for(var o,r,a,l=n(e),h=n(t);(o=l.next())&&!o.done;)if(o.value&&"object"==typeof o.value)a||(a=new S),T(a,o.value);else if(!O(t,o.value)){if(i.strict)return!1;if(!z(e,t,o.value))return!1;a||(a=new S),T(a,o.value)}if(a){for(;(r=h.next())&&!r.done;)if(r.value&&"object"==typeof r.value){if(!A(a,r.value,i.strict,s))return!1}else if(!i.strict&&!O(e,r.value)&&!A(a,r.value,i.strict,s))return!1;return 0===j(a)}return!0}(t,s,o,r):"Map"!==J||function(t,i,s,o){if(P(t)!==P(i))return!1;for(var r,a,l,h,c,u,d=n(t),p=n(i);(r=d.next())&&!r.done;)if(h=r.value[0],c=r.value[1],h&&"object"==typeof h)l||(l=new S),T(l,h);else if(void 0===(u=I(i,h))&&!k(i,h)||!F(c,u,s,o)){if(s.strict)return!1;if(!M(t,i,h,c,s,o))return!1;l||(l=new S),T(l,h)}if(l){for(;(a=p.next())&&!a.done;)if(h=a.value[0],u=a.value[1],h&&"object"==typeof h){if(!D(l,t,h,u,s,o))return!1}else if(!(s.strict||t.has(h)&&F(I(t,h),u,s,o)||D(l,t,h,u,e({},s,{strict:!1}),o)))return!1;return 0===j(l)}return!0}(t,s,o,r))}(t,s,E,C)}function L(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0]||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}return nn=function(e,t,i){return F(e,t,i,o())}}()),yn={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${R}`};class gn extends a.GameObjects.Text{constructor(e,t,i=3500,s=N){const n=Fe(e,gn).reduce(((e,t)=>Math.max(e,t.y-20)),0)+65;super(e,20,n,t,{...yn,backgroundColor:"#"+s,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(B.Overlay).setScrollFactor(0),e.add.existing(this),e.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:i,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}let fn=1;class mn extends a.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,renderTarget:!0,fragShader:"precision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\n// slight modifications made to original shader\n// use alpha channel for fragColor + changed uniform names\n\n// original shader from: https://www.shadertoy.com/view/WsVSzV\n// tips for chromatic aberration: https://lettier.github.io/3d-game-shaders-for-beginners/chromatic-aberration.html\n\nfloat warp = 0.35; // simulate curvature of CRT monitor (larger number = more curvature)\nfloat scan = 0.75; // simulate darkness between scanlines\nfloat scanSize = 0.75; // size of scanlines [0.0 - 2.0] (smaller number = taller scanlines)\n\nfloat chromaticAberration = 0.25 * uAlpha;\nfloat redOffset = 0.006 * chromaticAberration;\nfloat greenOffset = 0.003 * chromaticAberration;\nfloat blueOffset = -0.003 * chromaticAberration;\n\nvec4 mainImage(in vec2 fragCoord, in vec2 uv) {\n if (uAlpha <= 0.0) {\n return texture2D(uMainSampler, uv);\n }\n\n // squared distance from center\n vec2 dc = abs(0.5-uv);\n dc *= dc;\n\n // warp the fragment coordinates\n uv.x -= 0.5; uv.x *= 1.0+(dc.y*(0.3*warp)); uv.x += 0.5;\n uv.y -= 0.5; uv.y *= 1.0+(dc.x*(0.4*warp)); uv.y += 0.5;\n\n vec2 chromaticOffset = vec2((abs(0.5-uv) + 0.5) * 2.);\n\n vec4 color;\n color.r = texture2D(uMainSampler,uv + vec2(redOffset * chromaticOffset)).r;\n color.g = texture2D(uMainSampler,uv + vec2(greenOffset * chromaticOffset)).g;\n color.b = texture2D(uMainSampler,uv + vec2(blueOffset * chromaticOffset)).b;\n color.a = texture2D(uMainSampler,uv).a;\n\n // sample inside boundaries, otherwise set to black\n if (uv.y > 1.0 || uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0) {\n return vec4(0.0);\n } else {\n // determine if we are drawing in a scanline\n float apply = abs(sin(fragCoord.y * scanSize)*0.5*scan);\n\n apply = uAlpha * apply;\n\n // sample the texture\n return vec4(mix(color.rgb,vec3(0.0), apply), color.a);\n }\n}\n\nvoid main(void) {\n gl_FragColor = mainImage(gl_FragCoord.xy, outTexCoord);\n}"})}onPreRender(){this.set1f("uAlpha",fn)}}class bn extends a.Plugins.ScenePlugin{boot(){var e;null==(e=this.systems)||e.events.on("start",this.applyPipeline,this);const{save:t}=In();vn(t.settings.useShader)}applyPipeline(){var e,t;null==(e=this.scene)||e.cameras.main.setPostPipeline("CRTPipeline"),(null==(t=this.scene)?void 0:t.cameras.main.getPostPipeline(mn)).bootFX()}}function vn(e){w.useShader=void 0!==e?e:!w.useShader,fn=w.useShader?1:0}let wn=0;class xn extends a.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,fragShader:"precision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\nvoid main(void)\n{\n vec4 baseColor = vec4(texture2D(uMainSampler, outTexCoord).rgba);\n vec4 newColor = baseColor;\n newColor.g *= 1.25;\n newColor.r *= 2.5;\n newColor.b *= 3.;\n\n gl_FragColor = mix(baseColor, newColor, uAlpha);\n}"})}onPreRender(){this.set1f("uAlpha",wn)}}function Sn(e,t){wn!==(t?.85:0)&&e.tweens.addCounter({from:wn,to:t?.85:0,onUpdate:e=>{wn=e.getValue()},duration:t?2500:1500,ease:t?"Bounce":void 0})}function kn(e){return{player:{x:e.player.x,y:e.player.y,flip:e.player.flipX},journal:e.player.journal.journal.sort(),inventory:e.player.inventory.inventory.sort(((e,t)=>e.type-t.type)),quests:e.player.quests.quests.sort(((e,t)=>e.id-t.id)),gameState:e.player.gameState.data,settings:{gamepad:e.gamepad.visible,debug:w.debug,zoomed:w.zoomed,useShader:w.useShader,time:Date.now(),muted:e.sound.mute}}}function In(){const e=localStorage.getItem(qo);let t,i;try{e&&(t=JSON.parse(e))}catch(s){console.error(s),i=s}return{save:t||Qo[Xo.New],error:i,newGame:!t}}const Pn={journal:{enumObj:C,enumName:"JournalEntry"},inventory:{enumObj:k,enumName:"ItemType"},type:{enumObj:k,enumName:"ItemType"},quests:{enumObj:I,enumName:"QuestType"},id:{enumObj:I,enumName:"QuestType"}};function Tn(e,t){const i={...w};return w.debug=e.settings.debug,w.zoomed=e.settings.zoomed,w.useShader=e.settings.useShader,vn(w.useShader),Sn(t,!1),w.zoomed!==i.zoomed?(function(e,t){const i=t?h:l;w.zoomed=t,w.width=i.width,w.height=i.height,w.cameraOffset=i.height/3,e.scale.setGameSize(i.width,i.height),e.scene.restart()}(t,w.zoomed),!0):w.debug!==i.debug&&(t.scene.restart(),!0)}function Cn(e){const{save:t,error:i,newGame:s}=In();i&&new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4);try{Tn(t,e),e.sound.mute=t.settings.muted,e.player.setX(t.player.x),e.player.setY(t.player.y),e.player.previousPosition.set(t.player.x+(t.player.flip?1:-1),t.player.y),e.time.delayedCall(50,(()=>{try{e.player.inventory.createUI(),e.player.quests.createUI(),e.player.journal.createUI(),s&&function(e){e.player.active=!1,e.time.delayedCall(1500,(()=>{e.player.message.setDialog({messages:["Now that I have arrived in town, I should talk to the townsfolk about the strange occurrences.","Maybe someone has seen something that could help me start my investigation."],onCompleted:()=>{e.player.active=!0}},void 0,"player_portrait")}))}(e),t.inventory.sort(((e,t)=>e.type-t.type)).forEach((t=>e.player.inventory.addItem(t,!0))),t.journal.sort().reverse().forEach((t=>e.player.journal.addEntry(t,!0))),t.quests.sort(((e,t)=>e.id-t.id)).forEach((t=>e.player.quests.addQuest(t,!0))),e.player.gameState.updateData(t.gameState,!0)}catch(i){console.error(i),new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,H),On(e,Qo[Xo.New]),Cn(e)}})),e.gamepad.setVisible(t.settings.gamepad);const i=pn(t,Qo[Xo.New])?"[New]":"[Storage]";w.prod||e.time.delayedCall(200,(()=>{new gn(e,`Game Loaded ${w.prod?"":i}`)})),pn(t,Qo[Xo.New])&&On(e,void 0,!0)}catch(n){console.error(n),new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,H),On(e,Qo[Xo.New]),Cn(e)}}function On(e,t,i){const s=kn(e);localStorage.setItem(qo,JSON.stringify(t||s)),i||e.tweens.add({targets:e.saveIcon,alpha:.7,scale:.6,duration:500,hold:250,yoyo:!0,onComplete:()=>e.saveIcon.setAlpha(0)})}function jn(e){w.prod&&On(e)}class An extends a.GameObjects.Container{constructor(e,i){var s;super(e,0,0),t(this,"text"),t(this,"rect"),t(this,"player"),t(this,"activeElement"),t(this,"outline"),t(this,"scene"),t(this,"dayNight",!1),t(this,"xray",!1),this.scene=e,this.player=i,e.physics.world.drawDebug=w.debug,w.debug?e.physics.world.createDebugGraphic():null==(s=e.physics.world.debugGraphic)||s.clear(),this.createEventListeners(),w.debug&&(this.setScrollFactor(0).setDepth(B.Debug).setAlpha(.8),this.scene.add.existing(this),this.rect=e.add.rectangle(0,0,0,0,K(_)).setOrigin(0).setDepth(B.Debug),this.add(this.rect),this.text=e.add.bitmapText(20,90,"m6x11-24",""),this.add(this.text),this.outline=e.add.rectangle(0,0,0,0).setStrokeStyle(2,65280).setScale(1.1).setDepth(B.Debug))}createEventListeners(){var e,t,i,s,n,o,r,a,l,h;null==(e=this.scene.input.keyboard)||e.on("keydown-K",(()=>{On(this.scene)})),null==(t=this.scene.input.keyboard)||t.on("keydown-L",(()=>{this.scene.scene.restart()})),null==(i=this.scene.input.keyboard)||i.on("keydown-M",(()=>{On(this.scene,Qo[Xo.Act2]),this.scene.scene.restart()})),null==(s=this.scene.input.keyboard)||s.on("keydown-N",(()=>{localStorage.removeItem(qo),this.scene.scene.start("Preloader")})),null==(n=this.scene.input.keyboard)||n.on("keydown-Z",(()=>{w.debug=!w.debug,On(this.scene),this.scene.scene.restart()})),null==(o=this.scene.input.keyboard)||o.on("keydown-FORWARD_SLASH",(()=>{var e;te(e=this.scene)?function(e,t=!0){ee||(se(e,V,t),ne(e,1),e.lights.lights.forEach((i=>{const s=i.intensity;i.setVisible(!0),t&&(i.setIntensity(0),e.tweens.add({targets:i,duration:Z,intensity:s}))})))}(e):ie(e)})),null==(r=this.scene.input.keyboard)||r.on("keydown-CLOSED_BRACKET",(()=>{he(this.scene,"DebugTool")})),null==(a=this.scene.input.keyboard)||a.on("keydown-QUOTES",(()=>{Sn(this.scene,!this.xray),this.xray=!this.xray})),w.debug&&(null==(l=this.scene.input.keyboard)||l.on("keydown-COMMA",(()=>{const e=this.scene.lights.lights;console.table(e,["x","y"])})),null==(h=this.scene.input.keyboard)||h.on("keydown-PERIOD",(()=>{const e=this.scene.input.activePointer;new ye(this.scene,e.worldX,e.worldY,100,K($),1)})),this.scene.input.on("gameobjectdown",((e,t)=>{1===e.buttons&&(t!==this.activeElement?this.activeElement=t:this.activeElement=void 0)})),this.scene.input.on("drag",((e,t)=>{this.activeElement===t&&t.setPosition(e.worldX,e.worldY)})),this.scene.input.on("wheel",((e,t,i,s,n)=>{this.scene.cameras.main.zoom=Math.max(.01,this.scene.cameras.main.zoom+5e-4*s)})),this.scene.input.on("pointerup",(e=>{1===e.button&&(this.scene.cameras.main.zoom=1)})))}update(){if(!w.debug)return;const e=this.scene.input.activePointer,t=[`FPS (now): ${(1e3/this.scene.game.loop.delta).toFixed(1)}`,`FPS (avg): ${this.scene.game.loop.actualFps.toFixed(1)}`,`Frame Time: ${this.scene.game.loop.delta.toFixed(2)}`,`Zoom: ${this.scene.cameras.main.zoom.toFixed(2)}`,"",`Player x: ${this.player.x.toFixed(1)}`,`Player y: ${this.player.y.toFixed(1)}`,"",`Mouse x: ${e.worldX.toFixed(1)}`,`Mouse y: ${e.worldY.toFixed(1)}`];if(this.activeElement&&(t.push(""),t.push(`Active x: ${this.activeElement.x.toFixed(1)}`),t.push(`Active y: ${this.activeElement.y.toFixed(1)}`)),this.text.setText(t),this.rect.setPosition(this.text.x-10,this.text.y-10).setSize(this.text.displayWidth+20,this.text.displayHeight+20),this.activeElement){this.outline.setPosition(this.activeElement.x,this.activeElement.y),this.outline.setSize(this.activeElement.displayWidth,this.activeElement.displayHeight),this.outline.setOrigin(this.activeElement.originX,this.activeElement.originY);const e=this.activeElement.body;(e&&e instanceof a.Physics.Arcade.Body||e instanceof a.Physics.Arcade.StaticBody)&&e.updateFromGameObject()}else this.outline.setSize(0,0)}}class En extends a.Physics.Arcade.Image{constructor(e,i,s){var n;const{x:o,y:r,image:l,scale:h}=i;super(e,o,r,l),t(this,"player"),t(this,"initialized",!1),t(this,"info"),t(this,"center"),t(this,"bounds"),this.name=`Background-${i.image}`,this.info=i,this.player=s,this.setOrigin(0).setDepth(B.Backgrounds),We(this,i);const c=null==(n=e.textures.get(l))?void 0:n.getSourceImage();this.center=new a.Math.Vector2(o+c.width*(h||1)/2,r+c.height*((h||1)/2)),w.debug&&e.add.rectangle(this.center.x,this.center.y,c.width,c.height).setStrokeStyle(10,26214).setOrigin(.5)}lazyInit(e){(e||!this.initialized&&le(this.center,this.player,2e3))&&(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.bounds=this.getBounds(),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0)}update(){var e,t;if(this.lazyInit(),null==(e=this.bounds)?void 0:e.contains(this.player.x,this.player.y)){const e=Object.entries(M).find((([e,t])=>t.locations.includes(this.info.location)));e&&(null==(t=z.music)?void 0:t.key)!==e[0]&&z.start(e[0])}}}function Mn(){return Math.random()-.5}w.dayMinutes,a.GameObjects.Container;const zn=[3200,600],Dn=[5350,690],Fn=[500,200,100,50,10];class Ln extends a.GameObjects.GameObject{constructor(e,i,s,n=40,o=[1400,600]){super(e,"fireflies"),t(this,"scene"),t(this,"center",new a.Math.Vector2(0,0)),t(this,"lights",[]),t(this,"count"),t(this,"centers",[]),t(this,"bounds",[1e3,400]),t(this,"biases",[]),t(this,"initialized",!1),t(this,"debug"),e.add.existing(this),this.scene=e,this.count=n,this.bounds=o,this.setPosition(i,s)}setPosition(e,t){this.center.set(e,t),this.centers=[];for(let i=0;ie.visible=!1));const i=e/1e3*.025,s=Math.cos(i),n=Math.sin(i);this.lights.forEach(((e,t)=>{const o=this.biases[t],r=Math.cos(70*i+o[10]);e.visible=!0,e.intensity=Math.min(.05+Math.abs(o[4]*r+o[3]*s+o[4]*s)/50,.4),e.x=s*o[0]+n*o[1]+s*o[2]+n*o[3]+s*o[4]+this.centers[t].x,e.y=n*o[5]+s*o[6]+n*o[7]+s*o[8]+n*o[9]+this.centers[t].y}))}}const Bn={[j.LabStairs]:{x:-1670,y:1730,size:{x:80,y:80},text:"Press [UP] to go upstairs"}};class Gn extends a.GameObjects.Image{constructor(e,i,s){const{x:n,y:o}=Bn[i];super(e,n,o,""),t(this,"player"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`HelperText-${i}`,this.player=s}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;const{size:t}=Bn[j.LabStairs];this.setDepth(B.Items),this.setDisplaySize(t.x,t.y),w.debug||this.setAlpha(0),this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0}getButtonPrompt(){return Bn[j.LabStairs].text}onInteract(e){return x.None}update(){this.lazyInit()}}class Rn extends a.GameObjects.Container{constructor(e,i){const{position:s,size:n}=i;super(e,s.x,s.y),t(this,"initialized",!1),t(this,"center"),t(this,"player"),t(this,"layers",[]),t(this,"info"),this.name=`ParallaxBackground-${s.x}-${s.y}`,this.info=i,this.player=e.player,this.setDepth(B.Backgrounds),this.center=new a.Math.Vector2(s.x+.5*n.x,s.y+.5*n.y),w.debug&&this.add(e.add.rectangle(this.center.x,this.center.y,n.x,n.y).setStrokeStyle(10,26214).setOrigin(.5))}lazyInit(e){if(!e&&(this.initialized||!le(this.center,this.player,this.info.size.x)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this);const{position:t,size:i,scale:s,images:n,skipLighting:o}=this.info;n.forEach((({texture:e,scale:n,speed:r})=>{const a=this.scene.add.tileSprite(t.x,t.y,i.x,i.y,e);a.setOrigin(0).setTileScale((s||1)*(n||1)).setData("speed",r),o||a.setPipeline("Light2D"),a.setPostPipeline("XRayPipeline"),this.add(a),this.layers.push(a)})),w.debug&&this.setInteractive({draggable:!0,hitArea:new a.Geom.Rectangle(t.x,t.y,i.x,i.y),hitAreaCallback:a.Geom.Rectangle.Contains}),this.initialized=!0}update(){if(this.lazyInit(),!this.initialized||!this.getBounds().contains(this.player.x,this.player.y))return;const{size:e}=this.info,t=a.Math.Clamp(this.player.x-this.center.x,-.5*e.x,.5*e.x)/e.x;this.layers.forEach((i=>{i.tilePositionX=t*i.getData("speed")*e.x}))}}class Wn extends a.GameObjects.Text{constructor(e){super(e,w.width/2,w.height-50,"",yn),this.setOrigin(.5).setBackgroundColor("#"+_).setPadding(10,5).setAlign("center").setAlpha(.8).setScrollFactor(0).setDepth(B.Overlay).setVisible(!1),e.add.existing(this)}}const Nn={octave:3.5,speed:1,volume:1,type:"sine"},_n={[P.Inventor]:{octave:3.3,speed:1,volume:1.8},[P.Stranger]:{octave:2.8,speed:1.1,volume:2.6},[P.Sphinx]:{octave:2.5,speed:2,volume:2,type:"triangle"},[P.Mayor]:{octave:3.9,speed:.8,volume:.8},[P.ClockTower]:{octave:2.1,speed:1.5,volume:1.5,type:"sawtooth"},player:{octave:3.7,speed:.75,volume:.9}};class Hn extends a.GameObjects.Text{constructor(e,i,s,n,o,r){super(e,i,s,n,{...yn,fontSize:48,backgroundColor:`#${N}`,padding:{x:15,y:10},...r}),t(this,"onClick"),t(this,"disabled"),t(this,"selected"),this.setOrigin(.5),e.add.existing(this),this.onClick=o,this.disabled=!1,this.selected=!1,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>{this.disabled||(this.setSelected(!1),o(this))})),this.on("pointerover",(()=>{this.disabled||this.selected||this.setTint(12303291)})),this.on("pointerout",(()=>{this.disabled||this.selected||this.setTint(16777215)}))}disable(){this.disabled=!0,this.selected=!1,this.disableInteractive(),this.setTint(6710886)}enable(){this.disabled=!1,this.selected=!1,this.setInteractive(),this.setTint(16777215)}setSelected(e){this.selected=e,this.setTint(e?K(X):16777215)}}class Un extends Hn{constructor(e,t,i,s,n,o,r,a){super(e,t,i,s,n,{fontSize:32,align:"center",...o}),this.setOrigin((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0),null!==r&&this.setFixedSize((null==r?void 0:r.x)||250,(null==r?void 0:r.y)||50)}}class $n extends a.GameObjects.Container{constructor(e,i,s){var n,o,r;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",-1),e.add.existing(this).setScrollFactor(0),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(o=e.input.keyboard)||o.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(r=e.input.keyboard)||r.on("keydown-ENTER",(()=>{var e;null==(e=this.buttons[this.activeIndex])||e.onClick(this.buttons[this.activeIndex])}))}addButton(e){this.add(e),this.buttons.push(e),1===this.buttons.length&&this.setActiveButton(0),e.on("pointerover",(()=>{this.setActiveButton(-1)}))}setActiveButton(e){var t,i;null==(t=this.buttons[this.activeIndex])||t.setSelected(!1),this.activeIndex=e,null==(i=this.buttons[this.activeIndex])||i.setSelected(!0)}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const Vn=20;class qn extends a.GameObjects.Container{constructor(e,i){var s,n;super(e),t(this,"textWidth"),t(this,"textHeight"),t(this,"player"),t(this,"target"),t(this,"npcName"),t(this,"text"),t(this,"portrait"),t(this,"options"),t(this,"optionsContainer"),t(this,"dialog"),t(this,"messageIndex"),t(this,"interactionTimeout"),t(this,"gamepadVisible",!1),t(this,"initialized",!1),t(this,"animating",!1),t(this,"stopAnimation"),t(this,"stopAudio");const{width:o,height:r}=w;this.textWidth=o-135-80,this.textHeight=130,this.setScrollFactor(0),this.setPosition(Vn,r-Vn-170),this.setDepth(B.Overlay),this.setAlpha(0),this.setVisible(!1),i&&(this.player=i),null==(s=this.scene.input.keyboard)||s.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(n=this.scene.input.keyboard)||n.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}createUI(){this.scene.add.existing(this),this.npcName=new a.GameObjects.Text(this.scene,170,15,"",{...yn,color:"#"+W}),this.text=this.scene.add.text(170,60,"",yn),this.text.width=this.textWidth,this.text.height=this.textHeight,this.text.setOrigin(0).setMaxLines(5),this.portrait=this.scene.add.image(Vn,Vn,"").setOrigin(0).setScale(1.5);const e=this.scene.add.rectangle(0,0,w.width-40,170,K(_),.8).setStrokeStyle(2,K(W),1).setOrigin(0,0).setScrollFactor(0).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{this.options||this.updateDialog()}));this.optionsContainer=new $n(this.scene).setDepth(B.Overlay);const t=this.scene.add.image(w.width-40-20,154,"chevron-down").setScale(.5);this.scene.tweens.add({targets:t,y:148,scale:.4,duration:1e3,ease:"Sine.easeInOut",yoyo:!0,repeat:-1}),this.add([e,this.npcName,this.text,this.portrait,t])}setDialog(e,t,i){var s,n;if(this.npcName||this.createUI(),this.gamepadVisible=(null==(s=this.scene.gamepad)?void 0:s.visible)||!1,this.setVisible(!0),this.scene.tweens.add({targets:this,alpha:void 0!==e?1:0,duration:125,onComplete:()=>this.setVisible(void 0!==e)}),this.target=t,this.messageIndex=0,this.dialog=e,this.interactionTimeout=Date.now()+350,null==(n=this.scene.gamepad)||n.setVisible(void 0===this.dialog&&this.gamepadVisible),!e)return;const o=i||(t instanceof ve?G[t.npcType].portrait:void 0);this.npcName.setVisible(!1),o?(this.portrait.setVisible(!0),this.portrait.setTexture(o),this.text.setPosition(170,Vn+(t instanceof ve?40:0)).setWordWrapWidth(this.textWidth,!0).setFixedSize(this.textWidth,this.textHeight),t instanceof ve&&(this.npcName.setVisible(!0),this.npcName.setText(G[t.npcType].name))):(this.portrait.setVisible(!1),this.text.setPosition(Vn,Vn).setWordWrapWidth(170+this.textWidth,!0).setFixedSize(170+this.textWidth,this.textHeight)),this.showMessage()}showMessage(){var e;const t=this.getMessages(),i=t&&t[this.messageIndex];if(i){this.text.setText(i);const t=this.target instanceof ve?this.target.npcType:void 0;let s="player_portrait"===(null==(e=this.portrait)?void 0:e.texture.key)?_n.player:t?_n[t]:Nn;const{promise:n,stop:o}=function(e,t,i,s){return 0===i?{promise:Promise.resolve()}:(s.sound.unlock(),((e,i)=>{let s=!1;const n=e=>new Promise((s=>{const n=i.sound.add(e);n.on("complete",(()=>{n.destroy(),s()})),n.play({rate:3,detune:300*(t.octave-4)})}));return{promise:new Promise((async t=>{const i=e.toLowerCase().split(" ");for(let e=0;e=97&&t.charCodeAt(0)<=122&&await n(t)}t()})),stop:()=>{s=!0}}})(e,s))}(i,s,this.scene.sound.mute?0:this.scene.sound.volume,this.scene),{promise:r,stop:a}=function(e,t=15){const i=e.text,s=i.replace(/[^ ]/g," ");e.text="";let n="";const o=e.scene.time.addEvent({delay:t,loop:!0});return{promise:new Promise((t=>{o.callback=()=>{if(e.text===i)return o.destroy(),t();n+=i[n.length];const r=s.substring(n.length);e.text=n+r}})),stop:()=>{o.destroy(),e.text=i}}}(this.text);this.animating=!0,this.stopAudio=o,this.stopAnimation=a,Promise.all([n,r]).then((()=>{this.animating=!1,this.stopAudio=void 0,this.stopAnimation=void 0})),this.text.getWrappedText().length>5&&console.error("Message too long!",i)}this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const e=!w.zoomed;this.options.forEach(((t,i)=>{const s=new Hn(this.scene,w.width/2,w.height/(e?9:14)+i*(30+w.height/(e?16:22)),t,(()=>this.onSelectOption(t)),{fontSize:24,backgroundColor:"#"+_,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(B.Overlay);this.optionsContainer.addButton(s)}))}onSelectOption(e){var t;(null==(t=this.dialog)?void 0:t.onSelected)&&(this.dialog.onSelected(e,this.player,this.target),this.optionsContainer.removeAll(!0))}updateDialog(){var e,t,i,s;if(Date.now()=n.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.target),this.dialog=void 0,this.text.setText(""),this.scene.tweens.add({targets:this,alpha:0,duration:125,onComplete:()=>this.setVisible(!1)}),null==(i=this.scene.gamepad)||i.resetButtons()):this.showMessage(),null==(s=this.scene.gamepad)||s.setVisible(void 0===this.dialog&&this.gamepadVisible),this.interactionTimeout=Date.now()+350}}getMessages(){var e;let t=null==(e=this.dialog)?void 0:e.messages;return"function"==typeof t&&(t=t(this.player)),t}getOptions(){var e;let t=null==(e=this.dialog)?void 0:e.options;return"function"==typeof t&&(t=t(this.player)),t}}const Xn={[k.Wrench]:{x:0,y:0,image:"wrench",name:"Old Wrench"},[k.Gear1]:{x:0,y:0,image:"gear",name:"Shiny Gear"},[k.Key]:{x:0,y:0,image:"key",name:"Rusty Key",skipLighting:!0},[k.HerbRed]:{x:-200,y:1730,image:"herb_red",name:"Crimson Starbloom"},[k.HerbGreen]:{x:5295,y:985,image:"herb_green",name:"Green Writhewood"},[k.HerbBlue]:{x:1535,y:875,image:"herb_blue",name:"Blue Plumed Frond"},[k.Potion]:{x:0,y:0,image:"potion",name:"Strange Potion"},[k.Gear2]:{x:0,y:0,image:"gear2",name:"Old Gear"}};class Kn extends a.GameObjects.Container{constructor(e){super(e,0,0),t(this,"inventory",[]),t(this,"text"),t(this,"rect"),t(this,"initialized",!1),this.setScrollFactor(0).setDepth(B.Ui).setVisible(!1)}createUI(){this.initialized||(this.scene.add.existing(this),this.rect=this.scene.add.rectangle(0,0,0,0,K(N)).setStrokeStyle(2,K(R)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=this.scene.add.text(10,4,"Inventory",{...yn,fontSize:32}),this.add(this.text),this.initialized=!0)}addItem(e,t){if(this.initialized||this.createUI(),this.inventory.push(e),!e.used){const t=this.scene.add.image(0,0,Xn[e.type].image).setScale(.35);e.type===k.Key&&t.setAngle(45),this.add(t)}this.updateItems();const i=Ge(this.scene,e.type);null==i||i.destroy(),t||(new gn(this.scene,`New item added: ${Xn[e.type].name}`),jn(this.scene))}removeItem(e){var t;this.initialized||this.createUI();const i=this.inventory.find((t=>t.type===e));i&&(i.used=!0,null==(t=this.getAll().find((t=>{var i;return(null==(i=t.texture)?void 0:i.key)===Xn[e].image})))||t.destroy()),this.updateItems()}updateItems(){var e;this.initialized||this.createUI();let t=0;this.getAll().forEach((e=>{if(e instanceof a.GameObjects.Image){const i=32+50*t;e.setPosition(i,68),t++}})),this.setVisible(this.inventory.length>0);const i=Math.max((null==(e=this.text)?void 0:e.displayWidth)+18,50*t+12);this.setPosition(w.width-i-20,20),this.rect.setSize(i,102)}}class Yn extends a.GameObjects.Image{constructor(e,i){super(e,w.width-50,w.height-55,"journal"),t(this,"player"),t(this,"journal",[]),t(this,"unread"),t(this,"initialized",!1),this.player=i}createUI(){var e;this.initialized||(this.setScrollFactor(0).setDepth(B.Ui).setScale(.5).setAlpha(0).setInteractive({useHandCursor:!0}).setActive(!1),this.on("pointerdown",this.openJournal),this.scene.add.existing(this),this.unread=this.scene.add.ellipse(w.width-21,w.height-89,20,20,11141120).setStrokeStyle(2,K(_)).setScrollFactor(0).setDepth(B.Ui2).setVisible(!1),null==(e=this.scene.input.keyboard)||e.on("keydown-J",(()=>{this.openJournal()})),this.initialized=!0)}addEntry(e,t){this.initialized||this.createUI(),this.journal.includes(e)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(e),t||(this.unread.setVisible(!0),new gn(this.scene,"New journal entry added!")),this.handleSideEffects(e,t||!1))}openJournal(){this.initialized||this.createUI(),0!==this.journal.length&&he(this.scene,"JournalDialog")}handleSideEffects(e,t){const{warpAdd:i}=Se[e];if(i&&Le(this.scene,i,!1),e===C.ClockFirstGear||e===C.ClockSecondGear){const e=Be(this.scene,P.ClockTower);(null==e?void 0:e.clock)&&e.clock.updateHands()}e!==C.ExtraPotionInformation||this.journal.includes(C.SafeDiscovered)||Sn(this.scene,!0),e===C.SafeDiscovered&&function(e,t){const i=Re(e.scene,O.MansionPicture);t||e.setActive(!1),null==i||i.scene.tweens.add({targets:i,angle:97,duration:t?0:1500,onComplete:()=>{t||(e.setActive(!0),e.message.setDialog({messages:["A sturdy looking safe was hidden behind the picture.","It looks like it requires a special key to open."]},void 0,"player_portrait"))}})}(this.player,t),t||jn(this.scene)}}class Qn extends a.GameObjects.Container{constructor(e,i){super(e,w.width-330-20,120),t(this,"player"),t(this,"quests",[]),t(this,"questRectangle"),t(this,"initialized",!1),this.player=i}createUI(){if(this.initialized)return;this.scene.add.existing(this),this.setScrollFactor(0).setDepth(B.Ui).setVisible(!1),this.questRectangle=this.scene.add.rectangle(0,0,330,60,K(N)).setStrokeStyle(2,K(R)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle);const e=this.scene.add.text(10,4,"Quests",{...yn,fontSize:32});this.add(e),this.initialized=!0}addQuest(e,t){this.initialized||this.createUI(),this.quests.find((t=>t.id===e.id))||(this.quests.push(e),this.add(this.scene.add.text(0,0,ke[e.id].description,{...yn,fontSize:20})),this.updateQuests(),t||new gn(this.scene,`New quest added: ${ke[e.id].description}`),this.handleSideEffects(e.id,e.completed,t))}updateExistingQuest(e,t){this.initialized||this.createUI();const i=this.quests.find((t=>t.id===e));i?(!i.completed&&t&&new gn(this.scene,`Quest completed: ${ke[i.id].description}`),i.completed=t,this.updateQuests(),this.handleSideEffects(e,t)):console.error(`Quest ${e} not found in player quests`)}updateQuests(){this.initialized||this.createUI();const e=this.quests.filter((e=>!e.completed));let t=1,i=0;this.getAll().forEach((s=>{if(s instanceof a.GameObjects.Text)if(e.find((e=>s.text===ke[e.id].description))||"Quests"===s.text){if("Quests"!==s.text){const e=14+30*t;s.setPosition(10,e),t++,i=Math.max(i,s.width)}}else s.destroy()}));const s=i+20;this.setX(w.width-20-s),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(e.length>0),this.questRectangle.setSize(s,50+30*e.length)}handleSideEffects(e,t,i){const{warpAdd:s,warpComplete:n}=ke[e];if(s&&Le(this.scene,s,!1),t&&n&&Le(this.scene,n,!1),e===I.FindPotionIngredients&&!t){const e=this.player.scene;e.interactiveObjects.add(new Wo(e,k.HerbGreen,this.player)),e.interactiveObjects.add(new Wo(e,k.HerbBlue,this.player))}e!==I.ExploreLab||t||Uo(this.player),i||jn(this.scene)}reset(){this.quests=[],this.updateQuests()}}const Jn=1.35*(w.fastMode?350:175),Zn=new a.Math.Vector2(400,650);class eo extends a.Physics.Arcade.Sprite{constructor(e){var i;super(e,Zn.x,Zn.y,"character",0),t(this,"scene"),t(this,"keys"),t(this,"light"),t(this,"debug"),t(this,"buttonPrompt"),t(this,"interactive"),t(this,"interactionTimeout",0),t(this,"message"),t(this,"inventory"),t(this,"quests"),t(this,"journal"),t(this,"gameState"),t(this,"previousPosition",new a.Math.Vector2),t(this,"counter",0),t(this,"history",[]),t(this,"rewinding",!1),this.name="Player",this.scene=e,e.add.existing(this),e.physics.add.existing(this),w.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(B.Player).setScale(1.35).setPipeline("Light2D").setPostPipeline("XRayPipeline"),w.debug?(this.light=new ye(e,this.x,this.y,200,16768443,1),this.debug=e.add.circle(this.x,this.y,3,16711935).setDepth(B.Debug)):this.light=e.lights.addLight(this.x,this.y,200,16768443,1),(i=this).anims.create({key:"walk",frames:i.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:w.prod?6:9,repeat:-1}),i.anims.play("walk"),this.keys=new be(e),this.message=new qn(e,this),this.inventory=new Kn(e),this.quests=new Qn(e,this),this.journal=new Yn(e,this),this.gameState=new Vo(e,this),w.perfTest&&e.time.delayedCall(1e3,(()=>{this.setVelocityX(Jn),e.time.addEvent({delay:1e3,callback:()=>this.setVelocityX(this.body?-this.body.velocity.x:0),loop:!0})}))}update(e,t){var i,s,n;w.debug&&(this.setTint(this.interactive?16755370:16777215),this.debug.setPosition(this.x,this.y));const o=this.interactive&&!this.message.visible&&(null==(s=null==(i=this.buttonPrompt)?void 0:i.text)?void 0:s.length)>0||!1;o&&!this.buttonPrompt&&(this.buttonPrompt=new Wn(this.scene)),null==(n=this.buttonPrompt)||n.setVisible(o),w.perfTest||(this.setVelocity(0),this.rewinding?this.counter+t>31.25?(this.rewind(),this.counter=0):this.counter+=t:this.checkInteraction()||this.message.visible||this.updateVelocity()),this.light.setPosition(this.x,this.y-20),function(e){const t=e.x-e.previousPosition.x,i=e.y-e.previousPosition.y,s=t<0;Math.abs(t)>.01||Math.abs(i)>.01?e.anims.resume():e.anims.pause(),Math.abs(t)>0&&(e.flipX=e.rewinding?!s:s),e.setAngle(e.flipX?-5:5)}(this),this.previousPosition.set(this.x,this.y)}checkInteraction(){var e;let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==x.None&&(this.interactionTimeout=Date.now()+((null==(e=this.interactive)?void 0:e.interactionTimeout)||500),this.keys.resetKeys(),t===x.Teleported&&(this.interactive=void 0))),t}updateVelocity(){const e=this.keys.keys;let t=1;!w.prod&&e[me.Shift]&&(t=2),this.anims.timeScale=t;const i=Jn*t;e[me.Left]&&this.setVelocityX(-i),e[me.Right]&&this.setVelocityX(i),w.debug&&!this.interactive&&(e[me.Up]&&this.setVelocityY(-i),e[me.Down]&&this.setVelocityY(i)),e[me.Left]&&e[me.Right]&&this.setVelocityX(0)}record(){var e;this.history.length<1e3?this.history.push(new a.Math.Vector3(this.x,this.y,(null==(e=this.body)?void 0:e.velocity.x)||0)):console.warn("Max history reached")}rewind(){const e=this.history.pop();e&&(this.x=e.x,this.y=e.y,this.setVelocityX(-e.z))}setRewind(e){this.rewinding=e,this.counter=0}reset(){this.quests.reset(),this.setPosition(Zn.x,Zn.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(e){var t,i;this.interactive=e,(null==e?void 0:e.onCollided)&&e.onCollided();const s=null==(t=null==e?void 0:e.getButtonPrompt)?void 0:t.call(e);s&&!this.buttonPrompt&&(this.buttonPrompt=new Wn(this.scene)),null==(i=this.buttonPrompt)||i.setText(s)}}class to extends a.Physics.Arcade.Image{constructor(e,i,s,n=100,o=100,r=!1,a=!1){super(e,i,s,""),t(this,"scene"),t(this,"width"),t(this,"height"),t(this,"flipped"),t(this,"upwards"),t(this,"graphics"),t(this,"initialized",!1),this.name=`Slope-${i}-${s}`,this.scene=e,this.width=n,this.height=o,this.flipped=r,this.upwards=a}lazyInit(e){if(e||!this.initialized&&le(this,this.scene.player)){if(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.setOrigin(0).setDepth(B.Items).setVisible(w.debug).setSize(this.width,1.5*this.height),w.debug){this.setInteractive({draggable:!0});const e=this.scene.add.graphics().setDepth(B.Debug);this.graphics=e,e.lineStyle(2,65280,1);const t=this.width/2,i=new a.Math.Vector2(0,this.flipped?0:0+this.height),s=new a.Math.Vector2(0+this.width,this.flipped?0+this.height:0);e.lineBetween(i.x,i.y,s.x,s.y),e.lineBetween(i.x-t,i.y,i.x,i.y),e.lineBetween(s.x,s.y,s.x+t,s.y),e.strokeCircle(i.x,i.y,2),e.strokeCircle(s.x,s.y,2)}this.initialized=!0}}update(e,t){if(this.lazyInit(),!this.initialized)return;w.debug&&this.graphics&&this.graphics.setPosition(this.x,this.y);const i=this.scene.player,s=i.keys.keys;if(this.body&&this.scene.physics.world.intersects(this.body,i.body)){let e=a.Math.Clamp(1-(this.x+this.width-i.x)/this.width,0,1);this.flipped&&(e=1-e);const t=this.y+this.height,n=(1-i.originY)*i.displayHeight,o=t-this.height*e-n;if(this.upwards&&s[me.Up]&&Math.abs(i.y-o)<70)return i.setVelocityX(this.flipped?-Jn:Jn),void i.setY(o);if(this.upwards&&(s[me.Right]||s[me.Left]&&this.flipped)&&i.y{void 0!==e.id&&this.createWall(e,t)}))}createWall(e,t){const i=this.scene.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(w.debug);i.name=`Wall-${e.id||t}-${e.x}-${e.y}`,void 0!==e.id&&i.setData("WallType",e.id),w.debug&&i.setInteractive({draggable:!0}),this.add(i),this.initialized.push(t)}update(){for(let e=0;eoo){if("RIGHT"===this.lastXAxisKey)return;"LEFT"===this.lastXAxisKey&&(null==(n=this.scene.input.keyboard)||n.emit("keyup-LEFT")),null==(o=this.scene.input.keyboard)||o.emit("keydown-RIGHT"),this.lastXAxisKey="RIGHT"}if(y<-.1){if("LEFT"===this.lastXAxisKey)return;"RIGHT"===this.lastXAxisKey&&(null==(r=this.scene.input.keyboard)||r.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastXAxisKey="LEFT"}if(Math.abs(g)<=oo&&this.lastYAxisKey)return null==(l=this.scene.input.keyboard)||l.emit("keyup-"+this.lastYAxisKey),void(this.lastYAxisKey=void 0);if(g>oo){if("DOWN"===this.lastYAxisKey)return;"UP"===this.lastYAxisKey&&(null==(h=this.scene.input.keyboard)||h.emit("keyup-UP")),null==(c=this.scene.input.keyboard)||c.emit("keydown-DOWN"),this.lastYAxisKey="DOWN"}if(g<-.1){if("UP"===this.lastYAxisKey)return;"DOWN"===this.lastYAxisKey&&(null==(u=this.scene.input.keyboard)||u.emit("keyup-DOWN")),null==(d=this.scene.input.keyboard)||d.emit("keydown-UP"),this.lastYAxisKey="UP"}}createDPad(){console.log("createDPad");const e=this.scene.add.container(10,-10);this.add(e);const t=this.scene.add.circle(0,0,60,K(N),.45).setStrokeStyle(3,K(_));e.add(t),this.button(-57,0,"LEFT",e),this.button(57,0,"RIGHT",e),this.button(0,-57,"UP",e),this.button(0,57,"DOWN",e)}createButtons(){const e=this.scene.add.container(w.width-300,0);this.add(e);const t=this.scene.add.circle(40,0,65,K(N),.45).setStrokeStyle(3,K(_)).setScale(1,.6).setAngle(-30);e.add(t),this.button(80,-20,"ENTER",e),this.button(0,20,"BACKSPACE",e)}createControllerListeners(){var e,t,i,s;null==(e=this.scene.input.gamepad)||e.on("connected",(e=>{new gn(this.scene,"Gamepad connected")})),null==(t=this.scene.input.gamepad)||t.on("disconnected",(e=>{new gn(this.scene,"Gamepad disconnected")})),null==(i=this.scene.input.gamepad)||i.on("down",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keydown-${s}`))})),null==(s=this.scene.input.gamepad)||s.on("up",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keyup-${s}`))}))}getKeyFromButton(e){const t=e.pad.id.toLowerCase().includes("nintendo");let i;switch(e.index){case 0:i=t?"BACKSPACE":"ENTER";break;case 1:i=t?"ENTER":"BACKSPACE";break;case 2:i=t?"SHIFT":"BACK_SLASH";break;case 3:i=t?"BACK_SLASH":"SHIFT";break;case 8:i="J";break;case 9:i="ESC";break;case 12:i="UP";break;case 13:i="DOWN";break;case 14:i="LEFT";break;case 15:i="RIGHT"}return i}button(e,t,i,s){const n="ENTER"===i||"ESCAPE"===i?35:38,o=this.scene.add.circle(e,t,n,K(R),no).setStrokeStyle(3,K(_));o.setInteractive({useHandCursor:!0}).setScrollFactor(0),s.add(o),o.on("pointerdown",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keydown-${i}`),o.setFillStyle(K(N),Math.min(1,1.05))})),o.on("pointerup",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),o.setFillStyle(K(R),no)})),o.on("pointerout",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),o.setFillStyle(K(R),no)})),this.buttons.push(o)}resetButtons(){this.buttons.forEach((e=>e.setFillStyle(K(R),no)))}}class ao extends a.GameObjects.Container{constructor(e,i,s,n,o){super(e,i,s),t(this,"onClick"),t(this,"img"),t(this,"rect"),t(this,"selected"),e.add.existing(this),this.setScrollFactor(0).setDepth(B.Ui),this.rect=e.add.rectangle(0,0,42,42,K(N)).setScrollFactor(0).setStrokeStyle(2,K(_)),this.img=e.add.image(-1,1,n).setDisplaySize(32,32),this.add(this.rect),this.add(this.img),this.rect.setInteractive({useHandCursor:!0}).on("pointerdown",(()=>o(this))),this.onClick=o,this.selected=!1,this.rect.on("pointerover",(()=>{this.rect.setScale(1.1),this.img.setDisplaySize(36,36)})),this.rect.on("pointerout",(()=>{this.rect.setScale(1),this.img.setDisplaySize(32,32)}))}setTint(e){this.img.setTint(e)}setSelected(e){this.selected=e,this.setTint(e?K(X):16777215)}setIcon(e){this.img.setTexture(e).setDisplaySize(32,32)}}var lo=(e=>(e.Horizontal="H",e.Vertical="V",e.Corner="C",e.T="T",e.Cross="X",e.Empty=" ",e))(lo||{});const ho={H:[[0,0,0],[1,1,1],[0,0,0]],V:[[0,1,0],[0,1,0],[0,1,0]],C:[[0,0,0],[1,1,0],[0,1,0]],T:[[0,0,0],[1,1,1],[0,1,0]],X:[[0,1,0],[1,1,1],[0,1,0]]," ":[[0,0,0],[0,0,0],[0,0,0]]},co=[[" "," "," ","V"," "," ","V"," "," ","V"," "," "," ","V"," "," "],[" "," ","C","C"," "," ","V"," "," ","V"," "," ","C","T","H","H"],["H","H","X","T","T","T","T","T","T","C"," "," ","V"," "," "," "],[" "," ","V","C","X","C"," ","C","X","H","T","H","X","H","C"," "],[" "," ","C","T","X","H","C"," ","V"," ","V"," ","V"," ","T","H"],["H","T","H","T","V"," ","T","H","X","H","T","H","T"," ","V"," "],[" ","V"," ","C","X","H","C"," ","T","C"," "," ","C","C","C","H"],[" ","V"," "," ","V"," "," "," ","V","V"," "," "," ","V"," "," "]].map((e=>e.map((e=>e))));function uo(e,t){if(!e||!t)return!1;const i=po(e),s=po(t),n=t.x-e.x,o=t.y-e.y;return 1===n&&0===o?i.right&&s.left:-1===n&&0===o?i.left&&s.right:0===n&&1===o?i.bottom&&s.top:0===n&&-1===o&&i.top&&s.bottom}function po(e){const t=function(e){let t=ho[e.type];const i=Math.floor(e.rotation/90);for(let s=0;s1===e[0])),right:t.some((e=>1===e[e.length-1])),top:t[0].some((e=>1===e)),bottom:t[t.length-1].some((e=>1===e))}}function yo(e){return e[0].map(((t,i)=>e.map((e=>e[i])).reverse()))}const go=Object.keys(k).map((e=>k[e])).filter((e=>"number"==typeof e)),fo=Object.keys(C).map((e=>C[e])).filter((e=>"number"==typeof e)),mo=Object.keys(P).map((e=>P[e])).filter((e=>"number"==typeof e)),bo=Object.keys(O).map((e=>O[e])).filter((e=>"number"==typeof e)),vo=Object.keys(I).map((e=>I[e])).filter((e=>"number"==typeof e)),wo=Object.keys(S).map((e=>S[e])).filter((e=>"number"==typeof e)),xo=Object.keys(j).map((e=>j[e])).filter((e=>"number"==typeof e)),So=Object.values(lo).filter((e=>"number"!=typeof e)),ko=["MainMenu","MazeDialog","PipesDialog","TumblerDialog","MemoryDialog","SliderDialog"],Io=[{x:0,y:0,image:"town",location:A.Town},{x:500,y:-1100,image:"clock_outside",location:A.ClockOutside},{x:500,y:-2400,image:"clock_inner",location:A.ClockInner,skipLighting:!0},{x:2300,y:0,image:"forest",location:A.Forest},{x:4400,y:100,image:"lake",location:A.Lake},{x:-2200,y:-170,image:"mansion_outside",location:A.MansionOutside},{x:-2e3,y:-1320,image:"mansion_inside",location:A.MansionInside,skipLighting:!0},{x:-3200,y:1300,image:"alchemy_lab",location:A.AlchemyLab,scale:.9,skipLighting:!0},{x:1600,y:-700,image:"library",location:A.Library,skipLighting:!0}],Po=[{x:135,y:462,radius:150,color:K(W),intensity:2.5},{x:697,y:441},{x:1018,y:435},{x:887,y:200,radius:150},{x:1561,y:460},{x:791,y:472,intensity:.5},{x:962,y:469,intensity:.5},{x:162,y:814,intensity:2},{x:635,y:772},{x:1638,y:788,intensity:2},{x:5300,y:530,intensity:2},{x:5315,y:730,intensity:.75,radius:75}],To=[],Co=[{x:740,y:-1370,width:170,height:95},{x:815,y:-2010,width:90,height:70},{x:5150,y:953,width:100,height:60,flip:!0},{x:-1300,y:-415,width:90,height:35},{x:-1710,y:1577,width:280,height:190,upwards:!0},{x:-1020,y:1697,width:200,height:70},{x:-2570,y:1728,width:200,height:40,flip:!0}],Oo=(e,t,i)=>{var s=1/0,n=0,o=Math.round;const r=1.25*o(window.devicePixelRatio||1),a=100*r,l=65*r,h=3*r,c=2*r,u=3*r,d=23*r,p=Math.floor(a-2*u),y=l-d-2*r,g=document.createElement("canvas");g.width=a,g.height=l;const f=g.getContext("2d");f.font="bold "+9*r+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=i,f.fillRect(0,0,a,l),f.fillStyle=t,f.fillText(e,h,c),f.fillRect(u,d,p,y),f.fillStyle=i,f.globalAlpha=.9,f.fillRect(u,d,p,y);let m=0,b=0,v=new Array(Math.floor(p/r)).fill(0);return{dom:g,update:function(l){if(!(performance.now()-m<100)){v[b]=l,b=(b+1)%v.length,s=Math.min(...v),n=Math.max(...v),f.fillStyle=i,f.globalAlpha=1,f.fillRect(0,0,a,d),f.fillStyle=t,f.fillText(`${e}: ${l.toFixed(1)}`,h,c),f.fillText(`[${s.toFixed(1)} - ${n.toFixed(1)}]`,h,c+10*r),f.fillRect(u,d,p,y),f.fillStyle=i,f.globalAlpha=.8;for(let e=0;e300||!w.debug&&t>150?new gn(this,i,void 0,H):new gn(this,i)}}update(){this.player&&(this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((e,t)=>{const i=e;let s=!0;return i.disabled&&(s=!1),void 0!==i.visible&&(s=s&&i.visible),s}),this.player)||this.player.setInteractiveObject(void 0)),this.frustumCull()}frustumCull(){var e,t,i;const s=performance.now();this.cameraBounds.x=this.cameras.main.scrollX-150,this.cameraBounds.y=this.cameras.main.scrollY-150;const n=this.children.getAll();for(let o of n)if(o instanceof a.GameObjects.Image||o instanceof a.GameObjects.Sprite||o instanceof a.GameObjects.Particles.ParticleEmitter||o instanceof a.GameObjects.Graphics){if(o.depth!==B.Debug&&(o instanceof to||!(o instanceof Ce)&&(null==(e=o.name)?void 0:e.startsWith("Warp"))||o.depth>=B.Ui||0===(null==(t=o.name)?void 0:t.length)))continue;this.objectBounds.setTo(o.x,o.y,o.width||1,o.height||1),a.Geom.Intersects.RectangleToRectangle(this.cameraBounds,this.objectBounds)?o instanceof Ce?o.updateLocked():o.setVisible(!0):o.setVisible(!1)}jo&&!this.cullingStats&&(this.cullingStats=jo.addPanel(Oo("Culling","#9ad8e4","#064b62"))),null==(i=this.cullingStats)||i.update(performance.now()-s)}createBackgrounds(){return Io.map((e=>new En(this,e,this.player)))}createParallaxBackgrounds(){return To.map((e=>new Rn(this,e)))}createWarpers(){return wo.map((e=>new Ce(this,e,this.player)))}createNpcs(){return mo.map((e=>new ve(this,e,this.player)))}createItems(){return[].map((e=>new Wo(this,e,this.player)))}createSlopes(){return Co.map((e=>new to(this,e.x,e.y,e.width,e.height,e.flip,e.upwards)))}createProps(){return bo.map((e=>new xe(this,e,this.player)))}createHelperText(){return xo.map((e=>new Gn(this,e,this.player)))}createUI(){this.time.delayedCall(50,(()=>{let e=30;new ao(this,e,30,"settings",(()=>{this.player.message.visible||(this.scene.pause(),this.scene.launch("Paused",{game:this}))})),w.prod||new ao(this,e+=50,30,"terminal",(()=>{he(this,"DebugTool")})),this.saveIcon=this.add.image(30,w.height-30,"save").setScale(.4).setDepth(B.Ui).setScrollFactor(0).setAlpha(0),this.saveIcon.postFX.addGlow(0,2)})),this.gamepad=new ro(this),w.prod||(this.time.delayedCall(500,(()=>{const e=new An(this,this.player);this.add.group(e,{runChildUpdate:!0})})),w.bootDialog&&this.time.delayedCall(150,(()=>he(this,w.bootDialog))))}createLights(){this.lights.enable().setAmbientColor(K(R)),Po.forEach((e=>{w.debug?new ye(this,e.x,e.y,e.radius||100,e.color||K($),e.intensity||1):this.lights.addLight(e.x,e.y,e.radius||100,e.color||K($),e.intensity||1)})),ie(this,!1)}createEventListeners(){var e;null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.player.message.visible||(this.scene.pause(),this.scene.launch("Paused",{game:this}))})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}const Eo=[{question:"I speak without a mouth and hear without ears. I have no body, but I come alive with the wind.",answer:"echo",options:["echo","whisper","ghost","silence","shadow"],hints:{[P.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[P.Stranger]:["The sphinx’s riddles are always a bit tricky.","I think this one is about something that bounces off walls."]}},{question:"I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?",answer:"map",options:["map","globe","dream","photograph","landscape"],hints:{[P.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[P.Stranger]:["Imagine something that can fit in your hand or hang on a wall, showing vast landscapes and bodies of water, but not in their true form."]}},{question:"I fly without wings. I cry without eyes. Whenever I go, darkness flies. What am I?",answer:"cloud",options:["cloud","bat","wind","shadow","storm"],hints:{[P.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[P.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function Mo(e){return e instanceof Ao&&Me(e.player,I.FindPotionIngredients)?1:0}function zo(e,t){const i=Mo(e);return Eo[i].hints[t]}const Do={messages:e=>function(e){const t=Mo(e);return[Eo[t].question]}(e.scene),options:e=>function(e){const t=Mo(e),i=[...Eo[t].options].sort((()=>Math.random()-.5));return i.push("I don’t know"),i}(e.scene),onSelected:function(e,t,i){e===function(e){const t=Mo(e);return Eo[t].answer}(t.scene)?t.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:e=>{e.quests.updateExistingQuest(I.SphinxRiddle,!0),e.gameState.updateData({sphinxMoved:!0,sphinxFail:!1})}},i):"I don’t know"===e?t.message.setDialog({messages:["Come back when you have an answer for me."]},i):t.message.setDialog({messages:["That is not correct. You will not remember how to get back to me."],onCompleted:e=>{e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxFail:!0}),Oe(S.TownEast,e,{x:-100,y:0})}},i)}},Fo={messages:["There. It looks like the alchemy set has been properly fit back together."],onCompleted:e=>{e.journal.addEntry(C.AlchemySetFixed)}},Lo={[P.Inventor]:[{messages:["There is still one more gear missing.","Something tells me there is a great evil near the lake."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Ah, the second gear. You should take it to the clock tower."],conditions:{hasItem:k.Gear2}},{messages:["You found a secret safe in the mansion?","Very interesting. There may be a hint about opening it nearby."],conditions:{journalEntry:C.SafeDiscovered}},{messages:["Blue Plumed Frond? I have not heard of such a plant.","The stranger may know. Many secrets lie under this town."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["There are rumors of an abandoned mansion west of the town.","Some say it is haunted and dark magic lurks within."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:k.Gear1},onCompleted:e=>{e.quests.updateExistingQuest(I.ForestGear,!0)}},{messages:e=>zo(e.scene,P.Inventor),conditions:{activeQuest:I.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:k.Wrench}},{messages:["The clock tower is the heart of our town, but it’s been broken for ages. I’ve got a wrench, but you’ll need three special gears to fix it.","You might find the others by helping the townsfolk."],onCompleted:e=>{e.journal.addEntry(C.FixTheClock),e.inventory.addItem({type:k.Wrench,used:!1})}}],[P.Stranger]:[{messages:["I am worried about the secrets hidden near the lake.","Long ago I saw a great evil lurking there."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Another gear? The mayor probably wants that put back in the clock tower."],conditions:{hasItem:k.Gear2}},{messages:["The lock on that safe is no ordinary lock. It requires something special to open it."],conditions:{journalEntry:C.SafeDiscovered,hasUnusedItem:k.Potion}},{messages:["Hmm a potion, I wonder what it does.","The alchemist was no ordinary person and built magical safeguards against intruders."],conditions:{hasUnusedItem:k.Potion}},{messages:["Green Writhewood? Hm, there might be some near the forest or lake."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["You heard of the mansion to the west? It was abandoned many years ago.","There is a rumor of an alchemy lab hidden somewhere nearby, but I have been searching for years and have found not even a single potion."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:k.Gear1}},{messages:e=>zo(e.scene,P.Stranger),conditions:{activeQuest:I.SphinxRiddle}},{messages:["I’ve heard rumors of a gear hidden deep in the Enchanted Forest. Beware of the forest’s creatures and traps.","One time I thought I saw an ancient being, but it ran away."],conditions:{hasItem:k.Wrench},onCompleted:e=>{e.quests.addQuest({id:I.ForestGear,completed:!1})}},{messages:["Who am I?","Eventually, you will learn."]}],[P.Sphinx]:[{messages:e=>e.gameState.data.sphinxFail?["You have returned. I am surprised you were able to find your way back.","Try again."]:Me(e,I.FindPotionIngredients)?["I see you are back again. You may find what you are looking for ahead, but must first answer my riddle."]:["Ponder this riddle. Answer wisely."],conditions:{activeQuest:I.SphinxRiddle,completedQuest:I.SphinxRiddle,or:!0},onCompleted:(e,t)=>{e.scene.time.delayedCall(50,(()=>{e.message.setDialog({...Do},t)}))}},{messages:["Welcome, brave soul. To pass, you must answer my riddle. You may only answer once. If you are unsure, you may speak to the townsfolk. Choose wisely."],onCompleted:e=>{e.quests.addQuest({id:I.SphinxRiddle,completed:!1})}}],[P.Mayor]:[{messages:["I’ve been hearing strange reports from the townsfolk. It’s as if time is slipping. Have you felt it?","The clock is still missing a gear. It must be somewhere nearby."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["The second gear has been found? That’s incredible news!"],conditions:{completedQuest:I.InvestigateTownWest}},{messages:["Herbs? I haven’t the faintest idea where to being looking. Start at the source - there are bound to be a few ingredients in the lab you found."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["The minute hand on the clock is spinning again.","It looks like it’s missing two more gears.","The abandoned mansion west of the town might be a good place to look."],conditions:{journalEntry:C.ClockFirstGear},onCompleted:e=>{e.quests.addQuest({id:I.InvestigateTownWest,completed:!1})}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:C.MetTheMayor}},{messages:["Hello, traveler. I am the mayor of this town. The clock tower has been broken for years.","Ah, I see you have found an old gear. Maybe it could be used to help fix the clock tower."],onCompleted:e=>{e.journal.addEntry(C.MetTheMayor)}}],[P.ClockTower]:[{messages:["With two of the gears in place, the clocks hands are moving again."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Slowly, you align and tighten the second gear into place.","[CREAKING NOISE]","Now two of the hands of the clock are moving again."],conditions:{hasItem:k.Gear2},onCompleted:e=>{e.inventory.removeItem(k.Gear2),e.journal.addEntry(C.ClockSecondGear)}},{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:C.ClockFirstGear}},{messages:["This dusty clock tower hasn't told the correct time in many years. It appears to be missing some gears.","Let’s see what happens when we add the first gear. You tighten the gear into place.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:k.Gear1},onCompleted:e=>{e.inventory.removeItem(k.Gear1),e.journal.addEntry(C.ClockFirstGear)}}]},Bo={[k.Gear1]:[{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}],[k.Gear2]:[{messages:["Finally! I found the second gear to the clock tower.","I should take this and put it back."],onCompleted:e=>{e.quests.updateExistingQuest(I.InvestigateTownWest,!0)}}]},Go={[O.Chest]:[{messages:["The chest seems to be locked.","It appears to have many symbols above the latch"],conditions:{custom:e=>!je(e,k.Gear1)&&void 0===Ge(e.scene,k.Gear1)},onCompleted:e=>{he(e.scene,"MemoryDialog")}}],[O.LabHatch]:[{messages:["Let me see if I can open this hatch.","Wow, the rusty key fits!","[CREAKING NOISE]","Alright, let’s see what is down there!"],conditions:{hasItem:k.Key},onCompleted:(e,t)=>{null==t||t.destroy(),e.inventory.removeItem(k.Key),e.journal.addEntry(C.AlchemyLabFound)}},{messages:["The hatch is locked. I wonder if there is a key somewhere."]}],[O.LabBook]:[{messages:[],conditions:{journalEntry:C.ClockSecondGear}},{messages:['How could I have missed this? The potion is called the "Elixir of Sight".',"This must be related to one of the gears in the clock tower.","Well, bottoms up, I suppose!"],conditions:{hasItem:k.Potion},onCompleted:e=>{e.journal.addEntry(C.ExtraPotionInformation),e.inventory.removeItem(k.Potion),e.scene.time.delayedCall(3500,(()=>{e.message.setDialog({messages:["I feel... different.","I should retrace my steps to see if there is anything new in the area."]})}))}},{messages:["With the alchemy set fixed, I should be able to recreate the experiment.","I will need to find three ingredients according to this - Crimson Starbloom, Green Writhewood, and a Blue Plumed Frond.","Maybe I can find them in the lab or the forest. The villagers should know more."],conditions:{journalEntry:C.AlchemySetFixed},onCompleted:e=>{e.quests.addQuest({id:I.FindPotionIngredients,completed:!1}),e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxMoved:!1})}},{messages:["Maybe I can find more information in the lab."],conditions:{activeQuest:I.ExploreLab}},{messages:["This lab journal contains notes about an ancient alchemy experiement.","According to the notes, the experiment was a failure, and the alchemist disappeared.","It does say that there might have been a problem with one of the ingredients.","Maybe I can find more information in the lab."],onCompleted:e=>{e.quests.addQuest({id:I.ExploreLab,completed:!1})}}],[O.AlchemySet]:[{messages:["There’s nothing more that I can do here."],conditions:{hasItem:k.Potion}},{messages:["Now we have all of the ingredients.","Now I should be able to recreate the experiment.","According to the book..."],conditions:{hasUsedItem:k.HerbBlue},onCompleted:(e,t)=>{!function(e,t){const i=e.scene;e.inventory.removeItem(k.HerbBlue),e.setActive(!1),ae(i,500,(()=>{i.time.delayedCall(700,(()=>{var s;null==t||t.setTexture("alchemy_full"),null==(s=null==t?void 0:t.particles)||s.setConfig({...we[O.AlchemySet].particles,tint:[6684791],x:30,delay:200,stopAfter:120}).start(),re(i,1500,(()=>{e.message.setDialog({messages:["I have created the potion mentioned in the old journal.","I should bring it to the mysterious stranger to see if they know how to use it."],onCompleted:(e,t)=>{e.inventory.addItem({type:k.Potion,used:!1}),e.quests.updateExistingQuest(I.ExploreLab,!0),null==t||t.setTexture("alchemy_empty"),e.setActive(!0)}},t,"player_portrait")}))}))}))}(e,t)}},{messages:["The Blue Plumed Frond is last."],conditions:{hasItem:k.HerbBlue,hasUsedItem:k.HerbRed},onCompleted:(e,t)=>{Ho(e,t,k.HerbBlue),e.quests.updateExistingQuest(I.FindPotionIngredients,!0)}},{messages:["The Crimson Starbloom comes next."],conditions:{hasItem:k.HerbRed,hasUsedItem:k.HerbGreen},onCompleted:(e,t)=>Ho(e,t,k.HerbRed)},{messages:["The Green Writhewood goes in first."],conditions:{hasItem:k.HerbGreen},onCompleted:(e,t)=>Ho(e,t,k.HerbGreen)},{messages:["Maybe the journal has more information about using this alchemy set."],conditions:{journalEntry:C.AlchemySetFixed}},{messages:["This alchemy set looks like the one in the journal.","If I can figure out how the set connects together, I might be able to recreate the experiment."],conditions:{activeQuest:I.ExploreLab},onCompleted:e=>{he(e.scene,"PipesDialog")}},{messages:["A series of pipes and tubes. I shouldn’t touch this without knowing what it does."]}],[O.LabBookshelf1]:[{messages:['[Secrets of the Silver Transmutation]\n"Silver, the mirror of the soul, can be yielded from common materials. Begin with a lead base, cleanse it with the tears of a willow, and chant thrice under a new moon. Such processes, though fraught with danger, promise immense reward. Meticulous preparation of the material is crucial."','"Among these pages lie safeguards against volatile spirits and the precise lunar phases essential for success. Here are protective circles and counter-spells to be used should spirits prove malevolent. This knowledge has been passed down and refined for safety."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf2]:[{messages:['[Whispering Woods: A Compendium]\n"The sentient trees of Eldergrove are not myths; their trunks groan with ancient wisdom. To engage them, perform the Ritual of Leaves, using moonlit water and rare herbs, along with whispered incantations passed down by forest guardians."','"Notes on the rare Blue Moonflower, whose petals glow ghostly and unlock forest languages, are also included. Its bloom is brief, and harvesting must be timed at midnight to retain its properties. The chapter concludes with a discussion on plant symbiosis with Eldertrees."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf3]:[{messages:['[The Essence of Fire: Ignite and Control]\n"Mastering fire requires strength of will and profound respect for its power. Here, summoning circles and incantations to call forth fire spirits are detailed. Each summoning demands a tribute of phoenix ash. The endeavor is perilous, as spirits may lash out if provoked."','"The tome also discusses methods to quell flames should they rise against the summoner. Included are the chant of suppression and a dousing mixture from elemental waters and frost-bitten herbs. These countermeasures are vital for maintaining control over summoned entities."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabPotionShelf1]:[{messages:["Nightshade, wolfsbane, starvine, frost ferns... No, those are not the right ingedients.","Oh, a Crimson Starbloom! Yes, this should work!"],conditions:{activeQuest:I.FindPotionIngredients,custom:e=>!je(e,k.HerbRed)},onCompleted(e){e.inventory.addItem({type:k.HerbRed,used:!1})}},{messages:['Hm, this is an interesting collection. What’s this "Elixir of Luminescence"? Could light up some dark corners. And "Brew of Bravery"... might make me bold enough to face a dragon, or foolish enough to try. What about "Draught of the Depths"—sounds like it could show me treasures or drown me in visions. Better not risk it; these might just burn me to a crisp!'],conditions:{activeQuest:I.ExploreLab}}],[O.MansionPicture]:[{messages:[],conditions:{hasItem:k.Gear2}},{messages:["A sturdy looking safe was hidden behind the picture.","There are large rusty rings to the side, as if it they were meant to be moved."],conditions:{journalEntry:C.SafeDiscovered},onCompleted:e=>{he(e.scene,"TumblerDialog")}},{messages:["An abstract picture of blocks.","Wait a moment, something is behind this picture","[CREAK]"],onCompleted:e=>{e.journal.addEntry(C.SafeDiscovered)},conditions:{hasUsedItem:k.Potion}},{messages:["An abstract picture of blocks."]}],[O.MansionHole]:[{messages:["Literally a hole in the wall.","Huh, there is something here. It's a key!"],conditions:{hasItem:k.Key,invert:!0},onCompleted:e=>{e.inventory.addItem({type:k.Key,used:!1})}},{messages:["Literally a hole in the wall."]}]};function Ro(e,t,i){for(const s of e){const{conditions:e}=s,n=[];if(void 0!==(null==e?void 0:e.hasItem)&&n.push(je(t,e.hasItem)),void 0!==(null==e?void 0:e.hasUnusedItem)&&n.push(Ae(t,e.hasUnusedItem)),void 0!==(null==e?void 0:e.hasUsedItem)&&n.push(Ee(t,e.hasUsedItem)),void 0!==(null==e?void 0:e.completedQuest)&&n.push(ze(t,e.completedQuest)),void 0!==(null==e?void 0:e.activeQuest)&&n.push(Me(t,e.activeQuest)),void 0!==(null==e?void 0:e.journalEntry)&&n.push(De(t,e.journalEntry)),(null==e?void 0:e.custom)&&n.push(e.custom(t,i)),null==e?void 0:e.invert){if(null==e?void 0:e.or){if(n.some((e=>!e)))return s}else if(n.every((e=>!e)))return s;return}if(null==e?void 0:e.or){if(n.some((e=>e)))return s}else if(n.every((e=>e)))return s}}class Wo extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=Xn[i];super(e,n,o,r),t(this,"itemType"),t(this,"player"),t(this,"particles"),t(this,"light"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`Item-${i}`,this.itemType=i,this.player=s,this.setScale(.35).setDepth(B.Items),We(this,Xn[i])}lazyInit(e){(e||!this.initialized&&le(this,this.player))&&(je(this.player,this.itemType)?this.destroy():(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.particles=this.scene.add.particles(this.x,this.y,"warp",{scale:{start:0,end:.9},alpha:{start:.7,end:0},delay:500,lifespan:1500,maxAliveParticles:1}).setDepth(B.Items).setName(`Item-${this.itemType}-Particles`),w.debug?this.light=new ye(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2),this.initialized=!0))}onInteract(e){return e[me.Continue]?(this.scene.time.delayedCall(0,(()=>{this.player.inventory.addItem({type:this.itemType,used:!1});const e=Ro(Bo[this.itemType]||[],this.player,this);e&&(null==e?void 0:e.messages.length)>0&&this.player.message.setDialog(e,this,"player_portrait")})),this.destroy(),x.Item):x.None}destroy(e){var t,i,s;null==(t=this.particles)||t.destroy(),this.light instanceof ye?this.light.destroy():null==(s=null==(i=this.scene)?void 0:i.lights)||s.removeLight(this.light),super.destroy(e)}getButtonPrompt(){return[`Pick Up ${Xn[this.itemType].name}`,"Press [CONTINUE]"]}update(){var e,t;this.lazyInit(),null==(e=this.particles)||e.setPosition(this.x,this.y),null==(t=this.light)||t.setPosition(this.x,this.y)}}function No(e,t,i){var s,n;const o=Be(e,P.Sphinx);if(!o)return void console.error("Sphinx not found");const r=function(e,t){return Fe(e,a.GameObjects.Rectangle).find((e=>e.getData("WallType")===t))}(e,T.Sphinx);if(r){const e=(null==(s=io.find((e=>e.id===T.Sphinx)))?void 0:s.x)||0;t?r.setX(e||0):r.setX(e-150),null==(n=r.body)||n.updateFromGameObject()}Le(e,S.ForestEast,!t);const{x:l,y:h}=G[P.Sphinx],c=t?l+200:l,u=t?h-90:h;e.tweens.add({targets:o,alpha:0,duration:!t||i?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{o.setPosition(c,u)},onComplete:()=>{o.alpha=1,o.disabled=t||!1}}),e.tweens.add({targets:o.light,x:c,y:u,duration:!t||i?0:450,ease:"Power1"})}const _o={[k.HerbRed]:{texture:"alchemy_red",tint:11141120,x:-20},[k.HerbGreen]:{texture:"alchemy_green",tint:43520,x:-35},[k.HerbBlue]:{texture:"alchemy_blue",tint:170,x:-5}};function Ho(e,t,i){e.inventory.removeItem(i),e.setActive(!1),t&&t.particles&&(Uo(e),t.disabled=!0,t.particles.setConfig({...we[O.AlchemySet].particles,tint:_o[i].tint,x:_o[i].x}).start().on("complete",(()=>{t.disabled=!1,e.setActive(!0)})))}function Uo(e){const t=Re(e.scene,O.AlchemySet);t&&(t.setTexture("alchemy_empty"),Ee(e,k.HerbBlue)?t.setTexture(_o[k.HerbBlue].texture):Ee(e,k.HerbRed)?t.setTexture(_o[k.HerbRed].texture):Ee(e,k.HerbGreen)&&t.setTexture(_o[k.HerbGreen].texture))}const $o={mazeSolved:!1,mazeSeed:0,sphinxFail:!1,sphinxMoved:!1};class Vo{constructor(e,i){t(this,"scene"),t(this,"player"),t(this,"data"),this.scene=e,this.player=i,this.data={...$o}}updateData(e,t){this.data={...this.data,...e},Object.entries(e).forEach((([e,i])=>{this.handleSideEffects(e,i,t)}))}handleSideEffects(e,t,i){"sphinxMoved"===e&&No(this.scene,t,i)}}const qo="chrono-sleuth-save";var Xo=(e=>(e[e.New=0]="New",e[e.Act1=1]="Act1",e[e.Act2=2]="Act2",e[e.LabItems=3]="LabItems",e[e.Act3=4]="Act3",e))(Xo||{});const Ko={player:{x:Zn.x,y:Zn.y,flip:!1},journal:[],inventory:[],quests:[],gameState:{...$o},settings:{gamepad:[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((e=>navigator.userAgent.match(e))),debug:!1,zoomed:!0,useShader:!0,time:Date.now(),muted:!1}},Yo={...Ko.settings,gamepad:!1},Qo={0:Ko,1:{player:{x:Zn.x,y:Zn.y,flip:!1},journal:[C.FixTheClock],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!1}],quests:[{id:I.ForestGear,completed:!1},{id:I.SphinxRiddle,completed:!0}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}},2:{player:{x:-770,y:Zn.y,flip:!0},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}},3:{player:{x:-1500,y:1729,flip:!0},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear,C.AlchemyLabFound,C.AlchemySetFixed],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0},{type:k.Key,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1},{id:I.ExploreLab,completed:!1},{id:I.FindPotionIngredients,completed:!1}],gameState:{...$o},settings:{...Yo}},4:{player:{x:5073.875,y:915,flip:!1},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear,C.AlchemyLabFound,C.AlchemySetFixed,C.SafeDiscovered,C.ExtraPotionInformation,C.ClockSecondGear],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0},{type:k.Key,used:!0},{type:k.HerbRed,used:!0},{type:k.HerbGreen,used:!0},{type:k.HerbBlue,used:!0},{type:k.Potion,used:!0},{type:k.Gear2,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!0},{id:I.ExploreLab,completed:!0},{id:I.FindPotionIngredients,completed:!0}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}}};class Jo extends a.Scene{constructor(){super({key:"Boot",pack:{files:[{type:"image",key:"splash",url:"assets/splash.jpg"}]}})}init(){var e;this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.sound.pauseOnBlur=!1,e=this.sound,z=new D(e)}preload(){this.load.setPath("assets"),this.load.image("logo","logo.jpg"),this.load.font("m6x11","../m6x11.ttf","truetype"),this.load.bitmapFont("m6x11-24","fonts/m6x11-24.png","fonts/m6x11-24.xml"),this.load.svg("maximize","icons/maximize.svg",{width:64,height:64}),this.load.svg("minimize","icons/minimize.svg",{width:64,height:64}),this.load.svg("settings","icons/settings.svg",{width:64,height:64}),this.load.json("build",`../build.json?cacheBust=${Date.now()}`),w.phaserInspector&&(this.load.scripts("inspector",["https://cdn.jsdelivr.net/npm/tweakpane@3.1.10/dist/tweakpane.js","https://cdn.jsdelivr.net/npm/phaser-plugin-inspector@2.5.0/dist/phaser-plugin-inspector.umd.js"]),this.load.once("complete",(()=>{PhaserPluginInspector.Install(this.plugins)})))}create(){var e;try{const t=null==(e=this.cache.json.get("build"))?void 0:e.buildTime;if(t&&"2025-01-10T08:16:58.435Z"!==t)return this.add.text(w.width/2,w.height/2,"New version available!\nUpdating Game...",{...yn,align:"center",fontSize:48}).setOrigin(.5).postFX.addGlow(0,10),void setTimeout((()=>window.location.reload()),15e3)}catch(t){console.error(t)}w.prod&&localStorage.getItem(qo)?this.scene.start("MainMenu"):this.scene.start("Preloader")}}function Zo(e){e.load.setPath("assets"),e.load.image("train","maps/intro/train.png"),e.load.image("layer2","maps/intro/layer2.png"),e.load.image("layer3","maps/intro/layer3.png"),e.load.image("layer4","maps/intro/layer4.png"),e.load.image("layer5","maps/intro/layer5.png"),e.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),e.load.image("player_portrait","characters/player_portrait.png"),e.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),e.load.audio(E.Intro,"sounds/music/A New Day's Hurry.m4a")}class er extends a.Scene{constructor(){super("Intro"),t(this,"player"),t(this,"playerProgess",0),t(this,"direction",1),t(this,"pauseDuration",0)}preload(){Zo(this)}init(){var e,t;this.sound.mute=Qo[Xo.New].settings.muted,w.prod||(null==(e=this.input.keyboard)||e.on("keydown-BACK_SLASH",(()=>{ae(this,500,(()=>{this.textures.exists("warp")?this.scene.start("Game"):this.scene.start("Preloader")}))})),null==(t=this.input.keyboard)||t.on("keydown-R",(()=>{this.scene.restart()})))}create(){var e;z.setScene(this),z.start(E.Intro);const t=w.zoomed?.75:1;re(this,350),this.add.image(w.width,w.height,"layer5").setScale(5*t);const i=this.add.image(0,w.height,"layer4").setScale(5*t),s=this.add.image(0,w.height,"layer4").setScale(5*t),n=this.add.image(0,350*t,"layer3").setScale(2*t),o=this.add.image(0,.7*w.height,"layer2").setScale(5*t),r=w.width;this.tweens.add({targets:[i],x:{from:2.5*-r,to:0},duration:12e4,repeat:-1}),this.tweens.add({targets:[s],x:{from:0,to:2.5*r},duration:12e4,repeat:-1}),this.tweens.add({targets:n,x:{from:2*-r,to:2.75*r},duration:6e4,hold:9e4,repeat:-1}),this.tweens.add({targets:[o],x:{from:-r,to:1.5*r},duration:15e3,hold:45e3,repeat:-1});const a=this.add.container(0,w.zoomed?-35:0);this.player=this.add.sprite(560*t,w.height-250*t,"character",0).setScale(2.5*t),this.player.anims.create({key:"walk",frames:this.player.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:5,repeat:-1}),this.player.anims.play("walk"),this.player.anims.pause(),a.add(this.player),this.cameras.main.startFollow(this.player,!0,.1,.1,0,120);const l=this.add.image(w.width/2,w.height/2,"train").setScale(2*t);a.add(l),this.tweens.add({targets:a,x:a.x+1,y:a.y+5,duration:300,hold:300,ease:"Bounce",repeat:-1}),null==(e=this.add.rectangle(-w.width/2,w.height-(w.zoomed?60:35),2*w.width,35,4472896).setOrigin(0).postFX)||e.addShadow(0,0,.5,1),function(e,t){const i=w.zoomed?.75:1,s=new qn(e),n=e.add.text(w.width/2,w.height/2,"Later that day...",{...yn,fontSize:"42px"}).setOrigin(.5).setScrollFactor(0).setAlpha(0);t.setAngle(5);const o=e.add.timeline([{at:1500,tween:{targets:t,x:850*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:3100,sound:{key:"ladder",config:{rate:.6}}},{at:6e3,run:()=>ae(e,500)},{at:7500,run:()=>{const t=e.cameras.main;t.stopFollow(),t.centerOn(1e4,1e4),n.setAlpha(1),re(e,500)}},{at:1e4,run:()=>ae(e,500)},{at:12e3,run:()=>{e.textures.exists("warp")?e.scene.start("Game"):e.scene.start("Preloader")}}]),r=e.add.timeline([{at:1500,tween:{targets:t,x:1200*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:3100,sound:{key:"ladder",config:{rate:.6}}},{at:5500,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:6500,run:()=>{s.setDialog({messages:["No doubt about it, this will be a strange journey.","Whatever awaits me in this town, it’s certain that nothing will ever be the same again."],onCompleted:()=>o.play()},void 0,"player_portrait")}}]);e.add.timeline([{at:2500,tween:{targets:t,x:850*i,duration:3e3,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:4100,sound:{key:"ladder",config:{rate:.6}}},{at:7e3,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:8e3,run:()=>{t.setFlipX(!1),t.setAngle(5)}},{at:9e3,run:()=>{s.setDialog({messages:["What a beautiful mountain-scape. I almost forgot where I am headed.","It’s been three days since the letter arrived... It has been many years since I last visited that sleepy old town.","Rumors swirl of strange occurrences. People disappearing, clocks that never strike the hour, and a darkness that lingers beneath the surface."],onCompleted:()=>r.play()},void 0,"player_portrait")}}]).play()}(this,this.player)}}class tr extends ao{constructor(e,t,i){super(e,t,i,e.scale.isFullscreen?"minimize":"maximize",(()=>{e.scale.isFullscreen?e.scale.stopFullscreen():e.scale.startFullscreen()})),e.scale.on(Phaser.Scale.Events.ENTER_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("minimize")})),e.scale.on(Phaser.Scale.Events.LEAVE_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("maximize")}))}}class ir extends a.Scene{constructor(){super("MainMenu")}create(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height);const e=this.add.container(0,0);e.setAlpha(0),this.tweens.add({targets:e,alpha:1,duration:150}),e.add(this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4)),new ro(this,!0).setVisible(!1);const t=new $n(this);e.add(t);const i=new tr(this,w.width-30,30);t.addButton(i),localStorage.getItem(qo)&&t.addButton(new Hn(this,w.width-120,w.height-145,"Continue",(()=>this.scene.start("Preloader")),{align:"center"}).setFixedSize(200,70)),t.addButton(new Hn(this,w.width-120,w.height-60,"New Game",(()=>{localStorage.removeItem(qo),this.scene.start("Preloader")}),{align:"center"}).setFixedSize(200,70)),t.setActiveButton(1)}}class sr extends a.Scene{constructor(){super("Preloader"),t(this,"container")}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4);const e=.66*w.width,t=.05*w.height,i=this.add.container(.24*w.width,.86*w.height);this.container=i;const s=this.add.rectangle(0,0,e,t).setStrokeStyle(1,16777215,.85).setOrigin(0);i.add(s);const n=this.add.rectangle(3,3,0,t-6,16777215,.85).setOrigin(0);i.add(n),this.load.on("progress",(t=>{const i=w.prod?.6*t:t;n.width=(e-6)*i})),w.prod&&this.load.on("complete",(()=>{this.tweens.add({targets:n,width:e-6,duration:2e3})}));const o=this.add.image(w.width-50,w.height-60,"settings").setScale(.75);this.tweens.add({targets:o,angle:360,duration:2e3,delay:100,repeat:-1})}preload(){this.load.setPath("assets"),this.load.svg("sun","icons/sun.svg",{width:64,height:64}),this.load.svg("moon","icons/moon.svg",{width:64,height:64}),this.load.svg("zoom-in","icons/zoom-in.svg",{width:64,height:64}),this.load.svg("zoom-out","icons/zoom-out.svg",{width:64,height:64}),this.load.svg("terminal","icons/terminal.svg",{width:64,height:64}),this.load.svg("award","icons/award.svg",{width:64,height:64}),this.load.svg("tv","icons/tv.svg",{width:64,height:64}),this.load.svg("save","icons/save.svg",{width:64,height:64}),this.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),this.load.svg("volume","icons/volume-2.svg",{width:64,height:64}),this.load.svg("volume-mute","icons/volume-x.svg",{width:64,height:64}),this.load.svg("gamepad","icons/gamepad-solid.svg",{width:64,height:64}),this.load.image("town","maps/town.jpg"),this.load.image("clock_outside","maps/clock_outside.jpg"),this.load.image("clock_inner","maps/clock_inner.jpg"),this.load.image("forest","maps/forest.jpg"),this.load.image("lake","maps/lake.jpg"),this.load.image("mansion_outside","maps/mansion_outside_hatch.jpg"),this.load.image("mansion_inside","maps/mansion_inside.jpg"),this.load.image("alchemy_lab","maps/alchemy_lab.jpg"),this.load.image("library","maps/library.jpg"),this.load.image("watch","items/watch.png"),this.load.image("ladder","props/ladder.png"),this.load.image("warp","props/warp.png"),this.load.spritesheet("portal","props/portal.png",{frameWidth:140,frameHeight:120}),this.load.image("gear","items/gear.png"),this.load.image("gear2","items/gear2.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.png"),this.load.image("key","items/key.png"),this.load.image("herb_red","items/herb_red.png"),this.load.image("herb_green","items/herb_green.png"),this.load.image("herb_blue","items/herb_blue.png"),this.load.image("potion","items/potion.png"),this.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),this.load.image("player_portrait","characters/player_portrait.png"),this.load.image("inventor","characters/inventor.png"),this.load.image("inventor_portrait","characters/inventor_portrait.png"),this.load.image("stranger","characters/stranger.png"),this.load.image("stranger_portrait","characters/stranger_portrait.png"),this.load.image("sphinx","characters/sphinx.png"),this.load.image("sphinx_portrait","characters/sphinx_portrait.png"),this.load.image("mayor","characters/mayor.png"),this.load.image("mayor_portrait","characters/mayor_portrait.png"),this.load.image("clock_portrait","characters/clock_portrait.png"),this.load.image("chest","props/chest.png"),this.load.image("chest_open","props/chest_open.png"),this.load.image("book","props/book.png"),this.load.image("picture","props/picture.png"),this.load.image("safe","props/safe.png"),this.load.image("alchemy_empty","props/alchemy/alchemy_empty.png"),this.load.image("alchemy_green","props/alchemy/alchemy_green.png"),this.load.image("alchemy_red","props/alchemy/alchemy_red.png"),this.load.image("alchemy_blue","props/alchemy/alchemy_blue.png"),this.load.image("alchemy_full","props/alchemy/alchemy_full.png"),this.load.image("arrow","puzzles/arrow.png"),Array.from({length:26},((e,t)=>String.fromCharCode(97+t))).forEach((e=>this.load.audio(e,`sounds/words/${e}.mp3`))),this.load.audio("warp","sounds/sfx/warp.mp3"),this.load.audio("ladder","sounds/sfx/ladder.mp3"),this.load.audio("door","sounds/sfx/door.mp3"),this.load.audio(E.Town,"sounds/music/Unknown.m4a"),this.load.audio(E.Clock,"sounds/music/Night Time Scavenge II.m4a"),this.load.audio(E.Mansion,"sounds/music/Reflective District.m4a"),this.load.audio(E.Forest,"sounds/music/Serene.m4a"),localStorage.getItem(qo)||Zo(this)}create(){this.time.delayedCall(w.prod?2500:0,(()=>{ae(this,300,(()=>{localStorage.getItem(qo)?this.scene.start("Game"):this.scene.start("Intro")}))}))}}class nr extends a.GameObjects.Container{constructor(e,i,s){var n,o,r,l,h;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",new a.Math.Vector2),t(this,"cursor"),e.add.existing(this).setScrollFactor(0),this.activeIndex.set(-1,-1),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton({x:0,y:-1})})),null==(o=e.input.keyboard)||o.on("keydown-DOWN",(()=>{this.setActiveButton({x:0,y:1})})),null==(r=e.input.keyboard)||r.on("keydown-LEFT",(()=>{this.setActiveButton({x:-1,y:0})})),null==(l=e.input.keyboard)||l.on("keydown-RIGHT",(()=>{this.setActiveButton({x:1,y:0})})),null==(h=e.input.keyboard)||h.on("keydown-ENTER",(()=>{const e=this.getActiveButton();e&&e.onClick(e)})),e.input.on("pointermove",(()=>{this.cursor.setVisible(!1)}))}setButtons(e){this.buttons=e,this.activeIndex.set(-1,-1),this.removeAll(!0),this.cursor=this.scene.add.rectangle(0,0,60,80).setStrokeStyle(2,K(W),.75).setVisible(!1).setDepth(1),this.add(this.cursor);for(const t of e)for(const e of t)void 0!==e&&this.add(e)}getActiveButton(){var e;return null==(e=this.buttons[this.activeIndex.y])?void 0:e[this.activeIndex.x]}setActiveButton(e){var t,i,s,n,o,r,l;let{x:h,y:c}=this.activeIndex;if(!1===this.cursor.visible){const e=null==(t=this.buttons[c])?void 0:t[h];return void(e&&(this.updateButtonSize(e),this.cursor.setPosition(e.x,e.y).setVisible(!0),this.cursor.setVisible(!0)))}const u=this.buttons.length;if(c=a.Math.Clamp(c,0,u-1),h=a.Math.Clamp(h,0,((null==(i=this.buttons[c])?void 0:i.length)||0)-1),0===e.x){let t;if(-1!==this.activeIndex.y){for(;c>=0&&c=0&&h<(null==(o=this.buttons[c])?void 0:o.length)&&void 0===t;)h+=e.x,t=null==(r=this.buttons[c])?void 0:r[h];if(!t)return}const d=null==(l=this.buttons[c])?void 0:l[h];d&&(this.updateButtonSize(d),this.cursor.setPosition(d.x,d.y).setVisible(!0),this.activeIndex.set(h,c))}updateButtonSize(e){const t=1.2;e instanceof Hn&&this.cursor.setSize(e.displayWidth*t,e.displayHeight*t),e instanceof ao&&this.cursor.setSize(e.rect.displayWidth*t,e.rect.displayHeight*t)}}const or=[[1,1,1,0,1],[1,0,1,0,1],[1,1,1,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1]],rr=[["0","1","2"],["3"," ","4"],["5","6","7"]];class ar extends a.Scene{constructor(){super("UITest"),t(this,"selected"),t(this,"cursor"),t(this,"grid"),this.selected=void 0}create(){var e;const t=[];for(let i=0;i{t[0][0].text="0",t[0][1].text="1",t[0][2].text="2",t[1][0].text="3",t[1][2].text="4",t[2][0].text="5",t[2][1].text="6",t[0][4].text=" ",t[1][4].text=" ",t[2][4].text=" ",t[3][4].text=" ",t[4][4].text=" ",t[5][4].text=" ",t[6][4].text=" "}))}btn(e,t){return new Hn(this,50+60*e,50+85*t,e<3?" ":t.toString(),(e=>this.selectButton(e)))}selectButton(e){if(void 0===this.selected)this.selected=e,e.setSelected(!0);else{const t=this.selected.text;this.selected.setSelected(!1),this.selected.text=e.text,e.text=t,this.selected=void 0,this.checkValid()&&console.log("You Won!")}}checkValid(){var e;let t=!0;for(let i=0;i{const s=this.textObject.getWrappedText().length,n=i/this.textObject.height,o=Math.floor(n*s);r&&r(o)})),null==(l=e.input.keyboard)||l.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(h=e.input.keyboard)||h.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=e.add.graphics().setPosition(i,s).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=e.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(e,t){this.boxHeight=t,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,e,t);const i=this.maskGraphics.createGeometryMask();return this.textObject.setMask(i),this.textObject.setWordWrapWidth(e-8),this.textObject.setFixedSize(e-8,0),this.updateTextPosition(),this}setText(e){return this.textObject.setText(e),this.updateTextPosition(),this}handleDrag(e){e.isDown&&(this.scrollY-=e.velocity.y,this.updateTextPosition())}handleScroll(e,t,i,s,n){this.scrollY+=.5*s,this.updateTextPosition()}updateTextPosition(){const e=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=a.Math.Clamp(this.scrollY,0,e),this.textObject.y=-this.scrollY;const t=this.scrollY/e,i=this.boxHeight/this.textObject.height;this.scrollbar.height=i*this.boxHeight,this.scrollbar.setPosition(this.textObject.width+4,t*(this.boxHeight-i*this.boxHeight))}}class hr extends a.Scene{constructor(e){super(e.key),t(this,"dialogData"),t(this,"container"),t(this,"keys"),t(this,"title"),t(this,"additionalUI"),t(this,"closing"),this.dialogData=e}create(){var e,t,i;this.additionalUI=[],this.closing=!1,this.container=this.add.container(w.width/2,w.height/2),this.container.add(this.add.rectangle(0,0,.95*w.width,.95*w.height,0,.75).setStrokeStyle(4,K(W))),this.container.add(new Hn(this,.44*w.width,-.4*w.height,"X",(()=>this.close(!1)),{backgroundColor:`#${H}`})),w.prod||this.dialogData.hideCloseSuccess||this.container.add(new ao(this,.38*w.width,-.4*w.height,"award",(()=>this.startClose(!0)))),this.title=this.add.text(0,-.4*w.height,this.dialogData.title,{...yn,fontSize:48}).setOrigin(.5),this.container.add(this.title),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.startClose(!1)})),null==(t=this.input.keyboard)||t.on("keydown-BACKSPACE",(()=>{this.startClose(!1)})),w.prod||null==(i=this.input.keyboard)||i.on("keydown-BACK_SLASH",(()=>{this.startClose(!0)})),this.keys=new be(this),new ro(this,!0).setVisible(this.dialogData.gamepadVisible),this.container.setAlpha(0),this.dialogData.childScene?(this.scene.launch(this.dialogData.childScene,{parent:this}),this.scene.get(this.dialogData.childScene).events.on("create",(()=>this.fadeIn()))):this.fadeIn()}fadeIn(){this.tweens.add({targets:this.getTargets(),alpha:{start:0,to:1},delay:100,duration:500})}fadeOut(e){this.tweens.add({targets:this.getTargets(),alpha:{start:1,to:0},duration:250,hold:250,onComplete:e})}addTarget(e){e.setAlpha(0),this.additionalUI.push(e)}getTargets(){return[this.container,...this.additionalUI]}startClose(e){this.closing||(this.closing=!0,this.close(e))}close(e){this.fadeOut((()=>{var t,i,s,n;this.scene.stop(),this.dialogData.childScene&&this.scene.stop(this.dialogData.childScene),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),null==(n=null==(s=this.scene.get("Game"))?void 0:s.gamepad)||n.resetButtons(),this.handleSuccess(e)}))}}const cr="chrono-sleuth-debug-tab";function ur(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function dr(e){for(var t=1;tt+e)):Array.from(Array(e).keys())}function fr(e){return[...new Set(e)]}function mr(e,t){const i=fr(e.map((e=>e.set))).filter(Boolean),s=(n=gr(1,e.length+1),o=i,[n,o].reduce(((e,t)=>e.filter((e=>!t.includes(e)))))).sort((()=>.5-t()));var n,o;e.filter((e=>!e.set)).forEach(((e,t)=>e.set=s[t]))}function br(e,t,i=.5){yr(e).forEach(((s,n)=>{const o=e[n+1],r=s.set!==o.set,a=t()<=i;var l,h,c;r&&a&&(l=e,h=o.set,c=s.set,l.forEach((e=>{e.set===h&&(e.set=c)})),s.right=!1,o.left=!1)}))}const vr=48;class wr extends a.Scene{constructor(){super("Maze"),t(this,"parent"),t(this,"graphics"),t(this,"keys"),t(this,"maze"),t(this,"mazePlayer"),t(this,"nextUpdate")}init(e){this.parent=e.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*vr,.8*vr,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys,this.parent.addTarget(this.graphics),this.parent.addTarget(this.mazePlayer)}getMazeSeed(){return this.parent.player.gameState.data.mazeSeed||0}createMaze(){const e=this.getMazeSeed();this.maze=function(e=8,t=e,i=!0,s=1){const n=function(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}(s),o=[],r=gr(e);for(let h=0;h({x:s,y:h,top:i||h>0,left:i||s>0,bottom:i||h{mr(e,n),br(e,n),function(e,t,i){const s=Object.values(function(e){let t=fr(e.map((e=>e.set))).reduce(((e,t)=>dr(dr({},e),{},{[t]:[]})),{});return e.forEach((e=>t[e.set].push(e))),t}(e)),{ceil:n}=Math;s.forEach((e=>{(function(e,t,i){t=null==t?1:t;const s=null==e?0:e.length;if(!s||t<1)return[];t=t>s?s:t;let n=-1;const o=s-1,r=[...e];for(;++n{if(e){const i=t[e.x];e.bottom=!1,i.top=!1,i.set=e.set}}))}))}(e,o[t+1],n)}));const a=(l=o)[l.length-1];var l;return mr(a,n),br(a,n,1),o}(24,24,!0,e),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,vr,vr),this.graphics.lineStyle(3,3385907),this.maze.forEach((e=>{e.forEach((e=>{if(e.top){const t=new a.Geom.Line(e.x*vr,e.y*vr,e.x*vr+vr,e.y*vr);this.graphics.strokeLineShape(t)}if(e.bottom){const t=new a.Geom.Line(e.x*vr,e.y*vr+vr,e.x*vr+vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}if(e.left){const t=new a.Geom.Line(e.x*vr,e.y*vr,e.x*vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}if(e.right){const t=new a.Geom.Line(e.x*vr+vr,e.y*vr,e.x*vr+vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}}))})),this.cameras.main.setViewport(50,130,w.width-100,w.height-170)}update(e,t){if(e=24||n>=24)return!1;const o=a.Math.FloorTo(this.mazePlayer.x/vr),r=a.Math.FloorTo(this.mazePlayer.y/vr),l=this.maze[r][o];return!(l.top&&ithis.mazePlayer.y||l.left&&tthis.mazePlayer.x)}}class xr extends a.GameObjects.Rectangle{constructor(e,i,s){super(e,0,0,i.size,i.size),t(this,"keys"),t(this,"cursorData"),t(this,"nextUpdate",0),t(this,"position",new a.Math.Vector2(-1,-1)),e.add.group(this,{runChildUpdate:!0}),this.setStrokeStyle(2,K(W),.75),this.setVisible(!1),this.cursorData=i,this.keys=s,e.input.on("pointerdown",(e=>{this.setVisible(!1)}))}update(e,t){var i;if(ethis.resume()))),this.container.add(this.add.text(t/2,w.height/2-100,"Game Paused",{...yn,fontSize:72}).setOrigin(.5)),this.debugCount=0,this.container.add(this.add.text(t-20,i-20,`Build Time: ${new Date("2025-01-10T08:16:58.435Z").toLocaleString()}\n${w.prod?"":"Debug Mode"}`,{...yn,fontSize:16,align:"right",padding:{x:20,y:20}}).setOrigin(1,1).setInteractive({useHandCursor:!1}).on("pointerdown",(()=>{this.debugCount++,this.debugCount>10&&(localStorage.setItem("chrono-sleuth-prod",w.prod?"false":"true"),window.location.reload())})));const s=w.zoomed?36:48,n=new nr(this);this.container.add(n);const o=new ao(this,w.width-210,30,"tv",(()=>{vn()})),r=new ao(this,w.width-150,30,"gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)})),a=new ao(this,w.width-90,30,this.parent.sound.mute?"volume-mute":"volume",(()=>{const e=this.parent.sound.mute;this.parent.sound.mute=!e,a.setIcon(e?"volume":"volume-mute")})),l=new tr(this,w.width-30,30),h=new Hn(this,t/2,w.height/2,"Resume",(()=>this.resume()),{fontSize:s});let c;w.prod||(c=new ao(this,30,30,"terminal",(()=>{this.resume(),this.parent.time.delayedCall(200,(()=>{he(this.parent,"DebugTool")}))}))),n.setButtons([[c,o,r,a,l],[void 0,h,void 0,void 0,void 0],[void 0,void 0,void 0,void 0,void 0]]),n.activeIndex.set(1,1),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>this.resume())),new ro(this).setVisible(!1),this.tweens.add({targets:this.container,alpha:{start:0,to:1},duration:250})}resume(){this.tweens.add({targets:this.container,alpha:{start:1,to:0},duration:250,onComplete:()=>{this.scene.stop(),this.scene.resume("Game")}})}}class kr extends a.Scene{constructor(){super("Pipes"),t(this,"parent"),t(this,"keys"),t(this,"pipes",[]),t(this,"totalPipes",0),t(this,"images",[]),t(this,"container"),t(this,"blockSize"),t(this,"pipeSize"),t(this,"initialized",!1)}init(e){this.parent=e.parent,this.blockSize=w.zoomed?13:17,this.pipeSize=3.75*this.blockSize}preload(){this.prerenderPipes()}prerenderPipes(){for(const e of So){const t=ho[e],i=`pipe_${e}`;this.textures.exists(i)&&this.textures.remove(i);const s=this.textures.createCanvas(i,3*this.blockSize,3*this.blockSize);if(s){const e=s.context;e.fillStyle="#ffffff";for(let i=0;i{const t=this.pipes[e.y+1][e.x+1];t.interactive&&(t.rotation=(t.rotation+90)%360,this.updatePipes())}},this.keys);this.container.add(t)}createPipes(){this.pipes=[],this.container=this.add.container().setPosition(w.width/2-16*this.pipeSize/2+this.pipeSize/2,w.height/4),this.totalPipes=0;for(let e=0;e<8;e++){this.pipes[e]||(this.pipes[e]=[]);for(let t=0;t<16;t++){let i=co[e][t];const s=0===t||0===e||15===t||7===e,n=15===t&&7===e,o=!s;this.pipes[e][t]={x:t,y:e,type:i,rotation:s?0:90*a.Math.Between(0,3),interactive:o},i!==lo.Empty&&this.totalPipes++;const r=t+e*co[0].length;this.time.delayedCall(50+5*r,(()=>{const s=`pipe_${i}`,r=this.add.image(t*this.pipeSize,e*this.pipeSize,s).on("pointerdown",(()=>{this.initialized&&(this.pipes[e][t].rotation=(this.pipes[e][t].rotation+90)%360,this.updatePipes())}));r.setAlpha(0).setScale(.5).setAngle(this.pipes[e][t].rotation),this.tweens.add({targets:r,alpha:1,scale:1,duration:300,onComplete:n?()=>{this.initialized=!0,this.updatePipes()}:void 0}),o?r.setInteractive():r.setTint(6710886),this.container.add(r),this.images.push(r)}))}}this.parent.addTarget(this.container)}updatePipes(){const e=function(e){const t=[],i=new Set,s=e.length,n=e[0].length;return function o(r,a){const l=`${r},${a}`;i.add(l),t.push(e[a][r]),r+1=0&&!i.has(`${r-1},${a}`)&&uo(e[a][r],e[a][r-1])&&o(r-1,a),a+1=0&&!i.has(`${r},${a-1}`)&&uo(e[a][r],e[a-1][r])&&o(r,a-1)}(0,2),t}(this.pipes);this.pipes.forEach((e=>{e.forEach((e=>{this.images[e.x+e.y*co[0].length].setAngle(e.rotation)}))})),e.length===this.totalPipes&&this.parent.close(!0)}completed(e){const t=this.images.length,i=new a.Display.Color(255,255,255),s=Q(K(N));for(let n=0;no.setTint(e)),{duration:500,delay:10*n,hold:1e3,onComplete:n===t-1?e:void 0})}}}const Ir=w.height/(w.zoomed?4:5.5),Pr=[[1,0,1,1,0],[0,1,0,0,0],[0,0,1,0,1],[0,0,1,1,0],[1,1,0,0,1]],Tr=2*Math.PI/16;!function(e={}){const{immediate:t=!1,onNeedRefresh:i,onOfflineReady:s,onRegistered:n,onRegisteredSW:o,onRegisterError:a}=e;let l,h;h=async function(){if("serviceWorker"in navigator){if(l=await function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),o=(null==n?void 0:n.nonce)||(null==n?void 0:n.getAttribute("nonce"));s=Promise.allSettled(t.map((t=>{if(t=function(e,t){return new URL(e,t).href}(t,i),t in r)return;r[t]=!0;const s=t.endsWith(".css"),n=s?'[rel="stylesheet"]':"";if(i)for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.href===t&&(!s||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${t}"]${n}`))return;const a=document.createElement("link");return a.rel=s?"stylesheet":"modulepreload",s||(a.as="script"),a.crossOrigin="",a.href=t,o&&a.setAttribute("nonce",o),document.head.appendChild(a),s?new Promise(((e,i)=>{a.addEventListener("load",e),a.addEventListener("error",(()=>i(new Error(`Unable to preload CSS for ${t}`))))})):void 0})))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then((t=>{for(const e of t||[])"rejected"===e.status&&n(e.reason);return e().catch(n)}))}((async()=>{const{Workbox:e}=await import("./workbox-window.prod.es5-BXNXHyjv.js");return{Workbox:e}}),[],import.meta.url).then((({Workbox:e})=>new e("./sw.js",{scope:"./",type:"classic"}))).catch((e=>{null==a||a(e)})),!l)return;l.addEventListener("activated",(e=>{(e.isUpdate||e.isExternal)&&window.location.reload()})),l.addEventListener("installed",(e=>{e.isUpdate||null==s||s()})),l.register({immediate:t}).then((e=>{o?o("./sw.js",e):null==n||n(e)})).catch((e=>{null==a||a(e)}))}}()}({immediate:!0});const Cr={type:Phaser.WEBGL,width:w.width,height:w.height,parent:"game-container",backgroundColor:K(q),scale:{mode:Phaser.Scale.FIT,autoCenter:w.prod?Phaser.Scale.CENTER_BOTH:Phaser.Scale.CENTER_HORIZONTALLY},loader:{imageLoadType:"HTMLImageElement"},scene:[Jo,ir,sr,er,Ao,Sr,class extends hr{constructor(){super({key:"JournalDialog",title:"Journal",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player")}init(e){this.player=e.player}create(){var e;super.create(),this.player.journal.unread.setVisible(!1);const t=this.player.journal.journal.map((e=>`- ${Se[e].description}\n`)).reverse(),i=new lr(this,.08*w.width,.25*w.height,t,{fontSize:32});i.setBoxSize(.84*w.width,.62*w.height),this.addTarget(i),this.fadeIn(),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.close()}))}handleSuccess(){}},class extends hr{constructor(){super({key:"DebugTool",title:"Debug Tool",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player"),t(this,"tabs",[]),t(this,"tab",0),t(this,"mainContainer"),t(this,"textBox"),t(this,"helperText"),t(this,"stateContainer"),t(this,"saveContainer"),t(this,"miscContainer"),t(this,"preSave"),t(this,"testVoice",{octave:3.5,speed:1,volume:1,type:"sine"});const e=localStorage.getItem(cr);e&&(this.tab=Number(e))}init(e){this.player=e.player;const t=kn(this.player.scene);t.settings.time=0,this.preSave=JSON.stringify(t)}create(){var e;super.create(),this.mainContainer=this.add.container(-w.width/2,-w.height/2),this.container.add(this.mainContainer),this.mainContainer.add(this.add.rectangle(300,100,.65*w.width,.75*w.height,K("#112233")).setOrigin(0));const t=this.makeTab("Items",0),i=this.makeTab("Journal",1),s=this.makeTab("Quests",2),n=this.makeTab("State",3),o=this.makeTab("Warp",4),r=this.makeTab("Saves",5),a=this.makeTab("Misc",6);this.textBox=new lr(this,300,100,"",{fontSize:32},(e=>this.handleLineClick(e))).setBoxSize(.38*w.width,.75*w.height),this.mainContainer.add(this.textBox),this.helperText=this.add.text(w.zoomed?.94*w.width:.87*w.width,110,"",{...yn,fontSize:24}).setOrigin(1,0).setDepth(1),this.mainContainer.add(this.helperText),this.tabs=[t,i,s,n,o,r,a],this.container.add(this.tabs),this.createStateContainer(),this.createSaveContainer(),this.createMiscContainer(),this.updateTabs(),null==(e=this.input.keyboard)||e.on("keydown-CLOSED_BRACKET",(()=>{this.close()}))}createStateContainer(){this.stateContainer=this.add.container(310,100),this.mainContainer.add(this.stateContainer);const e=this.player.gameState.data;Object.entries(e).forEach(((t,i)=>{const[s,n]=t,o=this.add.text(0,20+40*i,`${s}: ${n}`,{...yn,fontSize:32}).setOrigin(0);switch(this.stateContainer.add(o),typeof n){case"boolean":o.setText(`${n?"[x]":"[ ]"} ${s}`),o.setInteractive().on("pointerdown",(()=>{e[s]=!e[s],o.setText(`${e[s]?"[x]":"[ ]"} ${s}`)}));break;case"number":const t=this.smallButton(o.width+20,22+40*i,"-",(()=>{e[s]--,o.setText(`${s}: ${e[s]}`)})),r=this.smallButton(o.width+55,22+40*i,"+",(()=>{e[s]++,o.setText(`${s}: ${e[s]}`)}));this.stateContainer.add([t,r])}}))}smallButton(e,t,i,s){return new Un(this,e,t,i,s,{fontSize:36,backgroundColor:"#111",padding:{x:6,y:-4}},null)}createSaveContainer(){this.saveContainer=this.add.container(310,100),this.mainContainer.add(this.saveContainer),Object.entries(Qo).forEach(((e,t)=>{const[i,s]=e,n=new Un(this,0,10+60*t,Xo[Number(i)],(()=>{Number(i)===Xo.New?(localStorage.removeItem(qo),window.location.reload()):(On(this.player.scene,s),this.player.x+=.1,this.close(!0))}),{backgroundColor:"#111"});this.saveContainer.add(n)}));const e=new Un(this,350,10,"Dump Save",(()=>{const e=(t=kn(this.player.scene),JSON.stringify(t,((e,t)=>{const i=Pn[e];return Array.isArray(t)&&i?t.map((e=>ce(e,i.enumObj,i.enumName))):i?ce(t,i.enumObj,i.enumName):t}),2).replace(/"(\w+\.\w+)"/g,"$1"));var t;navigator.clipboard.writeText(e).catch((e=>console.error(e))),console.warn("save copied to clipboard!"),console.log(e)}),{backgroundColor:"#111"});this.saveContainer.add(e)}createMiscContainer(){this.miscContainer=this.add.container(310,100),this.mainContainer.add(this.miscContainer);const e=new Un(this,350,10,"Debug Mode",(()=>{w.debug=!w.debug,this.close()}),{backgroundColor:"#111"});this.miscContainer.add(e)}makeTab(e,t){return new Un(this,40-this.container.x,100-this.container.y+60*t,e,(()=>{this.tab=t,localStorage.setItem(cr,String(t)),this.updateTabs()}))}rangeInput(e,t,i,s,n){const o=this.add.text(e,t,`${n}: ${i().toFixed(1)}`,{...yn}),r=this.smallButton(e+130,t,"-",(()=>{s(i()-.1),o.text=`${n}: ${i().toFixed(1)}`})),a=this.smallButton(e+170,t,"+",(()=>{s(i()+.1),o.text=`${n}: ${i().toFixed(1)}`}));return[o,r,a]}handleLineClick(e){var t,i;switch(this.tab){case 0:const s=go[e],n=this.player.inventory.inventory,o=n.find((e=>e.type===s));o?o.used?n.splice(n.indexOf(o),1):o.used=!o.used:this.player.inventory.addItem({type:s,used:!1},!0);break;case 1:const r=fo[e],a=this.player.journal.journal;De(this.player,r)?a.splice(a.indexOf(r),1):this.player.journal.addEntry(r,!0);break;case 2:const l=vo[e],h=this.player.quests.quests,c=h.find((e=>e.id===l));c?c.completed?h.splice(h.indexOf(c),1):c.completed=!c.completed:this.player.quests.addQuest({id:l,completed:!1},!0);break;case 4:const u=wo[e],d=Pe[u];this.player.setPosition(d.x,d.y),this.close();break;case 6:if(e>1){const s=ko[e-2];"MainMenu"===s?(this.scene.sendToBack("Game"),this.scene.start(s)):(this.scene.stop(this),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),he(this.player.scene,s))}}this.updateTabs()}updateTabs(){var e,t,i;this.tabs.forEach(((e,t)=>{e.setBackgroundColor(t===this.tab?"#123":"#151515")}));const s=0===this.tab||1===this.tab||2===this.tab||4===this.tab||6===this.tab,n=0===this.tab||2===this.tab;null==(e=this.stateContainer)||e.setVisible(3===this.tab),null==(t=this.saveContainer)||t.setVisible(5===this.tab),null==(i=this.miscContainer)||i.setVisible(6===this.tab),this.textBox.setVisible(s),this.helperText.setVisible(n);let o="";switch(this.tab){case 0:o=go.map((e=>`[${Ae(this.player,e)?"-":Ee(this.player,e)?"x":" "}] ${k[e]}`)).join("\n"),this.helperText.setText("[-] item held\n[x] item used");break;case 1:o=fo.map((e=>`[${De(this.player,e)?"x":" "}] ${C[e]}`)).join("\n");break;case 2:o=vo.map((e=>`[${Me(this.player,e)?"-":ze(this.player,e)?"x":" "}] ${I[e]}`)).join("\n"),this.helperText.setText("[-] quest active\n[x] quest complete");break;case 4:o=wo.map((e=>S[e])).join("\n");break;case 6:o=["Scenes","-----------------",...ko].join("\n")}this.textBox.setText(o)}handleSuccess(e){const t=kn(this.player.scene);t.settings.time=0,this.preSave!==JSON.stringify(t)&&(e||On(this.player.scene),this.player.scene.scene.restart())}},class extends hr{constructor(){super({key:"MazeDialog",title:"Find your way through the forest",childScene:"Maze",gamepadVisible:!0}),t(this,"player"),t(this,"arrow")}init(e){var t,i;this.player=e.player,this.dialogData.gamepadVisible=null==(i=null==(t=e.player.scene)?void 0:t.gamepad)?void 0:i.visible}create(){super.create(),this.arrow=this.add.image(.4*-w.width,.4*-w.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow)}setAngle(e){this.arrow.setRotation(e+Math.PI/2)}handleSuccess(e){e?(Oe(S.Forest,this.player),this.player.gameState.updateData({mazeSolved:!0,mazeSeed:this.player.gameState.data.mazeSeed+1},!1)):this.player.setPosition(Pe[S.TownEast].x-100,Pe[S.TownEast].y)}},wr,class extends hr{constructor(){super({key:"PipesDialog",title:"Attach all of the pipes to fix the alchemy set.\n[CONTINUE/CLICK] to rotate",gamepadVisible:!1,childScene:"Pipes"}),t(this,"player")}init(e){this.player=e.player}create(){super.create(),this.title.setFontSize(36).setAlign("center").setY(this.title.y+10)}close(e){const t=this.scene.get("Pipes");e&&t?t.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.player.message.setDialog(Fo,Re(this.player.scene,O.AlchemySet),"player_portrait")}},kr,class extends hr{constructor(){super({key:"TumblerDialog",title:"Open the lock by aligning all rings",gamepadVisible:!1}),t(this,"player"),t(this,"angles"),t(this,"rings"),t(this,"line"),t(this,"fx"),t(this,"active"),t(this,"nextUpdate"),t(this,"disabled")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=5;e++)this.load.image(`ring_${e}`,`puzzles/tumbler/ring${e}.png`)}create(){super.create(),this.angles=[],this.rings=[],this.fx=[],this.active=-1,this.nextUpdate=0,this.disabled=!1,this.line=this.add.line(0,30,27,0,216,0,K(V)).setOrigin(0,0).setLineWidth(5),this.container.add(this.line),this.container.add(this.add.text(.45*-w.width,.2*w.height,"Use [Left]/[Right]\nto select a ring\n\nUse [Up]/[Down]\nto rotate a ring",{...yn}));for(let e=0;e{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragstart",(i=>{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragend",(()=>{this.active=-1,this.updateMarkers(!0)}));this.fx.push(i.postFX.addGlow(K(V),2,0)),this.input.enableDebug(i),this.container.add(i),this.rings.push(i)}handleMove(e,t,i){var s;if(this.disabled)return;const n=this.angles[e]-t;this.angles[e]=t%(2*Math.PI),null==(s=Pr[e])||s.forEach(((t,i)=>{i!==e&&(this.angles[i]=(this.angles[i]+t*n)%(2*Math.PI))})),this.updateMarkers(i)}updateMarkers(e){let t=!0;this.angles.forEach(((e,i)=>{var s;const n=a.Math.Snap.To(e,Tr);Math.abs(n-0)<.6*Tr||Math.abs(n-2*Math.PI)<.6*Tr||(t=!1),null==(s=this.rings[i])||s.setAngle(a.Math.RadToDeg(n))})),t&&e&&this.close(!0)}completed(e){this.tweens.add({targets:this.rings,rotation:0,duration:500,onComplete:()=>{this.angles=[0,0,0,0,0],this.updateMarkers(),this.disabled=!0,this.active=-1,this.tweens.add({targets:[...this.rings,this.line],rotation:2*Math.PI,delay:500,duration:1500,hold:1e3,onComplete:e})}})}update(e,t){var i;if(!(esuper.close(e))):super.close(e)}handleSuccess(e){e&&function(e){e.inventory.removeItem(k.Potion);const t=e.scene,i=new Wo(e.scene,k.Gear2,e);t.interactiveObjects.add(i);const s=Re(t,O.MansionPicture);s&&(i.disabled=!0,i.setPosition(s.x,s.y+20),t.tweens.add({targets:i,x:s.x-10,y:s.y+120,duration:1e3,onComplete:()=>{e.message.setDialog({messages:["Wow, that was a trip","I should be more careful next time","At least I found the gear!"],onCompleted:()=>{Sn(t,!1),t.time.delayedCall(1e3,(()=>i.disabled=!1))}},s,"player_portrait")},ease:"Bounce.easeOut"}))}(this.player)}},class extends hr{constructor(){super({key:"MemoryDialog",title:"Figure out the secret code",gamepadVisible:!1}),t(this,"sequence"),t(this,"pressed"),t(this,"buttons"),t(this,"player")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=12;e++)this.load.image(`rune_${e}`,`puzzles/runes/Stone${e}.png`)}create(){for(super.create(),this.sequence=[],this.pressed=[];this.sequence.length<6;){const e=a.Math.RND.between(0,11);this.sequence.includes(e)||this.sequence.push(e)}w.prod||this.container.add(this.add.text(0,.43*w.height,`[ ${this.sequence.map((e=>e+1)).join(", ")} ]`,{fontSize:18,align:"center"}).setOrigin(.5)),this.buttons=new $n(this),this.container.add(this.buttons);const e=w.width/13*1.2,t=[];for(let s=0;s<12;s++){const i=s%3*e-e,n=1.2*-e+Math.floor(s/3)*e,o=Math.floor(s/3);void 0===t[o]&&t.push([]),t[o].push({x:i,y:n});const r=this.add.image(i,n,`rune_${s+1}`).setInteractive({useHandCursor:!0});r.on("pointerdown",(()=>this.onButtonPress(r,s))),this.buttons.add(r)}const i=new xr(this,{regions:t,size:e,keyHandler:e=>{const t=3*e.y+e.x,i=this.buttons.getAt(t);this.onButtonPress(i,t)}},this.keys);this.container.add(i)}onButtonPress(e,t){const i=this.pressed.length;this.sequence[i]===t?(this.pressed.push(t),e.disableInteractive(),J(this,new a.Display.Color(255,255,255),Q(K(U)),(t=>e.setTint(t)),{duration:250,onComplete:()=>{J(this,Q(K(U)),Q(3355443),(t=>e.setTint(t)),{duration:250,onComplete:()=>{this.sequence.length===this.pressed.length&&this.close(!0)}})}})):(e.disableInteractive(),J(this,new a.Display.Color(255,255,255),Q(K(H)),(t=>e.setTint(t)),{duration:250,yoyo:!0,onComplete:()=>{this.buttons.each((e=>{e.setInteractive(),e.setTint(16777215)}))}}),this.pressed=[])}close(e){e?this.completed((()=>super.close(e))):super.close()}completed(e){this.time.delayedCall(300,(()=>{this.buttons.getAll().forEach(((t,i)=>{const s=11===i,n=t.tint,o=Q(n),r=Q(K(U));t.disableInteractive(),t.setTint(n),J(this,o,r,(e=>t.setTint(e)),{duration:200,delay:70*i,hold:500,onComplete:s?e:void 0})}))}))}handleSuccess(e){e&&function(e){const t=e.scene,i=new Wo(t,k.Gear1,e);t.interactiveObjects.add(i);const s=Re(t,O.Chest);s&&(e.setX(s.x-100),s.setTexture("chest_open"),s.disabled=!0,i.disabled=!0,i.setPosition(s.x,s.y-20),i.setScale(.15),t.tweens.add({targets:i,scale:.35,y:s.y+20,duration:700,onComplete:()=>{s.disabled=!1,i.disabled=!1},ease:"Bounce.easeOut"}))}(this.player)}},class extends hr{constructor(){super({key:"SliderDialog",title:"Arrange the tiles to be in order.",gamepadVisible:!1}),t(this,"solution",[]),t(this,"layout",[]),t(this,"tiles",[])}preload(){this.load.setPath("assets");const e=Math.floor(1024/3);this.load.spritesheet("puzzle","puzzles/puzzle.png",{frameWidth:e,frameHeight:e})}create(){super.create();const e=[];this.solution=Array.from({length:9},((e,t)=>t)),this.layout=[...this.solution],this.tiles=[];for(let i=this.layout.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[this.layout[i],this.layout[e]]=[this.layout[e],this.layout[i]]}this.layout.forEach(((t,i)=>{const s=i%3,n=Math.floor(i/3),o=(s-1)*Ir,r=(n-1)*Ir+30;void 0===e[n]&&(e[n]=[]),e[n].push({x:o,y:r});const a=this.add.image(o,r,"puzzle",i).setOrigin(.5).setDisplaySize(.95*Ir,.95*Ir);this.container.add(a),a.setInteractive({useHandCursor:!0}),a.on("pointerdown",(()=>{this.moveTile(i)})),this.tiles.push(a)}));const t=new xr(this,{regions:e,size:1.1*Ir,keyHandler:e=>{const t=3*e.y+e.x;this.moveTile(t)}},this.keys);this.container.add(t),this.updateLayout()}moveTile(e){const t=this.layout.indexOf(8),i=t%3,s=Math.floor(t/3),n=e%3,o=Math.floor(e/3);Math.abs(i-n)+Math.abs(s-o)===1&&(this.layout[t]=this.layout[e],this.layout[e]=8,this.updateLayout()),this.layout.join("")===this.solution.join("")&&this.handleSuccess(!0)}updateLayout(){this.layout.forEach(((e,t)=>{this.tiles[t].setFrame(e),this.tiles[t].setVisible(8!=e)}))}completed(e){for(let t=0;t{t0&&this.tiles[t-1].setTint(6710886)}));this.time.delayedCall(2e3,e)}close(e){e?this.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.time.delayedCall(750,(()=>{this.close(!0)}))}},ar],pipeline:{CRTPipeline:mn,XRayPipeline:xn},input:{gamepad:!0},disableContextMenu:w.prod,physics:{default:"arcade"},fps:{panicMax:165,smoothStep:!0},render:{pixelArt:!0,antialias:!1},dom:{createContainer:!0},plugins:{scene:[{key:"PipelinePlugin",plugin:bn,mapping:"pipelinePlugin"}]}};pe.style.cursor="none",pe.addEventListener("mousemove",(function(){pe.style.cursor="default",clearTimeout(de),de=setTimeout((()=>{pe.style.cursor="none"}),2500)}));const Or=document.querySelector("#initial-loader");null==Or||Or.remove();const jr=new a.Game(Cr);w.prod&&!w.debug||function(e){jo=(()=>{const e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";const t=[];return{REVISION:17,dom:e,panels:t,addPanel:function(i){return e.appendChild(i.dom),t.push(i),i}}})(),document.body.appendChild(jo.dom);const t=jo.dom.style;t.display="flex",t.justifyContent="center",t.flexWrap="wrap",t.gap="6px",t.cursor="",t.right="0",t.top="",t.bottom="10px",t.opacity="0.7";const i=jo.addPanel(Oo("FPS","#9ad8e4","#064b62")),s=jo.addPanel(Oo("Frame Time","#f3b0c3","#6b1e3d")),n=jo.addPanel(Oo("Memory (mb)","#ffd59a","#6b3e06")),o=jo.addPanel(Oo("Render","#e9f3a3","#4c6b1a")),r=jo.addPanel(Oo("Step","#c3c3f3","#1d1d6b"));let a=0,l=0;e.events.on(Phaser.Core.Events.PRE_STEP,(()=>a=performance.now())),e.events.on(Phaser.Core.Events.POST_STEP,(()=>r.update(performance.now()-a))),e.events.on(Phaser.Core.Events.PRE_RENDER,(()=>l=performance.now())),e.events.on(Phaser.Core.Events.POST_RENDER,(()=>{const t=e.loop.deltaHistory.slice(0,10).reduce(((e,t)=>e+t),0)/10;o.update(performance.now()-l),i.update(1e3/t),s.update(performance.now()-a),performance.memory&&n.update(performance.memory.usedJSHeapSize/1048576)}))}(jr); +var e=Object.defineProperty,t=(t,i,s)=>((t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s)(t,"symbol"!=typeof i?i+"":i,s);import{r as i,g as s,c as n,a as o}from"./phaser-BZMViRUx.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const i of e)if("childList"===i.type)for(const e of i.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const r={};var a=i();const l={width:1280,height:720},h={width:960,height:540};let c=!1,u=!1,d=!1;d=!0;let p=!0;const y=localStorage.getItem("chrono-sleuth-prod");let g;null!==y&&(p="true"===y);let f=p;f=!0;let m=!1;p&&(m=!1);const{width:b,height:v}=h;p&&(c=!1,d=!1,p=!0,g=void 0,u=!1);const w={debug:c,phaserInspector:u,prod:p,bootDialog:g,useShader:!0,width:b,height:v,cameraOffset:v/3,zoomed:!0,dayMinutes:.25,rewindEnabled:!1,fastMode:d,perfTest:m};var x=(e=>(e[e.None=0]="None",e[e.Teleported=1]="Teleported",e[e.Talked=2]="Talked",e[e.Item=3]="Item",e[e.Prop=4]="Prop",e))(x||{}),S=(e=>(e[e.Underground=0]="Underground",e[e.Town=1]="Town",e[e.TownEast=2]="TownEast",e[e.Forest=3]="Forest",e[e.ForestEast=4]="ForestEast",e[e.Lake=5]="Lake",e[e.TownNorth=6]="TownNorth",e[e.ClockSquare=7]="ClockSquare",e[e.ClockSquareNorth=8]="ClockSquareNorth",e[e.ClockEntrance=9]="ClockEntrance",e[e.ClockStairs=10]="ClockStairs",e[e.ClockTop=11]="ClockTop",e[e.TownWest=12]="TownWest",e[e.MansionGrounds=13]="MansionGrounds",e[e.MansionEntrance=14]="MansionEntrance",e[e.Mansion=15]="Mansion",e[e.LabHatch=16]="LabHatch",e[e.Lab=17]="Lab",e[e.LibraryEntrance=18]="LibraryEntrance",e[e.Library=19]="Library",e))(S||{}),k=(e=>(e[e.Wrench=0]="Wrench",e[e.Gear1=1]="Gear1",e[e.Key=2]="Key",e[e.HerbRed=3]="HerbRed",e[e.HerbGreen=4]="HerbGreen",e[e.HerbBlue=5]="HerbBlue",e[e.Potion=6]="Potion",e[e.Gear2=7]="Gear2",e))(k||{}),I=(e=>(e[e.ForestGear=0]="ForestGear",e[e.SphinxRiddle=1]="SphinxRiddle",e[e.InvestigateTownWest=2]="InvestigateTownWest",e[e.ExploreLab=3]="ExploreLab",e[e.FindPotionIngredients=4]="FindPotionIngredients",e))(I||{}),P=(e=>(e[e.Inventor=0]="Inventor",e[e.Stranger=1]="Stranger",e[e.Sphinx=2]="Sphinx",e[e.Mayor=3]="Mayor",e[e.ClockTower=4]="ClockTower",e))(P||{}),T=(e=>(e[e.Sphinx=0]="Sphinx",e))(T||{}),C=(e=>(e[e.FixTheClock=0]="FixTheClock",e[e.MetTheMayor=1]="MetTheMayor",e[e.ClockFirstGear=2]="ClockFirstGear",e[e.AlchemyLabFound=3]="AlchemyLabFound",e[e.AlchemySetFixed=4]="AlchemySetFixed",e[e.ExtraPotionInformation=5]="ExtraPotionInformation",e[e.SafeDiscovered=6]="SafeDiscovered",e[e.ClockSecondGear=7]="ClockSecondGear",e))(C||{}),O=(e=>(e[e.Chest=0]="Chest",e[e.LabHatch=1]="LabHatch",e[e.LabBook=2]="LabBook",e[e.AlchemySet=3]="AlchemySet",e[e.LabBookshelf1=4]="LabBookshelf1",e[e.LabBookshelf2=5]="LabBookshelf2",e[e.LabBookshelf3=6]="LabBookshelf3",e[e.LabPotionShelf1=7]="LabPotionShelf1",e[e.MansionPicture=8]="MansionPicture",e[e.MansionHole=9]="MansionHole",e))(O||{}),j=(e=>(e[e.LabStairs=0]="LabStairs",e))(j||{}),A=(e=>(e[e.Town=0]="Town",e[e.ClockOutside=1]="ClockOutside",e[e.ClockInner=2]="ClockInner",e[e.Forest=3]="Forest",e[e.Lake=4]="Lake",e[e.MansionOutside=5]="MansionOutside",e[e.MansionInside=6]="MansionInside",e[e.AlchemyLab=7]="AlchemyLab",e[e.Library=8]="Library",e))(A||{}),E=(e=>(e.Intro="music-intro",e.Town="music-town",e.Mansion="music-mansion",e.Forest="music-forest",e.Clock="music-clock",e))(E||{});const M={[E.Intro]:{locations:[],volume:.5},[E.Town]:{locations:[A.Town],volume:.5},[E.Clock]:{locations:[A.ClockInner,A.ClockOutside],volume:.5},[E.Forest]:{locations:[A.Forest,A.Lake],volume:.5},[E.Mansion]:{locations:[A.MansionInside,A.MansionOutside,A.AlchemyLab],volume:.5}};let z;class D{constructor(e){t(this,"sound"),t(this,"music"),t(this,"volume",.5),t(this,"scene"),this.sound=e,e.on("mute",((e,t)=>{this.music&&(t?L(this.scene,this.music):F(this.scene,this.music,this.volume))})),e.once("unlocked",(()=>{this.music&&!this.music.isPlaying&&F(this.scene,this.music,this.volume)}))}start(e,t){var i,s;(null==(i=this.music)?void 0:i.key)===e&&(null==(s=this.music)?void 0:s.isPlaying)||(this.stop(),this.volume=t||M[e].volume||.5,this.music=this.sound.get(e)||this.sound.add(e,{loop:!0,volume:this.volume}),this.sound.mute||this.sound.locked||F(this.scene,this.music,this.volume))}stop(){this.music&&L(this.scene,this.music),this.music=void 0}setScene(e){this.scene=e}}function F(e,t,i=.5,s=500){e&&t&&!t.pendingRemove&&(t.play({volume:0}),e.tweens.getTweensOf(t).forEach((e=>e.stop())),e.tweens.add({targets:t,volume:i,duration:s}))}function L(e,t,i=500){e&&t.isPlaying?(e.tweens.getTweensOf(t).forEach((e=>e.stop())),e.tweens.add({targets:t,volume:0,duration:i,onComplete:()=>t.stop()})):t.stop()}var B=(e=>(e[e.Backgrounds=-1]="Backgrounds",e[e.Warpers=0]="Warpers",e[e.Npcs=1]="Npcs",e[e.Items=2]="Items",e[e.Player=3]="Player",e[e.Shader=4]="Shader",e[e.Ui=5]="Ui",e[e.Ui2=6]="Ui2",e[e.Debug=7]="Debug",e[e.Overlay=8]="Overlay",e))(B||{});const G={[P.Inventor]:{x:550,y:635,scale:.75,image:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[P.Stranger]:{x:750,y:865,scale:1.35,image:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[P.Sphinx]:{x:3520,y:790,scale:1,image:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:e=>No(e.scene,e.scene.player.gameState.data.sphinxMoved,!0),light:1.85,initializeOnStart:!0},[P.Mayor]:{x:1065,y:-340,scale:.9,image:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[P.ClockTower]:{x:880,y:-2090,scale:.5,image:"warp",portrait:"clock_portrait",name:"Clock Tower",particles:{texture:"warp",scale:{start:0,end:1.1},alpha:{start:1,end:0},lifespan:2e3,delay:1e3,maxAliveParticles:1,tint:[13067088]},onCreate:e=>{e.setOffset(150,-40)}}},R="fcfee9",W="e6c99d",N="303646",_="1c1831",H="993333",U="339933",$="ffccaa",V="335588",q="111111",X="ddaaee";function K(e){return a.Display.Color.HexStringToColor(e).color}function Y(e){return K(a.Display.Color.RGBToString(255*e.r,255*e.g,255*e.b))}function Q(e){const t=a.Display.Color.ColorToRGBA(e);return new a.Display.Color(t.r,t.g,t.b,t.a)}function J(e,t,i,s,n){const o=.3*(n.duration||100);return e.tweens.addCounter({from:0,to:o,onUpdate:e=>{const n=a.Display.Color.Interpolate.ColorWithColor(t,i,o,e.getValue());var r;s((r=n,K(a.Display.Color.RGBToString(r.r,r.g,r.b))))},...n})}const Z=1200;let ee=!1;function te(e){return Y(e.lights.ambientColor)===K(R)}function ie(e,t=!0){ee||(se(e,R,t),t?e.time.delayedCall(Z,(()=>ne(e,.5))):ne(e,.5),e.lights.lights.forEach((i=>{const s=i.intensity;t?e.tweens.add({targets:i,duration:Z,intensity:0,onComplete:()=>{i.setVisible(!1),i.setIntensity(s)}}):i.setVisible(!1)})))}function se(e,t,i){if(!i)return void e.lights.setAmbientColor(K(t));ee=!0;const s=Y(e.lights.ambientColor),n=a.Display.Color.ValueToColor(s),o=a.Display.Color.ValueToColor(t);J(e,n,o,(t=>e.lights.setAmbientColor(t)),{duration:Z,onComplete:()=>{ee=!1}})}function ne(e,t){e.children.getAll("name","DebugLightGraphics").forEach((e=>e.setAlpha(t)))}const oe=Q(K(q));function re(e,t,i){e.cameras.main.fadeIn(t,oe.red,oe.green,oe.blue,((e,t)=>{t>=1&&i&&i()}))}function ae(e,t,i){e.cameras.main.fadeOut(t,oe.red,oe.green,oe.blue,((e,t)=>{t>=1&&i&&i()}))}function le(e,t,i){return!!(t.inventory.initialized&&t.quests.initialized&&t.journal.initialized)&&a.Math.Distance.BetweenPointsSquared(e,t)<(i||1e3)**2}function he(e,t,i){var s,n;null==(s=e.gamepad)||s.setAlpha(0),null==(n=e.gamepad)||n.resetButtons(),e.scene.pause(),e.scene.launch(t,{player:e.player,...i})}function ce(e,t,i){return t&&Object.values(t).includes(e)?`${i}.${Object.keys(t).find((i=>t[i]===e))}`:e}function ue(e){return e.replace(/([A-Z]+|[0-9]+)/g," $1").trim()}let de;const pe=document.documentElement;class ye extends a.GameObjects.GameObject{constructor(e,i,s,n,o,r){super(e,"DebugLight"),t(this,"x"),t(this,"y"),t(this,"light"),t(this,"debug"),e.add.existing(this),this.light=e.lights.addLight(i,s,n,o,r),this.debug=e.add.graphics({x:i,y:s}).setDepth(B.Debug),this.debug.lineStyle(3,65280),this.debug.name="DebugLightGraphics",this.x=i,this.y=s,w.debug&&this.debug.strokeCircle(0,0,n)}setPosition(e,t){this.light.setPosition(e,t),this.debug.setPosition(e,t),this.x=e,this.y=t}destroy(e){var t,i;super.destroy(e),this.debug.destroy(),null==(i=null==(t=this.scene)?void 0:t.lights)||i.removeLight(this.light)}}const ge=2*Math.PI;class fe extends a.GameObjects.Graphics{constructor(e,i){super(e),t(this,"player"),t(this,"angle1",0),t(this,"angle2",1),t(this,"angle3",4),t(this,"update1",!1),t(this,"update2",!1),t(this,"update3",!1),this.name="ClockHands",e.add.existing(this),this.player=i,this.setPosition(842,-2107),this.setDepth(B.Npcs),this.updateHands()}update(e){if(this.scene.cameras.main.worldView.contains(this.x,this.y))this.setVisible(!1);else{this.setVisible(!0),this.update1&&(this.angle1=ge*(e/6e4)*35),this.update2&&(this.angle2=ge*(e/36e5)*35),this.update3&&(this.angle3=ge*(e/432e5)*35),this.clear(),this.fillStyle(K("#224477")),this.fillCircle(0,0,6),[8,6].forEach((e=>{this.lineStyle(e,K(6===e?"#224477":_)),this.lineBetween(0,0,50*Math.cos(this.angle1),50*Math.sin(this.angle1)),this.lineBetween(0,0,40*Math.cos(this.angle2),40*Math.sin(this.angle2)),this.lineBetween(0,0,25*Math.cos(this.angle3),25*Math.sin(this.angle3))})),this.lineStyle(5,K(_));for(let e=0;e<12;e++){const t=ge*(e/12),i=50*Math.cos(t),s=50*Math.sin(t);this.lineBetween(i,s,1.5*i,1.5*s)}}}updateHands(){De(this.player,C.ClockFirstGear)&&(this.update1=!0),De(this.player,C.ClockSecondGear)&&(this.update2=!0)}}var me=(e=>(e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right",e[e.Continue=4]="Continue",e[e.Back=5]="Back",e[e.Shift=6]="Shift",e))(me||{});class be{constructor(e){t(this,"scene"),t(this,"keys",Object.keys(me).map(Number).reduce(((e,t)=>({...e,[t]:!1})),{})),this.scene=e,this.listener(2,"LEFT"),this.listener(3,"RIGHT"),this.listener(0,"UP"),this.listener(1,"DOWN"),this.listener(0,"W"),this.listener(2,"A"),this.listener(1,"S"),this.listener(3,"D"),this.listener(4,"SPACE"),this.listener(4,"ENTER"),this.listener(5,"BACKSPACE"),this.listener(6,"SHIFT")}listener(e,t){var i,s;null==(i=this.scene.input.keyboard)||i.on(`keydown-${t}`,(()=>this.keys[e]=!0)),null==(s=this.scene.input.keyboard)||s.on(`keyup-${t}`,(()=>this.keys[e]=!1))}resetKeys(){Object.entries(this.keys).forEach((([e,t])=>this.keys[Number(e)]=!1))}}class ve extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=G[i];super(e,n,o,r),t(this,"npcType"),t(this,"player"),t(this,"light"),t(this,"particles"),t(this,"lastPos",new a.Math.Vector2),t(this,"clock"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`NPC-${i}`,this.npcType=i,this.player=s,this.setDepth(B.Npcs),"warp"===r&&this.setAlpha(0),We(this,G[i])}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const{x:t,y:i,light:s,particles:n,onCreate:o}=G[this.npcType],r=s||1,a=!te(this.scene);w.debug?(this.light=new ye(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,r),this.light.light.setVisible(a)):(this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,r),this.light.setVisible(a)),n&&(this.particles=this.scene.add.particles(t,i,"",n).setName(`NPC-${this.npcType}-Particles`)),this.npcType===P.ClockTower&&(this.clock=new fe(this.scene,this.player)),o&&o(this),this.initialized=!0}update(e,t){this.lazyInit(),!this.light||this.x===this.lastPos.x&&this.y===this.lastPos.y||this.light.setPosition(this.x,this.y),this.lastPos.set(this.x,this.y),this.clock&&this.clock.update(e)}onInteract(e){if(this.player.message.visible||Date.now()0){const t=G[this.npcType].portrait.length>0;return this.player.message.setDialog(e,t?this:void 0),x.Talked}}return x.None}getButtonPrompt(){return this.npcType===P.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${G[this.npcType].name}`,"Press [CONTINUE]"]}}const we={[O.Chest]:{x:5110,y:915,image:"chest",scale:{x:4.5,y:3}},[O.LabHatch]:{x:-1910,y:640},[O.LabBook]:{x:-700,y:1630,image:"book"},[O.AlchemySet]:{x:-2650,y:1600,image:"alchemy_empty",initializeOnStart:!0,skipLighting:!0,particles:{scale:{min:.05,max:.15},speed:{min:30,max:120},alpha:{values:[0,.5,0]},gravityY:100,lifespan:{min:250,max:500},emitting:!1,stopAfter:60}},[O.LabBookshelf1]:{x:-2025,y:1700},[O.LabBookshelf2]:{x:-1290,y:1700},[O.LabBookshelf3]:{x:-1115,y:1700},[O.LabPotionShelf1]:{x:-1790,y:1700},[O.MansionPicture]:{x:-1233,y:-580,scale:1.2,angle:5,image:"picture",origin:{x:0,y:0},initializeOnStart:!0,skipLighting:!0},[O.MansionHole]:{x:-1870,y:-490}};class xe extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=we[i];super(e,n,o,r||""),t(this,"propType"),t(this,"player"),t(this,"particles"),t(this,"initialized",!1),t(this,"disabled",!1),this.name=`Prop-${i}`,this.propType=i,this.player=s,this.setScale(r?.35:2).setDepth(B.Items),r||w.debug||this.setAlpha(0),We(this,we[i]),i===O.MansionPicture&&this.resetPostPipeline()}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;if(this.checkDestroyed())return;this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0});const t=we[this.propType].particles;t&&(this.particles=this.scene.add.particles(this.x,this.y,"warp",t).setDepth(B.Items).setName(`Prop-${this.propType}-Particles`)),this.propType===O.MansionPicture&&this.scene.add.image(this.x,this.y,"safe").setOrigin(0,0).setScale(.9).setName("Prop-Safe"),this.initialized=!0}onInteract(e){if(this.player.message.visible||Date.now()0)return this.player.message.setDialog(e,this,we[this.propType].portrait||"player_portrait"),x.Prop}return x.None}checkDestroyed(){let e=!1;return this.propType===O.LabHatch&&De(this.player,C.AlchemyLabFound)&&(e=!0),this.propType===O.Chest&&je(this.player,k.Gear1)&&(e=!0),e&&this.destroy(),e}getButtonPrompt(){const e=Ro(Go[this.propType]||[],this.player,this);let t=O[this.propType];return t=ue(t),this.propType===O.MansionPicture&&De(this.player,C.SafeDiscovered)&&(t="Safe"),e&&(null==e?void 0:e.messages.length)>0?[`Inspect ${t}`,"Press [CONTINUE]"]:""}update(){this.lazyInit()}}const Se={[C.FixTheClock]:{description:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it."},[C.MetTheMayor]:{description:"I have met the mayor of the town. She told me about the old clock tower. I should see if I can use the gear I found to try and fix it.",warpAdd:S.ClockSquareNorth},[C.ClockFirstGear]:{description:"I found the first gear for the clock tower and placed it into the clock face. I still need two more gears to fix it."},[C.AlchemyLabFound]:{description:"I found a secret alchemy lab. I wonder what the previous alchemist was brewing up.",warpAdd:S.LabHatch},[C.AlchemySetFixed]:{description:"With the alchemy set fixed, I can now attempt to create the brew mentioned in the old journal."},[C.ExtraPotionInformation]:{description:'I found an extra journal entry with more information on the potion. It stated the name of the potion was the "Exlixir of Sight". This potion must be the key to finding a gear.'},[C.SafeDiscovered]:{description:"I discovered a safe in the abandonded mansion. I wonder what secrets it holds."},[C.ClockSecondGear]:{description:"I found the second gear for the clock tower inside a safe, which was located within the abandoned mansion. I still need one more gear to fix it."}},ke={[I.ForestGear]:{description:"Find the gear in the forest",warpAdd:S.TownEast,warpComplete:S.TownNorth},[I.SphinxRiddle]:{description:"Solve the Sphinx riddle"},[I.InvestigateTownWest]:{description:"Investigate the west side of town",warpAdd:S.TownWest},[I.ExploreLab]:{description:"Explore the hidden alchemy lab"},[I.FindPotionIngredients]:{description:"Find the 3 potion ingredients"}};var Ie=(e=>(e[e.Ladder=0]="Ladder",e[e.Warp=1]="Warp",e[e.Invisible=2]="Invisible",e[e.WarpLocked=3]="WarpLocked",e[e.InvisibleLocked=4]="InvisibleLocked",e))(Ie||{});const Pe={[S.Town]:{x:300,y:650,key:me.Down,warpTo:S.Underground,visual:0},[S.Underground]:{x:301,y:875,key:me.Up,warpTo:S.Town,visual:0},[S.TownEast]:{x:1720,y:650,key:me.Right,warpTo:S.Forest,visual:3},[S.Forest]:{x:2650,y:815,key:me.Left,warpTo:S.TownEast,visual:1},[S.TownNorth]:{x:775,y:650,key:me.Up,warpTo:S.ClockSquare,visual:3},[S.ClockSquare]:{x:610,y:-330,key:me.Left,warpTo:S.TownNorth,visual:1},[S.ClockSquareNorth]:{x:915,y:-330,key:me.Up,warpTo:S.ClockEntrance,visual:3},[S.ClockEntrance]:{x:690,y:-1320,range:15,key:me.Left,warpTo:S.ClockSquareNorth,visual:1,skipLighting:!0},[S.ClockStairs]:{x:910,y:-1400,range:20,key:me.Right,warpTo:S.ClockTop,visual:2,sound:"ladder"},[S.ClockTop]:{x:780,y:-1970,range:10,key:me.Left,warpTo:S.ClockStairs,visual:2,sound:"ladder"},[S.ForestEast]:{x:3590,y:815,key:me.Right,warpTo:S.Lake,visual:3,initializeOnStart:!0},[S.Lake]:{x:4625,y:915,key:me.Left,warpTo:S.ForestEast,visual:1},[S.TownWest]:{x:90,y:650,key:me.Left,warpTo:S.MansionGrounds,visual:3},[S.MansionGrounds]:{x:-620,y:640,key:me.Right,warpTo:S.TownWest,visual:1},[S.MansionEntrance]:{x:-1290,y:640,key:me.Up,warpTo:S.Mansion,visual:1,sound:"door"},[S.Mansion]:{x:-1405,y:-420,key:me.Down,warpTo:S.MansionEntrance,visual:2},[S.LabHatch]:{x:-1920,y:640,key:me.Down,warpTo:S.Lab,visual:4},[S.Lab]:{x:-1380,y:1545,key:me.Right,warpTo:S.LabHatch,visual:2,range:15,skipLighting:!0},[S.LibraryEntrance]:{x:1420,y:650,key:me.Up,warpTo:S.Library,visual:3},[S.Library]:{x:1730,y:-120,key:me.Left,warpTo:S.LibraryEntrance,visual:1}},Te=[];Object.values(ke).forEach((e=>{e.warpAdd&&Te.push(e.warpAdd),e.warpComplete&&Te.push(e.warpComplete)})),Object.values(Se).forEach((e=>{e.warpAdd&&Te.push(e.warpAdd)}));class Ce extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,visual:r,range:a}=Pe[i];super(e,n,o,r===Ie.Ladder?"ladder":"warp"),t(this,"warpType"),t(this,"player"),t(this,"locked"),t(this,"graphics"),t(this,"portal1"),t(this,"portal2"),t(this,"range"),t(this,"initialized",!1),this.name=`Warp-${i}`,this.warpType=i,this.player=s,this.range=a||30,this.setScale(.6).setDepth(B.Warpers),r!==Ie.Warp&&r!==Ie.WarpLocked||(this.setScale(.6,1),this.setPosition(n,o-12)),w.debug||(this.updateLocked(r===Ie.WarpLocked||r===Ie.InvisibleLocked),r!==Ie.Invisible&&r!==Ie.InvisibleLocked||this.setAlpha(0)),We(this,Pe[i]),Te.includes(i)&&e.add.existing(this)}lazyInit(e){(e||!this.initialized&&le(this,this.player))&&(Te.includes(this.warpType)||this.scene.add.existing(this),this.scene.physics.add.existing(this),this.createParticles(),this.createDebug(),this.warpType===S.Underground&&this.createLadder(),this.hasExtendedBounds()&&this.body&&this.setBodySize(this.body.width*(this.range/30*4),this.body.height),this.updateLocked(),this.initialized=!0)}createParticles(){const{visual:e,skipLighting:t}=Pe[this.warpType];e!==Ie.Warp&&e!==Ie.WarpLocked||(this.setAlpha(.1),this.scene.anims.exists("portal")||this.scene.anims.create({key:"portal",frames:this.scene.anims.generateFrameNumbers("portal",{start:0,end:63}),frameRate:10,repeat:-1}),this.portal1=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.45,1).setAlpha(.9).play("portal").setName(`${this.name}-1`),this.portal1.postFX.addPixelate(1),this.portal1.postFX.addShadow(0,0,.1,1,3355562,6,.5),this.portal2=this.scene.add.sprite(this.x,this.y,"portal_0").setScale(.35,1).setAlpha(.65).setFlipX(!0).setName(`${this.name}-2`),this.portal2.postFX.addPixelate(1),this.portal2.play("portal"),this.portal2.setFrame(Math.floor(30*Math.random())),t||(this.portal1.setPipeline("Light2D"),this.portal2.setPipeline("Light2D")),this.portal1.setPostPipeline("XRayPipeline"),this.portal2.setPostPipeline("XRayPipeline"))}createDebug(){if(w.debug&&(this.setInteractive({draggable:!0}),this.graphics=this.scene.add.graphics(),this.hasExtendedBounds())){this.graphics.lineStyle(2,16711935).setPosition(this.x,this.y);const e=this.body;this.graphics.lineBetween(-this.range,-e.halfHeight,-this.range,e.halfHeight),this.graphics.lineBetween(this.range,-e.halfHeight,this.range,e.halfHeight),this.graphics.strokeCircle(0,0,5)}}createLadder(){this.scene.add.image(this.x,this.y-60,"ladder").setScale(.6).setDepth(B.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder1"),this.scene.add.image(this.x,this.y-105,"ladder").setScale(.6).setDepth(B.Warpers).setPipeline("Light2D").setPostPipeline("XRayPipeline").setName("Ladder2")}hasExtendedBounds(){const{visual:e,key:t}=Pe[this.warpType];return!(e!==Ie.Warp&&e!==Ie.WarpLocked&&e!==Ie.Invisible||t!==me.Left&&t!==me.Right)}onInteract(e){const t=!this.hasExtendedBounds()||Math.abs(this.player.x-this.x){t>=1&&l.time.delayedCall(300,(()=>l.cameras.main.fadeIn(1e3,0,0,0)))})),l.cameras.main.stopFollow(),l.tweens.add({targets:l.cameras.main,scrollX:h,scrollY:c-w.cameraOffset,duration:600,delay:100,ease:"Power1",onComplete:()=>{l.cameras.main.startFollow(t,!0),l.cameras.main.setFollowOffset(0,w.cameraOffset)}}),t.setActive(!1),t.buttonPrompt.setVisible(!1),l.tweens.add({targets:t,alpha:0,duration:500,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{t.setPosition(n,o),t.previousPosition.set(n,o)},onComplete:()=>{t.alpha=1,t.setActive(!0)}}),l.tweens.add({targets:t.light,intensity:0,duration:50,hold:600,yoyo:!0,repeat:0});const d=t.light instanceof a.GameObjects.Light?t.light:t.light.light;l.tweens.add({targets:d,x:n,y:o,duration:400,ease:"Power1"})}function je(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t))}function Ae(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&!e.used))}function Ee(e,t){return void 0!==e.inventory.inventory.find((e=>e.type===t&&e.used))}function Me(e,t){return e.quests.quests.some((e=>e.id===t&&!e.completed))}function ze(e,t){return e.quests.quests.some((e=>e.id===t&&e.completed))}function De(e,t){return e.journal.journal.includes(t)}function Fe(e,t){return e.children.getAll().filter((e=>e instanceof t))}function Le(e,t,i){const s=function(e,t){return Fe(e,Ce).find((e=>e.warpType===t))}(e,t);s&&s.updateLocked(i)}function Be(e,t){return Fe(e,ve).find((e=>e.npcType===t))}function Ge(e,t){return Fe(e,Wo).find((e=>e.itemType===t))}function Re(e,t){return Fe(e,xe).find((e=>e.propType===t))}function We(e,t){const{scale:i,alpha:s,angle:n,depth:o,skipLighting:r,origin:a,initializeOnStart:l}=t;i&&("object"==typeof i?e.setScale(i.x,i.y):e.setScale(i)),s&&e.setAlpha(s),n&&e.setAngle(n),o&&e.setDepth(o),a&&e.setOrigin(a.x,a.y),r||e.setPipeline("Light2D"),e.setPostPipeline("XRayPipeline"),l&&e.lazyInit(!0)}var Ne,_e,He,Ue,$e,Ve,qe,Xe,Ke,Ye,Qe,Je,Ze,et,tt,it,st,nt,ot,rt,at,lt,ht,ct,ut,dt,pt,yt,gt,ft,mt,bt,vt,wt,xt,St,kt,It,Pt,Tt,Ct,Ot,jt,At;function Et(){if(_e)return Ne;_e=1;var e=Object.prototype.toString;return Ne=function(t){var i=e.call(t),s="[object Arguments]"===i;return s||(s="[object Array]"!==i&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===e.call(t.callee)),s}}function Mt(){if(Ve)return $e;Ve=1;var e=Array.prototype.slice,t=Et(),i=Object.keys,s=i?function(e){return i(e)}:function(){if(Ue)return He;var e;if(Ue=1,!Object.keys){var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Et(),n=Object.prototype.propertyIsEnumerable,o=!n.call({toString:null},"toString"),r=n.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{l(window[e])}catch(i){return!0}}catch(i){return!0}return!1}();e=function(e){var n=null!==e&&"object"==typeof e,h="[object Function]"===i.call(e),u=s(e),d=n&&"[object String]"===i.call(e),p=[];if(!n&&!h&&!u)throw new TypeError("Object.keys called on a non-object");var y=r&&h;if(d&&e.length>0&&!t.call(e,0))for(var g=0;g0)for(var f=0;f1&&"boolean"!=typeof t)throw new r('"allowMissing" argument must be a boolean');if(null===O(/^%?[^%]*%?$/,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(e){var t=C(e,0,1),i=C(e,-1);if("%"===t&&"%"!==i)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var s=[];return T(e,j,(function(e,t,i,n){s[s.length]=i?T(n,A,"$1"):t||e})),s}(e),s=i.length>0?i[0]:"",n=E("%"+s+"%",t),a=n.name,l=n.value,h=!1,u=n.alias;u&&(s=u[0],P(i,I([0,1],u)));for(var d=1,p=!0;d=i.length){var m=c(l,y);l=(p=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:l[y]}else p=k(l,y),l=l[y];p&&!h&&(b[a]=l)}}return l},vt}function Vt(){if(St)return xt;St=1;var e=$t()("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return xt=e}function qt(){if(It)return kt;It=1;var e=$t()("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch(t){e=null}return kt=e}function Xt(){if(Tt)return Pt;Tt=1;var e=Vt(),t=Bt(),i=Gt(),s=qt();return Pt=function(n,o,r){if(!n||"object"!=typeof n&&"function"!=typeof n)throw new i("`obj` must be an object or a function`");if("string"!=typeof o&&"symbol"!=typeof o)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new i("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],u=!!s&&s(n,o);if(e)e(n,o,{configurable:null===h&&u?u.configurable:!h,enumerable:null===a&&u?u.enumerable:!a,value:r,writable:null===l&&u?u.writable:!l});else{if(!c&&(a||l||h))throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");n[o]=r}},Pt}function Kt(){if(Ot)return Ct;Ot=1;var e=Vt(),t=function(){return!!e};return t.hasArrayLengthDefineBug=function(){if(!e)return null;try{return 1!==e([],"length",{value:1}).length}catch(t){return!0}},Ct=t}function Yt(){if(At)return jt;At=1;var e=Mt(),t="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),i=Object.prototype.toString,s=Array.prototype.concat,n=Xt(),o=Kt()(),r=function(e,t,s,r){if(t in e)if(!0===r){if(e[t]===s)return}else if("function"!=typeof(a=r)||"[object Function]"!==i.call(a)||!r())return;var a;o?n(e,t,s,!0):n(e,t,s)},a=function(i,n){var o=arguments.length>2?arguments[2]:{},a=e(n);t&&(a=s.call(a,Object.getOwnPropertySymbols(n)));for(var l=0;l4294967295||o(r)!==r)throw new n("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&s){var c=s(e,"length");c&&!c.configurable&&(l=!1),c&&!c.writable&&(h=!1)}return(l||h||!a)&&(i?t(e,"length",r,!0,!0):t(e,"length",r)),e},Qt}function Ii(){return Zt||(Zt=1,function(e){var t=Ht(),i=$t(),s=ki(),n=Gt(),o=i("%Function.prototype.apply%"),r=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||t.call(r,o),l=Vt(),h=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new n("a function is required");var i=a(t,r,arguments);return s(i,1+h(0,e.length-(arguments.length-1)),!0)};var c=function(){return a(t,o,arguments)};l?l(e.exports,"apply",{value:c}):e.exports.apply=c}(Si)),Si.exports}function Pi(){if(ti)return ei;ti=1;var e=$t(),t=Ii(),i=t(e("String.prototype.indexOf"));return ei=function(s,n){var o=e(s,!!n);return"function"==typeof o&&i(s,".prototype.")>-1?t(o):o}}function Ti(){if(si)return ii;si=1;var e=Mt(),t=Wt()(),i=Pi(),s=Object,n=i("Array.prototype.push"),o=i("Object.prototype.propertyIsEnumerable"),r=t?Object.getOwnPropertySymbols:null;return ii=function(i,a){if(null==i)throw new TypeError("target must be an object");var l=s(i);if(1===arguments.length)return l;for(var h=1;h2&&!!arguments[2]&&!i||(t?e(n,"name",o,!0,!0):e(n,"name",o)),n},di}(),t=Gt(),i=Object;return yi=e((function(){if(null==this||this!==i(this))throw new t("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e}),"get flags",!0)}function ji(){if(mi)return fi;mi=1;var e=Oi(),t=Yt().supportsDescriptors,i=Object.getOwnPropertyDescriptor;return fi=function(){if(t&&"gim"===/a/gim.flags){var s=i(RegExp.prototype,"flags");if(s&&"function"==typeof s.get&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(o,"sticky",{get:function(){n+="y"}}),s.get.call(o),"dy"===n)return s.get}}return e}}var Ai,Ei,Mi,zi,Di={exports:{}};function Fi(){if(Ei)return Ai;Ei=1;var e=Wt();return Ai=function(){return e()&&!!Symbol.toStringTag}}function Li(){if(zi)return Mi;zi=1;var e=Fi()(),t=Pi()("Object.prototype.toString"),i=function(i){return!(e&&i&&"object"==typeof i&&Symbol.toStringTag in i)&&"[object Arguments]"===t(i)},s=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==t(e)&&"[object Function]"===t(e.callee)},n=function(){return i(arguments)}();return i.isLegacyArguments=s,Mi=n?i:s}const Bi=s(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Gi,Ri,Wi,Ni,_i,Hi,Ui,$i,Vi,qi,Xi,Ki,Yi,Qi,Ji,Zi,es,ts,is,ss,ns,os,rs,as,ls,hs,cs,us,ds,ps,ys,gs,fs,ms,bs,vs,ws;function xs(){if(Ri)return Gi;Ri=1;var e="function"==typeof Map&&Map.prototype,t=Object.getOwnPropertyDescriptor&&e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,i=e&&t&&"function"==typeof t.get?t.get:null,s=e&&Map.prototype.forEach,o="function"==typeof Set&&Set.prototype,r=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=o&&r&&"function"==typeof r.get?r.get:null,l=o&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,c="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,u="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,d=Boolean.prototype.valueOf,p=Object.prototype.toString,y=Function.prototype.toString,g=String.prototype.match,f=String.prototype.slice,m=String.prototype.replace,b=String.prototype.toUpperCase,v=String.prototype.toLowerCase,w=RegExp.prototype.test,x=Array.prototype.concat,S=Array.prototype.join,k=Array.prototype.slice,I=Math.floor,P="function"==typeof BigInt?BigInt.prototype.valueOf:null,T=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,O="function"==typeof Symbol&&"object"==typeof Symbol.iterator,j="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,A=Object.prototype.propertyIsEnumerable,E=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function M(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||w.call(/e/,t))return t;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var s=e<0?-I(-e):I(e);if(s!==e){var n=String(s),o=f.call(t,n.length+1);return m.call(n,i,"$&_")+"."+m.call(m.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return m.call(t,i,"$&_")}var z=Bi,D=z.custom,F=_(D)?D:null,L={__proto__:null,double:'"',single:"'"},B={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function G(e,t,i){var s=i.quoteStyle||t,n=L[s];return n+e+n}function R(e){return m.call(String(e),/"/g,""")}function W(e){return!("[object Array]"!==$(e)||j&&"object"==typeof e&&j in e)}function N(e){return!("[object RegExp]"!==$(e)||j&&"object"==typeof e&&j in e)}function _(e){if(O)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!C)return!1;try{return C.call(e),!0}catch(t){}return!1}Gi=function e(t,o,r,p){var b=o||{};if(U(b,"quoteStyle")&&!U(L,b.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(U(b,"maxStringLength")&&("number"==typeof b.maxStringLength?b.maxStringLength<0&&b.maxStringLength!==1/0:null!==b.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var w=!U(b,"customInspect")||b.customInspect;if("boolean"!=typeof w&&"symbol"!==w)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(U(b,"indent")&&null!==b.indent&&"\t"!==b.indent&&!(parseInt(b.indent,10)===b.indent&&b.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(U(b,"numericSeparator")&&"boolean"!=typeof b.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var I=b.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return q(t,b);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var T=String(t);return I?M(t,T):T}if("bigint"==typeof t){var D=String(t)+"n";return I?M(t,D):D}var B=void 0===b.depth?5:b.depth;if(void 0===r&&(r=0),r>=B&&B>0&&"object"==typeof t)return W(t)?"[Array]":"[Object]";var H,X=function(e,t){var i;if("\t"===e.indent)i="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;i=S.call(Array(e.indent+1)," ")}return{base:i,prev:S.call(Array(t+1),i)}}(b,r);if(void 0===p)p=[];else if(V(p,t)>=0)return"[Circular]";function ee(t,i,s){if(i&&(p=k.call(p)).push(i),s){var n={depth:b.depth};return U(b,"quoteStyle")&&(n.quoteStyle=b.quoteStyle),e(t,n,r+1,p)}return e(t,b,r+1,p)}if("function"==typeof t&&!N(t)){var te=function(e){if(e.name)return e.name;var t=g.call(y.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),ie=Z(t,ee);return"[Function"+(te?": "+te:" (anonymous)")+"]"+(ie.length>0?" { "+S.call(ie,", ")+" }":"")}if(_(t)){var se=O?m.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(t);return"object"!=typeof t||O?se:K(se)}if((H=t)&&"object"==typeof H&&("undefined"!=typeof HTMLElement&&H instanceof HTMLElement||"string"==typeof H.nodeName&&"function"==typeof H.getAttribute)){for(var ne="<"+v.call(String(t.nodeName)),oe=t.attributes||[],re=0;re"}if(W(t)){if(0===t.length)return"[]";var ae=Z(t,ee);return X&&!function(e){for(var t=0;t=0)return!1;return!0}(ae)?"["+J(ae,X)+"]":"[ "+S.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==$(e)||j&&"object"==typeof e&&j in e)}(t)){var le=Z(t,ee);return"cause"in Error.prototype||!("cause"in t)||A.call(t,"cause")?0===le.length?"["+String(t)+"]":"{ ["+String(t)+"] "+S.call(le,", ")+" }":"{ ["+String(t)+"] "+S.call(x.call("[cause]: "+ee(t.cause),le),", ")+" }"}if("object"==typeof t&&w){if(F&&"function"==typeof t[F]&&z)return z(t,{depth:B-r});if("symbol"!==w&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!i||!e||"object"!=typeof e)return!1;try{i.call(e);try{a.call(e)}catch(ne){return!0}return e instanceof Map}catch(t){}return!1}(t)){var he=[];return s&&s.call(t,(function(e,i){he.push(ee(i,t,!0)+" => "+ee(e,t))})),Q("Map",i.call(t),he,X)}if(function(e){if(!a||!e||"object"!=typeof e)return!1;try{a.call(e);try{i.call(e)}catch(t){return!0}return e instanceof Set}catch(s){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e){ce.push(ee(e,t))})),Q("Set",a.call(t),ce,X)}if(function(e){if(!h||!e||"object"!=typeof e)return!1;try{h.call(e,h);try{c.call(e,c)}catch(ne){return!0}return e instanceof WeakMap}catch(t){}return!1}(t))return Y("WeakMap");if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e,c);try{h.call(e,h)}catch(ne){return!0}return e instanceof WeakSet}catch(t){}return!1}(t))return Y("WeakSet");if(function(e){if(!u||!e||"object"!=typeof e)return!1;try{return u.call(e),!0}catch(t){}return!1}(t))return Y("WeakRef");if(function(e){return!("[object Number]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(ee(Number(t)));if(function(e){if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(t){}return!1}(t))return K(ee(P.call(t)));if(function(e){return!("[object Boolean]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(d.call(t));if(function(e){return!("[object String]"!==$(e)||j&&"object"==typeof e&&j in e)}(t))return K(ee(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==n&&t===n)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==$(e)||j&&"object"==typeof e&&j in e)}(t)&&!N(t)){var ue=Z(t,ee),de=E?E(t)===Object.prototype:t instanceof Object||t.constructor===Object,pe=t instanceof Object?"":"null prototype",ye=!de&&j&&Object(t)===t&&j in t?f.call($(t),8,-1):pe?"Object":"",ge=(de||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ye||pe?"["+S.call(x.call([],ye||[],pe||[]),": ")+"] ":"");return 0===ue.length?ge+"{}":X?ge+"{"+J(ue,X)+"}":ge+"{ "+S.call(ue,", ")+" }"}return String(t)};var H=Object.prototype.hasOwnProperty||function(e){return e in this};function U(e,t){return H.call(e,t)}function $(e){return p.call(e)}function V(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0,s=e.length;it.maxStringLength){var i=e.length-t.maxStringLength,s="... "+i+" more character"+(i>1?"s":"");return q(f.call(e,0,t.maxStringLength),t)+s}var n=B[t.quoteStyle||"single"];return n.lastIndex=0,G(m.call(m.call(e,n,"\\$1"),/[\x00-\x1f]/g,X),"single",t)}function X(e){var t=e.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return i?"\\"+i:"\\x"+(t<16?"0":"")+b.call(t.toString(16))}function K(e){return"Object("+e+")"}function Y(e){return e+" { ? }"}function Q(e,t,i,s){return e+" ("+t+") {"+(s?J(i,s):S.call(i,", "))+"}"}function J(e,t){if(0===e.length)return"";var i="\n"+t.prev+t.base;return i+S.call(e,","+i)+"\n"+t.prev}function Z(e,t){var i=W(e),s=[];if(i){s.length=e.length;for(var n=0;n=e.length;return s||(i=e[t],t+=1),{done:s,value:i}}}},p=function(t,i){if(s(t)||e(t))return d(t);if(n(t)){var o=0;return{next:function(){var e=function(e,t){if(t+1>=e.length)return t+1;var i=c(e,t);if(i<55296||i>56319)return t+1;var s=c(e,t+1);return s<56320||s>57343?t+1:t+2}(t,o),i=u(t,o,e);return o=e,{done:e>t.length,value:i}}}}return i&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(r||a){var y=Ps(),g=Ts(),f=l("Map.prototype.forEach",!0),m=l("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var b=l("Map.prototype.iterator",!0),v=l("Set.prototype.iterator",!0);var w=l("Map.prototype.@@iterator",!0)||l("Map.prototype._es6-shim iterator_",!0),x=l("Set.prototype.@@iterator",!0)||l("Set.prototype._es6-shim iterator_",!0);Di.exports=function(e){return function(e){if(y(e)){if(b)return t(b(e));if(w)return w(e);if(f){var i=[];return f(e,(function(e,t){h(i,[t,e])})),d(i)}}if(g(e)){if(v)return t(v(e));if(x)return x(e);if(m){var s=[];return m(e,(function(e){h(s,e)})),d(s)}}}(e)||p(e)}}else Di.exports=function(e){if(null!=e)return p(e,!0)}}return Di.exports}function Os(){if(is)return ts;is=1;var e=function(e){return e!=e};return ts=function(t,i){return 0===t&&0===i?1/t==1/i:t===i||!(!e(t)||!e(i))}}function js(){if(ns)return ss;ns=1;var e=Os();return ss=function(){return"function"==typeof Object.is?Object.is:e}}function As(){if(cs)return hs;cs=1;var e=Ii(),t=Pi(),i=$t()("%ArrayBuffer%",!0),s=t("ArrayBuffer.prototype.byteLength",!0),n=t("Object.prototype.toString"),o=!!i&&!s&&new i(0).slice,r=!!o&&e(o);return hs=s||r?function(e){if(!e||"object"!=typeof e)return!1;try{return s?s(e):r(e,0),!0}catch(t){return!1}}:i?function(e){return"[object ArrayBuffer]"===n(e)}:function(e){return!1}}function Es(){if(fs)return gs;fs=1;var e=Pi()("SharedArrayBuffer.prototype.byteLength",!0);return gs=e?function(t){if(!t||"object"!=typeof t)return!1;try{return e(t),!0}catch(i){return!1}}:function(e){return!1}}var Ms,zs={exports:{}};var Ds,Fs,Ls,Bs,Gs,Rs,Ws,Ns={exports:{}};var _s,Hs,Us,$s,Vs,qs,Xs,Ks,Ys,Qs,Js,Zs,en,tn,sn,nn,on,rn={exports:{}};function an(){if(_s)return rn.exports;_s=1;var e=$t(),t=Pi(),i=e("%WeakSet%",!0),s=t("WeakSet.prototype.has",!0);if(s){var n=t("WeakMap.prototype.has",!0);rn.exports=function(e){if(!e||"object"!=typeof e)return!1;try{if(s(e,s),n)try{n(e,n)}catch(t){return!0}return e instanceof i}catch(t){}return!1}}else rn.exports=function(e){return!1};return rn.exports}function ln(){if(Us)return Hs;Us=1;var e=Ps(),t=Ts(),i=function(){if(Ws)return Rs;Ws=1;var e,t="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,i="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;t||(e=function(e){return!1});var s=t?t.prototype.has:null,n=i?i.prototype.has:null;return e||s||(e=function(e){return!1}),Rs=e||function(e){if(!e||"object"!=typeof e)return!1;try{if(s.call(e,s),n)try{n.call(e,n)}catch(i){return!0}return e instanceof t}catch(i){}return!1}}(),s=an();return Hs=function(n){if(n&&"object"==typeof n){if(e(n))return"Map";if(t(n))return"Set";if(i(n))return"WeakMap";if(s(n))return"WeakSet"}return!1}}function hn(){return Ys?Ks:(Ys=1,Ks=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"])}function cn(){if(Js)return Qs;Js=1;var e=hn(),t="undefined"==typeof globalThis?n:globalThis;return Qs=function(){for(var i=[],s=0;s=3&&(r=o),"[object Array]"===t.call(s)?function(e,t,s){for(var n=0,o=e.length;n-1?i:"Object"===i&&function(t){var i=!1;return e(p,(function(e,s){if(!i)try{e(t),i=c(s,1)}catch(n){}})),i}(t)}return o?function(t){var i=!1;return e(p,(function(e,s){if(!i)try{"$"+e(t)===s&&(i=c(s,1))}catch(n){}})),i}(t):null}}function dn(){if(sn)return tn;sn=1;var e=Pi()("ArrayBuffer.prototype.byteLength",!0),t=As();return tn=function(i){return t(i)?e?e(i):i.byteLength:NaN}}const pn=o(function(){if(on)return nn;on=1;var e=function(){if(hi)return li;hi=1;var e=Yt(),t=Ii(),i=Ti(),s=Ci(),n=function(){if(ai)return ri;ai=1;var e=Yt(),t=Ci();return ri=function(){var i=t();return e(Object,{assign:i},{assign:function(){return Object.assign!==i}}),i}}(),o=t.apply(s()),r=function(e,t){return o(Object,arguments)};return e(r,{getPolyfill:s,implementation:i,shim:n}),li=r}(),t=Pi(),i=function(){if(xi)return wi;xi=1;var e=Yt(),t=Ii(),i=Oi(),s=ji(),n=function(){if(vi)return bi;vi=1;var e=Yt().supportsDescriptors,t=ji(),i=Object.getOwnPropertyDescriptor,s=Object.defineProperty,n=TypeError,o=Object.getPrototypeOf,r=/a/;return bi=function(){if(!e||!o)throw new n("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=t(),l=o(r),h=i(l,"flags");return h&&h.get===a||s(l,"flags",{configurable:!0,enumerable:!1,get:a}),a}}(),o=t(s());return e(o,{getPolyfill:s,implementation:i,shim:n}),wi=o}(),s=$t(),n=Cs(),o=Ss(),r=function(){if(ls)return as;ls=1;var e=Yt(),t=Ii(),i=Os(),s=js(),n=function(){if(rs)return os;rs=1;var e=js(),t=Yt();return os=function(){var i=e();return t(Object,{is:i},{is:function(){return Object.is!==i}}),i}}(),o=t(s(),Object);return e(o,{getPolyfill:s,implementation:i,shim:n}),as=o}(),a=Li(),l=ks(),h=As(),c=function(){if(ds)return us;ds=1;var e=Date.prototype.getDay,t=Object.prototype.toString,i=Fi()();return us=function(s){return"object"==typeof s&&null!==s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Date]"===t.call(s))}}(),u=function(){if(ys)return ps;ys=1;var e,t,i,s,n=Pi(),o=Fi()();if(o){e=n("Object.prototype.hasOwnProperty"),t=n("RegExp.prototype.exec"),i={};var r=function(){throw i};s={toString:r,valueOf:r},"symbol"==typeof Symbol.toPrimitive&&(s[Symbol.toPrimitive]=r)}var a=n("Object.prototype.toString"),l=Object.getOwnPropertyDescriptor;return ps=o?function(n){if(!n||"object"!=typeof n)return!1;var o=l(n,"lastIndex");if(!o||!e(o,"value"))return!1;try{t(n,s)}catch(r){return r===i}}:function(e){return!(!e||"object"!=typeof e&&"function"!=typeof e)&&"[object RegExp]"===a(e)}}(),d=Es(),p=Mt(),y=function(){if(Gs)return Bs;Gs=1;var e=Is(),t=function(){if(bs)return ms;bs=1;var e=Number.prototype.toString,t=Object.prototype.toString,i=Fi()();return ms=function(s){return"number"==typeof s||"object"==typeof s&&(i?function(t){try{return e.call(t),!0}catch(i){return!1}}(s):"[object Number]"===t.call(s))}}(),i=function(){if(ws)return vs;ws=1;var e=Pi(),t=e("Boolean.prototype.toString"),i=e("Object.prototype.toString"),s=Fi()();return vs=function(e){return"boolean"==typeof e||null!==e&&"object"==typeof e&&(s&&Symbol.toStringTag in e?function(e){try{return t(e),!0}catch(i){return!1}}(e):"[object Boolean]"===i(e))}}(),s=function(){if(Ms)return zs.exports;Ms=1;var e=Object.prototype.toString;if(Nt()()){var t=Symbol.prototype.toString,i=/^Symbol\(.*\)$/;zs.exports=function(s){if("symbol"==typeof s)return!0;if("[object Symbol]"!==e.call(s))return!1;try{return function(e){return"symbol"==typeof e.valueOf()&&i.test(t.call(e))}(s)}catch(n){return!1}}}else zs.exports=function(e){return!1};return zs.exports}(),n=function(){if(Ls)return Ns.exports;if(Ls=1,function(){if(Fs)return Ds;Fs=1;var e="undefined"!=typeof BigInt&&BigInt;return Ds=function(){return"function"==typeof e&&"function"==typeof BigInt&&"bigint"==typeof e(42)&&"bigint"==typeof BigInt(42)}}()()){var e=BigInt.prototype.valueOf;Ns.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!=typeof t&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return e.call(t),!0}catch(i){}return!1}(t))}}else Ns.exports=function(e){return!1};return Ns.exports}();return Bs=function(o){return null==o||"object"!=typeof o&&"function"!=typeof o?null:e(o)?"String":t(o)?"Number":i(o)?"Boolean":s(o)?"Symbol":n(o)?"BigInt":void 0}}(),g=ln(),f=un(),m=dn(),b=t("SharedArrayBuffer.prototype.byteLength",!0),v=t("Date.prototype.getTime"),w=Object.getPrototypeOf,x=t("Object.prototype.toString"),S=s("%Set%",!0),k=t("Map.prototype.has",!0),I=t("Map.prototype.get",!0),P=t("Map.prototype.size",!0),T=t("Set.prototype.add",!0),C=t("Set.prototype.delete",!0),O=t("Set.prototype.has",!0),j=t("Set.prototype.size",!0);function A(e,t,i,s){for(var o,r=n(e);(o=r.next())&&!o.done;)if(F(t,o.value,i,s))return C(e,o.value),!0;return!1}function E(e){return void 0===e?null:"object"!=typeof e?"symbol"!=typeof e&&("string"!=typeof e&&"number"!=typeof e||+e==+e):void 0}function M(t,i,s,n,o,r){var a=E(s);if(null!=a)return a;var l=I(i,a),h=e({},o,{strict:!1});return!(void 0===l&&!k(i,a)||!F(n,l,h,r))&&!k(t,a)&&F(n,l,h,r)}function z(e,t,i){var s=E(i);return null!=s?s:O(t,s)&&!O(e,s)}function D(e,t,i,s,o,r){for(var a,l,h=n(e);(a=h.next())&&!a.done;)if(F(i,l=a.value,o,r)&&F(s,I(t,l),o,r))return C(e,l),!0;return!1}function F(t,s,o,C){var E=o||{};if(E.strict?r(t,s):t===s)return!0;if(y(t)!==y(s))return!1;if(!t||!s||"object"!=typeof t&&"object"!=typeof s)return E.strict?r(t,s):t==s;var B,G=C.has(t),R=C.has(s);if(G&&R){if(C.get(t)===C.get(s))return!0}else B={};return G||C.set(t,B),R||C.set(s,B),function(t,s,o,r){var y,C;if(typeof t!=typeof s)return!1;if(null==t||null==s)return!1;if(x(t)!==x(s))return!1;if(a(t)!==a(s))return!1;if(l(t)!==l(s))return!1;var E=t instanceof Error,B=s instanceof Error;if(E!==B)return!1;if((E||B)&&(t.name!==s.name||t.message!==s.message))return!1;var G=u(t),R=u(s);if(G!==R)return!1;if((G||R)&&(t.source!==s.source||i(t)!==i(s)))return!1;var W=c(t),N=c(s);if(W!==N)return!1;if((W||N)&&v(t)!==v(s))return!1;if(o.strict&&w&&w(t)!==w(s))return!1;var _=f(t),H=f(s);if(_!==H)return!1;if(_||H){if(t.length!==s.length)return!1;for(y=0;y=0;y--)if(Y[y]!=Q[y])return!1;for(y=Y.length-1;y>=0;y--)if(!F(t[C=Y[y]],s[C],o,r))return!1;var J=g(t),Z=g(s);return J===Z&&("Set"===J||"Set"===Z?function(e,t,i,s){if(j(e)!==j(t))return!1;for(var o,r,a,l=n(e),h=n(t);(o=l.next())&&!o.done;)if(o.value&&"object"==typeof o.value)a||(a=new S),T(a,o.value);else if(!O(t,o.value)){if(i.strict)return!1;if(!z(e,t,o.value))return!1;a||(a=new S),T(a,o.value)}if(a){for(;(r=h.next())&&!r.done;)if(r.value&&"object"==typeof r.value){if(!A(a,r.value,i.strict,s))return!1}else if(!i.strict&&!O(e,r.value)&&!A(a,r.value,i.strict,s))return!1;return 0===j(a)}return!0}(t,s,o,r):"Map"!==J||function(t,i,s,o){if(P(t)!==P(i))return!1;for(var r,a,l,h,c,u,d=n(t),p=n(i);(r=d.next())&&!r.done;)if(h=r.value[0],c=r.value[1],h&&"object"==typeof h)l||(l=new S),T(l,h);else if(void 0===(u=I(i,h))&&!k(i,h)||!F(c,u,s,o)){if(s.strict)return!1;if(!M(t,i,h,c,s,o))return!1;l||(l=new S),T(l,h)}if(l){for(;(a=p.next())&&!a.done;)if(h=a.value[0],u=a.value[1],h&&"object"==typeof h){if(!D(l,t,h,u,s,o))return!1}else if(!(s.strict||t.has(h)&&F(I(t,h),u,s,o)||D(l,t,h,u,e({},s,{strict:!1}),o)))return!1;return 0===j(l)}return!0}(t,s,o,r))}(t,s,E,C)}function L(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0]||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}return nn=function(e,t,i){return F(e,t,i,o())}}()),yn={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${R}`};class gn extends a.GameObjects.Text{constructor(e,t,i=3500,s=N){const n=Fe(e,gn).reduce(((e,t)=>Math.max(e,t.y-20)),0)+65;super(e,20,n,t,{...yn,backgroundColor:"#"+s,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(B.Overlay).setScrollFactor(0),e.add.existing(this),e.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:i,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}let fn=1;class mn extends a.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,renderTarget:!0,fragShader:"precision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\n// slight modifications made to original shader\n// use alpha channel for fragColor + changed uniform names\n\n// original shader from: https://www.shadertoy.com/view/WsVSzV\n// tips for chromatic aberration: https://lettier.github.io/3d-game-shaders-for-beginners/chromatic-aberration.html\n\nfloat warp = 0.35; // simulate curvature of CRT monitor (larger number = more curvature)\nfloat scan = 0.75; // simulate darkness between scanlines\nfloat scanSize = 0.75; // size of scanlines [0.0 - 2.0] (smaller number = taller scanlines)\n\nfloat chromaticAberration = 0.25 * uAlpha;\nfloat redOffset = 0.006 * chromaticAberration;\nfloat greenOffset = 0.003 * chromaticAberration;\nfloat blueOffset = -0.003 * chromaticAberration;\n\nvec4 mainImage(in vec2 fragCoord, in vec2 uv) {\n if (uAlpha <= 0.0) {\n return texture2D(uMainSampler, uv);\n }\n\n // squared distance from center\n vec2 dc = abs(0.5-uv);\n dc *= dc;\n\n // warp the fragment coordinates\n uv.x -= 0.5; uv.x *= 1.0+(dc.y*(0.3*warp)); uv.x += 0.5;\n uv.y -= 0.5; uv.y *= 1.0+(dc.x*(0.4*warp)); uv.y += 0.5;\n\n vec2 chromaticOffset = vec2((abs(0.5-uv) + 0.5) * 2.);\n\n vec4 color;\n color.r = texture2D(uMainSampler,uv + vec2(redOffset * chromaticOffset)).r;\n color.g = texture2D(uMainSampler,uv + vec2(greenOffset * chromaticOffset)).g;\n color.b = texture2D(uMainSampler,uv + vec2(blueOffset * chromaticOffset)).b;\n color.a = texture2D(uMainSampler,uv).a;\n\n // sample inside boundaries, otherwise set to black\n if (uv.y > 1.0 || uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0) {\n return vec4(0.0);\n } else {\n // determine if we are drawing in a scanline\n float apply = abs(sin(fragCoord.y * scanSize)*0.5*scan);\n\n apply = uAlpha * apply;\n\n // sample the texture\n return vec4(mix(color.rgb,vec3(0.0), apply), color.a);\n }\n}\n\nvoid main(void) {\n gl_FragColor = mainImage(gl_FragCoord.xy, outTexCoord);\n}"})}onPreRender(){this.set1f("uAlpha",fn)}}class bn extends a.Plugins.ScenePlugin{boot(){var e;null==(e=this.systems)||e.events.on("start",this.applyPipeline,this);const{save:t}=In();vn(t.settings.useShader)}applyPipeline(){var e,t;null==(e=this.scene)||e.cameras.main.setPostPipeline("CRTPipeline"),(null==(t=this.scene)?void 0:t.cameras.main.getPostPipeline(mn)).bootFX()}}function vn(e){w.useShader=void 0!==e?e:!w.useShader,fn=w.useShader?1:0}let wn=0;class xn extends a.Renderer.WebGL.Pipelines.PostFXPipeline{constructor(e){super({game:e,fragShader:"precision mediump float;\n\nuniform float uAlpha;\nuniform sampler2D uMainSampler;\n\nvarying vec2 outTexCoord;\n\nvoid main(void)\n{\n vec4 baseColor = vec4(texture2D(uMainSampler, outTexCoord).rgba);\n vec4 newColor = baseColor;\n newColor.g *= 1.25;\n newColor.r *= 2.5;\n newColor.b *= 3.;\n\n gl_FragColor = mix(baseColor, newColor, uAlpha);\n}"})}onPreRender(){this.set1f("uAlpha",wn)}}function Sn(e,t){wn!==(t?.85:0)&&e.tweens.addCounter({from:wn,to:t?.85:0,onUpdate:e=>{wn=e.getValue()},duration:t?2500:1500,ease:t?"Bounce":void 0})}function kn(e){return{player:{x:e.player.x,y:e.player.y,flip:e.player.flipX},journal:e.player.journal.journal.sort(),inventory:e.player.inventory.inventory.sort(((e,t)=>e.type-t.type)),quests:e.player.quests.quests.sort(((e,t)=>e.id-t.id)),gameState:e.player.gameState.data,settings:{gamepad:e.gamepad.visible,debug:w.debug,zoomed:w.zoomed,useShader:w.useShader,time:Date.now(),muted:e.sound.mute}}}function In(){const e=localStorage.getItem(qo);let t,i;try{e&&(t=JSON.parse(e))}catch(s){console.error(s),i=s}return{save:t||Qo[Xo.New],error:i,newGame:!t}}const Pn={journal:{enumObj:C,enumName:"JournalEntry"},inventory:{enumObj:k,enumName:"ItemType"},type:{enumObj:k,enumName:"ItemType"},quests:{enumObj:I,enumName:"QuestType"},id:{enumObj:I,enumName:"QuestType"}};function Tn(e,t){const i={...w};return w.debug=e.settings.debug,w.zoomed=e.settings.zoomed,w.useShader=e.settings.useShader,vn(w.useShader),Sn(t,!1),w.zoomed!==i.zoomed?(function(e,t){const i=t?h:l;w.zoomed=t,w.width=i.width,w.height=i.height,w.cameraOffset=i.height/3,e.scale.setGameSize(i.width,i.height),e.scene.restart()}(t,w.zoomed),!0):w.debug!==i.debug&&(t.scene.restart(),!0)}function Cn(e){const{save:t,error:i,newGame:s}=In();i&&new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4);try{Tn(t,e),e.sound.mute=t.settings.muted,e.player.setX(t.player.x),e.player.setY(t.player.y),e.player.previousPosition.set(t.player.x+(t.player.flip?1:-1),t.player.y),e.time.delayedCall(50,(()=>{try{e.player.inventory.createUI(),e.player.quests.createUI(),e.player.journal.createUI(),s&&function(e){e.player.active=!1,e.time.delayedCall(1500,(()=>{e.player.message.setDialog({messages:["Now that I have arrived in town, I should talk to the townsfolk about the strange occurrences.","Maybe someone has seen something that could help me start my investigation."],onCompleted:()=>{e.player.active=!0}},void 0,"player_portrait")}))}(e),t.inventory.sort(((e,t)=>e.type-t.type)).forEach((t=>e.player.inventory.addItem(t,!0))),t.journal.sort().reverse().forEach((t=>e.player.journal.addEntry(t,!0))),t.quests.sort(((e,t)=>e.id-t.id)).forEach((t=>e.player.quests.addQuest(t,!0))),e.player.gameState.updateData(t.gameState,!0)}catch(i){console.error(i),new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,H),On(e,Qo[Xo.New]),Cn(e)}})),e.gamepad.setVisible(t.settings.gamepad);const i=pn(t,Qo[Xo.New])?"[New]":"[Storage]";w.prod||e.time.delayedCall(200,(()=>{new gn(e,`Game Loaded ${w.prod?"":i}`)})),pn(t,Qo[Xo.New])&&On(e,void 0,!0)}catch(n){console.error(n),new gn(e,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4,H),On(e,Qo[Xo.New]),Cn(e)}}function On(e,t,i){const s=kn(e);localStorage.setItem(qo,JSON.stringify(t||s)),i||e.tweens.add({targets:e.saveIcon,alpha:.7,scale:.6,duration:500,hold:250,yoyo:!0,onComplete:()=>e.saveIcon.setAlpha(0)})}function jn(e){w.prod&&On(e)}class An extends a.GameObjects.Container{constructor(e,i){var s;super(e,0,0),t(this,"text"),t(this,"rect"),t(this,"player"),t(this,"activeElement"),t(this,"outline"),t(this,"scene"),t(this,"dayNight",!1),t(this,"xray",!1),this.scene=e,this.player=i,e.physics.world.drawDebug=w.debug,w.debug?e.physics.world.createDebugGraphic():null==(s=e.physics.world.debugGraphic)||s.clear(),this.createEventListeners(),w.debug&&(this.setScrollFactor(0).setDepth(B.Debug).setAlpha(.8),this.scene.add.existing(this),this.rect=e.add.rectangle(0,0,0,0,K(_)).setOrigin(0).setDepth(B.Debug),this.add(this.rect),this.text=e.add.bitmapText(20,90,"m6x11-24",""),this.add(this.text),this.outline=e.add.rectangle(0,0,0,0).setStrokeStyle(2,65280).setScale(1.1).setDepth(B.Debug))}createEventListeners(){var e,t,i,s,n,o,r,a,l,h;null==(e=this.scene.input.keyboard)||e.on("keydown-K",(()=>{On(this.scene)})),null==(t=this.scene.input.keyboard)||t.on("keydown-L",(()=>{this.scene.scene.restart()})),null==(i=this.scene.input.keyboard)||i.on("keydown-M",(()=>{On(this.scene,Qo[Xo.Act2]),this.scene.scene.restart()})),null==(s=this.scene.input.keyboard)||s.on("keydown-N",(()=>{localStorage.removeItem(qo),this.scene.scene.start("Preloader")})),null==(n=this.scene.input.keyboard)||n.on("keydown-Z",(()=>{w.debug=!w.debug,On(this.scene),this.scene.scene.restart()})),null==(o=this.scene.input.keyboard)||o.on("keydown-FORWARD_SLASH",(()=>{var e;te(e=this.scene)?function(e,t=!0){ee||(se(e,V,t),ne(e,1),e.lights.lights.forEach((i=>{const s=i.intensity;i.setVisible(!0),t&&(i.setIntensity(0),e.tweens.add({targets:i,duration:Z,intensity:s}))})))}(e):ie(e)})),null==(r=this.scene.input.keyboard)||r.on("keydown-CLOSED_BRACKET",(()=>{he(this.scene,"DebugTool")})),null==(a=this.scene.input.keyboard)||a.on("keydown-QUOTES",(()=>{Sn(this.scene,!this.xray),this.xray=!this.xray})),w.debug&&(null==(l=this.scene.input.keyboard)||l.on("keydown-COMMA",(()=>{const e=this.scene.lights.lights;console.table(e,["x","y"])})),null==(h=this.scene.input.keyboard)||h.on("keydown-PERIOD",(()=>{const e=this.scene.input.activePointer;new ye(this.scene,e.worldX,e.worldY,100,K($),1)})),this.scene.input.on("gameobjectdown",((e,t)=>{1===e.buttons&&(t!==this.activeElement?this.activeElement=t:this.activeElement=void 0)})),this.scene.input.on("drag",((e,t)=>{this.activeElement===t&&t.setPosition(e.worldX,e.worldY)})),this.scene.input.on("wheel",((e,t,i,s,n)=>{this.scene.cameras.main.zoom=Math.max(.01,this.scene.cameras.main.zoom+5e-4*s)})),this.scene.input.on("pointerup",(e=>{1===e.button&&(this.scene.cameras.main.zoom=1)})))}update(){if(!w.debug)return;const e=this.scene.input.activePointer,t=[`FPS (now): ${(1e3/this.scene.game.loop.delta).toFixed(1)}`,`FPS (avg): ${this.scene.game.loop.actualFps.toFixed(1)}`,`Frame Time: ${this.scene.game.loop.delta.toFixed(2)}`,`Zoom: ${this.scene.cameras.main.zoom.toFixed(2)}`,"",`Player x: ${this.player.x.toFixed(1)}`,`Player y: ${this.player.y.toFixed(1)}`,"",`Mouse x: ${e.worldX.toFixed(1)}`,`Mouse y: ${e.worldY.toFixed(1)}`];if(this.activeElement&&(t.push(""),t.push(`Active x: ${this.activeElement.x.toFixed(1)}`),t.push(`Active y: ${this.activeElement.y.toFixed(1)}`)),this.text.setText(t),this.rect.setPosition(this.text.x-10,this.text.y-10).setSize(this.text.displayWidth+20,this.text.displayHeight+20),this.activeElement){this.outline.setPosition(this.activeElement.x,this.activeElement.y),this.outline.setSize(this.activeElement.displayWidth,this.activeElement.displayHeight),this.outline.setOrigin(this.activeElement.originX,this.activeElement.originY);const e=this.activeElement.body;(e&&e instanceof a.Physics.Arcade.Body||e instanceof a.Physics.Arcade.StaticBody)&&e.updateFromGameObject()}else this.outline.setSize(0,0)}}class En extends a.Physics.Arcade.Image{constructor(e,i,s){var n;const{x:o,y:r,image:l,scale:h}=i;super(e,o,r,l),t(this,"player"),t(this,"initialized",!1),t(this,"info"),t(this,"center"),t(this,"bounds"),this.name=`Background-${i.image}`,this.info=i,this.player=s,this.setOrigin(0).setDepth(B.Backgrounds),We(this,i);const c=null==(n=e.textures.get(l))?void 0:n.getSourceImage();this.center=new a.Math.Vector2(o+c.width*(h||1)/2,r+c.height*((h||1)/2)),w.debug&&e.add.rectangle(this.center.x,this.center.y,c.width,c.height).setStrokeStyle(10,26214).setOrigin(.5)}lazyInit(e){(e||!this.initialized&&le(this.center,this.player,2e3))&&(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.bounds=this.getBounds(),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0)}update(){var e,t;if(this.lazyInit(),null==(e=this.bounds)?void 0:e.contains(this.player.x,this.player.y)){const e=Object.entries(M).find((([e,t])=>t.locations.includes(this.info.location)));e&&(null==(t=z.music)?void 0:t.key)!==e[0]&&z.start(e[0])}}}function Mn(){return Math.random()-.5}w.dayMinutes,a.GameObjects.Container;const zn=[3200,600],Dn=[5350,690],Fn=[500,200,100,50,10];class Ln extends a.GameObjects.GameObject{constructor(e,i,s,n=40,o=[1400,600]){super(e,"fireflies"),t(this,"scene"),t(this,"center",new a.Math.Vector2(0,0)),t(this,"lights",[]),t(this,"count"),t(this,"centers",[]),t(this,"bounds",[1e3,400]),t(this,"biases",[]),t(this,"initialized",!1),t(this,"debug"),e.add.existing(this),this.scene=e,this.count=n,this.bounds=o,this.setPosition(i,s)}setPosition(e,t){this.center.set(e,t),this.centers=[];for(let i=0;ie.visible=!1));const i=e/1e3*.025,s=Math.cos(i),n=Math.sin(i);this.lights.forEach(((e,t)=>{const o=this.biases[t],r=Math.cos(70*i+o[10]);e.visible=!0,e.intensity=Math.min(.05+Math.abs(o[4]*r+o[3]*s+o[4]*s)/50,.4),e.x=s*o[0]+n*o[1]+s*o[2]+n*o[3]+s*o[4]+this.centers[t].x,e.y=n*o[5]+s*o[6]+n*o[7]+s*o[8]+n*o[9]+this.centers[t].y}))}}const Bn={[j.LabStairs]:{x:-1670,y:1730,size:{x:80,y:80},text:"Press [UP] to go upstairs"}};class Gn extends a.GameObjects.Image{constructor(e,i,s){const{x:n,y:o}=Bn[i];super(e,n,o,""),t(this,"player"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`HelperText-${i}`,this.player=s}lazyInit(e){if(!e&&(this.initialized||!le(this,this.player)))return;const{size:t}=Bn[j.LabStairs];this.setDepth(B.Items),this.setDisplaySize(t.x,t.y),w.debug||this.setAlpha(0),this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.initialized=!0}getButtonPrompt(){return Bn[j.LabStairs].text}onInteract(e){return x.None}update(){this.lazyInit()}}class Rn extends a.GameObjects.Container{constructor(e,i){const{position:s,size:n}=i;super(e,s.x,s.y),t(this,"initialized",!1),t(this,"center"),t(this,"player"),t(this,"layers",[]),t(this,"info"),this.name=`ParallaxBackground-${s.x}-${s.y}`,this.info=i,this.player=e.player,this.setDepth(B.Backgrounds),this.center=new a.Math.Vector2(s.x+.5*n.x,s.y+.5*n.y),w.debug&&this.add(e.add.rectangle(this.center.x,this.center.y,n.x,n.y).setStrokeStyle(10,26214).setOrigin(.5))}lazyInit(e){if(!e&&(this.initialized||!le(this.center,this.player,this.info.size.x)))return;this.scene.add.existing(this),this.scene.physics.add.existing(this);const{position:t,size:i,scale:s,images:n,skipLighting:o}=this.info;n.forEach((({texture:e,scale:n,speed:r})=>{const a=this.scene.add.tileSprite(t.x,t.y,i.x,i.y,e);a.setOrigin(0).setTileScale((s||1)*(n||1)).setData("speed",r),o||a.setPipeline("Light2D"),a.setPostPipeline("XRayPipeline"),this.add(a),this.layers.push(a)})),w.debug&&this.setInteractive({draggable:!0,hitArea:new a.Geom.Rectangle(t.x,t.y,i.x,i.y),hitAreaCallback:a.Geom.Rectangle.Contains}),this.initialized=!0}update(){if(this.lazyInit(),!this.initialized||!this.getBounds().contains(this.player.x,this.player.y))return;const{size:e}=this.info,t=a.Math.Clamp(this.player.x-this.center.x,-.5*e.x,.5*e.x)/e.x;this.layers.forEach((i=>{i.tilePositionX=t*i.getData("speed")*e.x}))}}class Wn extends a.GameObjects.Text{constructor(e){super(e,w.width/2,w.height-50,"",yn),this.setOrigin(.5).setBackgroundColor("#"+_).setPadding(10,5).setAlign("center").setAlpha(.8).setScrollFactor(0).setDepth(B.Overlay).setVisible(!1),e.add.existing(this)}}const Nn={octave:3.5,speed:1,volume:1,type:"sine"},_n={[P.Inventor]:{octave:3.3,speed:1,volume:1.8},[P.Stranger]:{octave:2.8,speed:1.1,volume:2.6},[P.Sphinx]:{octave:2.5,speed:2,volume:2,type:"triangle"},[P.Mayor]:{octave:3.9,speed:.8,volume:.8},[P.ClockTower]:{octave:2.1,speed:1.5,volume:1.5,type:"sawtooth"},player:{octave:3.7,speed:.75,volume:.9}};class Hn extends a.GameObjects.Text{constructor(e,i,s,n,o,r){super(e,i,s,n,{...yn,fontSize:48,backgroundColor:`#${N}`,padding:{x:15,y:10},...r}),t(this,"onClick"),t(this,"disabled"),t(this,"selected"),this.setOrigin(.5),e.add.existing(this),this.onClick=o,this.disabled=!1,this.selected=!1,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>{this.disabled||(this.setSelected(!1),o(this))})),this.on("pointerover",(()=>{this.disabled||this.selected||this.setTint(12303291)})),this.on("pointerout",(()=>{this.disabled||this.selected||this.setTint(16777215)}))}disable(){this.disabled=!0,this.selected=!1,this.disableInteractive(),this.setTint(6710886)}enable(){this.disabled=!1,this.selected=!1,this.setInteractive(),this.setTint(16777215)}setSelected(e){this.selected=e,this.setTint(e?K(X):16777215)}}class Un extends Hn{constructor(e,t,i,s,n,o,r,a){super(e,t,i,s,n,{fontSize:32,align:"center",...o}),this.setOrigin((null==a?void 0:a.x)||0,(null==a?void 0:a.y)||0),null!==r&&this.setFixedSize((null==r?void 0:r.x)||250,(null==r?void 0:r.y)||50)}}class $n extends a.GameObjects.Container{constructor(e,i,s){var n,o,r;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",-1),e.add.existing(this).setScrollFactor(0),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(o=e.input.keyboard)||o.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(r=e.input.keyboard)||r.on("keydown-ENTER",(()=>{var e;null==(e=this.buttons[this.activeIndex])||e.onClick(this.buttons[this.activeIndex])}))}addButton(e){this.add(e),this.buttons.push(e),1===this.buttons.length&&this.setActiveButton(0),e.on("pointerover",(()=>{this.setActiveButton(-1)}))}setActiveButton(e){var t,i;null==(t=this.buttons[this.activeIndex])||t.setSelected(!1),this.activeIndex=e,null==(i=this.buttons[this.activeIndex])||i.setSelected(!0)}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const Vn=20;class qn extends a.GameObjects.Container{constructor(e,i){var s,n;super(e),t(this,"textWidth"),t(this,"textHeight"),t(this,"player"),t(this,"target"),t(this,"npcName"),t(this,"text"),t(this,"portrait"),t(this,"options"),t(this,"optionsContainer"),t(this,"dialog"),t(this,"messageIndex"),t(this,"interactionTimeout"),t(this,"gamepadVisible",!1),t(this,"initialized",!1),t(this,"animating",!1),t(this,"stopAnimation"),t(this,"stopAudio");const{width:o,height:r}=w;this.textWidth=o-135-80,this.textHeight=130,this.setScrollFactor(0),this.setPosition(Vn,r-Vn-170),this.setDepth(B.Overlay),this.setAlpha(0),this.setVisible(!1),i&&(this.player=i),null==(s=this.scene.input.keyboard)||s.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(n=this.scene.input.keyboard)||n.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}createUI(){this.scene.add.existing(this),this.npcName=new a.GameObjects.Text(this.scene,170,15,"",{...yn,color:"#"+W}),this.text=this.scene.add.text(170,60,"",yn),this.text.width=this.textWidth,this.text.height=this.textHeight,this.text.setOrigin(0).setMaxLines(5),this.portrait=this.scene.add.image(Vn,Vn,"").setOrigin(0).setScale(1.5);const e=this.scene.add.rectangle(0,0,w.width-40,170,K(_),.8).setStrokeStyle(2,K(W),1).setOrigin(0,0).setScrollFactor(0).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{this.options||this.updateDialog()}));this.optionsContainer=new $n(this.scene).setDepth(B.Overlay);const t=this.scene.add.image(w.width-40-20,154,"chevron-down").setScale(.5);this.scene.tweens.add({targets:t,y:148,scale:.4,duration:1e3,ease:"Sine.easeInOut",yoyo:!0,repeat:-1}),this.add([e,this.npcName,this.text,this.portrait,t])}setDialog(e,t,i){var s,n;if(this.npcName||this.createUI(),this.gamepadVisible=(null==(s=this.scene.gamepad)?void 0:s.visible)||!1,this.setVisible(!0),this.scene.tweens.add({targets:this,alpha:void 0!==e?1:0,duration:125,onComplete:()=>this.setVisible(void 0!==e)}),this.target=t,this.messageIndex=0,this.dialog=e,this.interactionTimeout=Date.now()+350,null==(n=this.scene.gamepad)||n.setVisible(void 0===this.dialog&&this.gamepadVisible),!e)return;const o=i||(t instanceof ve?G[t.npcType].portrait:void 0);this.npcName.setVisible(!1),o?(this.portrait.setVisible(!0),this.portrait.setTexture(o),this.text.setPosition(170,Vn+(t instanceof ve?40:0)).setWordWrapWidth(this.textWidth,!0).setFixedSize(this.textWidth,this.textHeight),t instanceof ve&&(this.npcName.setVisible(!0),this.npcName.setText(G[t.npcType].name))):(this.portrait.setVisible(!1),this.text.setPosition(Vn,Vn).setWordWrapWidth(170+this.textWidth,!0).setFixedSize(170+this.textWidth,this.textHeight)),this.showMessage()}showMessage(){var e;const t=this.getMessages(),i=t&&t[this.messageIndex];if(i){this.text.setText(i);const t=this.target instanceof ve?this.target.npcType:void 0;let s="player_portrait"===(null==(e=this.portrait)?void 0:e.texture.key)?_n.player:t?_n[t]:Nn;const{promise:n,stop:o}=function(e,t,i,s){return 0===i?{promise:Promise.resolve()}:(s.sound.unlock(),((e,i)=>{let s=!1;const n=e=>new Promise((s=>{const n=i.sound.add(e);n.on("complete",(()=>{n.destroy(),s()})),n.play({rate:3,detune:300*(t.octave-4)})}));return{promise:new Promise((async t=>{const i=e.toLowerCase().split(" ");for(let e=0;e=97&&t.charCodeAt(0)<=122&&await n(t)}t()})),stop:()=>{s=!0}}})(e,s))}(i,s,this.scene.sound.mute?0:this.scene.sound.volume,this.scene),{promise:r,stop:a}=function(e,t=15){const i=e.text,s=i.replace(/[^ ]/g," ");e.text="";let n="";const o=e.scene.time.addEvent({delay:t,loop:!0});return{promise:new Promise((t=>{o.callback=()=>{if(e.text===i)return o.destroy(),t();n+=i[n.length];const r=s.substring(n.length);e.text=n+r}})),stop:()=>{o.destroy(),e.text=i}}}(this.text);this.animating=!0,this.stopAudio=o,this.stopAnimation=a,Promise.all([n,r]).then((()=>{this.animating=!1,this.stopAudio=void 0,this.stopAnimation=void 0})),this.text.getWrappedText().length>5&&console.error("Message too long!",i)}this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const e=!w.zoomed;this.options.forEach(((t,i)=>{const s=new Hn(this.scene,w.width/2,w.height/(e?9:14)+i*(30+w.height/(e?16:22)),t,(()=>this.onSelectOption(t)),{fontSize:24,backgroundColor:"#"+_,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(B.Overlay);this.optionsContainer.addButton(s)}))}onSelectOption(e){var t;(null==(t=this.dialog)?void 0:t.onSelected)&&(this.dialog.onSelected(e,this.player,this.target),this.optionsContainer.removeAll(!0))}updateDialog(){var e,t,i,s;if(Date.now()=n.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.target),this.dialog=void 0,this.text.setText(""),this.scene.tweens.add({targets:this,alpha:0,duration:125,onComplete:()=>this.setVisible(!1)}),null==(i=this.scene.gamepad)||i.resetButtons()):this.showMessage(),null==(s=this.scene.gamepad)||s.setVisible(void 0===this.dialog&&this.gamepadVisible),this.interactionTimeout=Date.now()+350}}getMessages(){var e;let t=null==(e=this.dialog)?void 0:e.messages;return"function"==typeof t&&(t=t(this.player)),t}getOptions(){var e;let t=null==(e=this.dialog)?void 0:e.options;return"function"==typeof t&&(t=t(this.player)),t}}const Xn={[k.Wrench]:{x:0,y:0,image:"wrench",name:"Old Wrench"},[k.Gear1]:{x:0,y:0,image:"gear",name:"Shiny Gear"},[k.Key]:{x:0,y:0,image:"key",name:"Rusty Key",skipLighting:!0},[k.HerbRed]:{x:-200,y:1730,image:"herb_red",name:"Crimson Starbloom"},[k.HerbGreen]:{x:5295,y:985,image:"herb_green",name:"Green Writhewood"},[k.HerbBlue]:{x:1535,y:875,image:"herb_blue",name:"Blue Plumed Frond"},[k.Potion]:{x:0,y:0,image:"potion",name:"Strange Potion"},[k.Gear2]:{x:0,y:0,image:"gear2",name:"Old Gear"}};class Kn extends a.GameObjects.Container{constructor(e){super(e,0,0),t(this,"inventory",[]),t(this,"text"),t(this,"rect"),t(this,"initialized",!1),this.setScrollFactor(0).setDepth(B.Ui).setVisible(!1)}createUI(){this.initialized||(this.scene.add.existing(this),this.rect=this.scene.add.rectangle(0,0,0,0,K(N)).setStrokeStyle(2,K(R)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=this.scene.add.text(10,4,"Inventory",{...yn,fontSize:32}),this.add(this.text),this.initialized=!0)}addItem(e,t){if(this.initialized||this.createUI(),this.inventory.push(e),!e.used){const t=this.scene.add.image(0,0,Xn[e.type].image).setScale(.35);e.type===k.Key&&t.setAngle(45),this.add(t)}this.updateItems();const i=Ge(this.scene,e.type);null==i||i.destroy(),t||(new gn(this.scene,`New item added: ${Xn[e.type].name}`),jn(this.scene))}removeItem(e){var t;this.initialized||this.createUI();const i=this.inventory.find((t=>t.type===e));i&&(i.used=!0,null==(t=this.getAll().find((t=>{var i;return(null==(i=t.texture)?void 0:i.key)===Xn[e].image})))||t.destroy()),this.updateItems()}updateItems(){var e;this.initialized||this.createUI();let t=0;this.getAll().forEach((e=>{if(e instanceof a.GameObjects.Image){const i=32+50*t;e.setPosition(i,68),t++}})),this.setVisible(this.inventory.length>0);const i=Math.max((null==(e=this.text)?void 0:e.displayWidth)+18,50*t+12);this.setPosition(w.width-i-20,20),this.rect.setSize(i,102)}}class Yn extends a.GameObjects.Image{constructor(e,i){super(e,w.width-50,w.height-55,"journal"),t(this,"player"),t(this,"journal",[]),t(this,"unread"),t(this,"initialized",!1),this.player=i}createUI(){var e;this.initialized||(this.setScrollFactor(0).setDepth(B.Ui).setScale(.5).setAlpha(0).setInteractive({useHandCursor:!0}).setActive(!1),this.on("pointerdown",this.openJournal),this.scene.add.existing(this),this.unread=this.scene.add.ellipse(w.width-21,w.height-89,20,20,11141120).setStrokeStyle(2,K(_)).setScrollFactor(0).setDepth(B.Ui2).setVisible(!1),null==(e=this.scene.input.keyboard)||e.on("keydown-J",(()=>{this.openJournal()})),this.initialized=!0)}addEntry(e,t){this.initialized||this.createUI(),this.journal.includes(e)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(e),t||(this.unread.setVisible(!0),new gn(this.scene,"New journal entry added!")),this.handleSideEffects(e,t||!1))}openJournal(){this.initialized||this.createUI(),0!==this.journal.length&&he(this.scene,"JournalDialog")}handleSideEffects(e,t){const{warpAdd:i}=Se[e];if(i&&Le(this.scene,i,!1),e===C.ClockFirstGear||e===C.ClockSecondGear){const e=Be(this.scene,P.ClockTower);(null==e?void 0:e.clock)&&e.clock.updateHands()}e!==C.ExtraPotionInformation||this.journal.includes(C.SafeDiscovered)||Sn(this.scene,!0),e===C.SafeDiscovered&&function(e,t){const i=Re(e.scene,O.MansionPicture);t||e.setActive(!1),null==i||i.scene.tweens.add({targets:i,angle:97,duration:t?0:1500,onComplete:()=>{t||(e.setActive(!0),e.message.setDialog({messages:["A sturdy looking safe was hidden behind the picture.","It looks like it requires a special key to open."]},void 0,"player_portrait"))}})}(this.player,t),t||jn(this.scene)}}class Qn extends a.GameObjects.Container{constructor(e,i){super(e,w.width-330-20,120),t(this,"player"),t(this,"quests",[]),t(this,"questRectangle"),t(this,"initialized",!1),this.player=i}createUI(){if(this.initialized)return;this.scene.add.existing(this),this.setScrollFactor(0).setDepth(B.Ui).setVisible(!1),this.questRectangle=this.scene.add.rectangle(0,0,330,60,K(N)).setStrokeStyle(2,K(R)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle);const e=this.scene.add.text(10,4,"Quests",{...yn,fontSize:32});this.add(e),this.initialized=!0}addQuest(e,t){this.initialized||this.createUI(),this.quests.find((t=>t.id===e.id))||(this.quests.push(e),this.add(this.scene.add.text(0,0,ke[e.id].description,{...yn,fontSize:20})),this.updateQuests(),t||new gn(this.scene,`New quest added: ${ke[e.id].description}`),this.handleSideEffects(e.id,e.completed,t))}updateExistingQuest(e,t){this.initialized||this.createUI();const i=this.quests.find((t=>t.id===e));i?(!i.completed&&t&&new gn(this.scene,`Quest completed: ${ke[i.id].description}`),i.completed=t,this.updateQuests(),this.handleSideEffects(e,t)):console.error(`Quest ${e} not found in player quests`)}updateQuests(){this.initialized||this.createUI();const e=this.quests.filter((e=>!e.completed));let t=1,i=0;this.getAll().forEach((s=>{if(s instanceof a.GameObjects.Text)if(e.find((e=>s.text===ke[e.id].description))||"Quests"===s.text){if("Quests"!==s.text){const e=14+30*t;s.setPosition(10,e),t++,i=Math.max(i,s.width)}}else s.destroy()}));const s=i+20;this.setX(w.width-20-s),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(e.length>0),this.questRectangle.setSize(s,50+30*e.length)}handleSideEffects(e,t,i){const{warpAdd:s,warpComplete:n}=ke[e];if(s&&Le(this.scene,s,!1),t&&n&&Le(this.scene,n,!1),e===I.FindPotionIngredients&&!t){const e=this.player.scene;e.interactiveObjects.add(new Wo(e,k.HerbGreen,this.player)),e.interactiveObjects.add(new Wo(e,k.HerbBlue,this.player))}e!==I.ExploreLab||t||Uo(this.player),i||jn(this.scene)}reset(){this.quests=[],this.updateQuests()}}const Jn=1.35*(w.fastMode?350:175),Zn=new a.Math.Vector2(400,650);class eo extends a.Physics.Arcade.Sprite{constructor(e){var i;super(e,Zn.x,Zn.y,"character",0),t(this,"scene"),t(this,"keys"),t(this,"light"),t(this,"debug"),t(this,"buttonPrompt"),t(this,"interactive"),t(this,"interactionTimeout",0),t(this,"message"),t(this,"inventory"),t(this,"quests"),t(this,"journal"),t(this,"gameState"),t(this,"previousPosition",new a.Math.Vector2),t(this,"counter",0),t(this,"history",[]),t(this,"rewinding",!1),this.name="Player",this.scene=e,e.add.existing(this),e.physics.add.existing(this),w.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(B.Player).setScale(1.35).setPipeline("Light2D").setPostPipeline("XRayPipeline"),w.debug?(this.light=new ye(e,this.x,this.y,200,16768443,1),this.debug=e.add.circle(this.x,this.y,3,16711935).setDepth(B.Debug)):this.light=e.lights.addLight(this.x,this.y,200,16768443,1),(i=this).anims.create({key:"walk",frames:i.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:w.prod?6:9,repeat:-1}),i.anims.play("walk"),this.keys=new be(e),this.message=new qn(e,this),this.inventory=new Kn(e),this.quests=new Qn(e,this),this.journal=new Yn(e,this),this.gameState=new Vo(e,this),w.perfTest&&e.time.delayedCall(1e3,(()=>{this.setVelocityX(Jn),e.time.addEvent({delay:1e3,callback:()=>this.setVelocityX(this.body?-this.body.velocity.x:0),loop:!0})}))}update(e,t){var i,s,n;w.debug&&(this.setTint(this.interactive?16755370:16777215),this.debug.setPosition(this.x,this.y));const o=this.interactive&&!this.message.visible&&(null==(s=null==(i=this.buttonPrompt)?void 0:i.text)?void 0:s.length)>0||!1;o&&!this.buttonPrompt&&(this.buttonPrompt=new Wn(this.scene)),null==(n=this.buttonPrompt)||n.setVisible(o),w.perfTest||(this.setVelocity(0),this.rewinding?this.counter+t>31.25?(this.rewind(),this.counter=0):this.counter+=t:this.checkInteraction()||this.message.visible||this.updateVelocity()),this.light.setPosition(this.x,this.y-20),function(e){const t=e.x-e.previousPosition.x,i=e.y-e.previousPosition.y,s=t<0;Math.abs(t)>.01||Math.abs(i)>.01?e.anims.resume():e.anims.pause(),Math.abs(t)>0&&(e.flipX=e.rewinding?!s:s),e.setAngle(e.flipX?-5:5)}(this),this.previousPosition.set(this.x,this.y)}checkInteraction(){var e;let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==x.None&&(this.interactionTimeout=Date.now()+((null==(e=this.interactive)?void 0:e.interactionTimeout)||500),this.keys.resetKeys(),t===x.Teleported&&(this.interactive=void 0))),t}updateVelocity(){const e=this.keys.keys;let t=1;!w.prod&&e[me.Shift]&&(t=2),this.anims.timeScale=t;const i=Jn*t;e[me.Left]&&this.setVelocityX(-i),e[me.Right]&&this.setVelocityX(i),w.debug&&!this.interactive&&(e[me.Up]&&this.setVelocityY(-i),e[me.Down]&&this.setVelocityY(i)),e[me.Left]&&e[me.Right]&&this.setVelocityX(0)}record(){var e;this.history.length<1e3?this.history.push(new a.Math.Vector3(this.x,this.y,(null==(e=this.body)?void 0:e.velocity.x)||0)):console.warn("Max history reached")}rewind(){const e=this.history.pop();e&&(this.x=e.x,this.y=e.y,this.setVelocityX(-e.z))}setRewind(e){this.rewinding=e,this.counter=0}reset(){this.quests.reset(),this.setPosition(Zn.x,Zn.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(e){var t,i;this.interactive=e,(null==e?void 0:e.onCollided)&&e.onCollided();const s=null==(t=null==e?void 0:e.getButtonPrompt)?void 0:t.call(e);s&&!this.buttonPrompt&&(this.buttonPrompt=new Wn(this.scene)),null==(i=this.buttonPrompt)||i.setText(s)}}class to extends a.Physics.Arcade.Image{constructor(e,i,s,n=100,o=100,r=!1,a=!1){super(e,i,s,""),t(this,"scene"),t(this,"width"),t(this,"height"),t(this,"flipped"),t(this,"upwards"),t(this,"graphics"),t(this,"initialized",!1),this.name=`Slope-${i}-${s}`,this.scene=e,this.width=n,this.height=o,this.flipped=r,this.upwards=a}lazyInit(e){if(e||!this.initialized&&le(this,this.scene.player)){if(this.scene.add.existing(this),this.scene.physics.add.existing(this),this.setOrigin(0).setDepth(B.Items).setVisible(w.debug).setSize(this.width,1.5*this.height),w.debug){this.setInteractive({draggable:!0});const e=this.scene.add.graphics().setDepth(B.Debug);this.graphics=e,e.lineStyle(2,65280,1);const t=this.width/2,i=new a.Math.Vector2(0,this.flipped?0:0+this.height),s=new a.Math.Vector2(0+this.width,this.flipped?0+this.height:0);e.lineBetween(i.x,i.y,s.x,s.y),e.lineBetween(i.x-t,i.y,i.x,i.y),e.lineBetween(s.x,s.y,s.x+t,s.y),e.strokeCircle(i.x,i.y,2),e.strokeCircle(s.x,s.y,2)}this.initialized=!0}}update(e,t){if(this.lazyInit(),!this.initialized)return;w.debug&&this.graphics&&this.graphics.setPosition(this.x,this.y);const i=this.scene.player,s=i.keys.keys;if(this.body&&this.scene.physics.world.intersects(this.body,i.body)){let e=a.Math.Clamp(1-(this.x+this.width-i.x)/this.width,0,1);this.flipped&&(e=1-e);const t=this.y+this.height,n=(1-i.originY)*i.displayHeight,o=t-this.height*e-n;if(this.upwards&&s[me.Up]&&Math.abs(i.y-o)<70)return i.setVelocityX(this.flipped?-Jn:Jn),void i.setY(o);if(this.upwards&&(s[me.Right]||s[me.Left]&&this.flipped)&&i.y{void 0!==e.id&&this.createWall(e,t)}))}createWall(e,t){const i=this.scene.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(w.debug);i.name=`Wall-${e.id||t}-${e.x}-${e.y}`,void 0!==e.id&&i.setData("WallType",e.id),w.debug&&i.setInteractive({draggable:!0}),this.add(i),this.initialized.push(t)}update(){for(let e=0;eoo){if("RIGHT"===this.lastXAxisKey)return;"LEFT"===this.lastXAxisKey&&(null==(n=this.scene.input.keyboard)||n.emit("keyup-LEFT")),null==(o=this.scene.input.keyboard)||o.emit("keydown-RIGHT"),this.lastXAxisKey="RIGHT"}if(y<-.1){if("LEFT"===this.lastXAxisKey)return;"RIGHT"===this.lastXAxisKey&&(null==(r=this.scene.input.keyboard)||r.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastXAxisKey="LEFT"}if(Math.abs(g)<=oo&&this.lastYAxisKey)return null==(l=this.scene.input.keyboard)||l.emit("keyup-"+this.lastYAxisKey),void(this.lastYAxisKey=void 0);if(g>oo){if("DOWN"===this.lastYAxisKey)return;"UP"===this.lastYAxisKey&&(null==(h=this.scene.input.keyboard)||h.emit("keyup-UP")),null==(c=this.scene.input.keyboard)||c.emit("keydown-DOWN"),this.lastYAxisKey="DOWN"}if(g<-.1){if("UP"===this.lastYAxisKey)return;"DOWN"===this.lastYAxisKey&&(null==(u=this.scene.input.keyboard)||u.emit("keyup-DOWN")),null==(d=this.scene.input.keyboard)||d.emit("keydown-UP"),this.lastYAxisKey="UP"}}createDPad(){console.log("createDPad");const e=this.scene.add.container(10,-10);this.add(e);const t=this.scene.add.circle(0,0,60,K(N),.45).setStrokeStyle(3,K(_));e.add(t),this.button(-57,0,"LEFT",e),this.button(57,0,"RIGHT",e),this.button(0,-57,"UP",e),this.button(0,57,"DOWN",e)}createButtons(){const e=this.scene.add.container(w.width-300,0);this.add(e);const t=this.scene.add.circle(40,0,65,K(N),.45).setStrokeStyle(3,K(_)).setScale(1,.6).setAngle(-30);e.add(t),this.button(80,-20,"ENTER",e),this.button(0,20,"BACKSPACE",e)}createControllerListeners(){var e,t,i,s;null==(e=this.scene.input.gamepad)||e.on("connected",(e=>{new gn(this.scene,"Gamepad connected")})),null==(t=this.scene.input.gamepad)||t.on("disconnected",(e=>{new gn(this.scene,"Gamepad disconnected")})),null==(i=this.scene.input.gamepad)||i.on("down",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keydown-${s}`))})),null==(s=this.scene.input.gamepad)||s.on("up",((e,t)=>{var i;const s=this.getKeyFromButton(t);s&&(null==(i=this.scene.input.keyboard)||i.emit(`keyup-${s}`))}))}getKeyFromButton(e){const t=e.pad.id.toLowerCase().includes("nintendo");let i;switch(e.index){case 0:i=t?"BACKSPACE":"ENTER";break;case 1:i=t?"ENTER":"BACKSPACE";break;case 2:i=t?"SHIFT":"BACK_SLASH";break;case 3:i=t?"BACK_SLASH":"SHIFT";break;case 8:i="J";break;case 9:i="ESC";break;case 12:i="UP";break;case 13:i="DOWN";break;case 14:i="LEFT";break;case 15:i="RIGHT"}return i}button(e,t,i,s){const n="ENTER"===i||"ESCAPE"===i?35:38,o=this.scene.add.circle(e,t,n,K(R),no).setStrokeStyle(3,K(_));o.setInteractive({useHandCursor:!0}).setScrollFactor(0),s.add(o),o.on("pointerdown",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keydown-${i}`),o.setFillStyle(K(N),Math.min(1,1.05))})),o.on("pointerup",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),o.setFillStyle(K(R),no)})),o.on("pointerout",(()=>{var e;null==(e=this.scene.input.keyboard)||e.emit(`keyup-${i}`),o.setFillStyle(K(R),no)})),this.buttons.push(o)}resetButtons(){this.buttons.forEach((e=>e.setFillStyle(K(R),no)))}}class ao extends a.GameObjects.Container{constructor(e,i,s,n,o){super(e,i,s),t(this,"onClick"),t(this,"img"),t(this,"rect"),t(this,"selected"),e.add.existing(this),this.setScrollFactor(0).setDepth(B.Ui),this.rect=e.add.rectangle(0,0,42,42,K(N)).setScrollFactor(0).setStrokeStyle(2,K(_)),this.img=e.add.image(-1,1,n).setDisplaySize(32,32),this.add(this.rect),this.add(this.img),this.rect.setInteractive({useHandCursor:!0}).on("pointerdown",(()=>o(this))),this.onClick=o,this.selected=!1,this.rect.on("pointerover",(()=>{this.rect.setScale(1.1),this.img.setDisplaySize(36,36)})),this.rect.on("pointerout",(()=>{this.rect.setScale(1),this.img.setDisplaySize(32,32)}))}setTint(e){this.img.setTint(e)}setSelected(e){this.selected=e,this.setTint(e?K(X):16777215)}setIcon(e){this.img.setTexture(e).setDisplaySize(32,32)}}var lo=(e=>(e.Horizontal="H",e.Vertical="V",e.Corner="C",e.T="T",e.Cross="X",e.Empty=" ",e))(lo||{});const ho={H:[[0,0,0],[1,1,1],[0,0,0]],V:[[0,1,0],[0,1,0],[0,1,0]],C:[[0,0,0],[1,1,0],[0,1,0]],T:[[0,0,0],[1,1,1],[0,1,0]],X:[[0,1,0],[1,1,1],[0,1,0]]," ":[[0,0,0],[0,0,0],[0,0,0]]},co=[[" "," "," ","V"," "," ","V"," "," ","V"," "," "," ","V"," "," "],[" "," ","C","C"," "," ","V"," "," ","V"," "," ","C","T","H","H"],["H","H","X","T","T","T","T","T","T","C"," "," ","V"," "," "," "],[" "," ","V","C","X","C"," ","C","X","H","T","H","X","H","C"," "],[" "," ","C","T","X","H","C"," ","V"," ","V"," ","V"," ","T","H"],["H","T","H","T","V"," ","T","H","X","H","T","H","T"," ","V"," "],[" ","V"," ","C","X","H","C"," ","T","C"," "," ","C","C","C","H"],[" ","V"," "," ","V"," "," "," ","V","V"," "," "," ","V"," "," "]].map((e=>e.map((e=>e))));function uo(e,t){if(!e||!t)return!1;const i=po(e),s=po(t),n=t.x-e.x,o=t.y-e.y;return 1===n&&0===o?i.right&&s.left:-1===n&&0===o?i.left&&s.right:0===n&&1===o?i.bottom&&s.top:0===n&&-1===o&&i.top&&s.bottom}function po(e){const t=function(e){let t=ho[e.type];const i=Math.floor(e.rotation/90);for(let s=0;s1===e[0])),right:t.some((e=>1===e[e.length-1])),top:t[0].some((e=>1===e)),bottom:t[t.length-1].some((e=>1===e))}}function yo(e){return e[0].map(((t,i)=>e.map((e=>e[i])).reverse()))}const go=Object.keys(k).map((e=>k[e])).filter((e=>"number"==typeof e)),fo=Object.keys(C).map((e=>C[e])).filter((e=>"number"==typeof e)),mo=Object.keys(P).map((e=>P[e])).filter((e=>"number"==typeof e)),bo=Object.keys(O).map((e=>O[e])).filter((e=>"number"==typeof e)),vo=Object.keys(I).map((e=>I[e])).filter((e=>"number"==typeof e)),wo=Object.keys(S).map((e=>S[e])).filter((e=>"number"==typeof e)),xo=Object.keys(j).map((e=>j[e])).filter((e=>"number"==typeof e)),So=Object.values(lo).filter((e=>"number"!=typeof e)),ko=["MainMenu","MazeDialog","PipesDialog","TumblerDialog","MemoryDialog","SliderDialog"],Io=[{x:0,y:0,image:"town",location:A.Town},{x:500,y:-1100,image:"clock_outside",location:A.ClockOutside},{x:500,y:-2400,image:"clock_inner",location:A.ClockInner,skipLighting:!0},{x:2300,y:0,image:"forest",location:A.Forest},{x:4400,y:100,image:"lake",location:A.Lake},{x:-2200,y:-170,image:"mansion_outside",location:A.MansionOutside},{x:-2e3,y:-1320,image:"mansion_inside",location:A.MansionInside,skipLighting:!0},{x:-3200,y:1300,image:"alchemy_lab",location:A.AlchemyLab,scale:.9,skipLighting:!0},{x:1600,y:-700,image:"library",location:A.Library,skipLighting:!0}],Po=[{x:135,y:462,radius:150,color:K(W),intensity:2.5},{x:697,y:441},{x:1018,y:435},{x:887,y:200,radius:150},{x:1561,y:460},{x:791,y:472,intensity:.5},{x:962,y:469,intensity:.5},{x:162,y:814,intensity:2},{x:635,y:772},{x:1638,y:788,intensity:2},{x:5300,y:530,intensity:2},{x:5315,y:730,intensity:.75,radius:75}],To=[],Co=[{x:740,y:-1370,width:170,height:95},{x:815,y:-2010,width:90,height:70},{x:5150,y:953,width:100,height:60,flip:!0},{x:-1300,y:-415,width:90,height:35},{x:-1710,y:1577,width:280,height:190,upwards:!0},{x:-1020,y:1697,width:200,height:70},{x:-2570,y:1728,width:200,height:40,flip:!0}],Oo=(e,t,i)=>{var s=1/0,n=0,o=Math.round;const r=1.25*o(window.devicePixelRatio||1),a=100*r,l=65*r,h=3*r,c=2*r,u=3*r,d=23*r,p=Math.floor(a-2*u),y=l-d-2*r,g=document.createElement("canvas");g.width=a,g.height=l;const f=g.getContext("2d");f.font="bold "+9*r+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=i,f.fillRect(0,0,a,l),f.fillStyle=t,f.fillText(e,h,c),f.fillRect(u,d,p,y),f.fillStyle=i,f.globalAlpha=.9,f.fillRect(u,d,p,y);let m=0,b=0,v=new Array(Math.floor(p/r)).fill(0);return{dom:g,update:function(l){if(!(performance.now()-m<100)){v[b]=l,b=(b+1)%v.length,s=Math.min(...v),n=Math.max(...v),f.fillStyle=i,f.globalAlpha=1,f.fillRect(0,0,a,d),f.fillStyle=t,f.fillText(`${e}: ${l.toFixed(1)}`,h,c),f.fillText(`[${s.toFixed(1)} - ${n.toFixed(1)}]`,h,c+10*r),f.fillRect(u,d,p,y),f.fillStyle=i,f.globalAlpha=.8;for(let e=0;e300||!w.debug&&t>150?new gn(this,i,void 0,H):new gn(this,i)}}update(){this.player&&(this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((e,t)=>{const i=e;let s=!0;return i.disabled&&(s=!1),void 0!==i.visible&&(s=s&&i.visible),s}),this.player)||this.player.setInteractiveObject(void 0)),this.frustumCull()}frustumCull(){var e,t,i;const s=performance.now();this.cameraBounds.x=this.cameras.main.scrollX-150,this.cameraBounds.y=this.cameras.main.scrollY-150;const n=this.children.getAll();for(let o of n)if(o instanceof a.GameObjects.Image||o instanceof a.GameObjects.Sprite||o instanceof a.GameObjects.Particles.ParticleEmitter||o instanceof a.GameObjects.Graphics){if(o.depth!==B.Debug&&(o instanceof to||!(o instanceof Ce)&&(null==(e=o.name)?void 0:e.startsWith("Warp"))||o.depth>=B.Ui||0===(null==(t=o.name)?void 0:t.length)))continue;this.objectBounds.setTo(o.x,o.y,o.width||1,o.height||1),a.Geom.Intersects.RectangleToRectangle(this.cameraBounds,this.objectBounds)?o instanceof Ce?o.updateLocked():o.setVisible(!0):o.setVisible(!1)}jo&&!this.cullingStats&&(this.cullingStats=jo.addPanel(Oo("Culling","#9ad8e4","#064b62"))),null==(i=this.cullingStats)||i.update(performance.now()-s)}createBackgrounds(){return Io.map((e=>new En(this,e,this.player)))}createParallaxBackgrounds(){return To.map((e=>new Rn(this,e)))}createWarpers(){return wo.map((e=>new Ce(this,e,this.player)))}createNpcs(){return mo.map((e=>new ve(this,e,this.player)))}createItems(){return[].map((e=>new Wo(this,e,this.player)))}createSlopes(){return Co.map((e=>new to(this,e.x,e.y,e.width,e.height,e.flip,e.upwards)))}createProps(){return bo.map((e=>new xe(this,e,this.player)))}createHelperText(){return xo.map((e=>new Gn(this,e,this.player)))}createUI(){this.time.delayedCall(50,(()=>{let e=30;new ao(this,e,30,"settings",(()=>{this.player.message.visible||(this.scene.pause(),this.scene.launch("Paused",{game:this}))})),w.prod||new ao(this,e+=50,30,"terminal",(()=>{he(this,"DebugTool")})),this.saveIcon=this.add.image(30,w.height-30,"save").setScale(.4).setDepth(B.Ui).setScrollFactor(0).setAlpha(0),this.saveIcon.postFX.addGlow(0,2)})),this.gamepad=new ro(this),w.prod||(this.time.delayedCall(500,(()=>{const e=new An(this,this.player);this.add.group(e,{runChildUpdate:!0})})),w.bootDialog&&this.time.delayedCall(150,(()=>he(this,w.bootDialog))))}createLights(){this.lights.enable().setAmbientColor(K(R)),Po.forEach((e=>{w.debug?new ye(this,e.x,e.y,e.radius||100,e.color||K($),e.intensity||1):this.lights.addLight(e.x,e.y,e.radius||100,e.color||K($),e.intensity||1)})),ie(this,!1)}createEventListeners(){var e;null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.player.message.visible||(this.scene.pause(),this.scene.launch("Paused",{game:this}))})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}const Eo=[{question:"I speak without a mouth and hear without ears. I have no body, but I come alive with the wind.",answer:"echo",options:["echo","whisper","ghost","silence","shadow"],hints:{[P.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[P.Stranger]:["The sphinx’s riddles are always a bit tricky.","I think this one is about something that bounces off walls."]}},{question:"I have cities, but no houses. I have mountains, but no trees. I have water, but no fish. What am I?",answer:"map",options:["map","globe","dream","photograph","landscape"],hints:{[P.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[P.Stranger]:["Imagine something that can fit in your hand or hang on a wall, showing vast landscapes and bodies of water, but not in their true form."]}},{question:"I fly without wings. I cry without eyes. Whenever I go, darkness flies. What am I?",answer:"cloud",options:["cloud","bat","wind","shadow","storm"],hints:{[P.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[P.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function Mo(e){return e instanceof Ao&&Me(e.player,I.FindPotionIngredients)?1:0}function zo(e,t){const i=Mo(e);return Eo[i].hints[t]}const Do={messages:e=>function(e){const t=Mo(e);return[Eo[t].question]}(e.scene),options:e=>function(e){const t=Mo(e),i=[...Eo[t].options].sort((()=>Math.random()-.5));return i.push("I don’t know"),i}(e.scene),onSelected:function(e,t,i){e===function(e){const t=Mo(e);return Eo[t].answer}(t.scene)?t.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:e=>{e.quests.updateExistingQuest(I.SphinxRiddle,!0),e.gameState.updateData({sphinxMoved:!0,sphinxFail:!1})}},i):"I don’t know"===e?t.message.setDialog({messages:["Come back when you have an answer for me."]},i):t.message.setDialog({messages:["That is not correct. You will not remember how to get back to me."],onCompleted:e=>{e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxFail:!0}),Oe(S.TownEast,e,{x:-100,y:0})}},i)}},Fo={messages:["There. It looks like the alchemy set has been properly fit back together."],onCompleted:e=>{e.journal.addEntry(C.AlchemySetFixed)}},Lo={[P.Inventor]:[{messages:["There is still one more gear missing.","Something tells me there is a great evil near the lake."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Ah, the second gear. You should take it to the clock tower."],conditions:{hasItem:k.Gear2}},{messages:["You found a secret safe in the mansion?","Very interesting. There may be a hint about opening it nearby."],conditions:{journalEntry:C.SafeDiscovered}},{messages:["Blue Plumed Frond? I have not heard of such a plant.","The stranger may know. Many secrets lie under this town."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["There are rumors of an abandoned mansion west of the town.","Some say it is haunted and dark magic lurks within."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:k.Gear1},onCompleted:e=>{e.quests.updateExistingQuest(I.ForestGear,!0)}},{messages:e=>zo(e.scene,P.Inventor),conditions:{activeQuest:I.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:k.Wrench}},{messages:["The clock tower is the heart of our town, but it’s been broken for ages. I’ve got a wrench, but you’ll need three special gears to fix it.","You might find the others by helping the townsfolk."],onCompleted:e=>{e.journal.addEntry(C.FixTheClock),e.inventory.addItem({type:k.Wrench,used:!1})}}],[P.Stranger]:[{messages:["I am worried about the secrets hidden near the lake.","Long ago I saw a great evil lurking there."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Another gear? The mayor probably wants that put back in the clock tower."],conditions:{hasItem:k.Gear2}},{messages:["The lock on that safe is no ordinary lock. It requires something special to open it."],conditions:{journalEntry:C.SafeDiscovered,hasUnusedItem:k.Potion}},{messages:["Hmm a potion, I wonder what it does.","The alchemist was no ordinary person and built magical safeguards against intruders."],conditions:{hasUnusedItem:k.Potion}},{messages:["Green Writhewood? Hm, there might be some near the forest or lake."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["You heard of the mansion to the west? It was abandoned many years ago.","There is a rumor of an alchemy lab hidden somewhere nearby, but I have been searching for years and have found not even a single potion."],conditions:{activeQuest:I.InvestigateTownWest}},{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:k.Gear1}},{messages:e=>zo(e.scene,P.Stranger),conditions:{activeQuest:I.SphinxRiddle}},{messages:["I’ve heard rumors of a gear hidden deep in the Enchanted Forest. Beware of the forest’s creatures and traps.","One time I thought I saw an ancient being, but it ran away."],conditions:{hasItem:k.Wrench},onCompleted:e=>{e.quests.addQuest({id:I.ForestGear,completed:!1})}},{messages:["Who am I?","Eventually, you will learn."]}],[P.Sphinx]:[{messages:e=>e.gameState.data.sphinxFail?["You have returned. I am surprised you were able to find your way back.","Try again."]:Me(e,I.FindPotionIngredients)?["I see you are back again. You may find what you are looking for ahead, but must first answer my riddle."]:["Ponder this riddle. Answer wisely."],conditions:{activeQuest:I.SphinxRiddle,completedQuest:I.SphinxRiddle,or:!0},onCompleted:(e,t)=>{e.scene.time.delayedCall(50,(()=>{e.message.setDialog({...Do},t)}))}},{messages:["Welcome, brave soul. To pass, you must answer my riddle. You may only answer once. If you are unsure, you may speak to the townsfolk. Choose wisely."],onCompleted:e=>{e.quests.addQuest({id:I.SphinxRiddle,completed:!1})}}],[P.Mayor]:[{messages:["I’ve been hearing strange reports from the townsfolk. It’s as if time is slipping. Have you felt it?","The clock is still missing a gear. It must be somewhere nearby."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["The second gear has been found? That’s incredible news!"],conditions:{completedQuest:I.InvestigateTownWest}},{messages:["Herbs? I haven’t the faintest idea where to being looking. Start at the source - there are bound to be a few ingredients in the lab you found."],conditions:{activeQuest:I.FindPotionIngredients}},{messages:["The minute hand on the clock is spinning again.","It looks like it’s missing two more gears.","The abandoned mansion west of the town might be a good place to look."],conditions:{journalEntry:C.ClockFirstGear},onCompleted:e=>{e.quests.addQuest({id:I.InvestigateTownWest,completed:!1})}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:C.MetTheMayor}},{messages:["Hello, traveler. I am the mayor of this town. The clock tower has been broken for years.","Ah, I see you have found an old gear. Maybe it could be used to help fix the clock tower."],onCompleted:e=>{e.journal.addEntry(C.MetTheMayor)}}],[P.ClockTower]:[{messages:["With two of the gears in place, the clocks hands are moving again."],conditions:{journalEntry:C.ClockSecondGear}},{messages:["Slowly, you align and tighten the second gear into place.","[CREAKING NOISE]","Now two of the hands of the clock are moving again."],conditions:{hasItem:k.Gear2},onCompleted:e=>{e.inventory.removeItem(k.Gear2),e.journal.addEntry(C.ClockSecondGear)}},{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:C.ClockFirstGear}},{messages:["This dusty clock tower hasn't told the correct time in many years. It appears to be missing some gears.","Let’s see what happens when we add the first gear. You tighten the gear into place.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:k.Gear1},onCompleted:e=>{e.inventory.removeItem(k.Gear1),e.journal.addEntry(C.ClockFirstGear)}}]},Bo={[k.Gear1]:[{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}],[k.Gear2]:[{messages:["Finally! I found the second gear to the clock tower.","I should take this and put it back."],onCompleted:e=>{e.quests.updateExistingQuest(I.InvestigateTownWest,!0)}}]},Go={[O.Chest]:[{messages:["The chest seems to be locked.","It appears to have many symbols above the latch"],conditions:{custom:e=>!je(e,k.Gear1)&&void 0===Ge(e.scene,k.Gear1)},onCompleted:e=>{he(e.scene,"MemoryDialog")}}],[O.LabHatch]:[{messages:["Let me see if I can open this hatch.","Wow, the rusty key fits!","[CREAKING NOISE]","Alright, let’s see what is down there!"],conditions:{hasItem:k.Key},onCompleted:(e,t)=>{null==t||t.destroy(),e.inventory.removeItem(k.Key),e.journal.addEntry(C.AlchemyLabFound)}},{messages:["The hatch is locked. I wonder if there is a key somewhere."]}],[O.LabBook]:[{messages:[],conditions:{journalEntry:C.ClockSecondGear}},{messages:['How could I have missed this? The potion is called the "Elixir of Sight".',"This must be related to one of the gears in the clock tower.","Well, bottoms up, I suppose!"],conditions:{hasItem:k.Potion},onCompleted:e=>{e.journal.addEntry(C.ExtraPotionInformation),e.inventory.removeItem(k.Potion),e.scene.time.delayedCall(3500,(()=>{e.message.setDialog({messages:["I feel... different.","I should retrace my steps to see if there is anything new in the area."]})}))}},{messages:["With the alchemy set fixed, I should be able to recreate the experiment.","I will need to find three ingredients according to this - Crimson Starbloom, Green Writhewood, and a Blue Plumed Frond.","Maybe I can find them in the lab or the forest. The villagers should know more."],conditions:{journalEntry:C.AlchemySetFixed},onCompleted:e=>{e.quests.addQuest({id:I.FindPotionIngredients,completed:!1}),e.gameState.updateData({mazeSolved:!1,mazeSeed:e.gameState.data.mazeSeed+1,sphinxMoved:!1})}},{messages:["Maybe I can find more information in the lab."],conditions:{activeQuest:I.ExploreLab}},{messages:["This lab journal contains notes about an ancient alchemy experiement.","According to the notes, the experiment was a failure, and the alchemist disappeared.","It does say that there might have been a problem with one of the ingredients.","Maybe I can find more information in the lab."],onCompleted:e=>{e.quests.addQuest({id:I.ExploreLab,completed:!1})}}],[O.AlchemySet]:[{messages:["There’s nothing more that I can do here."],conditions:{hasItem:k.Potion}},{messages:["Now we have all of the ingredients.","Now I should be able to recreate the experiment.","According to the book..."],conditions:{hasUsedItem:k.HerbBlue},onCompleted:(e,t)=>{!function(e,t){const i=e.scene;e.inventory.removeItem(k.HerbBlue),e.setActive(!1),ae(i,500,(()=>{i.time.delayedCall(700,(()=>{var s;null==t||t.setTexture("alchemy_full"),null==(s=null==t?void 0:t.particles)||s.setConfig({...we[O.AlchemySet].particles,tint:[6684791],x:30,delay:200,stopAfter:120}).start(),re(i,1500,(()=>{e.message.setDialog({messages:["I have created the potion mentioned in the old journal.","I should bring it to the mysterious stranger to see if they know how to use it."],onCompleted:(e,t)=>{e.inventory.addItem({type:k.Potion,used:!1}),e.quests.updateExistingQuest(I.ExploreLab,!0),null==t||t.setTexture("alchemy_empty"),e.setActive(!0)}},t,"player_portrait")}))}))}))}(e,t)}},{messages:["The Blue Plumed Frond is last."],conditions:{hasItem:k.HerbBlue,hasUsedItem:k.HerbRed},onCompleted:(e,t)=>{Ho(e,t,k.HerbBlue),e.quests.updateExistingQuest(I.FindPotionIngredients,!0)}},{messages:["The Crimson Starbloom comes next."],conditions:{hasItem:k.HerbRed,hasUsedItem:k.HerbGreen},onCompleted:(e,t)=>Ho(e,t,k.HerbRed)},{messages:["The Green Writhewood goes in first."],conditions:{hasItem:k.HerbGreen},onCompleted:(e,t)=>Ho(e,t,k.HerbGreen)},{messages:["Maybe the journal has more information about using this alchemy set."],conditions:{journalEntry:C.AlchemySetFixed}},{messages:["This alchemy set looks like the one in the journal.","If I can figure out how the set connects together, I might be able to recreate the experiment."],conditions:{activeQuest:I.ExploreLab},onCompleted:e=>{he(e.scene,"PipesDialog")}},{messages:["A series of pipes and tubes. I shouldn’t touch this without knowing what it does."]}],[O.LabBookshelf1]:[{messages:['[Secrets of the Silver Transmutation]\n"Silver, the mirror of the soul, can be yielded from common materials. Begin with a lead base, cleanse it with the tears of a willow, and chant thrice under a new moon. Such processes, though fraught with danger, promise immense reward. Meticulous preparation of the material is crucial."','"Among these pages lie safeguards against volatile spirits and the precise lunar phases essential for success. Here are protective circles and counter-spells to be used should spirits prove malevolent. This knowledge has been passed down and refined for safety."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf2]:[{messages:['[Whispering Woods: A Compendium]\n"The sentient trees of Eldergrove are not myths; their trunks groan with ancient wisdom. To engage them, perform the Ritual of Leaves, using moonlit water and rare herbs, along with whispered incantations passed down by forest guardians."','"Notes on the rare Blue Moonflower, whose petals glow ghostly and unlock forest languages, are also included. Its bloom is brief, and harvesting must be timed at midnight to retain its properties. The chapter concludes with a discussion on plant symbiosis with Eldertrees."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabBookshelf3]:[{messages:['[The Essence of Fire: Ignite and Control]\n"Mastering fire requires strength of will and profound respect for its power. Here, summoning circles and incantations to call forth fire spirits are detailed. Each summoning demands a tribute of phoenix ash. The endeavor is perilous, as spirits may lash out if provoked."','"The tome also discusses methods to quell flames should they rise against the summoner. Included are the chant of suppression and a dousing mixture from elemental waters and frost-bitten herbs. These countermeasures are vital for maintaining control over summoned entities."'],conditions:{activeQuest:I.ExploreLab}}],[O.LabPotionShelf1]:[{messages:["Nightshade, wolfsbane, starvine, frost ferns... No, those are not the right ingedients.","Oh, a Crimson Starbloom! Yes, this should work!"],conditions:{activeQuest:I.FindPotionIngredients,custom:e=>!je(e,k.HerbRed)},onCompleted(e){e.inventory.addItem({type:k.HerbRed,used:!1})}},{messages:['Hm, this is an interesting collection. What’s this "Elixir of Luminescence"? Could light up some dark corners. And "Brew of Bravery"... might make me bold enough to face a dragon, or foolish enough to try. What about "Draught of the Depths"—sounds like it could show me treasures or drown me in visions. Better not risk it; these might just burn me to a crisp!'],conditions:{activeQuest:I.ExploreLab}}],[O.MansionPicture]:[{messages:[],conditions:{hasItem:k.Gear2}},{messages:["A sturdy looking safe was hidden behind the picture.","There are large rusty rings to the side, as if it they were meant to be moved."],conditions:{journalEntry:C.SafeDiscovered},onCompleted:e=>{he(e.scene,"TumblerDialog")}},{messages:["An abstract picture of blocks.","Wait a moment, something is behind this picture","[CREAK]"],onCompleted:e=>{e.journal.addEntry(C.SafeDiscovered)},conditions:{hasUsedItem:k.Potion}},{messages:["An abstract picture of blocks."]}],[O.MansionHole]:[{messages:["Literally a hole in the wall.","Huh, there is something here. It's a key!"],conditions:{hasItem:k.Key,invert:!0},onCompleted:e=>{e.inventory.addItem({type:k.Key,used:!1})}},{messages:["Literally a hole in the wall."]}]};function Ro(e,t,i){for(const s of e){const{conditions:e}=s,n=[];if(void 0!==(null==e?void 0:e.hasItem)&&n.push(je(t,e.hasItem)),void 0!==(null==e?void 0:e.hasUnusedItem)&&n.push(Ae(t,e.hasUnusedItem)),void 0!==(null==e?void 0:e.hasUsedItem)&&n.push(Ee(t,e.hasUsedItem)),void 0!==(null==e?void 0:e.completedQuest)&&n.push(ze(t,e.completedQuest)),void 0!==(null==e?void 0:e.activeQuest)&&n.push(Me(t,e.activeQuest)),void 0!==(null==e?void 0:e.journalEntry)&&n.push(De(t,e.journalEntry)),(null==e?void 0:e.custom)&&n.push(e.custom(t,i)),null==e?void 0:e.invert){if(null==e?void 0:e.or){if(n.some((e=>!e)))return s}else if(n.every((e=>!e)))return s;return}if(null==e?void 0:e.or){if(n.some((e=>e)))return s}else if(n.every((e=>e)))return s}}class Wo extends a.Physics.Arcade.Image{constructor(e,i,s){const{x:n,y:o,image:r}=Xn[i];super(e,n,o,r),t(this,"itemType"),t(this,"player"),t(this,"particles"),t(this,"light"),t(this,"disabled",!1),t(this,"initialized",!1),this.name=`Item-${i}`,this.itemType=i,this.player=s,this.setScale(.35).setDepth(B.Items),We(this,Xn[i])}lazyInit(e){(e||!this.initialized&&le(this,this.player))&&(je(this.player,this.itemType)?this.destroy():(this.scene.add.existing(this),this.scene.physics.add.existing(this),w.debug&&this.setInteractive({draggable:!0}),this.particles=this.scene.add.particles(this.x,this.y,"warp",{scale:{start:0,end:.9},alpha:{start:.7,end:0},delay:500,lifespan:1500,maxAliveParticles:1}).setDepth(B.Items).setName(`Item-${this.itemType}-Particles`),w.debug?this.light=new ye(this.scene,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=this.scene.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2),this.initialized=!0))}onInteract(e){return e[me.Continue]?(this.scene.time.delayedCall(0,(()=>{this.player.inventory.addItem({type:this.itemType,used:!1});const e=Ro(Bo[this.itemType]||[],this.player,this);e&&(null==e?void 0:e.messages.length)>0&&this.player.message.setDialog(e,this,"player_portrait")})),this.destroy(),x.Item):x.None}destroy(e){var t,i,s;null==(t=this.particles)||t.destroy(),this.light instanceof ye?this.light.destroy():null==(s=null==(i=this.scene)?void 0:i.lights)||s.removeLight(this.light),super.destroy(e)}getButtonPrompt(){return[`Pick Up ${Xn[this.itemType].name}`,"Press [CONTINUE]"]}update(){var e,t;this.lazyInit(),null==(e=this.particles)||e.setPosition(this.x,this.y),null==(t=this.light)||t.setPosition(this.x,this.y)}}function No(e,t,i){var s,n;const o=Be(e,P.Sphinx);if(!o)return void console.error("Sphinx not found");const r=function(e,t){return Fe(e,a.GameObjects.Rectangle).find((e=>e.getData("WallType")===t))}(e,T.Sphinx);if(r){const e=(null==(s=io.find((e=>e.id===T.Sphinx)))?void 0:s.x)||0;t?r.setX(e||0):r.setX(e-150),null==(n=r.body)||n.updateFromGameObject()}Le(e,S.ForestEast,!t);const{x:l,y:h}=G[P.Sphinx],c=t?l+200:l,u=t?h-90:h;e.tweens.add({targets:o,alpha:0,duration:!t||i?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{o.setPosition(c,u)},onComplete:()=>{o.alpha=1,o.disabled=t||!1}}),e.tweens.add({targets:o.light,x:c,y:u,duration:!t||i?0:450,ease:"Power1"})}const _o={[k.HerbRed]:{texture:"alchemy_red",tint:11141120,x:-20},[k.HerbGreen]:{texture:"alchemy_green",tint:43520,x:-35},[k.HerbBlue]:{texture:"alchemy_blue",tint:170,x:-5}};function Ho(e,t,i){e.inventory.removeItem(i),e.setActive(!1),t&&t.particles&&(Uo(e),t.disabled=!0,t.particles.setConfig({...we[O.AlchemySet].particles,tint:_o[i].tint,x:_o[i].x}).start().on("complete",(()=>{t.disabled=!1,e.setActive(!0)})))}function Uo(e){const t=Re(e.scene,O.AlchemySet);t&&(t.setTexture("alchemy_empty"),Ee(e,k.HerbBlue)?t.setTexture(_o[k.HerbBlue].texture):Ee(e,k.HerbRed)?t.setTexture(_o[k.HerbRed].texture):Ee(e,k.HerbGreen)&&t.setTexture(_o[k.HerbGreen].texture))}const $o={mazeSolved:!1,mazeSeed:0,sphinxFail:!1,sphinxMoved:!1};class Vo{constructor(e,i){t(this,"scene"),t(this,"player"),t(this,"data"),this.scene=e,this.player=i,this.data={...$o}}updateData(e,t){this.data={...this.data,...e},Object.entries(e).forEach((([e,i])=>{this.handleSideEffects(e,i,t)}))}handleSideEffects(e,t,i){"sphinxMoved"===e&&No(this.scene,t,i)}}const qo="chrono-sleuth-save";var Xo=(e=>(e[e.New=0]="New",e[e.Act1=1]="Act1",e[e.Act2=2]="Act2",e[e.LabItems=3]="LabItems",e[e.Act3=4]="Act3",e))(Xo||{});const Ko={player:{x:Zn.x,y:Zn.y,flip:!1},journal:[],inventory:[],quests:[],gameState:{...$o},settings:{gamepad:[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((e=>navigator.userAgent.match(e))),debug:!1,zoomed:!0,useShader:!0,time:Date.now(),muted:!1}},Yo={...Ko.settings,gamepad:!1},Qo={0:Ko,1:{player:{x:Zn.x,y:Zn.y,flip:!1},journal:[C.FixTheClock],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!1}],quests:[{id:I.ForestGear,completed:!1},{id:I.SphinxRiddle,completed:!0}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}},2:{player:{x:-770,y:Zn.y,flip:!0},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}},3:{player:{x:-1500,y:1729,flip:!0},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear,C.AlchemyLabFound,C.AlchemySetFixed],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0},{type:k.Key,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!1},{id:I.ExploreLab,completed:!1},{id:I.FindPotionIngredients,completed:!1}],gameState:{...$o},settings:{...Yo}},4:{player:{x:5073.875,y:915,flip:!1},journal:[C.FixTheClock,C.MetTheMayor,C.ClockFirstGear,C.AlchemyLabFound,C.AlchemySetFixed,C.SafeDiscovered,C.ExtraPotionInformation,C.ClockSecondGear],inventory:[{type:k.Wrench,used:!1},{type:k.Gear1,used:!0},{type:k.Key,used:!0},{type:k.HerbRed,used:!0},{type:k.HerbGreen,used:!0},{type:k.HerbBlue,used:!0},{type:k.Potion,used:!0},{type:k.Gear2,used:!0}],quests:[{id:I.ForestGear,completed:!0},{id:I.SphinxRiddle,completed:!0},{id:I.InvestigateTownWest,completed:!0},{id:I.ExploreLab,completed:!0},{id:I.FindPotionIngredients,completed:!0}],gameState:{...$o,mazeSolved:!0,sphinxMoved:!0},settings:{...Yo}}};class Jo extends a.Scene{constructor(){super({key:"Boot",pack:{files:[{type:"image",key:"splash",url:"assets/splash.jpg"}]}})}init(){var e;this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.sound.pauseOnBlur=!1,e=this.sound,z=new D(e)}preload(){this.load.setPath("assets"),this.load.image("logo","logo.jpg"),this.load.font("m6x11","../m6x11.ttf","truetype"),this.load.bitmapFont("m6x11-24","fonts/m6x11-24.png","fonts/m6x11-24.xml"),this.load.svg("maximize","icons/maximize.svg",{width:64,height:64}),this.load.svg("minimize","icons/minimize.svg",{width:64,height:64}),this.load.svg("settings","icons/settings.svg",{width:64,height:64}),this.load.json("build",`../build.json?cacheBust=${Date.now()}`),w.phaserInspector&&(this.load.scripts("inspector",["https://cdn.jsdelivr.net/npm/tweakpane@3.1.10/dist/tweakpane.js","https://cdn.jsdelivr.net/npm/phaser-plugin-inspector@2.5.0/dist/phaser-plugin-inspector.umd.js"]),this.load.once("complete",(()=>{PhaserPluginInspector.Install(this.plugins)})))}create(){var e;try{const t=null==(e=this.cache.json.get("build"))?void 0:e.buildTime;if(t&&"2025-01-10T08:21:04.722Z"!==t)return this.add.text(w.width/2,w.height/2,"New version available!\nUpdating Game...",{...yn,align:"center",fontSize:48}).setOrigin(.5).postFX.addGlow(0,10),void setTimeout((()=>window.location.reload()),15e3)}catch(t){console.error(t)}w.prod&&localStorage.getItem(qo)?this.scene.start("MainMenu"):this.scene.start("Preloader")}}function Zo(e){e.load.setPath("assets"),e.load.image("train","maps/intro/train.png"),e.load.image("layer2","maps/intro/layer2.png"),e.load.image("layer3","maps/intro/layer3.png"),e.load.image("layer4","maps/intro/layer4.png"),e.load.image("layer5","maps/intro/layer5.png"),e.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),e.load.image("player_portrait","characters/player_portrait.png"),e.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),e.load.audio(E.Intro,"sounds/music/A New Day's Hurry.m4a")}class er extends a.Scene{constructor(){super("Intro"),t(this,"player"),t(this,"playerProgess",0),t(this,"direction",1),t(this,"pauseDuration",0)}preload(){Zo(this)}init(){var e,t;this.sound.mute=Qo[Xo.New].settings.muted,w.prod||(null==(e=this.input.keyboard)||e.on("keydown-BACK_SLASH",(()=>{ae(this,500,(()=>{this.textures.exists("warp")?this.scene.start("Game"):this.scene.start("Preloader")}))})),null==(t=this.input.keyboard)||t.on("keydown-R",(()=>{this.scene.restart()})))}create(){var e;z.setScene(this),z.start(E.Intro);const t=w.zoomed?.75:1;re(this,350),this.add.image(w.width,w.height,"layer5").setScale(5*t);const i=this.add.image(0,w.height,"layer4").setScale(5*t),s=this.add.image(0,w.height,"layer4").setScale(5*t),n=this.add.image(0,350*t,"layer3").setScale(2*t),o=this.add.image(0,.7*w.height,"layer2").setScale(5*t),r=w.width;this.tweens.add({targets:[i],x:{from:2.5*-r,to:0},duration:12e4,repeat:-1}),this.tweens.add({targets:[s],x:{from:0,to:2.5*r},duration:12e4,repeat:-1}),this.tweens.add({targets:n,x:{from:2*-r,to:2.75*r},duration:6e4,hold:9e4,repeat:-1}),this.tweens.add({targets:[o],x:{from:-r,to:1.5*r},duration:15e3,hold:45e3,repeat:-1});const a=this.add.container(0,w.zoomed?-35:0);this.player=this.add.sprite(560*t,w.height-250*t,"character",0).setScale(2.5*t),this.player.anims.create({key:"walk",frames:this.player.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:5,repeat:-1}),this.player.anims.play("walk"),this.player.anims.pause(),a.add(this.player),this.cameras.main.startFollow(this.player,!0,.1,.1,0,120);const l=this.add.image(w.width/2,w.height/2,"train").setScale(2*t);a.add(l),this.tweens.add({targets:a,x:a.x+1,y:a.y+5,duration:300,hold:300,ease:"Bounce",repeat:-1}),null==(e=this.add.rectangle(-w.width/2,w.height-(w.zoomed?60:35),2*w.width,35,4472896).setOrigin(0).postFX)||e.addShadow(0,0,.5,1),function(e,t){const i=w.zoomed?.75:1,s=new qn(e),n=e.add.text(w.width/2,w.height/2,"Later that day...",{...yn,fontSize:"42px"}).setOrigin(.5).setScrollFactor(0).setAlpha(0);t.setAngle(5);const o=e.add.timeline([{at:1500,tween:{targets:t,x:850*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:3100,sound:{key:"ladder",config:{rate:.6}}},{at:6e3,run:()=>ae(e,500)},{at:7500,run:()=>{const t=e.cameras.main;t.stopFollow(),t.centerOn(1e4,1e4),n.setAlpha(1),re(e,500)}},{at:1e4,run:()=>ae(e,500)},{at:12e3,run:()=>{e.textures.exists("warp")?e.scene.start("Game"):e.scene.start("Preloader")}}]),r=e.add.timeline([{at:1500,tween:{targets:t,x:1200*i,duration:2500,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:3100,sound:{key:"ladder",config:{rate:.6}}},{at:5500,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:6500,run:()=>{s.setDialog({messages:["No doubt about it, this will be a strange journey.","Whatever awaits me in this town, it’s certain that nothing will ever be the same again."],onCompleted:()=>o.play()},void 0,"player_portrait")}}]);e.add.timeline([{at:2500,tween:{targets:t,x:850*i,duration:3e3,onComplete:()=>t.anims.pause()},run:()=>t.anims.resume(),sound:{key:"ladder",config:{rate:.6}}},{at:4100,sound:{key:"ladder",config:{rate:.6}}},{at:7e3,run:()=>{t.setFlipX(!0),t.setAngle(-5)}},{at:8e3,run:()=>{t.setFlipX(!1),t.setAngle(5)}},{at:9e3,run:()=>{s.setDialog({messages:["What a beautiful mountain-scape. I almost forgot where I am headed.","It’s been three days since the letter arrived... It has been many years since I last visited that sleepy old town.","Rumors swirl of strange occurrences. People disappearing, clocks that never strike the hour, and a darkness that lingers beneath the surface."],onCompleted:()=>r.play()},void 0,"player_portrait")}}]).play()}(this,this.player)}}class tr extends ao{constructor(e,t,i){super(e,t,i,e.scale.isFullscreen?"minimize":"maximize",(()=>{e.scale.isFullscreen?e.scale.stopFullscreen():e.scale.startFullscreen()})),e.scale.on(Phaser.Scale.Events.ENTER_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("minimize")})),e.scale.on(Phaser.Scale.Events.LEAVE_FULLSCREEN,(()=>{this.img.scene=e,this.img.setTexture("maximize")}))}}class ir extends a.Scene{constructor(){super("MainMenu")}create(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height);const e=this.add.container(0,0);e.setAlpha(0),this.tweens.add({targets:e,alpha:1,duration:150}),e.add(this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4)),new ro(this,!0).setVisible(!1);const t=new $n(this);e.add(t);const i=new tr(this,w.width-30,30);t.addButton(i),localStorage.getItem(qo)&&t.addButton(new Hn(this,w.width-120,w.height-145,"Continue",(()=>this.scene.start("Preloader")),{align:"center"}).setFixedSize(200,70)),t.addButton(new Hn(this,w.width-120,w.height-60,"New Game",(()=>{localStorage.removeItem(qo),this.scene.start("Preloader")}),{align:"center"}).setFixedSize(200,70)),t.setActiveButton(1)}}class sr extends a.Scene{constructor(){super("Preloader"),t(this,"container")}init(){this.add.image(0,0,"splash").setOrigin(0).setDisplaySize(w.width,w.height),this.add.image(35,w.height-30,"logo").setOrigin(0,1).setScale(.4);const e=.66*w.width,t=.05*w.height,i=this.add.container(.24*w.width,.86*w.height);this.container=i;const s=this.add.rectangle(0,0,e,t).setStrokeStyle(1,16777215,.85).setOrigin(0);i.add(s);const n=this.add.rectangle(3,3,0,t-6,16777215,.85).setOrigin(0);i.add(n),this.load.on("progress",(t=>{const i=w.prod?.6*t:t;n.width=(e-6)*i})),w.prod&&this.load.on("complete",(()=>{this.tweens.add({targets:n,width:e-6,duration:2e3})}));const o=this.add.image(w.width-50,w.height-60,"settings").setScale(.75);this.tweens.add({targets:o,angle:360,duration:2e3,delay:100,repeat:-1})}preload(){this.load.setPath("assets"),this.load.svg("sun","icons/sun.svg",{width:64,height:64}),this.load.svg("moon","icons/moon.svg",{width:64,height:64}),this.load.svg("zoom-in","icons/zoom-in.svg",{width:64,height:64}),this.load.svg("zoom-out","icons/zoom-out.svg",{width:64,height:64}),this.load.svg("terminal","icons/terminal.svg",{width:64,height:64}),this.load.svg("award","icons/award.svg",{width:64,height:64}),this.load.svg("tv","icons/tv.svg",{width:64,height:64}),this.load.svg("save","icons/save.svg",{width:64,height:64}),this.load.svg("chevron-down","icons/chevron-down.svg",{width:64,height:64}),this.load.svg("volume","icons/volume-2.svg",{width:64,height:64}),this.load.svg("volume-mute","icons/volume-x.svg",{width:64,height:64}),this.load.svg("gamepad","icons/gamepad-solid.svg",{width:64,height:64}),this.load.image("town","maps/town.jpg"),this.load.image("clock_outside","maps/clock_outside.jpg"),this.load.image("clock_inner","maps/clock_inner.jpg"),this.load.image("forest","maps/forest.jpg"),this.load.image("lake","maps/lake.jpg"),this.load.image("mansion_outside","maps/mansion_outside_hatch.jpg"),this.load.image("mansion_inside","maps/mansion_inside.jpg"),this.load.image("alchemy_lab","maps/alchemy_lab.jpg"),this.load.image("library","maps/library.jpg"),this.load.image("watch","items/watch.png"),this.load.image("ladder","props/ladder.png"),this.load.image("warp","props/warp.png"),this.load.spritesheet("portal","props/portal.png",{frameWidth:140,frameHeight:120}),this.load.image("gear","items/gear.png"),this.load.image("gear2","items/gear2.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.png"),this.load.image("key","items/key.png"),this.load.image("herb_red","items/herb_red.png"),this.load.image("herb_green","items/herb_green.png"),this.load.image("herb_blue","items/herb_blue.png"),this.load.image("potion","items/potion.png"),this.load.spritesheet("character","characters/player.png",{frameWidth:128,frameHeight:80}),this.load.image("player_portrait","characters/player_portrait.png"),this.load.image("inventor","characters/inventor.png"),this.load.image("inventor_portrait","characters/inventor_portrait.png"),this.load.image("stranger","characters/stranger.png"),this.load.image("stranger_portrait","characters/stranger_portrait.png"),this.load.image("sphinx","characters/sphinx.png"),this.load.image("sphinx_portrait","characters/sphinx_portrait.png"),this.load.image("mayor","characters/mayor.png"),this.load.image("mayor_portrait","characters/mayor_portrait.png"),this.load.image("clock_portrait","characters/clock_portrait.png"),this.load.image("chest","props/chest.png"),this.load.image("chest_open","props/chest_open.png"),this.load.image("book","props/book.png"),this.load.image("picture","props/picture.png"),this.load.image("safe","props/safe.png"),this.load.image("alchemy_empty","props/alchemy/alchemy_empty.png"),this.load.image("alchemy_green","props/alchemy/alchemy_green.png"),this.load.image("alchemy_red","props/alchemy/alchemy_red.png"),this.load.image("alchemy_blue","props/alchemy/alchemy_blue.png"),this.load.image("alchemy_full","props/alchemy/alchemy_full.png"),this.load.image("arrow","puzzles/arrow.png"),Array.from({length:26},((e,t)=>String.fromCharCode(97+t))).forEach((e=>this.load.audio(e,`sounds/words/${e}.mp3`))),this.load.audio("warp","sounds/sfx/warp.mp3"),this.load.audio("ladder","sounds/sfx/ladder.mp3"),this.load.audio("door","sounds/sfx/door.mp3"),this.load.audio(E.Town,"sounds/music/Unknown.m4a"),this.load.audio(E.Clock,"sounds/music/Night Time Scavenge II.m4a"),this.load.audio(E.Mansion,"sounds/music/Reflective District.m4a"),this.load.audio(E.Forest,"sounds/music/Serene.m4a"),localStorage.getItem(qo)||Zo(this)}create(){this.time.delayedCall(w.prod?2500:0,(()=>{ae(this,300,(()=>{localStorage.getItem(qo)?this.scene.start("Game"):this.scene.start("Intro")}))}))}}class nr extends a.GameObjects.Container{constructor(e,i,s){var n,o,r,l,h;super(e,i,s),t(this,"buttons",[]),t(this,"activeIndex",new a.Math.Vector2),t(this,"cursor"),e.add.existing(this).setScrollFactor(0),this.activeIndex.set(-1,-1),null==(n=e.input.keyboard)||n.on("keydown-UP",(()=>{this.setActiveButton({x:0,y:-1})})),null==(o=e.input.keyboard)||o.on("keydown-DOWN",(()=>{this.setActiveButton({x:0,y:1})})),null==(r=e.input.keyboard)||r.on("keydown-LEFT",(()=>{this.setActiveButton({x:-1,y:0})})),null==(l=e.input.keyboard)||l.on("keydown-RIGHT",(()=>{this.setActiveButton({x:1,y:0})})),null==(h=e.input.keyboard)||h.on("keydown-ENTER",(()=>{const e=this.getActiveButton();e&&e.onClick(e)})),e.input.on("pointermove",(()=>{this.cursor.setVisible(!1)}))}setButtons(e){this.buttons=e,this.activeIndex.set(-1,-1),this.removeAll(!0),this.cursor=this.scene.add.rectangle(0,0,60,80).setStrokeStyle(2,K(W),.75).setVisible(!1).setDepth(1),this.add(this.cursor);for(const t of e)for(const e of t)void 0!==e&&this.add(e)}getActiveButton(){var e;return null==(e=this.buttons[this.activeIndex.y])?void 0:e[this.activeIndex.x]}setActiveButton(e){var t,i,s,n,o,r,l;let{x:h,y:c}=this.activeIndex;if(!1===this.cursor.visible){const e=null==(t=this.buttons[c])?void 0:t[h];return void(e&&(this.updateButtonSize(e),this.cursor.setPosition(e.x,e.y).setVisible(!0),this.cursor.setVisible(!0)))}const u=this.buttons.length;if(c=a.Math.Clamp(c,0,u-1),h=a.Math.Clamp(h,0,((null==(i=this.buttons[c])?void 0:i.length)||0)-1),0===e.x){let t;if(-1!==this.activeIndex.y){for(;c>=0&&c=0&&h<(null==(o=this.buttons[c])?void 0:o.length)&&void 0===t;)h+=e.x,t=null==(r=this.buttons[c])?void 0:r[h];if(!t)return}const d=null==(l=this.buttons[c])?void 0:l[h];d&&(this.updateButtonSize(d),this.cursor.setPosition(d.x,d.y).setVisible(!0),this.activeIndex.set(h,c))}updateButtonSize(e){const t=1.2;e instanceof Hn&&this.cursor.setSize(e.displayWidth*t,e.displayHeight*t),e instanceof ao&&this.cursor.setSize(e.rect.displayWidth*t,e.rect.displayHeight*t)}}const or=[[1,1,1,0,1],[1,0,1,0,1],[1,1,1,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1],[0,0,0,0,1]],rr=[["0","1","2"],["3"," ","4"],["5","6","7"]];class ar extends a.Scene{constructor(){super("UITest"),t(this,"selected"),t(this,"cursor"),t(this,"grid"),this.selected=void 0}create(){var e;const t=[];for(let i=0;i{t[0][0].text="0",t[0][1].text="1",t[0][2].text="2",t[1][0].text="3",t[1][2].text="4",t[2][0].text="5",t[2][1].text="6",t[0][4].text=" ",t[1][4].text=" ",t[2][4].text=" ",t[3][4].text=" ",t[4][4].text=" ",t[5][4].text=" ",t[6][4].text=" "}))}btn(e,t){return new Hn(this,50+60*e,50+85*t,e<3?" ":t.toString(),(e=>this.selectButton(e)))}selectButton(e){if(void 0===this.selected)this.selected=e,e.setSelected(!0);else{const t=this.selected.text;this.selected.setSelected(!1),this.selected.text=e.text,e.text=t,this.selected=void 0,this.checkValid()&&console.log("You Won!")}}checkValid(){var e;let t=!0;for(let i=0;i{const s=this.textObject.getWrappedText().length,n=i/this.textObject.height,o=Math.floor(n*s);r&&r(o)})),null==(l=e.input.keyboard)||l.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(h=e.input.keyboard)||h.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=e.add.graphics().setPosition(i,s).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=e.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(e,t){this.boxHeight=t,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,e,t);const i=this.maskGraphics.createGeometryMask();return this.textObject.setMask(i),this.textObject.setWordWrapWidth(e-8),this.textObject.setFixedSize(e-8,0),this.updateTextPosition(),this}setText(e){return this.textObject.setText(e),this.updateTextPosition(),this}handleDrag(e){e.isDown&&(this.scrollY-=e.velocity.y,this.updateTextPosition())}handleScroll(e,t,i,s,n){this.scrollY+=.5*s,this.updateTextPosition()}updateTextPosition(){const e=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=a.Math.Clamp(this.scrollY,0,e),this.textObject.y=-this.scrollY;const t=this.scrollY/e,i=this.boxHeight/this.textObject.height;this.scrollbar.height=i*this.boxHeight,this.scrollbar.setPosition(this.textObject.width+4,t*(this.boxHeight-i*this.boxHeight))}}class hr extends a.Scene{constructor(e){super(e.key),t(this,"dialogData"),t(this,"container"),t(this,"keys"),t(this,"title"),t(this,"additionalUI"),t(this,"closing"),this.dialogData=e}create(){var e,t,i;this.additionalUI=[],this.closing=!1,this.container=this.add.container(w.width/2,w.height/2),this.container.add(this.add.rectangle(0,0,.95*w.width,.95*w.height,0,.75).setStrokeStyle(4,K(W))),this.container.add(new Hn(this,.44*w.width,-.4*w.height,"X",(()=>this.close(!1)),{backgroundColor:`#${H}`})),w.prod||this.dialogData.hideCloseSuccess||this.container.add(new ao(this,.38*w.width,-.4*w.height,"award",(()=>this.startClose(!0)))),this.title=this.add.text(0,-.4*w.height,this.dialogData.title,{...yn,fontSize:48}).setOrigin(.5),this.container.add(this.title),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.startClose(!1)})),null==(t=this.input.keyboard)||t.on("keydown-BACKSPACE",(()=>{this.startClose(!1)})),w.prod||null==(i=this.input.keyboard)||i.on("keydown-BACK_SLASH",(()=>{this.startClose(!0)})),this.keys=new be(this),new ro(this,!0).setVisible(this.dialogData.gamepadVisible),this.container.setAlpha(0),this.dialogData.childScene?(this.scene.launch(this.dialogData.childScene,{parent:this}),this.scene.get(this.dialogData.childScene).events.on("create",(()=>this.fadeIn()))):this.fadeIn()}fadeIn(){this.tweens.add({targets:this.getTargets(),alpha:{start:0,to:1},delay:100,duration:500})}fadeOut(e){this.tweens.add({targets:this.getTargets(),alpha:{start:1,to:0},duration:250,hold:250,onComplete:e})}addTarget(e){e.setAlpha(0),this.additionalUI.push(e)}getTargets(){return[this.container,...this.additionalUI]}startClose(e){this.closing||(this.closing=!0,this.close(e))}close(e){this.fadeOut((()=>{var t,i,s,n;this.scene.stop(),this.dialogData.childScene&&this.scene.stop(this.dialogData.childScene),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),null==(n=null==(s=this.scene.get("Game"))?void 0:s.gamepad)||n.resetButtons(),this.handleSuccess(e)}))}}const cr="chrono-sleuth-debug-tab";function ur(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function dr(e){for(var t=1;tt+e)):Array.from(Array(e).keys())}function fr(e){return[...new Set(e)]}function mr(e,t){const i=fr(e.map((e=>e.set))).filter(Boolean),s=(n=gr(1,e.length+1),o=i,[n,o].reduce(((e,t)=>e.filter((e=>!t.includes(e)))))).sort((()=>.5-t()));var n,o;e.filter((e=>!e.set)).forEach(((e,t)=>e.set=s[t]))}function br(e,t,i=.5){yr(e).forEach(((s,n)=>{const o=e[n+1],r=s.set!==o.set,a=t()<=i;var l,h,c;r&&a&&(l=e,h=o.set,c=s.set,l.forEach((e=>{e.set===h&&(e.set=c)})),s.right=!1,o.left=!1)}))}const vr=48;class wr extends a.Scene{constructor(){super("Maze"),t(this,"parent"),t(this,"graphics"),t(this,"keys"),t(this,"maze"),t(this,"mazePlayer"),t(this,"nextUpdate")}init(e){this.parent=e.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*vr,.8*vr,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys,this.parent.addTarget(this.graphics),this.parent.addTarget(this.mazePlayer)}getMazeSeed(){return this.parent.player.gameState.data.mazeSeed||0}createMaze(){const e=this.getMazeSeed();this.maze=function(e=8,t=e,i=!0,s=1){const n=function(e){return function(){let t=e+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}(s),o=[],r=gr(e);for(let h=0;h({x:s,y:h,top:i||h>0,left:i||s>0,bottom:i||h{mr(e,n),br(e,n),function(e,t,i){const s=Object.values(function(e){let t=fr(e.map((e=>e.set))).reduce(((e,t)=>dr(dr({},e),{},{[t]:[]})),{});return e.forEach((e=>t[e.set].push(e))),t}(e)),{ceil:n}=Math;s.forEach((e=>{(function(e,t,i){t=null==t?1:t;const s=null==e?0:e.length;if(!s||t<1)return[];t=t>s?s:t;let n=-1;const o=s-1,r=[...e];for(;++n{if(e){const i=t[e.x];e.bottom=!1,i.top=!1,i.set=e.set}}))}))}(e,o[t+1],n)}));const a=(l=o)[l.length-1];var l;return mr(a,n),br(a,n,1),o}(24,24,!0,e),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,vr,vr),this.graphics.lineStyle(3,3385907),this.maze.forEach((e=>{e.forEach((e=>{if(e.top){const t=new a.Geom.Line(e.x*vr,e.y*vr,e.x*vr+vr,e.y*vr);this.graphics.strokeLineShape(t)}if(e.bottom){const t=new a.Geom.Line(e.x*vr,e.y*vr+vr,e.x*vr+vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}if(e.left){const t=new a.Geom.Line(e.x*vr,e.y*vr,e.x*vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}if(e.right){const t=new a.Geom.Line(e.x*vr+vr,e.y*vr,e.x*vr+vr,e.y*vr+vr);this.graphics.strokeLineShape(t)}}))})),this.cameras.main.setViewport(50,130,w.width-100,w.height-170)}update(e,t){if(e=24||n>=24)return!1;const o=a.Math.FloorTo(this.mazePlayer.x/vr),r=a.Math.FloorTo(this.mazePlayer.y/vr),l=this.maze[r][o];return!(l.top&&ithis.mazePlayer.y||l.left&&tthis.mazePlayer.x)}}class xr extends a.GameObjects.Rectangle{constructor(e,i,s){super(e,0,0,i.size,i.size),t(this,"keys"),t(this,"cursorData"),t(this,"nextUpdate",0),t(this,"position",new a.Math.Vector2(-1,-1)),e.add.group(this,{runChildUpdate:!0}),this.setStrokeStyle(2,K(W),.75),this.setVisible(!1),this.cursorData=i,this.keys=s,e.input.on("pointerdown",(e=>{this.setVisible(!1)}))}update(e,t){var i;if(ethis.resume()))),this.container.add(this.add.text(t/2,w.height/2-100,"Game Paused",{...yn,fontSize:72}).setOrigin(.5)),this.debugCount=0,this.container.add(this.add.text(t-20,i-20,`Build Time: ${new Date("2025-01-10T08:21:04.722Z").toLocaleString()}\n${w.prod?"":"Debug Mode"}`,{...yn,fontSize:16,align:"right",padding:{x:20,y:20}}).setOrigin(1,1).setInteractive({useHandCursor:!1}).on("pointerdown",(()=>{this.debugCount++,this.debugCount>10&&(localStorage.setItem("chrono-sleuth-prod",w.prod?"false":"true"),window.location.reload())})));const s=w.zoomed?36:48,n=new nr(this);this.container.add(n);const o=new ao(this,w.width-210,30,"tv",(()=>{vn()})),r=new ao(this,w.width-150,30,"gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)})),a=new ao(this,w.width-90,30,this.parent.sound.mute?"volume-mute":"volume",(()=>{const e=this.parent.sound.mute;this.parent.sound.mute=!e,a.setIcon(e?"volume":"volume-mute")})),l=new tr(this,w.width-30,30),h=new Hn(this,t/2,w.height/2,"Resume",(()=>this.resume()),{fontSize:s});let c;w.prod||(c=new ao(this,30,30,"terminal",(()=>{this.resume(),this.parent.time.delayedCall(200,(()=>{he(this.parent,"DebugTool")}))}))),n.setButtons([[c,o,r,a,l],[void 0,h,void 0,void 0,void 0],[void 0,void 0,void 0,void 0,void 0]]),n.activeIndex.set(1,1),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>this.resume())),new ro(this).setVisible(!1),this.tweens.add({targets:this.container,alpha:{start:0,to:1},duration:250})}resume(){this.tweens.add({targets:this.container,alpha:{start:1,to:0},duration:250,onComplete:()=>{this.scene.stop(),this.scene.resume("Game")}})}}class kr extends a.Scene{constructor(){super("Pipes"),t(this,"parent"),t(this,"keys"),t(this,"pipes",[]),t(this,"totalPipes",0),t(this,"images",[]),t(this,"container"),t(this,"blockSize"),t(this,"pipeSize"),t(this,"initialized",!1)}init(e){this.parent=e.parent,this.blockSize=w.zoomed?13:17,this.pipeSize=3.75*this.blockSize}preload(){this.prerenderPipes()}prerenderPipes(){for(const e of So){const t=ho[e],i=`pipe_${e}`;this.textures.exists(i)&&this.textures.remove(i);const s=this.textures.createCanvas(i,3*this.blockSize,3*this.blockSize);if(s){const e=s.context;e.fillStyle="#ffffff";for(let i=0;i{const t=this.pipes[e.y+1][e.x+1];t.interactive&&(t.rotation=(t.rotation+90)%360,this.updatePipes())}},this.keys);this.container.add(t)}createPipes(){this.pipes=[],this.container=this.add.container().setPosition(w.width/2-16*this.pipeSize/2+this.pipeSize/2,w.height/4),this.totalPipes=0;for(let e=0;e<8;e++){this.pipes[e]||(this.pipes[e]=[]);for(let t=0;t<16;t++){let i=co[e][t];const s=0===t||0===e||15===t||7===e,n=15===t&&7===e,o=!s;this.pipes[e][t]={x:t,y:e,type:i,rotation:s?0:90*a.Math.Between(0,3),interactive:o},i!==lo.Empty&&this.totalPipes++;const r=t+e*co[0].length;this.time.delayedCall(50+5*r,(()=>{const s=`pipe_${i}`,r=this.add.image(t*this.pipeSize,e*this.pipeSize,s).on("pointerdown",(()=>{this.initialized&&(this.pipes[e][t].rotation=(this.pipes[e][t].rotation+90)%360,this.updatePipes())}));r.setAlpha(0).setScale(.5).setAngle(this.pipes[e][t].rotation),this.tweens.add({targets:r,alpha:1,scale:1,duration:300,onComplete:n?()=>{this.initialized=!0,this.updatePipes()}:void 0}),o?r.setInteractive():r.setTint(6710886),this.container.add(r),this.images.push(r)}))}}this.parent.addTarget(this.container)}updatePipes(){const e=function(e){const t=[],i=new Set,s=e.length,n=e[0].length;return function o(r,a){const l=`${r},${a}`;i.add(l),t.push(e[a][r]),r+1=0&&!i.has(`${r-1},${a}`)&&uo(e[a][r],e[a][r-1])&&o(r-1,a),a+1=0&&!i.has(`${r},${a-1}`)&&uo(e[a][r],e[a-1][r])&&o(r,a-1)}(0,2),t}(this.pipes);this.pipes.forEach((e=>{e.forEach((e=>{this.images[e.x+e.y*co[0].length].setAngle(e.rotation)}))})),e.length===this.totalPipes&&this.parent.close(!0)}completed(e){const t=this.images.length,i=new a.Display.Color(255,255,255),s=Q(K(N));for(let n=0;no.setTint(e)),{duration:500,delay:10*n,hold:1e3,onComplete:n===t-1?e:void 0})}}}const Ir=w.height/(w.zoomed?4:5.5),Pr=[[1,0,1,1,0],[0,1,0,0,0],[0,0,1,0,1],[0,0,1,1,0],[1,1,0,0,1]],Tr=2*Math.PI/16;!function(e={}){const{immediate:t=!1,onNeedRefresh:i,onOfflineReady:s,onRegistered:n,onRegisteredSW:o,onRegisterError:a}=e;let l,h;h=async function(){if("serviceWorker"in navigator){if(l=await function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),o=(null==n?void 0:n.nonce)||(null==n?void 0:n.getAttribute("nonce"));s=Promise.allSettled(t.map((t=>{if(t=function(e,t){return new URL(e,t).href}(t,i),t in r)return;r[t]=!0;const s=t.endsWith(".css"),n=s?'[rel="stylesheet"]':"";if(i)for(let i=e.length-1;i>=0;i--){const n=e[i];if(n.href===t&&(!s||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${t}"]${n}`))return;const a=document.createElement("link");return a.rel=s?"stylesheet":"modulepreload",s||(a.as="script"),a.crossOrigin="",a.href=t,o&&a.setAttribute("nonce",o),document.head.appendChild(a),s?new Promise(((e,i)=>{a.addEventListener("load",e),a.addEventListener("error",(()=>i(new Error(`Unable to preload CSS for ${t}`))))})):void 0})))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then((t=>{for(const e of t||[])"rejected"===e.status&&n(e.reason);return e().catch(n)}))}((async()=>{const{Workbox:e}=await import("./workbox-window.prod.es5-BXNXHyjv.js");return{Workbox:e}}),[],import.meta.url).then((({Workbox:e})=>new e("./sw.js",{scope:"./",type:"classic"}))).catch((e=>{null==a||a(e)})),!l)return;l.addEventListener("activated",(e=>{(e.isUpdate||e.isExternal)&&window.location.reload()})),l.addEventListener("installed",(e=>{e.isUpdate||null==s||s()})),l.register({immediate:t}).then((e=>{o?o("./sw.js",e):null==n||n(e)})).catch((e=>{null==a||a(e)}))}}()}({immediate:!0});const Cr={type:Phaser.WEBGL,width:w.width,height:w.height,parent:"game-container",backgroundColor:K(q),scale:{mode:Phaser.Scale.FIT,autoCenter:w.prod?Phaser.Scale.CENTER_BOTH:Phaser.Scale.CENTER_HORIZONTALLY},loader:{imageLoadType:"HTMLImageElement"},scene:[Jo,ir,sr,er,Ao,Sr,class extends hr{constructor(){super({key:"JournalDialog",title:"Journal",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player")}init(e){this.player=e.player}create(){var e;super.create(),this.player.journal.unread.setVisible(!1);const t=this.player.journal.journal.map((e=>`- ${Se[e].description}\n`)).reverse(),i=new lr(this,.08*w.width,.25*w.height,t,{fontSize:32});i.setBoxSize(.84*w.width,.62*w.height),this.addTarget(i),this.fadeIn(),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.close()}))}handleSuccess(){}},class extends hr{constructor(){super({key:"DebugTool",title:"Debug Tool",gamepadVisible:!1,hideCloseSuccess:!0}),t(this,"player"),t(this,"tabs",[]),t(this,"tab",0),t(this,"mainContainer"),t(this,"textBox"),t(this,"helperText"),t(this,"stateContainer"),t(this,"saveContainer"),t(this,"miscContainer"),t(this,"preSave"),t(this,"testVoice",{octave:3.5,speed:1,volume:1,type:"sine"});const e=localStorage.getItem(cr);e&&(this.tab=Number(e))}init(e){this.player=e.player;const t=kn(this.player.scene);t.settings.time=0,this.preSave=JSON.stringify(t)}create(){var e;super.create(),this.mainContainer=this.add.container(-w.width/2,-w.height/2),this.container.add(this.mainContainer),this.mainContainer.add(this.add.rectangle(300,100,.65*w.width,.75*w.height,K("#112233")).setOrigin(0));const t=this.makeTab("Items",0),i=this.makeTab("Journal",1),s=this.makeTab("Quests",2),n=this.makeTab("State",3),o=this.makeTab("Warp",4),r=this.makeTab("Saves",5),a=this.makeTab("Misc",6);this.textBox=new lr(this,300,100,"",{fontSize:32},(e=>this.handleLineClick(e))).setBoxSize(.38*w.width,.75*w.height),this.mainContainer.add(this.textBox),this.helperText=this.add.text(w.zoomed?.94*w.width:.87*w.width,110,"",{...yn,fontSize:24}).setOrigin(1,0).setDepth(1),this.mainContainer.add(this.helperText),this.tabs=[t,i,s,n,o,r,a],this.container.add(this.tabs),this.createStateContainer(),this.createSaveContainer(),this.createMiscContainer(),this.updateTabs(),null==(e=this.input.keyboard)||e.on("keydown-CLOSED_BRACKET",(()=>{this.close()}))}createStateContainer(){this.stateContainer=this.add.container(310,100),this.mainContainer.add(this.stateContainer);const e=this.player.gameState.data;Object.entries(e).forEach(((t,i)=>{const[s,n]=t,o=this.add.text(0,20+40*i,`${s}: ${n}`,{...yn,fontSize:32}).setOrigin(0);switch(this.stateContainer.add(o),typeof n){case"boolean":o.setText(`${n?"[x]":"[ ]"} ${s}`),o.setInteractive().on("pointerdown",(()=>{e[s]=!e[s],o.setText(`${e[s]?"[x]":"[ ]"} ${s}`)}));break;case"number":const t=this.smallButton(o.width+20,22+40*i,"-",(()=>{e[s]--,o.setText(`${s}: ${e[s]}`)})),r=this.smallButton(o.width+55,22+40*i,"+",(()=>{e[s]++,o.setText(`${s}: ${e[s]}`)}));this.stateContainer.add([t,r])}}))}smallButton(e,t,i,s){return new Un(this,e,t,i,s,{fontSize:36,backgroundColor:"#111",padding:{x:6,y:-4}},null)}createSaveContainer(){this.saveContainer=this.add.container(310,100),this.mainContainer.add(this.saveContainer),Object.entries(Qo).forEach(((e,t)=>{const[i,s]=e,n=new Un(this,0,10+60*t,Xo[Number(i)],(()=>{Number(i)===Xo.New?(localStorage.removeItem(qo),window.location.reload()):(On(this.player.scene,s),this.player.x+=.1,this.close(!0))}),{backgroundColor:"#111"});this.saveContainer.add(n)}));const e=new Un(this,350,10,"Dump Save",(()=>{const e=(t=kn(this.player.scene),JSON.stringify(t,((e,t)=>{const i=Pn[e];return Array.isArray(t)&&i?t.map((e=>ce(e,i.enumObj,i.enumName))):i?ce(t,i.enumObj,i.enumName):t}),2).replace(/"(\w+\.\w+)"/g,"$1"));var t;navigator.clipboard.writeText(e).catch((e=>console.error(e))),console.warn("save copied to clipboard!"),console.log(e)}),{backgroundColor:"#111"});this.saveContainer.add(e)}createMiscContainer(){this.miscContainer=this.add.container(310,100),this.mainContainer.add(this.miscContainer);const e=new Un(this,350,10,"Debug Mode",(()=>{w.debug=!w.debug,this.close()}),{backgroundColor:"#111"});this.miscContainer.add(e)}makeTab(e,t){return new Un(this,40-this.container.x,100-this.container.y+60*t,e,(()=>{this.tab=t,localStorage.setItem(cr,String(t)),this.updateTabs()}))}rangeInput(e,t,i,s,n){const o=this.add.text(e,t,`${n}: ${i().toFixed(1)}`,{...yn}),r=this.smallButton(e+130,t,"-",(()=>{s(i()-.1),o.text=`${n}: ${i().toFixed(1)}`})),a=this.smallButton(e+170,t,"+",(()=>{s(i()+.1),o.text=`${n}: ${i().toFixed(1)}`}));return[o,r,a]}handleLineClick(e){var t,i;switch(this.tab){case 0:const s=go[e],n=this.player.inventory.inventory,o=n.find((e=>e.type===s));o?o.used?n.splice(n.indexOf(o),1):o.used=!o.used:this.player.inventory.addItem({type:s,used:!1},!0);break;case 1:const r=fo[e],a=this.player.journal.journal;De(this.player,r)?a.splice(a.indexOf(r),1):this.player.journal.addEntry(r,!0);break;case 2:const l=vo[e],h=this.player.quests.quests,c=h.find((e=>e.id===l));c?c.completed?h.splice(h.indexOf(c),1):c.completed=!c.completed:this.player.quests.addQuest({id:l,completed:!1},!0);break;case 4:const u=wo[e],d=Pe[u];this.player.setPosition(d.x,d.y),this.close();break;case 6:if(e>1){const s=ko[e-2];"MainMenu"===s?(this.scene.sendToBack("Game"),this.scene.start(s)):(this.scene.stop(this),this.scene.resume("Game"),null==(i=null==(t=this.scene.get("Game"))?void 0:t.gamepad)||i.setAlpha(1),he(this.player.scene,s))}}this.updateTabs()}updateTabs(){var e,t,i;this.tabs.forEach(((e,t)=>{e.setBackgroundColor(t===this.tab?"#123":"#151515")}));const s=0===this.tab||1===this.tab||2===this.tab||4===this.tab||6===this.tab,n=0===this.tab||2===this.tab;null==(e=this.stateContainer)||e.setVisible(3===this.tab),null==(t=this.saveContainer)||t.setVisible(5===this.tab),null==(i=this.miscContainer)||i.setVisible(6===this.tab),this.textBox.setVisible(s),this.helperText.setVisible(n);let o="";switch(this.tab){case 0:o=go.map((e=>`[${Ae(this.player,e)?"-":Ee(this.player,e)?"x":" "}] ${k[e]}`)).join("\n"),this.helperText.setText("[-] item held\n[x] item used");break;case 1:o=fo.map((e=>`[${De(this.player,e)?"x":" "}] ${C[e]}`)).join("\n");break;case 2:o=vo.map((e=>`[${Me(this.player,e)?"-":ze(this.player,e)?"x":" "}] ${I[e]}`)).join("\n"),this.helperText.setText("[-] quest active\n[x] quest complete");break;case 4:o=wo.map((e=>S[e])).join("\n");break;case 6:o=["Scenes","-----------------",...ko].join("\n")}this.textBox.setText(o)}handleSuccess(e){const t=kn(this.player.scene);t.settings.time=0,this.preSave!==JSON.stringify(t)&&(e||On(this.player.scene),this.player.scene.scene.restart())}},class extends hr{constructor(){super({key:"MazeDialog",title:"Find your way through the forest",childScene:"Maze",gamepadVisible:!0}),t(this,"player"),t(this,"arrow")}init(e){var t,i;this.player=e.player,this.dialogData.gamepadVisible=null==(i=null==(t=e.player.scene)?void 0:t.gamepad)?void 0:i.visible}create(){super.create(),this.arrow=this.add.image(.4*-w.width,.4*-w.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow)}setAngle(e){this.arrow.setRotation(e+Math.PI/2)}handleSuccess(e){e?(Oe(S.Forest,this.player),this.player.gameState.updateData({mazeSolved:!0,mazeSeed:this.player.gameState.data.mazeSeed+1},!1)):this.player.setPosition(Pe[S.TownEast].x-100,Pe[S.TownEast].y)}},wr,class extends hr{constructor(){super({key:"PipesDialog",title:"Attach all of the pipes to fix the alchemy set.\n[CONTINUE/CLICK] to rotate",gamepadVisible:!1,childScene:"Pipes"}),t(this,"player")}init(e){this.player=e.player}create(){super.create(),this.title.setFontSize(36).setAlign("center").setY(this.title.y+10)}close(e){const t=this.scene.get("Pipes");e&&t?t.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.player.message.setDialog(Fo,Re(this.player.scene,O.AlchemySet),"player_portrait")}},kr,class extends hr{constructor(){super({key:"TumblerDialog",title:"Open the lock by aligning all rings",gamepadVisible:!1}),t(this,"player"),t(this,"angles"),t(this,"rings"),t(this,"line"),t(this,"fx"),t(this,"active"),t(this,"nextUpdate"),t(this,"disabled")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=5;e++)this.load.image(`ring_${e}`,`puzzles/tumbler/ring${e}.png`)}create(){super.create(),this.angles=[],this.rings=[],this.fx=[],this.active=-1,this.nextUpdate=0,this.disabled=!1,this.line=this.add.line(0,30,27,0,216,0,K(V)).setOrigin(0,0).setLineWidth(5),this.container.add(this.line),this.container.add(this.add.text(.45*-w.width,.2*w.height,"Use [Left]/[Right]\nto select a ring\n\nUse [Up]/[Down]\nto rotate a ring",{...yn}));for(let e=0;e{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragstart",(i=>{if(this.active=-1,i.isDown){this.active=e;const s=a.Math.Angle.Between(t.x,t.y,i.x,i.y);this.handleMove(e,s)}})).on("dragend",(()=>{this.active=-1,this.updateMarkers(!0)}));this.fx.push(i.postFX.addGlow(K(V),2,0)),this.input.enableDebug(i),this.container.add(i),this.rings.push(i)}handleMove(e,t,i){var s;if(this.disabled)return;const n=this.angles[e]-t;this.angles[e]=t%(2*Math.PI),null==(s=Pr[e])||s.forEach(((t,i)=>{i!==e&&(this.angles[i]=(this.angles[i]+t*n)%(2*Math.PI))})),this.updateMarkers(i)}updateMarkers(e){let t=!0;this.angles.forEach(((e,i)=>{var s;const n=a.Math.Snap.To(e,Tr);Math.abs(n-0)<.6*Tr||Math.abs(n-2*Math.PI)<.6*Tr||(t=!1),null==(s=this.rings[i])||s.setAngle(a.Math.RadToDeg(n))})),t&&e&&this.close(!0)}completed(e){this.tweens.add({targets:this.rings,rotation:0,duration:500,onComplete:()=>{this.angles=[0,0,0,0,0],this.updateMarkers(),this.disabled=!0,this.active=-1,this.tweens.add({targets:[...this.rings,this.line],rotation:2*Math.PI,delay:500,duration:1500,hold:1e3,onComplete:e})}})}update(e,t){var i;if(!(esuper.close(e))):super.close(e)}handleSuccess(e){e&&function(e){e.inventory.removeItem(k.Potion);const t=e.scene,i=new Wo(e.scene,k.Gear2,e);t.interactiveObjects.add(i);const s=Re(t,O.MansionPicture);s&&(i.disabled=!0,i.setPosition(s.x,s.y+20),t.tweens.add({targets:i,x:s.x-10,y:s.y+120,duration:1e3,onComplete:()=>{e.message.setDialog({messages:["Wow, that was a trip","I should be more careful next time","At least I found the gear!"],onCompleted:()=>{Sn(t,!1),t.time.delayedCall(1e3,(()=>i.disabled=!1))}},s,"player_portrait")},ease:"Bounce.easeOut"}))}(this.player)}},class extends hr{constructor(){super({key:"MemoryDialog",title:"Figure out the secret code",gamepadVisible:!1}),t(this,"sequence"),t(this,"pressed"),t(this,"buttons"),t(this,"player")}init(e){this.player=e.player}preload(){this.load.setPath("assets");for(let e=1;e<=12;e++)this.load.image(`rune_${e}`,`puzzles/runes/Stone${e}.png`)}create(){for(super.create(),this.sequence=[],this.pressed=[];this.sequence.length<6;){const e=a.Math.RND.between(0,11);this.sequence.includes(e)||this.sequence.push(e)}w.prod||this.container.add(this.add.text(0,.43*w.height,`[ ${this.sequence.map((e=>e+1)).join(", ")} ]`,{fontSize:18,align:"center"}).setOrigin(.5)),this.buttons=new $n(this),this.container.add(this.buttons);const e=w.width/13*1.2,t=[];for(let s=0;s<12;s++){const i=s%3*e-e,n=1.2*-e+Math.floor(s/3)*e,o=Math.floor(s/3);void 0===t[o]&&t.push([]),t[o].push({x:i,y:n});const r=this.add.image(i,n,`rune_${s+1}`).setInteractive({useHandCursor:!0});r.on("pointerdown",(()=>this.onButtonPress(r,s))),this.buttons.add(r)}const i=new xr(this,{regions:t,size:e,keyHandler:e=>{const t=3*e.y+e.x,i=this.buttons.getAt(t);this.onButtonPress(i,t)}},this.keys);this.container.add(i)}onButtonPress(e,t){const i=this.pressed.length;this.sequence[i]===t?(this.pressed.push(t),e.disableInteractive(),J(this,new a.Display.Color(255,255,255),Q(K(U)),(t=>e.setTint(t)),{duration:250,onComplete:()=>{J(this,Q(K(U)),Q(3355443),(t=>e.setTint(t)),{duration:250,onComplete:()=>{this.sequence.length===this.pressed.length&&this.close(!0)}})}})):(e.disableInteractive(),J(this,new a.Display.Color(255,255,255),Q(K(H)),(t=>e.setTint(t)),{duration:250,yoyo:!0,onComplete:()=>{this.buttons.each((e=>{e.setInteractive(),e.setTint(16777215)}))}}),this.pressed=[])}close(e){e?this.completed((()=>super.close(e))):super.close()}completed(e){this.time.delayedCall(300,(()=>{this.buttons.getAll().forEach(((t,i)=>{const s=11===i,n=t.tint,o=Q(n),r=Q(K(U));t.disableInteractive(),t.setTint(n),J(this,o,r,(e=>t.setTint(e)),{duration:200,delay:70*i,hold:500,onComplete:s?e:void 0})}))}))}handleSuccess(e){e&&function(e){const t=e.scene,i=new Wo(t,k.Gear1,e);t.interactiveObjects.add(i);const s=Re(t,O.Chest);s&&(e.setX(s.x-100),s.setTexture("chest_open"),s.disabled=!0,i.disabled=!0,i.setPosition(s.x,s.y-20),i.setScale(.15),t.tweens.add({targets:i,scale:.35,y:s.y+20,duration:700,onComplete:()=>{s.disabled=!1,i.disabled=!1},ease:"Bounce.easeOut"}))}(this.player)}},class extends hr{constructor(){super({key:"SliderDialog",title:"Arrange the tiles to be in order.",gamepadVisible:!1}),t(this,"solution",[]),t(this,"layout",[]),t(this,"tiles",[])}preload(){this.load.setPath("assets");const e=Math.floor(1024/3);this.load.spritesheet("puzzle","puzzles/puzzle.png",{frameWidth:e,frameHeight:e})}create(){super.create();const e=[];this.solution=Array.from({length:9},((e,t)=>t)),this.layout=[...this.solution],this.tiles=[];for(let i=this.layout.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[this.layout[i],this.layout[e]]=[this.layout[e],this.layout[i]]}this.layout.forEach(((t,i)=>{const s=i%3,n=Math.floor(i/3),o=(s-1)*Ir,r=(n-1)*Ir+30;void 0===e[n]&&(e[n]=[]),e[n].push({x:o,y:r});const a=this.add.image(o,r,"puzzle",i).setOrigin(.5).setDisplaySize(.95*Ir,.95*Ir);this.container.add(a),a.setInteractive({useHandCursor:!0}),a.on("pointerdown",(()=>{this.moveTile(i)})),this.tiles.push(a)}));const t=new xr(this,{regions:e,size:1.1*Ir,keyHandler:e=>{const t=3*e.y+e.x;this.moveTile(t)}},this.keys);this.container.add(t),this.updateLayout()}moveTile(e){const t=this.layout.indexOf(8),i=t%3,s=Math.floor(t/3),n=e%3,o=Math.floor(e/3);Math.abs(i-n)+Math.abs(s-o)===1&&(this.layout[t]=this.layout[e],this.layout[e]=8,this.updateLayout()),this.layout.join("")===this.solution.join("")&&this.handleSuccess(!0)}updateLayout(){this.layout.forEach(((e,t)=>{this.tiles[t].setFrame(e),this.tiles[t].setVisible(8!=e)}))}completed(e){for(let t=0;t{t0&&this.tiles[t-1].setTint(6710886)}));this.time.delayedCall(2e3,e)}close(e){e?this.completed((()=>super.close(e))):super.close(e)}handleSuccess(e){e&&this.time.delayedCall(750,(()=>{this.close(!0)}))}},ar],pipeline:{CRTPipeline:mn,XRayPipeline:xn},input:{gamepad:!0},disableContextMenu:w.prod,physics:{default:"arcade"},fps:{panicMax:165,smoothStep:!0},render:{pixelArt:!0,antialias:!1},dom:{createContainer:!0},plugins:{scene:[{key:"PipelinePlugin",plugin:bn,mapping:"pipelinePlugin"}]}};pe.style.cursor="none",pe.addEventListener("mousemove",(function(){pe.style.cursor="default",clearTimeout(de),de=setTimeout((()=>{pe.style.cursor="none"}),2500)}));const Or=document.querySelector("#initial-loader");null==Or||Or.remove();const jr=new a.Game(Cr);w.prod&&!w.debug||function(e){jo=(()=>{const e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";const t=[];return{REVISION:17,dom:e,panels:t,addPanel:function(i){return e.appendChild(i.dom),t.push(i),i}}})(),document.body.appendChild(jo.dom);const t=jo.dom.style;t.display="flex",t.justifyContent="center",t.flexWrap="wrap",t.gap="6px",t.cursor="",t.right="0",t.top="",t.bottom="10px",t.opacity="0.7";const i=jo.addPanel(Oo("FPS","#9ad8e4","#064b62")),s=jo.addPanel(Oo("Frame Time","#f3b0c3","#6b1e3d")),n=jo.addPanel(Oo("Memory (mb)","#ffd59a","#6b3e06")),o=jo.addPanel(Oo("Render","#e9f3a3","#4c6b1a")),r=jo.addPanel(Oo("Step","#c3c3f3","#1d1d6b"));let a=0,l=0;e.events.on(Phaser.Core.Events.PRE_STEP,(()=>a=performance.now())),e.events.on(Phaser.Core.Events.POST_STEP,(()=>r.update(performance.now()-a))),e.events.on(Phaser.Core.Events.PRE_RENDER,(()=>l=performance.now())),e.events.on(Phaser.Core.Events.POST_RENDER,(()=>{const t=e.loop.deltaHistory.slice(0,10).reduce(((e,t)=>e+t),0)/10;o.update(performance.now()-l),i.update(1e3/t),s.update(performance.now()-a),performance.memory&&n.update(performance.memory.usedJSHeapSize/1048576)}))}(jr); diff --git a/build.json b/build.json index 805178c..3011b8e 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"buildTime":"2025-01-10T08:16:58.435Z"} \ No newline at end of file +{"buildTime":"2025-01-10T08:21:04.722Z"} \ No newline at end of file diff --git a/index.html b/index.html index 181dd7e..a69c7a9 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Chrono Sleuth - + diff --git a/sw.js b/sw.js index 7424e76..aa9d6d5 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const n=(n,l)=>(n=new URL(n+".js",l).href,e[n]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=n,s.onload=e,document.head.appendChild(s)}else s=n,importScripts(n),e()})).then((()=>{let s=e[n];if(!s)throw new Error(`Module ${n} didn’t register its module`);return s})));self.define=(l,r)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>n(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(l.map((s=>t[s]||o(s)))).then((s=>(r(...s),u)))}}define(["./workbox-5ffe50d4"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/characters/clock_portrait.png",revision:null},{url:"assets/characters/inventor_portrait.png",revision:null},{url:"assets/characters/inventor.png",revision:null},{url:"assets/characters/mayor_portrait.png",revision:null},{url:"assets/characters/mayor.png",revision:null},{url:"assets/characters/player_portrait.png",revision:null},{url:"assets/characters/player.png",revision:null},{url:"assets/characters/sphinx_portrait.png",revision:null},{url:"assets/characters/sphinx.png",revision:null},{url:"assets/characters/stranger_portrait.png",revision:null},{url:"assets/characters/stranger.png",revision:null},{url:"assets/fonts/m6x11-24.png",revision:null},{url:"assets/fonts/m6x11-32.png",revision:null},{url:"assets/icons/award.svg",revision:null},{url:"assets/icons/chevron-down.svg",revision:null},{url:"assets/icons/gamepad-solid.svg",revision:null},{url:"assets/icons/maximize.svg",revision:null},{url:"assets/icons/minimize.svg",revision:null},{url:"assets/icons/moon.svg",revision:null},{url:"assets/icons/save.svg",revision:null},{url:"assets/icons/settings.svg",revision:null},{url:"assets/icons/sun.svg",revision:null},{url:"assets/icons/terminal.svg",revision:null},{url:"assets/icons/tv.svg",revision:null},{url:"assets/icons/volume-2.svg",revision:null},{url:"assets/icons/volume-x.svg",revision:null},{url:"assets/icons/zoom-in.svg",revision:null},{url:"assets/icons/zoom-out.svg",revision:null},{url:"assets/index-Cf9D1TsC.js",revision:null},{url:"assets/items/book.png",revision:null},{url:"assets/items/candle.png",revision:null},{url:"assets/items/dagger.png",revision:null},{url:"assets/items/gear.png",revision:null},{url:"assets/items/gear2.png",revision:null},{url:"assets/items/herb_blue.png",revision:null},{url:"assets/items/herb_green.png",revision:null},{url:"assets/items/herb_red.png",revision:null},{url:"assets/items/journal.png",revision:null},{url:"assets/items/key.png",revision:null},{url:"assets/items/lantern.png",revision:null},{url:"assets/items/letter.png",revision:null},{url:"assets/items/lockpick.png",revision:null},{url:"assets/items/map.png",revision:null},{url:"assets/items/potion.png",revision:null},{url:"assets/items/watch.png",revision:null},{url:"assets/items/wrench.png",revision:null},{url:"assets/logo.jpg",revision:null},{url:"assets/maps/alchemy_lab.jpg",revision:null},{url:"assets/maps/clock_inner.jpg",revision:null},{url:"assets/maps/clock_outside.jpg",revision:null},{url:"assets/maps/forest.jpg",revision:null},{url:"assets/maps/intro/layer2.png",revision:null},{url:"assets/maps/intro/layer3.png",revision:null},{url:"assets/maps/intro/layer4.png",revision:null},{url:"assets/maps/intro/layer5.png",revision:null},{url:"assets/maps/intro/train.png",revision:null},{url:"assets/maps/lake.jpg",revision:null},{url:"assets/maps/library.jpg",revision:null},{url:"assets/maps/mansion_inside.jpg",revision:null},{url:"assets/maps/mansion_outside_hatch.jpg",revision:null},{url:"assets/maps/mansion_outside.jpg",revision:null},{url:"assets/maps/town.jpg",revision:null},{url:"assets/phaser-BZMViRUx.js",revision:null},{url:"assets/props/alchemy/alchemy_blue.png",revision:null},{url:"assets/props/alchemy/alchemy_empty.png",revision:null},{url:"assets/props/alchemy/alchemy_full.png",revision:null},{url:"assets/props/alchemy/alchemy_green.png",revision:null},{url:"assets/props/alchemy/alchemy_red.png",revision:null},{url:"assets/props/book.png",revision:null},{url:"assets/props/chest_open.png",revision:null},{url:"assets/props/chest.png",revision:null},{url:"assets/props/ladder.png",revision:null},{url:"assets/props/picture.png",revision:null},{url:"assets/props/portal.png",revision:null},{url:"assets/props/safe.png",revision:null},{url:"assets/props/warp.png",revision:null},{url:"assets/puzzles/arrow.png",revision:null},{url:"assets/puzzles/puzzle.png",revision:null},{url:"assets/puzzles/runes/Stone1.png",revision:null},{url:"assets/puzzles/runes/Stone10.png",revision:null},{url:"assets/puzzles/runes/Stone11.png",revision:null},{url:"assets/puzzles/runes/Stone12.png",revision:null},{url:"assets/puzzles/runes/Stone2.png",revision:null},{url:"assets/puzzles/runes/Stone3.png",revision:null},{url:"assets/puzzles/runes/Stone4.png",revision:null},{url:"assets/puzzles/runes/Stone5.png",revision:null},{url:"assets/puzzles/runes/Stone6.png",revision:null},{url:"assets/puzzles/runes/Stone7.png",revision:null},{url:"assets/puzzles/runes/Stone8.png",revision:null},{url:"assets/puzzles/runes/Stone9.png",revision:null},{url:"assets/puzzles/tumbler/ring1.png",revision:null},{url:"assets/puzzles/tumbler/ring2.png",revision:null},{url:"assets/puzzles/tumbler/ring3.png",revision:null},{url:"assets/puzzles/tumbler/ring4.png",revision:null},{url:"assets/puzzles/tumbler/ring5.png",revision:null},{url:"assets/splash.jpg",revision:null},{url:"assets/workbox-window.prod.es5-BXNXHyjv.js",revision:null},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"index.html",revision:"76c7f5ff3ccdc78f6d61b9e938939866"},{url:"m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"style.css",revision:"2a4a8ff6606a74d24d9036f9e8155f91"},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"manifest.webmanifest",revision:"29d9fc647502ad672be1b166ce96d45a"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); +if(!self.define){let s,e={};const n=(n,l)=>(n=new URL(n+".js",l).href,e[n]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=n,s.onload=e,document.head.appendChild(s)}else s=n,importScripts(n),e()})).then((()=>{let s=e[n];if(!s)throw new Error(`Module ${n} didn’t register its module`);return s})));self.define=(l,r)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const o=s=>n(s,i),t={module:{uri:i},exports:u,require:o};e[i]=Promise.all(l.map((s=>t[s]||o(s)))).then((s=>(r(...s),u)))}}define(["./workbox-5ffe50d4"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/characters/clock_portrait.png",revision:null},{url:"assets/characters/inventor_portrait.png",revision:null},{url:"assets/characters/inventor.png",revision:null},{url:"assets/characters/mayor_portrait.png",revision:null},{url:"assets/characters/mayor.png",revision:null},{url:"assets/characters/player_portrait.png",revision:null},{url:"assets/characters/player.png",revision:null},{url:"assets/characters/sphinx_portrait.png",revision:null},{url:"assets/characters/sphinx.png",revision:null},{url:"assets/characters/stranger_portrait.png",revision:null},{url:"assets/characters/stranger.png",revision:null},{url:"assets/fonts/m6x11-24.png",revision:null},{url:"assets/fonts/m6x11-32.png",revision:null},{url:"assets/icons/award.svg",revision:null},{url:"assets/icons/chevron-down.svg",revision:null},{url:"assets/icons/gamepad-solid.svg",revision:null},{url:"assets/icons/maximize.svg",revision:null},{url:"assets/icons/minimize.svg",revision:null},{url:"assets/icons/moon.svg",revision:null},{url:"assets/icons/save.svg",revision:null},{url:"assets/icons/settings.svg",revision:null},{url:"assets/icons/sun.svg",revision:null},{url:"assets/icons/terminal.svg",revision:null},{url:"assets/icons/tv.svg",revision:null},{url:"assets/icons/volume-2.svg",revision:null},{url:"assets/icons/volume-x.svg",revision:null},{url:"assets/icons/zoom-in.svg",revision:null},{url:"assets/icons/zoom-out.svg",revision:null},{url:"assets/index-J3kh8FpM.js",revision:null},{url:"assets/items/book.png",revision:null},{url:"assets/items/candle.png",revision:null},{url:"assets/items/dagger.png",revision:null},{url:"assets/items/gear.png",revision:null},{url:"assets/items/gear2.png",revision:null},{url:"assets/items/herb_blue.png",revision:null},{url:"assets/items/herb_green.png",revision:null},{url:"assets/items/herb_red.png",revision:null},{url:"assets/items/journal.png",revision:null},{url:"assets/items/key.png",revision:null},{url:"assets/items/lantern.png",revision:null},{url:"assets/items/letter.png",revision:null},{url:"assets/items/lockpick.png",revision:null},{url:"assets/items/map.png",revision:null},{url:"assets/items/potion.png",revision:null},{url:"assets/items/watch.png",revision:null},{url:"assets/items/wrench.png",revision:null},{url:"assets/logo.jpg",revision:null},{url:"assets/maps/alchemy_lab.jpg",revision:null},{url:"assets/maps/clock_inner.jpg",revision:null},{url:"assets/maps/clock_outside.jpg",revision:null},{url:"assets/maps/forest.jpg",revision:null},{url:"assets/maps/intro/layer2.png",revision:null},{url:"assets/maps/intro/layer3.png",revision:null},{url:"assets/maps/intro/layer4.png",revision:null},{url:"assets/maps/intro/layer5.png",revision:null},{url:"assets/maps/intro/train.png",revision:null},{url:"assets/maps/lake.jpg",revision:null},{url:"assets/maps/library.jpg",revision:null},{url:"assets/maps/mansion_inside.jpg",revision:null},{url:"assets/maps/mansion_outside_hatch.jpg",revision:null},{url:"assets/maps/mansion_outside.jpg",revision:null},{url:"assets/maps/town.jpg",revision:null},{url:"assets/phaser-BZMViRUx.js",revision:null},{url:"assets/props/alchemy/alchemy_blue.png",revision:null},{url:"assets/props/alchemy/alchemy_empty.png",revision:null},{url:"assets/props/alchemy/alchemy_full.png",revision:null},{url:"assets/props/alchemy/alchemy_green.png",revision:null},{url:"assets/props/alchemy/alchemy_red.png",revision:null},{url:"assets/props/book.png",revision:null},{url:"assets/props/chest_open.png",revision:null},{url:"assets/props/chest.png",revision:null},{url:"assets/props/ladder.png",revision:null},{url:"assets/props/picture.png",revision:null},{url:"assets/props/portal.png",revision:null},{url:"assets/props/safe.png",revision:null},{url:"assets/props/warp.png",revision:null},{url:"assets/puzzles/arrow.png",revision:null},{url:"assets/puzzles/puzzle.png",revision:null},{url:"assets/puzzles/runes/Stone1.png",revision:null},{url:"assets/puzzles/runes/Stone10.png",revision:null},{url:"assets/puzzles/runes/Stone11.png",revision:null},{url:"assets/puzzles/runes/Stone12.png",revision:null},{url:"assets/puzzles/runes/Stone2.png",revision:null},{url:"assets/puzzles/runes/Stone3.png",revision:null},{url:"assets/puzzles/runes/Stone4.png",revision:null},{url:"assets/puzzles/runes/Stone5.png",revision:null},{url:"assets/puzzles/runes/Stone6.png",revision:null},{url:"assets/puzzles/runes/Stone7.png",revision:null},{url:"assets/puzzles/runes/Stone8.png",revision:null},{url:"assets/puzzles/runes/Stone9.png",revision:null},{url:"assets/puzzles/tumbler/ring1.png",revision:null},{url:"assets/puzzles/tumbler/ring2.png",revision:null},{url:"assets/puzzles/tumbler/ring3.png",revision:null},{url:"assets/puzzles/tumbler/ring4.png",revision:null},{url:"assets/puzzles/tumbler/ring5.png",revision:null},{url:"assets/splash.jpg",revision:null},{url:"assets/workbox-window.prod.es5-BXNXHyjv.js",revision:null},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"index.html",revision:"1c2f185e1113845a7cdb7517e6345a83"},{url:"m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"style.css",revision:"2a4a8ff6606a74d24d9036f9e8155f91"},{url:"favicon.webp",revision:"e2869a765701e32ca13599614043b043"},{url:"manifest.webmanifest",revision:"29d9fc647502ad672be1b166ce96d45a"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));