diff --git a/assets/index-77bP2BB0.js b/assets/index-77bP2BB0.js new file mode 100644 index 0000000..b7b7a8f --- /dev/null +++ b/assets/index-77bP2BB0.js @@ -0,0 +1 @@ +var t=Object.defineProperty,e=(e,r,n)=>(((e,r,n)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(e,"symbol"!=typeof r?r+"":r,n),n);import{p as r,g as n,c as o,a as i}from"./phaser-pZmLa9DQ.js";function s(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((t=>navigator.userAgent.match(t)))}!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const r of t)if("childList"===r.type)for(const t of r.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();let a=!1,l=!1;l=!0;let c=1280,h=720,u=!1;u=!0,s(),c=960,h=540,a=!1,l=!1;const p={debug:!1,width:960,height:540,cameraOffset:180,zoomed:true,dayMinutes:.25,rewindEnabled:!1,fastMode:!1};class y extends r.Scene{constructor(){super("Boot")}preload(){}create(){this.scene.start("Preloader")}}const f="fcfee9",d="e6c99d",g="d07151",m="303646",b="1c1831",v="ffccaa";function w(t){return r.Display.Color.HexStringToColor(t).color}const x={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${f}`};var S=(t=>(t[t.Backgrounds=0]="Backgrounds",t[t.Warpers=1]="Warpers",t[t.Npcs=2]="Npcs",t[t.Items=3]="Items",t[t.Player=4]="Player",t[t.Shader=5]="Shader",t[t.Ui=6]="Ui",t[t.Ui2=7]="Ui2",t[t.Overlay=8]="Overlay",t[t.Debug=9]="Debug",t))(S||{});class k extends r.GameObjects.Container{constructor(t,r,n){super(t,40,p.height-60),e(this,"currentTime",0),e(this,"rewindCount",0),e(this,"player"),e(this,"rewindable"),e(this,"rewinding",!1),e(this,"counter",0),e(this,"bar"),e(this,"hand"),e(this,"timeText"),e(this,"dayOver"),this.setVisible(p.rewindEnabled).setDepth(S.Ui).setScrollFactor(0),this.scene.add.existing(this),this.rewindable=r,this.player=n,this.add(t.add.sprite(0,0,"watch").setScale(.25)),this.hand=t.add.rectangle(0,10,3,14,w(b)).setOrigin(0,0),this.add(this.hand),this.timeText=t.add.text(15,10,"",x).setScrollFactor(0),this.bar=t.add.rectangle(0,p.height-6,0,6,13412864).setScrollFactor(0)}update(t,e){}}class j extends r.GameObjects.GameObject{constructor(t,r,n,o,i,s){super(t,"Light"),e(this,"x"),e(this,"y"),e(this,"light"),e(this,"debug"),t.add.existing(this),this.light=t.lights.addLight(r,n,o,i,s),this.debug=t.add.graphics({x:r,y:n}).setDepth(S.Debug),this.debug.lineStyle(3,65280),this.x=r,this.y=n,p.debug&&this.debug.strokeCircle(0,0,o)}setPosition(t,e){this.light.setPosition(t,e),this.debug.setPosition(t,e),this.x=t,this.y=e}destroy(t){var e,r;super.destroy(t),this.debug.destroy(),null==(r=null==(e=this.scene)?void 0:e.lights)||r.removeLight(this.light)}}function O(){return Math.random()-.5}const P=[500,200,100,50,10];class T extends r.GameObjects.GameObject{constructor(t,n,o,i=30,s=[1e3,400]){super(t,"fireflies"),e(this,"lights",[]),e(this,"count"),e(this,"centers",[]),e(this,"bounds",[1e3,400]),e(this,"biases",[]),this.scene.add.existing(this),this.count=i,this.bounds=s;for(let e=0;e{const i=this.biases[e],s=Math.cos(70*r+i[10]);t.intensity=Math.min(.05+Math.abs(i[4]*s+i[3]*n+i[4]*n)/50,.4),t.x=n*i[0]+o*i[1]+n*i[2]+o*i[3]+n*i[4]+this.centers[e].x,t.y=o*i[5]+n*i[6]+o*i[7]+n*i[8]+o*i[9]+this.centers[e].y}))}}var A=(t=>(t[t.None=0]="None",t[t.Teleported=1]="Teleported",t[t.Talked=2]="Talked",t[t.Item=3]="Item",t))(A||{}),I=(t=>(t[t.Underground=0]="Underground",t[t.Town=1]="Town",t[t.TownEast=2]="TownEast",t[t.Forest=3]="Forest",t[t.ForestEast=4]="ForestEast",t[t.Lake=5]="Lake",t[t.TownNorth=6]="TownNorth",t[t.ClockSquare=7]="ClockSquare",t[t.ClockSquareNorth=8]="ClockSquareNorth",t[t.ClockEntrance=9]="ClockEntrance",t[t.ClockStairs=10]="ClockStairs",t[t.ClockTop=11]="ClockTop",t))(I||{}),E=(t=>(t[t.Wrench=0]="Wrench",t[t.Gear1=1]="Gear1",t))(E||{}),C=(t=>(t[t.ForestGear=0]="ForestGear",t[t.SphinxRiddle=1]="SphinxRiddle",t))(C||{}),M=(t=>(t[t.Inventor=0]="Inventor",t[t.Stranger=1]="Stranger",t[t.Sphinx=2]="Sphinx",t[t.Mayor=3]="Mayor",t[t.ClockTower=4]="ClockTower",t))(M||{}),F=(t=>(t[t.Sphinx=0]="Sphinx",t))(F||{}),D=(t=>(t[t.FixTheClock=0]="FixTheClock",t[t.ForestMazeSolved=1]="ForestMazeSolved",t[t.SphinxRiddleSolved=2]="SphinxRiddleSolved",t[t.MetTheMayor=3]="MetTheMayor",t[t.ClockFirstGear=4]="ClockFirstGear",t))(D||{}),R=(t=>(t[t.Up=0]="Up",t[t.Down=1]="Down",t[t.Left=2]="Left",t[t.Right=3]="Right",t[t.Continue=4]="Continue",t[t.Back=5]="Back",t))(R||{});class G{constructor(t){e(this,"scene"),e(this,"keys",{0:!1,1:!1,2:!1,3:!1,4:!1,5:!1}),this.scene=t,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")}listener(t,e){var r,n;null==(r=this.scene.input.keyboard)||r.on(`keydown-${e}`,(()=>this.keys[t]=!0)),null==(n=this.scene.input.keyboard)||n.on(`keyup-${e}`,(()=>this.keys[t]=!1))}resetKeys(){this.keys[0]=!1,this.keys[1]=!1,this.keys[2]=!1,this.keys[3]=!1,this.keys[4]=!1,this.keys[5]=!1}}const N={[M.Inventor]:{x:550,y:635,scale:.75,img:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[M.Stranger]:{x:750,y:865,scale:1.35,img:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[M.Sphinx]:{x:3520,y:780,scale:1,img:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:t=>$(t.scene,!1),light:1.85},[M.Mayor]:{x:1065,y:-340,scale:.9,img:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[M.ClockTower]:{x:880,y:-2090,scale:.5,img:"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]}}};class B extends Phaser.Physics.Arcade.Sprite{constructor(t,r,n){const{x:o,y:i,img:s,scale:a,onCreate:l,light:c,particles:h}=N[r];super(t,o,i,s),e(this,"npcType"),e(this,"player"),e(this,"light"),e(this,"particles"),this.setScale(a).setDepth(S.Npcs).setPipeline("Light2D"),"warp"===s&&this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive({draggable:!0}),p.debug?this.light=new j(t,this.x,this.y,this.displayHeight/150*150,16764074,c||1):this.light=t.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,c||1),this.npcType=r,this.player=n,h&&(this.particles=t.add.particles(o,i,"",h)),l&&l(this)}update(t,e){this.light.setPosition(this.x,this.y)}onInteract(t){if(this.player.message.visible||Date.now()!t)))return i}else if(r.every((t=>!t)))return i;if(null==t?void 0:t.or){if(r.some((t=>t)))return i}else if(r.every((t=>t)))return i}var n,o}(this.npcType,this.player);if(!t)return A.None;const e=N[this.npcType].portrait.length>0;return this.player.message.setDialog(t,e?this:void 0),A.Talked}return A.None}getButtonPrompt(){return this.npcType===M.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${N[this.npcType].name}`,"Press [CONTINUE]"]}}const L=[{x:40,y:600},{x:1750,y:600},{x:90,y:820},{x:1650,y:820},{x:550,y:-400},{x:1150,y:-400},{x:640,y:-1380},{x:930,y:-1470},{x:740,y:-2050},{x:930,y:-2115},{x:2600,y:760},{x:3630,y:760,id:F.Sphinx},{x:4575,y:870},{x:5150,y:870}];class U extends r.Physics.Arcade.StaticGroup{constructor(t){super(t.physics.world,t),L.forEach((e=>{const r=t.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(p.debug);r.setData("WallType",e.id),p.debug&&r.setInteractive({draggable:!0}),this.add(r)}))}}const W={[I.Town]:{x:300,y:650,key:R.Down,warpTo:I.Underground,visual:0},[I.Underground]:{x:301,y:875,key:R.Up,warpTo:I.Town,visual:0},[I.TownEast]:{x:1720,y:650,key:R.Right,warpTo:I.Forest,visual:2},[I.Forest]:{x:2650,y:810,key:R.Left,warpTo:I.TownEast,visual:1},[I.TownNorth]:{x:775,y:650,key:R.Up,warpTo:I.ClockSquare,visual:2},[I.ClockSquare]:{x:610,y:-330,key:R.Left,warpTo:I.TownNorth,visual:1},[I.ClockSquareNorth]:{x:915,y:-330,key:R.Up,warpTo:I.ClockEntrance,visual:2},[I.ClockEntrance]:{x:690,y:-1320,key:R.Left,warpTo:I.ClockSquareNorth,visual:1},[I.ClockStairs]:{x:890,y:-1400,key:R.Right,warpTo:I.ClockTop,visual:3},[I.ClockTop]:{x:780,y:-1970,key:R.Left,warpTo:I.ClockStairs,visual:3},[I.ForestEast]:{x:3590,y:810,key:R.Right,warpTo:I.Lake,visual:2},[I.Lake]:{x:4625,y:915,key:R.Left,warpTo:I.ForestEast,visual:1}};class _ extends r.Physics.Arcade.Sprite{constructor(t,n,o){const{x:i,y:s,visual:a,warpTo:l}=W[n];if(super(t,i,s,0===a?"ladder":"warp"),e(this,"warpType"),e(this,"player"),e(this,"particles1"),e(this,"particles2"),this.warpType=n,this.player=o,this.setScale(.6).setPipeline("Light2D"),t.add.existing(this),t.physics.add.existing(this),p.debug){this.setInteractive({draggable:!0});const e=W[l],r=t.add.graphics(),o=n%2==0?16776960:65535;r.fillStyle(o),r.lineStyle(3,o);let a=-this.displayWidth/2,c=-this.displayHeight/2;e.x>i&&(a*=-1),e.y>s&&(c*=-1);const h=new Phaser.Geom.Line(i+a,s+c,e.x+a,e.y+c);r.strokeLineShape(h),r.fillRect(i+a-7,s+c-7,14,14)}1!==a&&2!==a||(this.particles1=t.add.particles(i,s,"warp",{x:{min:-3,max:3},y:{min:-3,max:3},speed:{random:[-40,40]},scale:{min:.35,max:.5},alpha:{start:.2,end:0},angle:{min:0,max:360},color:[w(m),w(f),w(d)],colorEase:"Linear",radial:!0,blendMode:r.BlendModes.OVERLAY}).setScale(1,1.75).setPipeline("Light2D"),this.particles2=t.add.particles(i,s,"warp",{x:{min:-30,max:30},y:{min:-50,max:50},speed:{random:[-5,5]},scale:{min:.05,max:.15},alpha:{values:[0,.2,0]},angle:{min:0,max:360},lifespan:{min:1e3,max:1400},color:[w(g),w(f),w(d)],colorEase:"Linear",radial:!0,maxAliveParticles:20}).setPipeline("Light2D")),n===I.Underground&&(t.add.sprite(i,s-60,"ladder").setScale(.6).setPipeline("Light2D"),t.add.sprite(i,s-105,"ladder").setScale(.6).setPipeline("Light2D")),3===a&&this.setAlpha(0),this.setVisible(2!==a)}onInteract(t){const e=t[W[this.warpType].key];return!e||this.warpType!==I.TownEast||H(this.player.journal.journal,D.ForestMazeSolved)||p.debug?e?(z(W[this.warpType].warpTo,this.player),A.Teleported):A.None:(this.scene.scene.pause(),this.scene.scene.launch("MazeDialog",{player:this.player}),A.None)}getButtonPrompt(){const t=W[this.warpType].key;let e;return t===R.Continue&&(e="[CONTINUE]"),t===R.Up&&(e="[Up]"),t===R.Down&&(e="[Down]"),t===R.Left&&(e="[Left]"),t===R.Right&&(e="[Right]"),[`Travel to ${I[W[this.warpType].warpTo]}`,"Press "+e]}setVisible(t){return super.setVisible(t),this.particles1&&this.particles2&&(t?(this.particles1.start(),this.particles2.start()):(this.particles1.stop(),this.particles1.killAll(),this.particles2.stop(),this.particles2.killAll())),this}destroy(t){this.particles1&&this.particles2&&(this.particles1.destroy(),this.particles2.destroy()),super.destroy(t)}}function z(t,e){const{x:n,y:o}=W[t],i=e.scene,s=n-i.cameras.main.width/2,a=o-i.cameras.main.height/2;i.cameras.main.stopFollow(),i.tweens.add({targets:i.cameras.main,scrollX:s,scrollY:a-p.cameraOffset,duration:400,ease:"Power1",onComplete:()=>{i.cameras.main.startFollow(e),i.cameras.main.setFollowOffset(0,p.cameraOffset)}}),e.setActive(!1),i.tweens.add({targets:e,alpha:0,duration:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{e.setPosition(n,o)},onComplete:()=>{e.alpha=1,e.setActive(!0)}});const l=e.light instanceof r.GameObjects.Light?e.light:e.light.light;i.tweens.add({targets:l,x:n,y:o,duration:300,ease:"Power1"})}function $(t,e,n){var o,i;const s=function(t,e){return Y(t,B).find((t=>t.npcType===e))}(t,M.Sphinx);K(t,I.ForestEast,!0===e);const a=function(t,e){return Y(t,r.GameObjects.Rectangle).find((t=>t.getData("WallType")===e))}(t,F.Sphinx);if(a&&(e?a.setX((null==(o=L.find((t=>t.id===F.Sphinx)))?void 0:o.x)||0):a.setX(a.x-150),null==(i=a.body)||i.updateFromGameObject()),!s)return;const{x:l,y:c}=N[M.Sphinx],h=e?l+200:l,u=e?c-90:c;t.tweens.add({targets:s,alpha:0,duration:!e||n?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{s.setPosition(h,u)},onComplete:()=>{s.alpha=1}}),t.tweens.add({targets:s.light,x:h,y:u,duration:!e||n?0:450,ease:"Power1"})}function V(t,e){return t.some((t=>t.id===e&&!t.completed))}function q(t,e){return t.some((t=>t.id===e&&t.completed))}function H(t,e){return t.includes(e)}function Y(t,e){return t.children.getAll().filter((t=>t instanceof e))}function K(t,e,r){const n=function(t,e){return Y(t,_).find((t=>t.warpType===e))}(t,e);n&&n.setVisible(r)}function Q(t){return t.scene.get("Game").clock.rewindCount||0}const J=[{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:{[M.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[M.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:{[M.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[M.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:{[M.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[M.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function X(t){return t instanceof ol?Q(t)%J.length:0}function Z(t,e){const r=X(t);return J[r].hints[e]}const tt={[M.Inventor]:[{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:E.Gear1},onCompleted:t=>{t.quests.updateExistingQuest(C.ForestGear,!0),K(t.scene,I.TownNorth,!0)}},{messages:t=>Z(t.scene,M.Inventor),conditions:{activeQuest:C.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:E.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:t=>{t.journal.addEntry(D.FixTheClock),t.inventory.addItem(E.Wrench)}}],[M.Stranger]:[{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:E.Gear1}},{messages:t=>Z(t.scene,M.Stranger),conditions:{activeQuest:C.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:E.Wrench},onCompleted:t=>{t.quests.addQuest({id:C.ForestGear,completed:!1}),K(t.scene,I.TownEast,!0)}},{messages:["Who am I?","Eventually, you will learn."]}],[M.Sphinx]:[{messages:t=>function(t){const e=X(t);return[J[e].question]}(t.scene),options:t=>function(t){const e=X(t),r=[...J[e].options].sort((()=>Math.random()-.5));return r.push("I don’t know"),r}(t.scene),conditions:{activeQuest:C.SphinxRiddle},onSelected:(t,e,r)=>{t===function(t){const e=X(t);return J[e].answer}(e.scene)?e.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:t=>{t.quests.updateExistingQuest(C.SphinxRiddle,!0),t.journal.addEntry(D.SphinxRiddleSolved)}},r):"I don’t know"===t?e.message.setDialog({messages:["Come back when you have an answer for me."]},r):e.message.setDialog({messages:["That is not correct. Do not return."]},r)}},{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:t=>{t.quests.addQuest({id:C.SphinxRiddle,completed:!1})}}],[M.Mayor]:[{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:D.ClockFirstGear}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:D.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:t=>{t.journal.addEntry(D.MetTheMayor),K(t.scene,I.ClockSquareNorth,!0)}}],[M.ClockTower]:[{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:D.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.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:E.Gear1},onCompleted:t=>{t.inventory.removeItem(E.Gear1),t.journal.addEntry(D.ClockFirstGear)}}]},et={[E.Gear1]:{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}},rt={[E.Wrench]:{x:150,y:650,image:"wrench",name:"Wrench"},[E.Gear1]:{x:5120,y:915,image:"gear",name:"Gear"}};class nt extends Phaser.Physics.Arcade.Sprite{constructor(t,r,n){const{x:o,y:i,image:s}=rt[r];super(t,o,i,s),e(this,"itemType"),e(this,"player"),e(this,"particles"),e(this,"light"),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive({draggable:!0}),this.setScale(.35).setDepth(S.Items).setPipeline("Light2D"),this.itemType=r,this.player=n,this.particles=t.add.particles(o,i,"warp",{scale:{start:0,end:.9},alpha:{start:.8,end:0},delay:500,lifespan:1500,maxAliveParticles:1}),p.debug?this.light=new j(t,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=t.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2)}onInteract(t){return t[R.Continue]?(this.player.inventory.addItem(this.itemType),this.handleSideEffects(),this.destroy(),A.Item):A.None}destroy(t){var e,r;this.particles.destroy(),this.light instanceof j?this.light.destroy():null==(r=null==(e=this.scene)?void 0:e.lights)||r.removeLight(this.light),super.destroy(t)}getButtonPrompt(){return[`Pick Up ${E[this.itemType]}`,"Press [CONTINUE]"]}handleSideEffects(){const t=et[this.itemType];t&&this.player.message.setDialog(t,void 0,"player_portrait")}}class ot extends r.GameObjects.Text{constructor(t,e,r=3500){const n=20+50*Y(t,ot).length;super(t,20,n,e,{...x,backgroundColor:"#"+m,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(S.Ui).setScrollFactor(0),t.add.existing(this),t.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:r,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}class it extends r.GameObjects.Container{constructor(t){super(t,0,0),e(this,"inventory",[]),e(this,"text"),e(this,"rect"),this.setScrollFactor(0).setDepth(S.Ui).setVisible(!1),t.add.existing(this),this.rect=t.add.rectangle(0,0,0,0,w(m)).setStrokeStyle(2,w(f)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=t.add.text(10,4,"Inventory",{...x,fontSize:32}),this.add(this.text)}addItem(t,e){this.inventory.push(t),this.add(this.scene.add.sprite(0,0,rt[t].image).setScale(.35)),this.updateItems();const r=function(t,e){return Y(t,nt).find((t=>t.itemType===e))}(this.scene,t);r&&r.destroy(),e||new ot(this.scene,`New item added: ${rt[t].name}`)}removeItem(t){var e;const r=this.inventory.indexOf(t);r>-1&&(this.inventory.splice(r,1),null==(e=this.getAll().find((e=>{var r;return(null==(r=e.texture)?void 0:r.key)===rt[t].image})))||e.destroy()),this.updateItems()}updateItems(){let t=0;this.getAll().forEach((e=>{if(e instanceof r.GameObjects.Sprite){const r=32+50*t;e.setPosition(r,68),t++}})),this.setVisible(this.inventory.length>0);const e=Math.max(this.text.displayWidth+18,50*t+12);this.setPosition(p.width-e-20,20),this.rect.setSize(e,102)}}class st extends r.GameObjects.Sprite{constructor(t,r){super(t,p.width-50,p.height-55,"journal"),e(this,"player"),e(this,"journal",[]),e(this,"unread"),this.setScrollFactor(0).setDepth(S.Ui).setScale(.5).setAlpha(0).setInteractive().setActive(!1),this.on("pointerdown",this.openJournal),t.add.existing(this),this.player=r,this.unread=t.add.ellipse(p.width-21,p.height-89,20,20,11141120).setStrokeStyle(2,w(b)).setScrollFactor(0).setDepth(S.Ui2).setVisible(!1)}addEntry(t,e){this.journal.includes(t)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(t),e||(this.unread.setVisible(!0),new ot(this.scene,"New journal entry added!")),this.handleSideEffects(t,e||!1))}openJournal(){0!==this.journal.length&&(this.unread.setVisible(!1),this.scene.scene.pause(),this.scene.scene.launch("JournalDialog",{player:this.player}))}handleSideEffects(t,e){t===D.SphinxRiddleSolved&&$(this.scene,!0,e)}}const at={[C.ForestGear]:"Find the gear in the forest",[C.SphinxRiddle]:"Solve the Sphinx riddle"};class lt extends r.GameObjects.Container{constructor(t){super(t,p.width-330-20,120),e(this,"quests",[]),e(this,"questRectangle"),t.add.existing(this),this.setScrollFactor(0).setDepth(S.Ui).setVisible(!1),this.questRectangle=t.add.rectangle(0,0,330,60,w(m)).setStrokeStyle(2,w(f)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle),this.add(t.add.text(10,4,"Quests",{...x,fontSize:32}))}addQuest(t,e){this.quests.find((e=>e.id===t.id))||(this.quests.push(t),this.add(this.scene.add.text(0,0,at[t.id],{...x,fontSize:20})),this.updateQuests(),e||new ot(this.scene,`New quest added: ${at[t.id]}`))}updateExistingQuest(t,e){const r=this.quests.find((e=>e.id===t));r&&(!r.completed&&e&&new ot(this.scene,`Quest completed: ${at[r.id]}`),r.completed=e),this.updateQuests()}updateQuests(){const t=this.quests.filter((t=>!t.completed));let e=1,n=0;this.getAll().forEach((o=>{if(o instanceof r.GameObjects.Text)if(t.find((t=>o.text===at[t.id]))||"Quests"===o.text){if("Quests"!==o.text){const t=14+30*e;o.setPosition(10,t),e++,n=Math.max(n,o.width)}}else o.destroy()}));const o=n+20;this.setX(p.width-20-o),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(t.length>0),this.questRectangle.setSize(o,50+30*t.length)}reset(){this.quests=[],this.updateQuests()}}class ct extends r.GameObjects.Text{constructor(t){super(t,p.width/2,p.height-50,"",x),this.setOrigin(.5).setBackgroundColor("#"+b).setPadding(10,5).setAlign("center").setAlpha(.9).setScrollFactor(0).setDepth(S.Overlay).setVisible(!1),t.add.existing(this)}}class ht extends r.GameObjects.Text{constructor(t,r,n,o,i,s){super(t,r,n,o,{...x,fontSize:48,backgroundColor:`#${m}`,padding:{x:15,y:10},...s}),e(this,"onClick"),this.setOrigin(.5),t.add.existing(this),this.onClick=i,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>i())),this.on("pointerover",(()=>this.setTint(12303291))),this.on("pointerout",(()=>this.setTint(16777215)))}}class ut extends r.GameObjects.Container{constructor(t){var r,n,o;super(t),e(this,"buttons",[]),e(this,"activeIndex",-1),t.add.existing(this).setScrollFactor(0),null==(r=t.input.keyboard)||r.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(n=t.input.keyboard)||n.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(o=t.input.keyboard)||o.on("keydown-ENTER",(()=>{var t;null==(t=this.buttons[this.activeIndex])||t.onClick()}))}addButton(t){this.add(t),this.buttons.push(t),1===this.buttons.length&&this.setActiveButton(0)}setActiveButton(t){var e,r;null==(e=this.buttons[this.activeIndex])||e.setTint(16777215),this.activeIndex=t,null==(r=this.buttons[this.activeIndex])||r.setTint(w(d))}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const pt=20,{width:yt,height:ft}=p,dt=yt-130-80;class gt extends r.GameObjects.Container{constructor(t,n){var o,i;super(t),e(this,"player"),e(this,"npc"),e(this,"npcName"),e(this,"text"),e(this,"box"),e(this,"image"),e(this,"options"),e(this,"optionsContainer"),e(this,"dialog"),e(this,"messageIndex"),e(this,"interactionTimeout"),t.add.existing(this),this.setScrollFactor(0),this.setPosition(pt,ft-pt-170),this.setDepth(S.Overlay),this.setVisible(!1),this.player=n,this.npcName=new r.GameObjects.Text(t,170,15,"",{...x,color:"#"+d}),this.text=new r.GameObjects.Text(t,170,60,"",x),this.text.width=dt,this.text.height=130,this.text.setOrigin(0).setMaxLines(3),this.image=new r.GameObjects.Image(t,pt,pt,"").setOrigin(0).setScale(1.5),this.box=new r.GameObjects.Rectangle(t,0,0,yt-40,170,w(b),.8),this.box.setStrokeStyle(2,w(d),1),this.box.setOrigin(0,0),this.optionsContainer=new ut(t).setDepth(S.Overlay),this.add([this.box,this.npcName,this.text,this.image]),null==(o=this.scene.input.keyboard)||o.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(i=this.scene.input.keyboard)||i.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}setDialog(t,e,r){this.setVisible(void 0!==t),this.npc=e,this.messageIndex=0,this.dialog=t,this.interactionTimeout=Date.now()+350,this.scene.gamepad.offsetButtons(void 0!==this.dialog),t&&(this.npcName.setVisible(!1),e||r?(e&&(this.npcName.setVisible(!0),this.npcName.setText(N[e.npcType].name)),this.image.setVisible(!0),e?this.image.setTexture(N[e.npcType].portrait):r&&this.image.setTexture(r),this.text.setPosition(170,pt+(e?40:0)).setWordWrapWidth(dt,!0).setFixedSize(dt,130)):(this.image.setVisible(!1),this.text.setPosition(pt,pt).setWordWrapWidth(170+dt,!0).setFixedSize(170+dt,130)),this.showMessage())}showMessage(){const t=this.getMessages(),e=t&&t[this.messageIndex];e&&(this.text.setText(e),this.text.getWrappedText().length>3&&console.error("Message too long!",e)),this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const t=!p.zoomed;this.options.forEach(((e,r)=>{const n=new ht(this.scene,p.width/2,p.height/(t?9:14)+r*(30+p.height/(t?16:22)),e,(()=>this.onSelectOption(e)),{fontSize:24,backgroundColor:"#"+b,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(S.Overlay);this.optionsContainer.addButton(n)}))}onSelectOption(t){var e;(null==(e=this.dialog)?void 0:e.onSelected)&&(this.dialog.onSelected(t,this.player,this.npc),this.optionsContainer.removeAll(!0))}updateDialog(){if(Date.now()=t.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.npc),this.dialog=void 0,this.setVisible(!1)):this.showMessage(),this.scene.gamepad.offsetButtons(void 0!==this.dialog),this.interactionTimeout=Date.now()+350)}getMessages(){var t;let e=null==(t=this.dialog)?void 0:t.messages;return"function"==typeof e&&(e=e(this.player)),e}getOptions(){var t;let e=null==(t=this.dialog)?void 0:t.options;return"function"==typeof e&&(e=e(this.player)),e}}const mt=1.35*(p.fastMode?350:120),bt=new r.Math.Vector2(400,650);class vt extends Phaser.Physics.Arcade.Sprite{constructor(t){var r;super(t,bt.x,bt.y,"character",0),e(this,"keys"),e(this,"light"),e(this,"buttonPrompt"),e(this,"interactive"),e(this,"interactionTimeout",0),e(this,"message"),e(this,"inventory"),e(this,"quests"),e(this,"journal"),e(this,"counter",0),e(this,"history",[]),e(this,"rewinding",!1),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(S.Player).setScale(1.35).setPipeline("Light2D"),p.debug?this.light=new j(t,this.x,this.y,250,16768443,1):this.light=t.lights.addLight(this.x,this.y,250,16768443,1),(r=this).anims.create({key:"walk",frames:r.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:4,repeat:-1}),r.anims.play("walk"),this.keys=new G(t),this.buttonPrompt=new ct(t),this.message=new gt(t,this),this.inventory=new it(t),this.quests=new lt(t),this.journal=new st(t,this)}update(t,e){p.debug&&this.setTint(this.interactive?16755370:16777215),this.buttonPrompt.setVisible(this.interactive&&!this.message.visible&&this.buttonPrompt.text.length>0||!1),this.setVelocity(0),this.rewinding?this.counter+e>31.25?(this.rewind(),this.counter=0):this.counter+=e:this.checkInteraction()||this.message.visible||this.updateVelocity(),this.light.setPosition(this.x,this.y),function(t){var e;const r=(null==(e=t.body)?void 0:e.velocity.x)||0,n=r<0;Math.abs(r)>0?(t.anims.resume(),t.flipX=t.rewinding?!n:n):t.anims.pause(),t.setAngle(t.flipX?-5:5)}(this)}checkInteraction(){let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==A.None&&(this.interactionTimeout=Date.now()+(this.interactive.interactionTimeout||500),this.keys.resetKeys(),t===A.Teleported&&(this.interactive=void 0))),t}updateVelocity(){let t=mt;const e=this.keys.keys;e[R.Left]&&this.setVelocityX(-t),e[R.Right]&&this.setVelocityX(t),p.debug&&!this.interactive&&(e[R.Up]&&this.setVelocityY(-t),e[R.Down]&&this.setVelocityY(t)),e[R.Left]&&e[R.Right]&&this.setVelocityX(0)}record(){var t;this.history.length<1e3?this.history.push(new Phaser.Math.Vector3(this.x,this.y,(null==(t=this.body)?void 0:t.velocity.x)||0)):console.warn("Max history reached")}rewind(){const t=this.history.pop();t&&(this.x=t.x,this.y=t.y,this.setVelocityX(-t.z))}setRewind(t){this.rewinding=t,this.counter=0}reset(){this.quests.reset(),this.setPosition(bt.x,bt.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(t){var e;this.interactive=t,this.buttonPrompt.setText((null==(e=null==t?void 0:t.getButtonPrompt)?void 0:e.call(t))||"")}}class wt extends r.Physics.Arcade.Image{constructor(t,r,n,o=100,i=100){if(super(t,r,n,""),e(this,"width"),e(this,"height"),t.add.existing(this),t.physics.add.existing(this),this.scene=t,this.width=o,this.height=i,this.setOrigin(0),this.setVisible(!1),this.setSize(o,1.5*i),p.debug){const e=t.add.graphics();e.lineStyle(2,65280,1);const s=o/2;e.lineBetween(r,n+i,r+o,n),e.lineBetween(r,n+i,r-s,n+i),e.lineBetween(r+o,n,r+o+s,n),e.strokeCircle(r+o,n,2),e.strokeCircle(r,n+i,2)}}update(t,e){const n=this.scene.player;if(this.body&&this.scene.physics.world.intersects(this.body,n.body)){const t=r.Math.Clamp(1-(this.x+this.width-n.x)/this.width,0,1),e=this.y+this.height,o=(1-n.originY)*n.displayHeight,i=e-this.height*t-o;n.setY(i)}}}const xt=1200;let St=!1;function kt(t,e=!0){St||(function(t,e,n){if(!n)return void t.lights.setAmbientColor(w(e));St=!0;const o=(a=t.lights.ambientColor,w(r.Display.Color.RGBToString(255*a.r,255*a.g,255*a.b))),i=r.Display.Color.ValueToColor(o),s=r.Display.Color.ValueToColor(e);var a;t.tweens.addCounter({from:0,to:100,duration:xt,onUpdate:e=>{const n=r.Display.Color.Interpolate.ColorWithColor(i,s,100,e.getValue());var o;t.lights.setAmbientColor((o=n,w(r.Display.Color.RGBToString(o.r,o.g,o.b))))},onComplete:()=>{St=!1}})}(t,f,e),t.lights.lights.forEach((r=>{const n=r.intensity;e?t.tweens.add({targets:r,duration:xt,intensity:0,onComplete:()=>{r.setVisible(!1),r.setIntensity(n)}}):r.setVisible(!1)})))}var jt,Ot,Pt=Object.prototype.toString,Tt=function(t){var e=Pt.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===Pt.call(t.callee)),r},At=Array.prototype.slice,It=Tt,Et=Object.keys,Ct=Et?function(t){return Et(t)}:function(){if(Ot)return jt;var t;if(Ot=1,!Object.keys){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Tt,o=Object.prototype.propertyIsEnumerable,i=!o.call({toString:null},"toString"),s=o.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$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},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(r){return!0}}catch(r){return!0}return!1}();t=function(t){var o=null!==t&&"object"==typeof t,c="[object Function]"===r.call(t),u=n(t),p=o&&"[object String]"===r.call(t),y=[];if(!o&&!c&&!u)throw new TypeError("Object.keys called on a non-object");var f=s&&c;if(p&&t.length>0&&!e.call(t,0))for(var d=0;d0)for(var g=0;g1&&"boolean"!=typeof e)throw new se('"allowMissing" argument must be a boolean');if(null===Ae(/^%?[^%]*%?$/,t))throw new ie("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=Te(t,0,1),r=Te(t,-1);if("%"===e&&"%"!==r)throw new ie("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new ie("invalid intrinsic syntax, expected opening `%`");var n=[];return Pe(t,Ie,(function(t,e,r,o){n[n.length]=r?Pe(o,Ee,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",o=Ce("%"+n+"%",e),i=o.name,s=o.value,a=!1,l=o.alias;l&&(n=l[0],Oe(r,je([0,1],l)));for(var c=1,h=!0;c=r.length){var f=he(s,u);s=(h=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[u]}else h=ke(s,u),s=s[u];h&&!a&&(be[i]=s)}}return s},Fe=Me("%Object.defineProperty%",!0)||!1;if(Fe)try{Fe({},"a",{value:1})}catch(Sl){Fe=!1}var De=Fe,Re=Me("%Object.getOwnPropertyDescriptor%",!0);if(Re)try{Re([],"length")}catch(Sl){Re=null}var Ge=Re,Ne=De,Be=Lt,Le=Ut,Ue=Ge,We=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Le("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new Le("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Le("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Le("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Le("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Le("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],a=!!Ue&&Ue(t,e);if(Ne)Ne(t,e,{configurable:null===i&&a?a.configurable:!i,enumerable:null===n&&a?a.enumerable:!n,value:r,writable:null===o&&a?a.writable:!o});else{if(!s&&(n||o||i))throw new Be("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}},_e=De,ze=function(){return!!_e};ze.hasArrayLengthDefineBug=function(){if(!_e)return null;try{return 1!==_e([],"length",{value:1}).length}catch(Sl){return!0}};var $e=ze,Ve=Dt,qe="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),He=Object.prototype.toString,Ye=Array.prototype.concat,Ke=We,Qe=$e(),Je=function(t,e,r,n){if(e in t)if(!0===n){if(t[e]===r)return}else if("function"!=typeof(o=n)||"[object Function]"!==He.call(o)||!n())return;var o;Qe?Ke(t,e,r,!0):Ke(t,e,r)},Xe=function(t,e){var r=arguments.length>2?arguments[2]:{},n=Ve(e);qe&&(n=Ye.call(n,Object.getOwnPropertySymbols(e)));for(var o=0;o4294967295||sr(e)!==e)throw new ir("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&or){var i=or(t,"length");i&&!i.configurable&&(n=!1),i&&!i.writable&&(o=!1)}return(n||o||!r)&&(nr?rr(t,"length",e,!0,!0):rr(t,"length",e)),t};!function(t){var e=Jt,r=Me,n=ar,o=Ut,i=r("%Function.prototype.apply%"),s=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(s,i),l=De,c=r("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new o("a function is required");var r=a(e,s,arguments);return n(r,1+c(0,t.length-(arguments.length-1)),!0)};var h=function(){return a(e,i,arguments)};l?l(t.exports,"apply",{value:h}):t.exports.apply=h}(tr);var lr=tr.exports,cr=Me,hr=lr,ur=hr(cr("String.prototype.indexOf")),pr=function(t,e){var r=cr(t,!!e);return"function"==typeof r&&ur(t,".prototype.")>-1?hr(r):r},yr=Dt,fr=_t(),dr=pr,gr=Object,mr=dr("Array.prototype.push"),br=dr("Object.prototype.propertyIsEnumerable"),vr=fr?Object.getOwnPropertySymbols:null,wr=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=gr(t);if(1===arguments.length)return r;for(var n=1;n2&&!!arguments[2]&&!Nr||(Gr?Rr(t,"name",e,!0,!0):Rr(t,"name",e)),t}((function(){if(null==this||this!==Ur(this))throw new Lr("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t}),"get flags",!0),_r=Wr,zr=Ze.supportsDescriptors,$r=Object.getOwnPropertyDescriptor,Vr=function(){if(zr&&"gim"===/a/gim.flags){var t=$r(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(r,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return _r},qr=Ze.supportsDescriptors,Hr=Vr,Yr=Object.getOwnPropertyDescriptor,Kr=Object.defineProperty,Qr=TypeError,Jr=Object.getPrototypeOf,Xr=/a/,Zr=Ze,tn=Wr,en=Vr,rn=lr(en());Zr(rn,{getPolyfill:en,implementation:tn,shim:function(){if(!qr||!Jr)throw new Qr("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=Hr(),e=Jr(Xr),r=Yr(e,"flags");return r&&r.get===t||Kr(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var nn=rn,on={exports:{}},sn=_t,an=function(){return sn()&&!!Symbol.toStringTag},ln=an(),cn=pr("Object.prototype.toString"),hn=function(t){return!(ln&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===cn(t)},un=function(t){return!!hn(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==cn(t)&&"[object Function]"===cn(t.callee)},pn=function(){return hn(arguments)}();hn.isLegacyArguments=un;var yn=pn?hn:un;const fn=n(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var dn="function"==typeof Map&&Map.prototype,gn=Object.getOwnPropertyDescriptor&&dn?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mn=dn&&gn&&"function"==typeof gn.get?gn.get:null,bn=dn&&Map.prototype.forEach,vn="function"==typeof Set&&Set.prototype,wn=Object.getOwnPropertyDescriptor&&vn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,xn=vn&&wn&&"function"==typeof wn.get?wn.get:null,Sn=vn&&Set.prototype.forEach,kn="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,jn="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,On="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,Pn=Boolean.prototype.valueOf,Tn=Object.prototype.toString,An=Function.prototype.toString,In=String.prototype.match,En=String.prototype.slice,Cn=String.prototype.replace,Mn=String.prototype.toUpperCase,Fn=String.prototype.toLowerCase,Dn=RegExp.prototype.test,Rn=Array.prototype.concat,Gn=Array.prototype.join,Nn=Array.prototype.slice,Bn=Math.floor,Ln="function"==typeof BigInt?BigInt.prototype.valueOf:null,Un=Object.getOwnPropertySymbols,Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,_n="function"==typeof Symbol&&"object"==typeof Symbol.iterator,zn="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,$n=Object.prototype.propertyIsEnumerable,Vn=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function qn(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||Dn.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-Bn(-t):Bn(t);if(n!==t){var o=String(n),i=En.call(e,o.length+1);return Cn.call(o,r,"$&_")+"."+Cn.call(Cn.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Cn.call(e,r,"$&_")}var Hn=fn,Yn=Hn.custom,Kn=to(Yn)?Yn:null;function Qn(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function Jn(t){return Cn.call(String(t),/"/g,""")}function Xn(t){return!("[object Array]"!==no(t)||zn&&"object"==typeof t&&zn in t)}function Zn(t){return!("[object RegExp]"!==no(t)||zn&&"object"==typeof t&&zn in t)}function to(t){if(_n)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!Wn)return!1;try{return Wn.call(t),!0}catch(Sl){}return!1}var eo=Object.prototype.hasOwnProperty||function(t){return t in this};function ro(t,e){return eo.call(t,e)}function no(t){return Tn.call(t)}function oo(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return io(En.call(t,0,e.maxStringLength),e)+n}return Qn(Cn.call(Cn.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,so),"single",e)}function so(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Mn.call(e.toString(16))}function ao(t){return"Object("+t+")"}function lo(t){return t+" { ? }"}function co(t,e,r,n){return t+" ("+e+") {"+(n?ho(r,n):Gn.call(r,", "))+"}"}function ho(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+Gn.call(t,","+r)+"\n"+e.prev}function uo(t,e){var r=Xn(t),n=[];if(r){n.length=t.length;for(var o=0;o0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ro(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return io(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var c=String(e);return l?qn(e,c):c}if("bigint"==typeof e){var h=String(e)+"n";return l?qn(e,h):h}var u=void 0===s.depth?5:s.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof e)return Xn(e)?"[Array]":"[Object]";var p,y=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=Gn.call(Array(t.indent+1)," ")}return{base:r,prev:Gn.call(Array(e+1),r)}}(s,n);if(void 0===i)i=[];else if(oo(i,e)>=0)return"[Circular]";function f(e,r,o){if(r&&(i=Nn.call(i)).push(r),o){var a={depth:s.depth};return ro(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,n+1,i)}return t(e,s,n+1,i)}if("function"==typeof e&&!Zn(e)){var d=function(t){if(t.name)return t.name;var e=In.call(An.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),g=uo(e,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(g.length>0?" { "+Gn.call(g,", ")+" }":"")}if(to(e)){var m=_n?Cn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Wn.call(e);return"object"!=typeof e||_n?m:ao(m)}if((p=e)&&"object"==typeof p&&("undefined"!=typeof HTMLElement&&p instanceof HTMLElement||"string"==typeof p.nodeName&&"function"==typeof p.getAttribute)){for(var b="<"+Fn.call(String(e.nodeName)),v=e.attributes||[],w=0;w"}if(Xn(e)){if(0===e.length)return"[]";var x=uo(e,f);return y&&!function(t){for(var e=0;e=0)return!1;return!0}(x)?"["+ho(x,y)+"]":"[ "+Gn.call(x,", ")+" ]"}if(function(t){return!("[object Error]"!==no(t)||zn&&"object"==typeof t&&zn in t)}(e)){var S=uo(e,f);return"cause"in Error.prototype||!("cause"in e)||$n.call(e,"cause")?0===S.length?"["+String(e)+"]":"{ ["+String(e)+"] "+Gn.call(S,", ")+" }":"{ ["+String(e)+"] "+Gn.call(Rn.call("[cause]: "+f(e.cause),S),", ")+" }"}if("object"==typeof e&&a){if(Kn&&"function"==typeof e[Kn]&&Hn)return Hn(e,{depth:u-n});if("symbol"!==a&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!mn||!t||"object"!=typeof t)return!1;try{mn.call(t);try{xn.call(t)}catch(b){return!0}return t instanceof Map}catch(Sl){}return!1}(e)){var k=[];return bn&&bn.call(e,(function(t,r){k.push(f(r,e,!0)+" => "+f(t,e))})),co("Map",mn.call(e),k,y)}if(function(t){if(!xn||!t||"object"!=typeof t)return!1;try{xn.call(t);try{mn.call(t)}catch(e){return!0}return t instanceof Set}catch(Sl){}return!1}(e)){var j=[];return Sn&&Sn.call(e,(function(t){j.push(f(t,e))})),co("Set",xn.call(e),j,y)}if(function(t){if(!kn||!t||"object"!=typeof t)return!1;try{kn.call(t,kn);try{jn.call(t,jn)}catch(b){return!0}return t instanceof WeakMap}catch(Sl){}return!1}(e))return lo("WeakMap");if(function(t){if(!jn||!t||"object"!=typeof t)return!1;try{jn.call(t,jn);try{kn.call(t,kn)}catch(b){return!0}return t instanceof WeakSet}catch(Sl){}return!1}(e))return lo("WeakSet");if(function(t){if(!On||!t||"object"!=typeof t)return!1;try{return On.call(t),!0}catch(Sl){}return!1}(e))return lo("WeakRef");if(function(t){return!("[object Number]"!==no(t)||zn&&"object"==typeof t&&zn in t)}(e))return ao(f(Number(e)));if(function(t){if(!t||"object"!=typeof t||!Ln)return!1;try{return Ln.call(t),!0}catch(Sl){}return!1}(e))return ao(f(Ln.call(e)));if(function(t){return!("[object Boolean]"!==no(t)||zn&&"object"==typeof t&&zn in t)}(e))return ao(Pn.call(e));if(function(t){return!("[object String]"!==no(t)||zn&&"object"==typeof t&&zn in t)}(e))return ao(f(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||void 0!==o&&e===o)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==no(t)||zn&&"object"==typeof t&&zn in t)}(e)&&!Zn(e)){var O=uo(e,f),P=Vn?Vn(e)===Object.prototype:e instanceof Object||e.constructor===Object,T=e instanceof Object?"":"null prototype",A=!P&&zn&&Object(e)===e&&zn in e?En.call(no(e),8,-1):T?"Object":"",I=(P||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(A||T?"["+Gn.call(Rn.call([],A||[],T||[]),": ")+"] ":"");return 0===O.length?I+"{}":y?I+"{"+ho(O,y)+"}":I+"{ "+Gn.call(O,", ")+" }"}return String(e)},go=Ut,mo=po("%WeakMap%",!0),bo=po("%Map%",!0),vo=yo("WeakMap.prototype.get",!0),wo=yo("WeakMap.prototype.set",!0),xo=yo("WeakMap.prototype.has",!0),So=yo("Map.prototype.get",!0),ko=yo("Map.prototype.set",!0),jo=yo("Map.prototype.has",!0),Oo=function(t,e){for(var r,n=t;null!==(r=n.next);n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},Po=function(){var t,e,r,n={assert:function(t){if(!n.has(t))throw new go("Side channel does not contain "+fo(t))},get:function(n){if(mo&&n&&("object"==typeof n||"function"==typeof n)){if(t)return vo(t,n)}else if(bo){if(e)return So(e,n)}else if(r)return function(t,e){var r=Oo(t,e);return r&&r.value}(r,n)},has:function(n){if(mo&&n&&("object"==typeof n||"function"==typeof n)){if(t)return xo(t,n)}else if(bo){if(e)return jo(e,n)}else if(r)return function(t,e){return!!Oo(t,e)}(r,n);return!1},set:function(n,o){mo&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new mo),wo(t,n,o)):bo?(e||(e=new bo),ko(e,n,o)):(r||(r={key:{},next:null}),function(t,e,r){var n=Oo(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(r,n,o))}};return n},To=te,Ao=Po(),Io=Ut,Eo={assert:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Io("`O` is not an object");if("string"!=typeof e)throw new Io("`slot` must be a string");if(Ao.assert(t),!Eo.has(t,e))throw new Io("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Io("`O` is not an object");if("string"!=typeof e)throw new Io("`slot` must be a string");var r=Ao.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Io("`O` is not an object");if("string"!=typeof e)throw new Io("`slot` must be a string");var r=Ao.get(t);return!!r&&To(r,"$"+e)},set:function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Io("`O` is not an object");if("string"!=typeof e)throw new Io("`slot` must be a string");var n=Ao.get(t);n||(n={},Ao.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(Eo);var Co,Mo=Eo,Fo=SyntaxError,Do="object"==typeof StopIteration?StopIteration:null,Ro={}.toString,Go=Array.isArray||function(t){return"[object Array]"==Ro.call(t)},No=String.prototype.valueOf,Bo=Object.prototype.toString,Lo=an(),Uo=function(t){return"string"==typeof t||"object"==typeof t&&(Lo?function(t){try{return No.call(t),!0}catch(Sl){return!1}}(t):"[object String]"===Bo.call(t))},Wo="function"==typeof Map&&Map.prototype?Map:null,_o="function"==typeof Set&&Set.prototype?Set:null;Wo||(Co=function(t){return!1});var zo=Wo?Map.prototype.has:null,$o=_o?Set.prototype.has:null;Co||zo||(Co=function(t){return!1});var Vo,qo=Co||function(t){if(!t||"object"!=typeof t)return!1;try{if(zo.call(t),$o)try{$o.call(t)}catch(Sl){return!0}return t instanceof Wo}catch(Sl){}return!1},Ho="function"==typeof Map&&Map.prototype?Map:null,Yo="function"==typeof Set&&Set.prototype?Set:null;Yo||(Vo=function(t){return!1});var Ko=Ho?Map.prototype.has:null,Qo=Yo?Set.prototype.has:null;Vo||Qo||(Vo=function(t){return!1});var Jo=Vo||function(t){if(!t||"object"!=typeof t)return!1;try{if(Qo.call(t),Ko)try{Ko.call(t)}catch(Sl){return!0}return t instanceof Yo}catch(Sl){}return!1},Xo=yn,Zo=function(t){if(!Do)throw new Fo("this environment lacks StopIteration");Mo.set(t,"[[Done]]",!1);var e={next:function(){var t=Mo.get(this,"[[Iterator]]"),e=Mo.get(t,"[[Done]]");try{return{done:e,value:e?void 0:t.next()}}catch(Sl){if(Mo.set(t,"[[Done]]",!0),Sl!==Do)throw Sl;return{done:!0,value:void 0}}}};return Mo.set(e,"[[Iterator]]",t),e};if(Vt()||_t()){var ti=Symbol.iterator;on.exports=function(t){return null!=t&&void 0!==t[ti]?t[ti]():Xo(t)?Array.prototype[ti].call(t):void 0}}else{var ei=Go,ri=Uo,ni=Me,oi=ni("%Map%",!0),ii=ni("%Set%",!0),si=pr,ai=si("Array.prototype.push"),li=si("String.prototype.charCodeAt"),ci=si("String.prototype.slice"),hi=function(t){var e=0;return{next:function(){var r,n=e>=t.length;return n||(r=t[e],e+=1),{done:n,value:r}}}},ui=function(t,e){if(ei(t)||Xo(t))return hi(t);if(ri(t)){var r=0;return{next:function(){var e=function(t,e){if(e+1>=t.length)return e+1;var r=li(t,e);if(r<55296||r>56319)return e+1;var n=li(t,e+1);return n<56320||n>57343?e+1:e+2}(t,r),n=ci(t,r,e);return r=e,{done:e>t.length,value:n}}}}return e&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(oi||ii){var pi=qo,yi=Jo,fi=si("Map.prototype.forEach",!0),di=si("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var gi=si("Map.prototype.iterator",!0),mi=si("Set.prototype.iterator",!0);var bi=si("Map.prototype.@@iterator",!0)||si("Map.prototype._es6-shim iterator_",!0),vi=si("Set.prototype.@@iterator",!0)||si("Set.prototype._es6-shim iterator_",!0);on.exports=function(t){return function(t){if(pi(t)){if(gi)return Zo(gi(t));if(bi)return bi(t);if(fi){var e=[];return fi(t,(function(t,r){ai(e,[r,t])})),hi(e)}}if(yi(t)){if(mi)return Zo(mi(t));if(vi)return vi(t);if(di){var r=[];return di(t,(function(t){ai(r,t)})),hi(r)}}}(t)||ui(t)}}else on.exports=function(t){if(null!=t)return ui(t,!0)}}var wi=on.exports,xi=function(t){return t!=t},Si=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!xi(t)||!xi(e))},ki=Si,ji=function(){return"function"==typeof Object.is?Object.is:ki},Oi=ji,Pi=Ze,Ti=Ze,Ai=Si,Ii=ji,Ei=lr(Ii(),Object);Ti(Ei,{getPolyfill:Ii,implementation:Ai,shim:function(){var t=Oi();return Pi(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Ci,Mi,Fi,Di,Ri=Ei,Gi=lr,Ni=pr,Bi=Me("%ArrayBuffer%",!0),Li=Ni("ArrayBuffer.prototype.byteLength",!0),Ui=Ni("Object.prototype.toString"),Wi=!!Bi&&!Li&&new Bi(0).slice,_i=!!Wi&&Gi(Wi),zi=Li||_i?function(t){if(!t||"object"!=typeof t)return!1;try{return Li?Li(t):_i(t,0),!0}catch(Sl){return!1}}:Bi?function(t){return"[object ArrayBuffer]"===Ui(t)}:function(t){return!1},$i=Date.prototype.getDay,Vi=Object.prototype.toString,qi=an(),Hi=pr,Yi=an();if(Yi){Ci=Hi("Object.prototype.hasOwnProperty"),Mi=Hi("RegExp.prototype.exec"),Fi={};var Ki=function(){throw Fi};Di={toString:Ki,valueOf:Ki},"symbol"==typeof Symbol.toPrimitive&&(Di[Symbol.toPrimitive]=Ki)}var Qi=Hi("Object.prototype.toString"),Ji=Object.getOwnPropertyDescriptor,Xi=Yi?function(t){if(!t||"object"!=typeof t)return!1;var e=Ji(t,"lastIndex");if(!e||!Ci(e,"value"))return!1;try{Mi(t,Di)}catch(Sl){return Sl===Fi}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===Qi(t)},Zi=pr("SharedArrayBuffer.prototype.byteLength",!0),ts=Zi?function(t){if(!t||"object"!=typeof t)return!1;try{return Zi(t),!0}catch(Sl){return!1}}:function(t){return!1},es=Number.prototype.toString,rs=Object.prototype.toString,ns=an(),os=pr,is=os("Boolean.prototype.toString"),ss=os("Object.prototype.toString"),as=an(),ls={exports:{}},cs=Object.prototype.toString;if(Vt()){var hs=Symbol.prototype.toString,us=/^Symbol\(.*\)$/;ls.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==cs.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&us.test(hs.call(t))}(t)}catch(Sl){return!1}}}else ls.exports=function(t){return!1};var ps=ls.exports,ys={exports:{}},fs="undefined"!=typeof BigInt&&BigInt;if("function"==typeof fs&&"function"==typeof BigInt&&"bigint"==typeof fs(42)&&"bigint"==typeof BigInt(42)){var ds=BigInt.prototype.valueOf;ys.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 ds.call(t),!0}catch(Sl){}return!1}(t))}}else ys.exports=function(t){return!1};var gs,ms=ys.exports,bs=Uo,vs=ps,ws=ms,xs="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,Ss="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;xs||(gs=function(t){return!1});var ks=xs?xs.prototype.has:null,js=Ss?Ss.prototype.has:null;gs||ks||(gs=function(t){return!1});var Os=gs||function(t){if(!t||"object"!=typeof t)return!1;try{if(ks.call(t,ks),js)try{js.call(t,js)}catch(Sl){return!0}return t instanceof xs}catch(Sl){}return!1},Ps={exports:{}},Ts=pr,As=Me("%WeakSet%",!0),Is=Ts("WeakSet.prototype.has",!0);if(Is){var Es=Ts("WeakMap.prototype.has",!0);Ps.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(Is(t,Is),Es)try{Es(t,Es)}catch(Sl){return!0}return t instanceof As}catch(Sl){}return!1}}else Ps.exports=function(t){return!1};var Cs,Ms,Fs=Ps.exports,Ds=qo,Rs=Jo,Gs=Os,Ns=Fs,Bs=Function.prototype.toString,Ls="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof Ls&&"function"==typeof Object.defineProperty)try{Cs=Object.defineProperty({},"length",{get:function(){throw Ms}}),Ms={},Ls((function(){throw 42}),null,Cs)}catch(kl){kl!==Ms&&(Ls=null)}else Ls=null;var Us=/^\s*class\b/,Ws=function(t){try{var e=Bs.call(t);return Us.test(e)}catch(Sl){return!1}},_s=function(t){try{return!Ws(t)&&(Bs.call(t),!0)}catch(Sl){return!1}},zs=Object.prototype.toString,$s="function"==typeof Symbol&&!!Symbol.toStringTag,Vs=!(0 in[,]),qs=function(){return!1};if("object"==typeof document){var Hs=document.all;zs.call(Hs)===zs.call(document.all)&&(qs=function(t){if((Vs||!t)&&(void 0===t||"object"==typeof t))try{var e=zs.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(Sl){}return!1})}var Ys=Ls?function(t){if(qs(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{Ls(t,null,Cs)}catch(Sl){if(Sl!==Ms)return!1}return!Ws(t)&&_s(t)}:function(t){if(qs(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if($s)return _s(t);if(Ws(t))return!1;var e=zs.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&_s(t)},Ks=Object.prototype.toString,Qs=Object.prototype.hasOwnProperty,Js=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Xs="undefined"==typeof globalThis?o:globalThis,Zs=function(t,e,r){if(!Ys(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=r),"[object Array]"===Ks.call(t)?function(t,e,r){for(var n=0,o=t.length;n-1?e:"Object"===e&&function(t){var e=!1;return Zs(ha,(function(r,n){if(!e)try{r(t),e=aa(n,1)}catch(Sl){}})),e}(t)}return ra?function(t){var e=!1;return Zs(ha,(function(r,n){if(!e)try{"$"+r(t)===n&&(e=aa(n,1))}catch(Sl){}})),e}(t):null},Ea=function(t){return pa(t)?ua?ua(t):t.byteLength:NaN},Ca=fa("SharedArrayBuffer.prototype.byteLength",!0),Ma=fa("Date.prototype.getTime"),Fa=Object.getPrototypeOf,Da=fa("Object.prototype.toString"),Ra=ga("%Set%",!0),Ga=fa("Map.prototype.has",!0),Na=fa("Map.prototype.get",!0),Ba=fa("Map.prototype.size",!0),La=fa("Set.prototype.add",!0),Ua=fa("Set.prototype.delete",!0),Wa=fa("Set.prototype.has",!0),_a=fa("Set.prototype.size",!0);function za(t,e,r,n){for(var o,i=ma(t);(o=i.next())&&!o.done;)if(Ya(e,o.value,r,n))return Ua(t,o.value),!0;return!1}function $a(t){return void 0===t?null:"object"!=typeof t?"symbol"!=typeof t&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function Va(t,e,r,n,o,i){var s=$a(r);if(null!=s)return s;var a=Na(e,s),l=ya({},o,{strict:!1});return!(void 0===a&&!Ga(e,s)||!Ya(n,a,l,i))&&!Ga(t,s)&&Ya(n,a,l,i)}function qa(t,e,r){var n=$a(r);return null!=n?n:Wa(e,n)&&!Wa(t,n)}function Ha(t,e,r,n,o,i){for(var s,a,l=ma(t);(s=l.next())&&!s.done;)if(Ya(r,a=s.value,o,i)&&Ya(n,Na(e,a),o,i))return Ua(t,a),!0;return!1}function Ya(t,e,r,n){var o=r||{};if(o.strict?va(t,e):t===e)return!0;if(Ta(t)!==Ta(e))return!1;if(!t||!e||"object"!=typeof t&&"object"!=typeof e)return o.strict?va(t,e):t==e;var i,s=n.has(t),a=n.has(e);if(s&&a){if(n.get(t)===n.get(e))return!0}else i={};return s||n.set(t,i),a||n.set(e,i),function(t,e,r,n){var o,i;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Da(t)!==Da(e))return!1;if(wa(t)!==wa(e))return!1;if(xa(t)!==xa(e))return!1;var s=t instanceof Error,a=e instanceof Error;if(s!==a)return!1;if((s||a)&&(t.name!==e.name||t.message!==e.message))return!1;var l=ja(t),c=ja(e);if(l!==c)return!1;if((l||c)&&(t.source!==e.source||da(t)!==da(e)))return!1;var h=ka(t),u=ka(e);if(h!==u)return!1;if((h||u)&&Ma(t)!==Ma(e))return!1;if(r.strict&&Fa&&Fa(t)!==Fa(e))return!1;var p=Ia(t),y=Ia(e);if(p!==y)return!1;if(p||y){if(t.length!==e.length)return!1;for(o=0;o=0;o--)if(w[o]!=x[o])return!1;for(o=w.length-1;o>=0;o--)if(!Ya(t[i=w[o]],e[i],r,n))return!1;var S=Aa(t),k=Aa(e);return S===k&&("Set"===S||"Set"===k?function(t,e,r,n){if(_a(t)!==_a(e))return!1;for(var o,i,s,a=ma(t),l=ma(e);(o=a.next())&&!o.done;)if(o.value&&"object"==typeof o.value)s||(s=new Ra),La(s,o.value);else if(!Wa(e,o.value)){if(r.strict)return!1;if(!qa(t,e,o.value))return!1;s||(s=new Ra),La(s,o.value)}if(s){for(;(i=l.next())&&!i.done;)if(i.value&&"object"==typeof i.value){if(!za(s,i.value,r.strict,n))return!1}else if(!r.strict&&!Wa(t,i.value)&&!za(s,i.value,r.strict,n))return!1;return 0===_a(s)}return!0}(t,e,r,n):"Map"!==S||function(t,e,r,n){if(Ba(t)!==Ba(e))return!1;for(var o,i,s,a,l,c,h=ma(t),u=ma(e);(o=h.next())&&!o.done;)if(a=o.value[0],l=o.value[1],a&&"object"==typeof a)s||(s=new Ra),La(s,a);else if(void 0===(c=Na(e,a))&&!Ga(e,a)||!Ya(l,c,r,n)){if(r.strict)return!1;if(!Va(t,e,a,l,r,n))return!1;s||(s=new Ra),La(s,a)}if(s){for(;(i=u.next())&&!i.done;)if(a=i.value[0],c=i.value[1],a&&"object"==typeof a){if(!Ha(s,t,a,c,r,n))return!1}else if(!(r.strict||t.has(a)&&Ya(Na(t,a),c,r,n)||Ha(s,t,a,c,ya({},r,{strict:!1}),n)))return!1;return 0===_a(s)}return!0}(t,e,r,n))}(t,e,o,n)}function Ka(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0]||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))}const Qa=i((function(t,e,r){return Ya(t,e,r,ba())})),Ja={player:{x:bt.x,y:bt.y,flip:!1},journal:[],inventory:[],quests:[],warpers:[],settings:{gamepad:s(),debug:!1}},Xa={player:{x:bt.x-200,y:bt.y,flip:!1},journal:[D.FixTheClock,D.SphinxRiddleSolved,D.MetTheMayor],inventory:[E.Wrench,E.Gear1],quests:[{id:C.SphinxRiddle,completed:!0}],warpers:[{warpType:I.TownEast,state:!0},{warpType:I.ClockSquareNorth,state:!0}],settings:{gamepad:!1,debug:!0}};function Za(t){let e,r=localStorage.getItem("save");try{r&&(e=JSON.parse(r))}catch(n){console.error(n),new ot(t,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4)}try{const r=e||Ja;if(r.settings.debug!==p.debug)return p.debug=r.settings.debug,void t.scene.restart();t.player.setX(r.player.x),t.player.setY(r.player.y),t.player.setFlipX(r.player.flip),r.journal.forEach((e=>t.player.journal.addEntry(e,!0))),r.inventory.forEach((e=>t.player.inventory.addItem(e,!0))),r.quests.forEach((e=>t.player.quests.addQuest(e,!0))),function(t,e){const r=Y(t,_);e.forEach((t=>{const e=r.find((e=>e.warpType===t.warpType));e&&e.setVisible(t.state)}))}(t,r.warpers),t.gamepad.setVisible(r.settings.gamepad);const n=Qa(e,Ja)?"[New]":Qa(e,Xa)?"[Debug]":"[Storage]";new ot(t,`Game Loaded ${n}`)}catch(n){console.error(n),new ot(t,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4),tl(t,Ja),Za(t)}}function tl(t,e){const r={player:{x:t.player.x,y:t.player.y,flip:t.player.flipX},journal:t.player.journal.journal,inventory:t.player.inventory.inventory,quests:t.player.quests.quests,warpers:el(t),settings:{gamepad:t.gamepad.visible,debug:p.debug}};localStorage.setItem("save",JSON.stringify(e||r)),new ot(t,"Game Saved")}function el(t){return Y(t,_).map((t=>({warpType:t.warpType,state:t.visible})))}r.GameObjects.Container;class rl extends r.GameObjects.Container{constructor(t,r){super(t,100,p.height-100),e(this,"buttons",[]),e(this,"lastAxisKey"),this.setScrollFactor(0).setDepth(S.Overlay),t.add.existing(this),this.createDPad(),r||this.createButtons(),this.createControllerListeners()}update(t,e){var r,n,o,i,s,a;const l=null==(r=this.scene.input.gamepad)?void 0:r.pad1;if(!l)return;const c=l.axes[0].getValue();if(Math.abs(c)<=.1&&this.lastAxisKey)return null==(n=this.scene.input.keyboard)||n.emit("keyup-"+this.lastAxisKey),void(this.lastAxisKey=void 0);if(c>.1){if("RIGHT"===this.lastAxisKey)return;"LEFT"===this.lastAxisKey&&(null==(o=this.scene.input.keyboard)||o.emit("keyup-LEFT")),null==(i=this.scene.input.keyboard)||i.emit("keydown-RIGHT"),this.lastAxisKey="RIGHT"}if(c<-.1){if("LEFT"===this.lastAxisKey)return;"RIGHT"===this.lastAxisKey&&(null==(s=this.scene.input.keyboard)||s.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastAxisKey="LEFT"}}createDPad(){const t=this.scene.add.container(20,-10);this.add(t);const e=this.scene.add.circle(0,0,60,w(m),.45).setStrokeStyle(3,w(b));t.add(e),this.button(-57,0,"LEFT",t),this.button(57,0,"RIGHT",t),this.button(0,-57,"UP",t),this.button(0,57,"DOWN",t)}createButtons(){const t=this.scene.add.container(p.width-300,0);this.add(t);const e=this.scene.add.circle(40,0,65,w(m),.45).setStrokeStyle(3,w(b)).setScale(1,.6).setAngle(-30);t.add(e),this.button(80,-20,"ENTER",t),this.button(0,20,"BACKSPACE",t)}createControllerListeners(){var t,e,r,n;null==(t=this.scene.input.gamepad)||t.on("connected",(t=>{new ot(this.scene,"Gamepad connected")})),null==(e=this.scene.input.gamepad)||e.on("disconnected",(t=>{new ot(this.scene,"Gamepad disconnected")})),null==(r=this.scene.input.gamepad)||r.on("down",((t,e)=>{var r;const n=this.getKeyFromButton(e);n&&(null==(r=this.scene.input.keyboard)||r.emit(`keydown-${n}`)),console.log("down",e)})),null==(n=this.scene.input.gamepad)||n.on("up",((t,e)=>{var r;const n=this.getKeyFromButton(e);n&&(null==(r=this.scene.input.keyboard)||r.emit(`keyup-${n}`)),console.log("up",e)}))}getKeyFromButton(t){let e;switch(t.index){case 0:e=t.pad.id.toLowerCase().includes("nintendo")?"BACKSPACE":"ENTER";break;case 1:e=t.pad.id.toLowerCase().includes("nintendo")?"ENTER":"BACKSPACE";break;case 9:e="ESC";break;case 12:e="UP";break;case 13:e="DOWN";break;case 14:e="LEFT";break;case 15:e="RIGHT"}return e}button(t,e,r,n){const o="ENTER"===r||"ESCAPE"===r?35:38,i=this.scene.add.circle(t,e,o,w(f),.8).setStrokeStyle(3,w(b));i.setInteractive({useHandCursor:!0}).setScrollFactor(0),n.add(i),i.on("pointerdown",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keydown-${r}`),i.setFillStyle(w(m),Math.min(1,1.05))})),i.on("pointerup",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keyup-${r}`),i.setFillStyle(w(f),.8)})),i.on("pointerout",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keyup-${r}`),i.setFillStyle(w(f),.8)})),this.buttons.push(i)}offsetButtons(t){t?this.setPosition(100,p.height-300):this.setPosition(100,p.height-100)}}class nl extends r.GameObjects.Text{constructor(t){super(t,24,p.height-22,"⚙",{fontSize:"48px",backgroundColor:`#${m}`,padding:{x:3,y:3},align:"center"}),t.add.existing(this),this.setOrigin(.5).setScrollFactor(0).setDepth(S.Ui).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{t.scene.pause(),t.scene.launch("Paused",{game:this})}))}}class ol extends r.Scene{constructor(){super("Game"),e(this,"player"),e(this,"interactiveObjects"),e(this,"clock"),e(this,"gamepad")}create(){this.createBackgrounds(),this.player=new vt(this);const t=new U(this),e=this.createWarpers(),r=this.createNpcs(),n=this.createItems(),o=this.createSlopes(),i=new T(this,3100,600);this.createLights(),new nl(this),this.gamepad=new rl(this);const s=[this.player];this.clock=new k(this,s,this.player),this.interactiveObjects=this.add.group([...e,...r,...n],{runChildUpdate:!0}),this.add.group([this.player,this.clock,this.gamepad,i,...o],{runChildUpdate:!0}),this.physics.add.collider(this.player,t),this.createEventListeners();const a=this.cameras.main;a.startFollow(this.player,!0),a.setFollowOffset(0,p.cameraOffset),Za(this)}update(){this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((t,e)=>void 0===t.visible||t.visible),this.player)||this.player.setInteractiveObject(void 0)}createBackgrounds(){const t=[this.physics.add.sprite(0,0,"town").setOrigin(0),this.physics.add.sprite(500,-1100,"clock_outside").setOrigin(0),this.physics.add.sprite(500,-2400,"clock_inner").setOrigin(0),this.physics.add.sprite(2300,0,"forest").setOrigin(0),this.physics.add.sprite(4400,100,"lake").setOrigin(0)];return t.forEach((t=>{"clock_inner"!==t.texture.key&&t.setPipeline("Light2D"),p.debug&&t.setInteractive({draggable:!0})})),t}createWarpers(){const t=[];for(const e in I)isNaN(Number(e))&&t.push(new _(this,I[e],this.player));return t}createNpcs(){return[new B(this,M.Inventor,this.player),new B(this,M.Stranger,this.player),new B(this,M.Sphinx,this.player),new B(this,M.Mayor,this.player),new B(this,M.ClockTower,this.player)]}createItems(){return[new nt(this,E.Gear1,this.player)]}createSlopes(){return[new wt(this,740,-1370,170,95),new wt(this,815,-2010,90,70)]}createLights(){this.lights.enable().setAmbientColor(w(f)),[{x:135,y:462,radius:150,color:w(d),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}].forEach((t=>{p.debug?new j(this,t.x,t.y,t.radius||100,t.color||w(v),t.intensity||1):this.lights.addLight(t.x,t.y,t.radius||100,t.color||w(v),t.intensity||1)})),kt(this,!1)}createEventListeners(){var t,e;null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.player.journal.openJournal()})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}class il extends r.GameObjects.Container{constructor(t,n,o,i,s){var a,l;super(t,n,o),e(this,"textObject"),e(this,"maskGraphics"),e(this,"scrollbar"),e(this,"scrollY"),e(this,"boxHeight"),t.add.existing(this),this.scrollY=0,this.boxHeight=0,this.textObject=new r.GameObjects.Text(t,0,0,i,{...x,padding:{x:10,y:10},...s}),this.textObject.setOrigin(0).setScrollFactor(0).setInteractive(),this.add(this.textObject),t.input.on("wheel",this.handleScroll,this),this.textObject.on("pointermove",this.handleDrag,this),null==(a=t.input.keyboard)||a.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(l=t.input.keyboard)||l.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=t.add.graphics().setPosition(n,o).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=t.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(t,e){this.boxHeight=e,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,t,e);const r=this.maskGraphics.createGeometryMask();this.textObject.setMask(r),this.textObject.setWordWrapWidth(t-4),this.textObject.setFixedSize(t-4,0),this.updateTextPosition()}handleDrag(t){t.isDown&&(this.scrollY-=t.velocity.y,this.updateTextPosition())}handleScroll(t,e,r,n,o){this.scrollY+=.5*n,this.updateTextPosition()}updateTextPosition(){const t=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=Phaser.Math.Clamp(this.scrollY,0,t),this.textObject.y=-this.scrollY;const e=this.scrollY/t,r=this.boxHeight/this.textObject.height;this.scrollbar.height=r*this.boxHeight,this.scrollbar.setPosition(this.textObject.width-4,e*(this.boxHeight-r*this.boxHeight))}}const sl={[D.FixTheClock]:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it.",[D.ForestMazeSolved]:"I finally got through the forest maze. Next time should be much easier.",[D.SphinxRiddleSolved]:"I solved the sphinx’s riddle. Now I can pass through the forest.",[D.MetTheMayor]:"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.",[D.ClockFirstGear]:"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."};class al extends r.Scene{constructor(){super("JournalDialog"),e(this,"player")}init(t){this.player=t.player}create(){var t,e,r;const n=this.add.container(p.width/2,p.height/2);n.add(this.add.rectangle(0,0,.8*p.width,.8*p.height,0,.75).setStrokeStyle(4,w(d))),n.add(new ht(this,.35*p.width,-.33*p.height,"X",(()=>this.close()))),n.add(this.add.text(0,-.33*p.height,"Journal",{...x,fontSize:48}).setOrigin(.5));const o=this.player.journal.journal.map((t=>`- ${sl[t]}\n\n`)).reverse();new il(this,.13*p.width,.25*p.height,o,{fontSize:32}).setBoxSize(.74*p.width,.62*p.height),new rl(this).setVisible(!1),null==(t=this.input.keyboard)||t.on("keydown-J",(()=>{this.close()})),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.close()})),null==(r=this.input.keyboard)||r.on("keydown-BACKSPACE",(()=>{this.close()}))}close(){this.scene.stop(),this.scene.resume("Game")}}function ll(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function cl(t){for(var e=1;ee+t)):Array.from(Array(t).keys())}function yl(t){return[...new Set(t)]}function fl(t,e){const r=yl(t.map((t=>t.set))).filter(Boolean),n=(o=pl(1,t.length+1),i=r,[o,i].reduce(((t,e)=>t.filter((t=>!e.includes(t)))))).sort((()=>.5-e()));var o,i;t.filter((t=>!t.set)).forEach(((t,e)=>t.set=n[e]))}function dl(t,e,r=.5){ul(t).forEach(((n,o)=>{const i=t[o+1],s=n.set!==i.set,a=e()<=r;var l,c,h;s&&a&&(l=t,c=i.set,h=n.set,l.forEach((t=>{t.set===c&&(t.set=h)})),n.right=!1,i.left=!1)}))}const gl=48;class ml extends r.Scene{constructor(){super("Maze"),e(this,"parent"),e(this,"graphics"),e(this,"keys"),e(this,"maze"),e(this,"mazePlayer"),e(this,"nextUpdate")}init(t){this.parent=t.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*gl,.8*gl,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys}createMaze(){const t=Q(this.parent.player.scene);this.maze=function(t=8,e=t,r=!0,n=1){const o=function(t){return function(){let e=t+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),i=[],s=pl(t);for(let c=0;c({x:n,y:c,top:r||c>0,left:r||n>0,bottom:r||c{fl(t,o),dl(t,o),function(t,e,r){const n=Object.values(function(t,e){let r=yl(t.map((t=>t.set))).reduce(((t,e)=>cl(cl({},t),{},{[e]:[]})),{});return t.forEach((t=>r[t.set].push(t))),r}(t)),{ceil:o}=Math;n.forEach((t=>{(function(t,e,r){e=null==e?1:e;const n=null==t?0:t.length;if(!n||e<1)return[];e=e>n?n:e;let o=-1;const i=n-1,s=[...t];for(;++o{if(t){const r=e[t.x];t.bottom=!1,r.top=!1,r.set=t.set}}))}))}(t,i[e+1],o)}));const a=(l=i)[l.length-1];var l;return fl(a,o),dl(a,o,1),i}(24,24,!0,t),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,gl,gl),this.graphics.lineStyle(3,3385907),this.maze.forEach((t=>{t.forEach((t=>{if(t.top){const e=new Phaser.Geom.Line(t.x*gl,t.y*gl,t.x*gl+gl,t.y*gl);this.graphics.strokeLineShape(e)}if(t.bottom){const e=new Phaser.Geom.Line(t.x*gl,t.y*gl+gl,t.x*gl+gl,t.y*gl+gl);this.graphics.strokeLineShape(e)}if(t.left){const e=new Phaser.Geom.Line(t.x*gl,t.y*gl,t.x*gl,t.y*gl+gl);this.graphics.strokeLineShape(e)}if(t.right){const e=new Phaser.Geom.Line(t.x*gl+gl,t.y*gl,t.x*gl+gl,t.y*gl+gl);this.graphics.strokeLineShape(e)}}))})),this.cameras.main.setViewport(50,130,p.width-100,p.height-170)}update(t,e){if(t=24||i>=24)return!1;const s=r.Math.FloorTo(this.mazePlayer.x/gl),a=r.Math.FloorTo(this.mazePlayer.y/gl),l=this.maze[a][s];return!(l.top&&nthis.mazePlayer.y||l.left&&ethis.mazePlayer.x)}}class bl extends r.Scene{constructor(){super("MazeDialog"),e(this,"player"),e(this,"container"),e(this,"arrow"),e(this,"keys")}init(t){this.player=t.player}create(){var t,e;this.container=this.add.container(p.width/2,p.height/2),this.container.add(this.add.rectangle(0,0,.95*p.width,.95*p.height,0,.9).setStrokeStyle(4,w(d))),this.container.add(new ht(this,.44*p.width,-.4*p.height,"X",(()=>this.close(!1)))),this.container.add(this.add.text(0,-.4*p.height,"Find your way through the forest",{...x,fontSize:48}).setOrigin(.5)),this.arrow=this.add.sprite(.4*-p.width,.4*-p.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow),null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>{this.close(!1)})),null==(e=this.input.keyboard)||e.on("keydown-BACKSPACE",(()=>{this.close(!1)})),new rl(this,!0).setVisible(this.player.scene.gamepad.visible),this.keys=new G(this),this.scene.launch("Maze",{parent:this})}setAngle(t){this.arrow.setRotation(t+Math.PI/2)}close(t){this.scene.stop(),this.scene.stop("Maze"),this.scene.resume("Game"),t?(z(I.Forest,this.player),this.player.journal.addEntry(D.ForestMazeSolved)):this.player.setPosition(W[I.TownEast].x-40,W[I.TownEast].y)}}class vl extends r.Scene{constructor(){super("Paused"),e(this,"parent")}init(t){this.parent=t.game}create(){var t;const{width:e,height:r}=p;this.add.rectangle(e/2,r/2,e,r,0,.75).setInteractive().on("pointerdown",(()=>this.resume())),this.add.text(e/2,100,"Game Paused",{...x,fontSize:72}).setOrigin(.5),this.add.text(e-20,20,`Build Time: ${new Date("2024-07-22T03:29:46.073Z").toLocaleString()}`,{...x,fontSize:16}).setOrigin(1,0);const n=!p.zoomed,o=n?100:88,i=r/2-(n?100:70),s=new ut(this);s.addButton(new ht(this,e/2,i,"Resume",(()=>this.resume()))),s.addButton(new ht(this,e/2,i+o,"Save",(()=>{this.resume(),tl(this.parent)}))),s.addButton(new ht(this,e/2,i+2*o,"Load",(()=>{this.resume(),this.parent.scene.restart()}))),s.addButton(new ht(this,e/2,i+3*o,"Toggle Gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)}))),null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>this.resume())),new rl(this).setVisible(!1)}resume(){this.scene.stop(),this.scene.resume("Game")}}class wl extends r.Scene{constructor(){super("Preloader")}init(){const t=this.add.rectangle(p.width/2,p.height/2,.75*p.width,32).setStrokeStyle(1,16777215),e=this.add.rectangle(4+t.x-t.width/2,p.height/2,4,27,16777215);this.load.on("progress",(t=>{e.width=.75*p.width*t-5}))}preload(){this.load.setPath("assets"),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("ladder","ladder.png"),this.load.image("warp","warp.png"),this.load.image("watch","watch.png"),this.load.image("arrow","arrow.png"),this.load.image("gear","items/gear.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.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")}create(){this.scene.start("Game")}}const xl={type:Phaser.AUTO,width:p.width,height:p.height,parent:"game-container",backgroundColor:1118481,scale:{mode:Phaser.Scale.FIT,autoCenter:Phaser.Scale.CENTER_BOTH},scene:[y,wl,ol,vl,al,bl,ml],input:{gamepad:!0},physics:{default:"arcade"},render:{pixelArt:!0,antialias:!1}};("m6x11","assets/m6x11.ttf",new FontFace("m6x11","url(assets/m6x11.ttf)").load().then((function(t){document.fonts.add(t)})).catch((function(t){return t}))).then((()=>{new r.Game(xl)})); diff --git a/assets/index-_jfZM_XL.js b/assets/index-_jfZM_XL.js deleted file mode 100644 index 1817d7e..0000000 --- a/assets/index-_jfZM_XL.js +++ /dev/null @@ -1 +0,0 @@ -var t=Object.defineProperty,e=(e,r,n)=>(((e,r,n)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(e,"symbol"!=typeof r?r+"":r,n),n);import{p as r,g as n,c as o,a as i}from"./phaser-pZmLa9DQ.js";function s(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some((t=>navigator.userAgent.match(t)))}!function(){const t=document.createElement("link").relList;if(!(t&&t.supports&&t.supports("modulepreload"))){for(const t of document.querySelectorAll('link[rel="modulepreload"]'))e(t);new MutationObserver((t=>{for(const r of t)if("childList"===r.type)for(const t of r.addedNodes)"LINK"===t.tagName&&"modulepreload"===t.rel&&e(t)})).observe(document,{childList:!0,subtree:!0})}function e(t){if(t.ep)return;t.ep=!0;const e=function(t){const e={};return t.integrity&&(e.integrity=t.integrity),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?e.credentials="include":"anonymous"===t.crossOrigin?e.credentials="omit":e.credentials="same-origin",e}(t);fetch(t.href,e)}}();let a=!1,l=!1;l=!0;let c=1280,h=720,u=!1;u=!0,s(),c=960,h=540,a=!1,l=!1;const p={debug:!1,width:960,height:540,cameraOffset:180,zoomed:true,dayMinutes:.25,rewindEnabled:!1,fastMode:!1};class y extends r.Scene{constructor(){super("Boot")}preload(){}create(){this.scene.start("Preloader")}}const f="fcfee9",d="e6c99d",g="303646",m="1c1831",b="ffccaa";function v(t){return r.Display.Color.HexStringToColor(t).color}const w={fontFamily:"m6x11, sans-serif",fontSize:24,color:`#${f}`};var x=(t=>(t[t.Backgrounds=0]="Backgrounds",t[t.Warpers=1]="Warpers",t[t.Npcs=2]="Npcs",t[t.Items=3]="Items",t[t.Player=4]="Player",t[t.Shader=5]="Shader",t[t.Ui=6]="Ui",t[t.Ui2=7]="Ui2",t[t.Overlay=8]="Overlay",t[t.Debug=9]="Debug",t))(x||{});class S extends r.GameObjects.Container{constructor(t,r,n){super(t,40,p.height-60),e(this,"currentTime",0),e(this,"rewindCount",0),e(this,"player"),e(this,"rewindable"),e(this,"rewinding",!1),e(this,"counter",0),e(this,"bar"),e(this,"hand"),e(this,"timeText"),e(this,"dayOver"),this.setVisible(p.rewindEnabled).setDepth(x.Ui).setScrollFactor(0),this.scene.add.existing(this),this.rewindable=r,this.player=n,this.add(t.add.sprite(0,0,"watch").setScale(.25)),this.hand=t.add.rectangle(0,10,3,14,v(m)).setOrigin(0,0),this.add(this.hand),this.timeText=t.add.text(15,10,"",w).setScrollFactor(0),this.bar=t.add.rectangle(0,p.height-6,0,6,13412864).setScrollFactor(0)}update(t,e){}}class k extends r.GameObjects.GameObject{constructor(t,r,n,o,i,s){super(t,"Light"),e(this,"x"),e(this,"y"),e(this,"light"),e(this,"debug"),t.add.existing(this),this.light=t.lights.addLight(r,n,o,i,s),this.debug=t.add.graphics({x:r,y:n}).setDepth(x.Debug),this.debug.lineStyle(3,65280),this.x=r,this.y=n,p.debug&&this.debug.strokeCircle(0,0,o)}setPosition(t,e){this.light.setPosition(t,e),this.debug.setPosition(t,e),this.x=t,this.y=e}destroy(t){var e,r;super.destroy(t),this.debug.destroy(),null==(r=null==(e=this.scene)?void 0:e.lights)||r.removeLight(this.light)}}function j(){return Math.random()-.5}const O=[500,200,100,50,10];class P extends r.GameObjects.GameObject{constructor(t,n,o,i=30,s=[1e3,400]){super(t,"fireflies"),e(this,"lights",[]),e(this,"count"),e(this,"centers",[]),e(this,"bounds",[1e3,400]),e(this,"biases",[]),this.scene.add.existing(this),this.count=i,this.bounds=s;for(let e=0;e{const i=this.biases[e],s=Math.cos(70*r+i[10]);t.intensity=Math.min(.05+Math.abs(i[4]*s+i[3]*n+i[4]*n)/50,.4),t.x=n*i[0]+o*i[1]+n*i[2]+o*i[3]+n*i[4]+this.centers[e].x,t.y=o*i[5]+n*i[6]+o*i[7]+n*i[8]+o*i[9]+this.centers[e].y}))}}var A=(t=>(t[t.None=0]="None",t[t.Teleported=1]="Teleported",t[t.Talked=2]="Talked",t[t.Item=3]="Item",t))(A||{}),T=(t=>(t[t.Underground=0]="Underground",t[t.Town=1]="Town",t[t.TownEast=2]="TownEast",t[t.Forest=3]="Forest",t[t.ForestEast=4]="ForestEast",t[t.Lake=5]="Lake",t[t.TownNorth=6]="TownNorth",t[t.ClockSquare=7]="ClockSquare",t[t.ClockSquareNorth=8]="ClockSquareNorth",t[t.ClockEntrance=9]="ClockEntrance",t[t.ClockStairs=10]="ClockStairs",t[t.ClockTop=11]="ClockTop",t))(T||{}),I=(t=>(t[t.Wrench=0]="Wrench",t[t.Gear1=1]="Gear1",t))(I||{}),E=(t=>(t[t.ForestGear=0]="ForestGear",t[t.SphinxRiddle=1]="SphinxRiddle",t))(E||{}),M=(t=>(t[t.Inventor=0]="Inventor",t[t.Stranger=1]="Stranger",t[t.Sphinx=2]="Sphinx",t[t.Mayor=3]="Mayor",t[t.ClockTower=4]="ClockTower",t))(M||{}),C=(t=>(t[t.Sphinx=0]="Sphinx",t))(C||{}),F=(t=>(t[t.FixTheClock=0]="FixTheClock",t[t.ForestMazeSolved=1]="ForestMazeSolved",t[t.SphinxRiddleSolved=2]="SphinxRiddleSolved",t[t.MetTheMayor=3]="MetTheMayor",t[t.ClockFirstGear=4]="ClockFirstGear",t))(F||{}),D=(t=>(t[t.Up=0]="Up",t[t.Down=1]="Down",t[t.Left=2]="Left",t[t.Right=3]="Right",t[t.Continue=4]="Continue",t[t.Back=5]="Back",t))(D||{});class R{constructor(t){e(this,"scene"),e(this,"keys",{0:!1,1:!1,2:!1,3:!1,4:!1,5:!1}),this.scene=t,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")}listener(t,e){var r,n;null==(r=this.scene.input.keyboard)||r.on(`keydown-${e}`,(()=>this.keys[t]=!0)),null==(n=this.scene.input.keyboard)||n.on(`keyup-${e}`,(()=>this.keys[t]=!1))}resetKeys(){this.keys[0]=!1,this.keys[1]=!1,this.keys[2]=!1,this.keys[3]=!1,this.keys[4]=!1,this.keys[5]=!1}}const G={[M.Inventor]:{x:550,y:635,scale:.75,img:"inventor",portrait:"inventor_portrait",name:"Johan the Inventor"},[M.Stranger]:{x:750,y:865,scale:1.35,img:"stranger",portrait:"stranger_portrait",name:"Mysterious Stranger"},[M.Sphinx]:{x:3520,y:780,scale:1,img:"sphinx",portrait:"sphinx_portrait",name:"Mystical Sphinx",onCreate:t=>z(t.scene,!1),light:1.85},[M.Mayor]:{x:1065,y:-340,scale:.9,img:"mayor",portrait:"mayor_portrait",name:"Mayor of Town"},[M.ClockTower]:{x:880,y:-2090,scale:.5,img:"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]}}};class N extends Phaser.Physics.Arcade.Sprite{constructor(t,r,n){const{x:o,y:i,img:s,scale:a,onCreate:l,light:c,particles:h}=G[r];super(t,o,i,s),e(this,"npcType"),e(this,"player"),e(this,"light"),e(this,"particles"),this.setScale(a).setDepth(x.Npcs).setPipeline("Light2D"),"warp"===s&&this.setAlpha(0),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive({draggable:!0}),p.debug?this.light=new k(t,this.x,this.y,this.displayHeight/150*150,16764074,c||1):this.light=t.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,c||1),this.npcType=r,this.player=n,h&&(this.particles=t.add.particles(o,i,"",h)),l&&l(this)}update(t,e){this.light.setPosition(this.x,this.y)}onInteract(t){if(this.player.message.visible||Date.now()!t)))return i}else if(r.every((t=>!t)))return i;if(null==t?void 0:t.or){if(r.some((t=>t)))return i}else if(r.every((t=>t)))return i}var n,o}(this.npcType,this.player);if(!t)return A.None;const e=G[this.npcType].portrait.length>0;return this.player.message.setDialog(t,e?this:void 0),A.Talked}return A.None}getButtonPrompt(){return this.npcType===M.ClockTower?["Inspect Clock Tower","Press [CONTINUE]"]:[`Talk to ${G[this.npcType].name}`,"Press [CONTINUE]"]}}const B=[{x:40,y:600},{x:1750,y:600},{x:90,y:820},{x:1650,y:820},{x:550,y:-400},{x:1150,y:-400},{x:640,y:-1380},{x:930,y:-1470},{x:740,y:-2050},{x:930,y:-2115},{x:2600,y:760},{x:3630,y:760,id:C.Sphinx},{x:4575,y:870},{x:5150,y:870}];class L extends r.Physics.Arcade.StaticGroup{constructor(t){super(t.physics.world,t),B.forEach((e=>{const r=t.add.rectangle(e.x,e.y,6,100).setOrigin(0).setVisible(p.debug);r.setData("WallType",e.id),p.debug&&r.setInteractive({draggable:!0}),this.add(r)}))}}const U={[T.Town]:{x:300,y:650,key:D.Down,warpTo:T.Underground,visual:0},[T.Underground]:{x:301,y:875,key:D.Up,warpTo:T.Town,visual:0},[T.TownEast]:{x:1720,y:650,key:D.Right,warpTo:T.Forest,visual:2},[T.Forest]:{x:2650,y:810,key:D.Left,warpTo:T.TownEast,visual:1},[T.TownNorth]:{x:775,y:650,key:D.Up,warpTo:T.ClockSquare,visual:2},[T.ClockSquare]:{x:610,y:-330,key:D.Left,warpTo:T.TownNorth,visual:1},[T.ClockSquareNorth]:{x:915,y:-330,key:D.Up,warpTo:T.ClockEntrance,visual:2},[T.ClockEntrance]:{x:690,y:-1320,key:D.Left,warpTo:T.ClockSquareNorth,visual:1},[T.ClockStairs]:{x:890,y:-1400,key:D.Right,warpTo:T.ClockTop,visual:3},[T.ClockTop]:{x:780,y:-1970,key:D.Left,warpTo:T.ClockStairs,visual:3},[T.ForestEast]:{x:3590,y:810,key:D.Right,warpTo:T.Lake,visual:2},[T.Lake]:{x:4625,y:915,key:D.Left,warpTo:T.ForestEast,visual:1}};class W extends r.Physics.Arcade.Sprite{constructor(t,n,o){const{x:i,y:s,visual:a,warpTo:l}=U[n];if(super(t,i,s,0===a?"ladder":"warp"),e(this,"warpType"),e(this,"player"),e(this,"particles1"),e(this,"particles2"),this.warpType=n,this.player=o,this.setScale(.6).setPipeline("Light2D"),t.add.existing(this),t.physics.add.existing(this),p.debug){this.setInteractive({draggable:!0});const e=U[l],r=t.add.graphics(),o=n%2==0?16776960:65535;r.fillStyle(o),r.lineStyle(3,o);let a=-this.displayWidth/2,c=-this.displayHeight/2;e.x>i&&(a*=-1),e.y>s&&(c*=-1);const h=new Phaser.Geom.Line(i+a,s+c,e.x+a,e.y+c);r.strokeLineShape(h),r.fillRect(i+a-7,s+c-7,14,14)}1!==a&&2!==a||(this.particles1=t.add.particles(i,s,"warp",{x:{min:-3,max:3},y:{min:-3,max:3},speed:{random:[-40,40]},scale:{min:.35,max:.5},alpha:{start:.2,end:0},angle:{min:0,max:360},color:[v(g),v(f),v(d)],colorEase:"Linear",radial:!0,blendMode:r.BlendModes.OVERLAY}).setScale(1,1.75).setPipeline("Light2D"),this.particles2=t.add.particles(i,s,"warp",{x:{min:-30,max:30},y:{min:-50,max:50},speed:{random:[-5,5]},scale:{min:.05,max:.15},alpha:{values:[0,.2,0]},angle:{min:0,max:360},lifespan:{min:1e3,max:1400},color:[v("d07151"),v(f),v(d)],colorEase:"Linear",radial:!0,maxAliveParticles:20}).setPipeline("Light2D")),n===T.Underground&&(t.add.sprite(i,s-60,"ladder").setScale(.6).setPipeline("Light2D"),t.add.sprite(i,s-105,"ladder").setScale(.6).setPipeline("Light2D")),3===a&&this.setAlpha(0),this.setVisible(2!==a)}onInteract(t){const e=t[U[this.warpType].key];return!e||this.warpType!==T.TownEast||V(this.player.journal.journal,F.ForestMazeSolved)||p.debug?e?(_(U[this.warpType].warpTo,this.player),A.Teleported):A.None:(this.scene.scene.pause(),this.scene.scene.launch("MazeDialog",{player:this.player}),A.None)}getButtonPrompt(){const t=U[this.warpType].key;let e;return t===D.Continue&&(e="[CONTINUE]"),t===D.Up&&(e="[Up]"),t===D.Down&&(e="[Down]"),t===D.Left&&(e="[Left]"),t===D.Right&&(e="[Right]"),[`Travel to ${T[U[this.warpType].warpTo]}`,"Press "+e]}setVisible(t){return super.setVisible(t),this.particles1&&this.particles2&&(t?(this.particles1.start(),this.particles2.start()):(this.particles1.stop(),this.particles1.killAll(),this.particles2.stop(),this.particles2.killAll())),this}destroy(t){this.particles1&&this.particles2&&(this.particles1.destroy(),this.particles2.destroy()),super.destroy(t)}}function _(t,e){const{x:n,y:o}=U[t],i=e.scene,s=n-i.cameras.main.width/2,a=o-i.cameras.main.height/2;i.cameras.main.stopFollow(),i.tweens.add({targets:i.cameras.main,scrollX:s,scrollY:a-p.cameraOffset,duration:400,ease:"Power1",onComplete:()=>{i.cameras.main.startFollow(e),i.cameras.main.setFollowOffset(0,p.cameraOffset)}}),e.setActive(!1),i.tweens.add({targets:e,alpha:0,duration:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{e.setPosition(n,o)},onComplete:()=>{e.alpha=1,e.setActive(!0)}});const l=e.light instanceof r.GameObjects.Light?e.light:e.light.light;i.tweens.add({targets:l,x:n,y:o,duration:300,ease:"Power1"})}function z(t,e,n){var o,i;const s=function(t,e){return H(t,N).find((t=>t.npcType===e))}(t,M.Sphinx);Y(t,T.ForestEast,!0===e);const a=function(t,e){return H(t,r.GameObjects.Rectangle).find((t=>t.getData("WallType")===e))}(t,C.Sphinx);if(a&&(e?a.setX((null==(o=B.find((t=>t.id===C.Sphinx)))?void 0:o.x)||0):a.setX(a.x-150),null==(i=a.body)||i.updateFromGameObject()),!s)return;const{x:l,y:c}=G[M.Sphinx],h=e?l+200:l,u=e?c-90:c;t.tweens.add({targets:s,alpha:0,duration:!e||n?0:300,ease:"Power1",yoyo:!0,repeat:0,onYoyo:()=>{s.setPosition(h,u)},onComplete:()=>{s.alpha=1}}),t.tweens.add({targets:s.light,x:h,y:u,duration:!e||n?0:450,ease:"Power1"})}function $(t,e){return t.some((t=>t.id===e&&!t.completed))}function q(t,e){return t.some((t=>t.id===e&&t.completed))}function V(t,e){return t.includes(e)}function H(t,e){return t.children.getAll().filter((t=>t instanceof e))}function Y(t,e,r){const n=function(t,e){return H(t,W).find((t=>t.warpType===e))}(t,e);n&&n.setVisible(r)}function K(t){return t.scene.get("Game").clock.rewindCount||0}const Q=[{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:{[M.Inventor]:["The sphinx is known for asking about things we take for granted.","Think about what we hear in canyons."],[M.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:{[M.Inventor]:["Think of something that represents the world, showing cities and mountains but not in a literal way."],[M.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:{[M.Inventor]:["The sphinx’s riddles can be twisted. Think about things that move or change without the usual parts, like wings or eyes."],[M.Stranger]:["Look at your surroundings. Shadows often behave in strange ways, don’t they?","They move, disappear, and seem to fly without wings."]}}];function J(t){return t instanceof tl?K(t)%Q.length:0}function X(t,e){const r=J(t);return Q[r].hints[e]}const Z={[M.Inventor]:[{messages:["I see you found the first gear. You should talk to the mayor to learn more about the old clock."],conditions:{hasItem:I.Gear1},onCompleted:t=>{t.quests.updateExistingQuest(E.ForestGear,!0),Y(t.scene,T.TownNorth,!0)}},{messages:t=>X(t.scene,M.Inventor),conditions:{activeQuest:E.SphinxRiddle}},{messages:["Now that you have the wrench, you can fix the clock tower. You’ll need three gears to do it."],conditions:{hasItem:I.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:t=>{t.journal.addEntry(F.FixTheClock),t.inventory.addItem(I.Wrench)}}],[M.Stranger]:[{messages:["Now that you have the first gear, I would talk to the inventor."],conditions:{hasItem:I.Gear1}},{messages:t=>X(t.scene,M.Stranger),conditions:{activeQuest:E.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:I.Wrench},onCompleted:t=>{t.quests.addQuest({id:E.ForestGear,completed:!1}),Y(t.scene,T.TownEast,!0)}},{messages:["Who am I?","Eventually, you will learn."]}],[M.Sphinx]:[{messages:t=>function(t){const e=J(t);return[Q[e].question]}(t.scene),options:t=>function(t){const e=J(t),r=[...Q[e].options].sort((()=>Math.random()-.5));return r.push("I don’t know"),r}(t.scene),conditions:{activeQuest:E.SphinxRiddle},onSelected:(t,e,r)=>{t===function(t){const e=J(t);return Q[e].answer}(e.scene)?e.message.setDialog({messages:["That is correct. Well done, you may pass."],onCompleted:t=>{t.quests.updateExistingQuest(E.SphinxRiddle,!0),t.journal.addEntry(F.SphinxRiddleSolved)}},r):"I don’t know"===t?e.message.setDialog({messages:["Come back when you have an answer for me."]},r):e.message.setDialog({messages:["That is not correct. Do not return."]},r)}},{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:t=>{t.quests.addQuest({id:E.SphinxRiddle,completed:!1})}}],[M.Mayor]:[{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:F.ClockFirstGear}},{messages:["Did you go into the clock tower yet?"],conditions:{journalEntry:F.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:t=>{t.journal.addEntry(F.MetTheMayor),Y(t.scene,T.ClockSquareNorth,!0)}}],[M.ClockTower]:[{messages:["The clock is partially moving again, but it is still missing two gears."],conditions:{journalEntry:F.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.","[CREAKING NOISE]","The clock tower is starting to partially move again. It looks like it’s missing two more gears."],conditions:{hasItem:I.Gear1},onCompleted:t=>{t.inventory.removeItem(I.Gear1),t.journal.addEntry(F.ClockFirstGear)}}]},tt={[I.Gear1]:{messages:["Hmm, this gear looks like it belongs in the clock tower. I should ask the inventor about it."]}},et={[I.Wrench]:{x:150,y:650,image:"wrench",name:"Wrench"},[I.Gear1]:{x:5120,y:915,image:"gear",name:"Gear"}};class rt extends Phaser.Physics.Arcade.Sprite{constructor(t,r,n){const{x:o,y:i,image:s}=et[r];super(t,o,i,s),e(this,"itemType"),e(this,"player"),e(this,"particles"),e(this,"light"),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive({draggable:!0}),this.setScale(.35).setDepth(x.Items).setPipeline("Light2D"),this.itemType=r,this.player=n,this.particles=t.add.particles(o,i,"warp",{scale:{start:0,end:.9},alpha:{start:.8,end:0},delay:500,lifespan:1500,maxAliveParticles:1}),p.debug?this.light=new k(t,this.x,this.y,this.displayHeight/150*150,16764074,2):this.light=t.lights.addLight(this.x,this.y,this.displayHeight/150*150,16764074,2)}onInteract(t){return t[D.Continue]?(this.player.inventory.addItem(this.itemType),this.handleSideEffects(),this.destroy(),A.Item):A.None}destroy(t){var e,r;this.particles.destroy(),this.light instanceof k?this.light.destroy():null==(r=null==(e=this.scene)?void 0:e.lights)||r.removeLight(this.light),super.destroy(t)}getButtonPrompt(){return[`Pick Up ${I[this.itemType]}`,"Press [CONTINUE]"]}handleSideEffects(){const t=tt[this.itemType];t&&this.player.message.setDialog(t,void 0,"player_portrait")}}class nt extends r.GameObjects.Text{constructor(t,e,r=3500){const n=20+50*H(t,nt).length;super(t,20,n,e,{...w,backgroundColor:"#"+g,padding:{x:10,y:5}}),this.setAlpha(0).setDepth(x.Ui).setScrollFactor(0),t.add.existing(this),t.add.tween({targets:this,alpha:1,scale:1.05,y:n+10,duration:350,hold:r,yoyo:!0,repeat:0,onComplete:()=>this.destroy()})}}class ot extends r.GameObjects.Container{constructor(t){super(t,0,0),e(this,"inventory",[]),e(this,"text"),e(this,"rect"),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1),t.add.existing(this),this.rect=t.add.rectangle(0,0,0,0,v(g)).setStrokeStyle(2,v(f)).setAlpha(.75).setOrigin(0),this.add(this.rect),this.text=t.add.text(10,4,"Inventory",{...w,fontSize:32}),this.add(this.text)}addItem(t,e){this.inventory.push(t),this.add(this.scene.add.sprite(0,0,et[t].image).setScale(.35)),this.updateItems();const r=function(t,e){return H(t,rt).find((t=>t.itemType===e))}(this.scene,t);r&&r.destroy(),e||new nt(this.scene,`New item added: ${et[t].name}`)}removeItem(t){var e;const r=this.inventory.indexOf(t);r>-1&&(this.inventory.splice(r,1),null==(e=this.getAll().find((e=>{var r;return(null==(r=e.texture)?void 0:r.key)===et[t].image})))||e.destroy()),this.updateItems()}updateItems(){let t=0;this.getAll().forEach((e=>{if(e instanceof r.GameObjects.Sprite){const r=32+50*t;e.setPosition(r,68),t++}})),this.setVisible(this.inventory.length>0);const e=Math.max(this.text.displayWidth+18,50*t+12);this.setPosition(p.width-e-20,20),this.rect.setSize(e,102)}}class it extends r.GameObjects.Sprite{constructor(t,r){super(t,p.width-50,p.height-55,"journal"),e(this,"player"),e(this,"journal",[]),e(this,"unread"),this.setScrollFactor(0).setDepth(x.Ui).setScale(.5).setAlpha(0).setInteractive().setActive(!1),this.on("pointerdown",this.openJournal),t.add.existing(this),this.player=r,this.unread=t.add.ellipse(p.width-21,p.height-89,20,20,11141120).setStrokeStyle(2,v(m)).setScrollFactor(0).setDepth(x.Ui2).setVisible(!1)}addEntry(t,e){this.journal.includes(t)||(0===this.journal.length&&(this.scene.tweens.add({targets:this,alpha:1,duration:300}),this.setActive(!0)),this.journal.push(t),e||(this.unread.setVisible(!0),new nt(this.scene,"New journal entry added!")),this.handleSideEffects(t,e||!1))}openJournal(){0!==this.journal.length&&(this.unread.setVisible(!1),this.scene.scene.pause(),this.scene.scene.launch("JournalDialog",{player:this.player}))}handleSideEffects(t,e){t===F.SphinxRiddleSolved&&z(this.scene,!0,e)}}const st={[E.ForestGear]:"Find the gear in the forest",[E.SphinxRiddle]:"Solve the Sphinx riddle"};class at extends r.GameObjects.Container{constructor(t){super(t,p.width-330-20,120),e(this,"quests",[]),e(this,"questRectangle"),t.add.existing(this),this.setScrollFactor(0).setDepth(x.Ui).setVisible(!1),this.questRectangle=t.add.rectangle(0,0,330,60,v(g)).setStrokeStyle(2,v(f)).setAlpha(.75).setOrigin(0),this.add(this.questRectangle),this.add(t.add.text(10,4,"Quests",{...w,fontSize:32}))}addQuest(t,e){this.quests.find((e=>e.id===t.id))||(this.quests.push(t),this.add(this.scene.add.text(0,0,st[t.id],{...w,fontSize:20})),this.updateQuests(),e||new nt(this.scene,`New quest added: ${st[t.id]}`))}updateExistingQuest(t,e){const r=this.quests.find((e=>e.id===t));r&&(!r.completed&&e&&new nt(this.scene,`Quest completed: ${st[r.id]}`),r.completed=e),this.updateQuests()}updateQuests(){const t=this.quests.filter((t=>!t.completed));let e=1,n=0;this.getAll().forEach((o=>{if(o instanceof r.GameObjects.Text)if(t.find((t=>o.text===st[t.id]))||"Quests"===o.text){if("Quests"!==o.text){const t=14+30*e;o.setPosition(10,t),e++,n=Math.max(n,o.width)}}else o.destroy()}));const o=n+20;this.setX(p.width-20-o),this.setY(this.scene.player.inventory.inventory.length>0?140:20),this.setVisible(t.length>0),this.questRectangle.setSize(o,50+30*t.length)}reset(){this.quests=[],this.updateQuests()}}class lt extends r.GameObjects.Text{constructor(t){super(t,p.width/2,p.height-50,"",w),this.setOrigin(.5).setBackgroundColor("#"+m).setPadding(10,5).setAlign("center").setAlpha(.9).setScrollFactor(0).setDepth(x.Overlay).setVisible(!1),t.add.existing(this)}}class ct extends r.GameObjects.Text{constructor(t,r,n,o,i,s){super(t,r,n,o,{...w,fontSize:48,backgroundColor:`#${g}`,padding:{x:15,y:10},...s}),e(this,"onClick"),this.setOrigin(.5),t.add.existing(this),this.onClick=i,this.setInteractive({useHandCursor:!0}).setScrollFactor(0),this.on("pointerdown",(()=>i())),this.on("pointerover",(()=>this.setTint(12303291))),this.on("pointerout",(()=>this.setTint(16777215)))}}class ht extends r.GameObjects.Container{constructor(t){var r,n,o;super(t),e(this,"buttons",[]),e(this,"activeIndex",-1),t.add.existing(this).setScrollFactor(0),null==(r=t.input.keyboard)||r.on("keydown-UP",(()=>{this.setActiveButton(Math.max(0,this.activeIndex-1))})),null==(n=t.input.keyboard)||n.on("keydown-DOWN",(()=>{this.setActiveButton(Math.min(this.activeIndex+1,this.buttons.length-1))})),null==(o=t.input.keyboard)||o.on("keydown-ENTER",(()=>{var t;null==(t=this.buttons[this.activeIndex])||t.onClick()}))}addButton(t){this.add(t),this.buttons.push(t),1===this.buttons.length&&this.setActiveButton(0)}setActiveButton(t){var e,r;null==(e=this.buttons[this.activeIndex])||e.setTint(16777215),this.activeIndex=t,null==(r=this.buttons[this.activeIndex])||r.setTint(v(d))}clearButtons(){this.buttons=[],this.activeIndex=-1,this.removeAll(!0)}}const ut=20,{width:pt,height:yt}=p,ft=pt-130-80;class dt extends r.GameObjects.Container{constructor(t,n){var o,i;super(t),e(this,"player"),e(this,"npc"),e(this,"npcName"),e(this,"text"),e(this,"box"),e(this,"image"),e(this,"options"),e(this,"optionsContainer"),e(this,"dialog"),e(this,"messageIndex"),e(this,"interactionTimeout"),t.add.existing(this),this.setScrollFactor(0),this.setPosition(ut,yt-ut-170),this.setDepth(x.Overlay),this.setVisible(!1),this.player=n,this.npcName=new r.GameObjects.Text(t,170,15,"",{...w,color:"#"+d}),this.text=new r.GameObjects.Text(t,170,60,"",w),this.text.width=ft,this.text.height=130,this.text.setOrigin(0).setMaxLines(3),this.image=new r.GameObjects.Image(t,ut,ut,"").setOrigin(0).setScale(1.5),this.box=new r.GameObjects.Rectangle(t,0,0,pt-40,170,v(m),.8),this.box.setStrokeStyle(2,v(d),1),this.box.setOrigin(0,0),this.optionsContainer=new ht(t).setDepth(x.Overlay),this.add([this.box,this.npcName,this.text,this.image]),null==(o=this.scene.input.keyboard)||o.on("keydown-ENTER",(()=>{this.options||this.updateDialog()})),null==(i=this.scene.input.keyboard)||i.on("keydown-BACKSPACE",(()=>{this.options||this.updateDialog()}))}setDialog(t,e,r){this.setVisible(void 0!==t),this.npc=e,this.messageIndex=0,this.dialog=t,this.interactionTimeout=Date.now()+350,this.scene.gamepad.offsetButtons(void 0!==this.dialog),t&&(this.npcName.setVisible(!1),e||r?(e&&(this.npcName.setVisible(!0),this.npcName.setText(G[e.npcType].name)),this.image.setVisible(!0),e?this.image.setTexture(G[e.npcType].portrait):r&&this.image.setTexture(r),this.text.setPosition(170,ut+(e?40:0)).setWordWrapWidth(ft,!0).setFixedSize(ft,130)):(this.image.setVisible(!1),this.text.setPosition(ut,ut).setWordWrapWidth(170+ft,!0).setFixedSize(170+ft,130)),this.showMessage())}showMessage(){const t=this.getMessages(),e=t&&t[this.messageIndex];e&&(this.text.setText(e),this.text.getWrappedText().length>3&&console.error("Message too long!",e)),this.updateOptions()}updateOptions(){if(this.optionsContainer.clearButtons(),this.options=this.getOptions(),!this.options)return;const t=!p.zoomed;this.options.forEach(((e,r)=>{const n=new ct(this.scene,p.width/2,p.height/(t?9:14)+r*(30+p.height/(t?16:22)),e,(()=>this.onSelectOption(e)),{fontSize:24,backgroundColor:"#"+m,padding:{y:10},align:"center",fixedWidth:350}).setOrigin(.5).setDepth(x.Overlay);this.optionsContainer.addButton(n)}))}onSelectOption(t){var e;(null==(e=this.dialog)?void 0:e.onSelected)&&(this.dialog.onSelected(t,this.player,this.npc),this.optionsContainer.removeAll(!0))}updateDialog(){if(Date.now()=t.length?(this.dialog.onCompleted&&this.dialog.onCompleted(this.player,this.npc),this.dialog=void 0,this.setVisible(!1)):this.showMessage(),this.scene.gamepad.offsetButtons(void 0!==this.dialog),this.interactionTimeout=Date.now()+350)}getMessages(){var t;let e=null==(t=this.dialog)?void 0:t.messages;return"function"==typeof e&&(e=e(this.player)),e}getOptions(){var t;let e=null==(t=this.dialog)?void 0:t.options;return"function"==typeof e&&(e=e(this.player)),e}}const gt=1.35*(p.fastMode?350:120),mt=new r.Math.Vector2(400,650);class bt extends Phaser.Physics.Arcade.Sprite{constructor(t){var r;super(t,mt.x,mt.y,"character",0),e(this,"keys"),e(this,"light"),e(this,"buttonPrompt"),e(this,"interactive"),e(this,"interactionTimeout",0),e(this,"message"),e(this,"inventory"),e(this,"quests"),e(this,"journal"),e(this,"counter",0),e(this,"history",[]),e(this,"rewinding",!1),t.add.existing(this),t.physics.add.existing(this),p.debug&&this.setInteractive(),this.setBodySize(48,70).setOffset(40,10).setOrigin(.5,.65).setDepth(x.Player).setScale(1.35).setPipeline("Light2D"),p.debug?this.light=new k(t,this.x,this.y,250,16768443,1):this.light=t.lights.addLight(this.x,this.y,250,16768443,1),(r=this).anims.create({key:"walk",frames:r.anims.generateFrameNumbers("character",{start:0,end:5}),frameRate:4,repeat:-1}),r.anims.play("walk"),this.keys=new R(t),this.buttonPrompt=new lt(t),this.message=new dt(t,this),this.inventory=new ot(t),this.quests=new at(t),this.journal=new it(t,this)}update(t,e){p.debug&&this.setTint(this.interactive?16755370:16777215),this.buttonPrompt.setVisible(this.interactive&&!this.message.visible&&this.buttonPrompt.text.length>0||!1),this.setVelocity(0),this.rewinding?this.counter+e>31.25?(this.rewind(),this.counter=0):this.counter+=e:this.checkInteraction()||this.message.visible||this.updateVelocity(),this.light.setPosition(this.x,this.y),function(t){var e;const r=(null==(e=t.body)?void 0:e.velocity.x)||0,n=r<0;Math.abs(r)>0?(t.anims.resume(),t.flipX=t.rewinding?!n:n):t.anims.pause(),t.setAngle(t.flipX?-5:5)}(this)}checkInteraction(){let t;return this.interactive&&Date.now()>this.interactionTimeout&&(t=this.interactive.onInteract(this.keys.keys),t!==A.None&&(this.interactionTimeout=Date.now()+(this.interactive.interactionTimeout||500),this.keys.resetKeys(),t===A.Teleported&&(this.interactive=void 0))),t}updateVelocity(){let t=gt;const e=this.keys.keys;e[D.Left]&&this.setVelocityX(-t),e[D.Right]&&this.setVelocityX(t),p.debug&&!this.interactive&&(e[D.Up]&&this.setVelocityY(-t),e[D.Down]&&this.setVelocityY(t)),e[D.Left]&&e[D.Right]&&this.setVelocityX(0)}record(){var t;this.history.length<1e3?this.history.push(new Phaser.Math.Vector3(this.x,this.y,(null==(t=this.body)?void 0:t.velocity.x)||0)):console.warn("Max history reached")}rewind(){const t=this.history.pop();t&&(this.x=t.x,this.y=t.y,this.setVelocityX(-t.z))}setRewind(t){this.rewinding=t,this.counter=0}reset(){this.quests.reset(),this.setPosition(mt.x,mt.y),this.flipX=!1,this.setVelocity(0)}setInteractiveObject(t){var e;this.interactive=t,this.buttonPrompt.setText((null==(e=null==t?void 0:t.getButtonPrompt)?void 0:e.call(t))||"")}}class vt extends r.Physics.Arcade.Image{constructor(t,r,n,o=100,i=100){if(super(t,r,n,""),e(this,"width"),e(this,"height"),t.add.existing(this),t.physics.add.existing(this),this.scene=t,this.width=o,this.height=i,this.setOrigin(0),this.setVisible(!1),this.setSize(o,1.5*i),p.debug){const e=t.add.graphics();e.lineStyle(2,65280,1);const s=o/2;e.lineBetween(r,n+i,r+o,n),e.lineBetween(r,n+i,r-s,n+i),e.lineBetween(r+o,n,r+o+s,n),e.strokeCircle(r+o,n,2),e.strokeCircle(r,n+i,2)}}update(t,e){const n=this.scene.player;if(this.body&&this.scene.physics.world.intersects(this.body,n.body)){const t=r.Math.Clamp(1-(this.x+this.width-n.x)/this.width,0,1),e=this.y+this.height,o=(1-n.originY)*n.displayHeight,i=e-this.height*t-o;n.setY(i)}}}var wt,xt,St=Object.prototype.toString,kt=function(t){var e=St.call(t),r="[object Arguments]"===e;return r||(r="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===St.call(t.callee)),r},jt=Array.prototype.slice,Ot=kt,Pt=Object.keys,At=Pt?function(t){return Pt(t)}:function(){if(xt)return wt;var t;if(xt=1,!Object.keys){var e=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=kt,o=Object.prototype.propertyIsEnumerable,i=!o.call({toString:null},"toString"),s=o.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$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},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(r){return!0}}catch(r){return!0}return!1}();t=function(t){var o=null!==t&&"object"==typeof t,c="[object Function]"===r.call(t),u=n(t),p=o&&"[object String]"===r.call(t),y=[];if(!o&&!c&&!u)throw new TypeError("Object.keys called on a non-object");var f=s&&c;if(p&&t.length>0&&!e.call(t,0))for(var d=0;d0)for(var g=0;g1&&"boolean"!=typeof e)throw new re('"allowMissing" argument must be a boolean');if(null===je(/^%?[^%]*%?$/,t))throw new ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=ke(t,0,1),r=ke(t,-1);if("%"===e&&"%"!==r)throw new ee("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new ee("invalid intrinsic syntax, expected opening `%`");var n=[];return Se(t,Oe,(function(t,e,r,o){n[n.length]=r?Se(o,Pe,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",o=Ae("%"+n+"%",e),i=o.name,s=o.value,a=!1,l=o.alias;l&&(n=l[0],xe(r,we([0,1],l)));for(var c=1,h=!0;c=r.length){var f=se(s,u);s=(h=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[u]}else h=ve(s,u),s=s[u];h&&!a&&(fe[i]=s)}}return s},Ie=Te("%Object.defineProperty%",!0)||!1;if(Ie)try{Ie({},"a",{value:1})}catch(bl){Ie=!1}var Ee=Ie,Me=Te("%Object.getOwnPropertyDescriptor%",!0);if(Me)try{Me([],"length")}catch(bl){Me=null}var Ce=Me,Fe=Ee,De=Rt,Re=Gt,Ge=Ce,Ne=function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Re("`obj` must be an object or a function`");if("string"!=typeof e&&"symbol"!=typeof e)throw new Re("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Re("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Re("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Re("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Re("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],a=!!Ge&&Ge(t,e);if(Fe)Fe(t,e,{configurable:null===i&&a?a.configurable:!i,enumerable:null===n&&a?a.enumerable:!n,value:r,writable:null===o&&a?a.writable:!o});else{if(!s&&(n||o||i))throw new De("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[e]=r}},Be=Ee,Le=function(){return!!Be};Le.hasArrayLengthDefineBug=function(){if(!Be)return null;try{return 1!==Be([],"length",{value:1}).length}catch(bl){return!0}};var Ue=Le,We=Et,_e="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),ze=Object.prototype.toString,$e=Array.prototype.concat,qe=Ne,Ve=Ue(),He=function(t,e,r,n){if(e in t)if(!0===n){if(t[e]===r)return}else if("function"!=typeof(o=n)||"[object Function]"!==ze.call(o)||!n())return;var o;Ve?qe(t,e,r,!0):qe(t,e,r)},Ye=function(t,e){var r=arguments.length>2?arguments[2]:{},n=We(e);_e&&(n=$e.call(n,Object.getOwnPropertySymbols(e)));for(var o=0;o4294967295||rr(e)!==e)throw new er("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&tr){var i=tr(t,"length");i&&!i.configurable&&(n=!1),i&&!i.writable&&(o=!1)}return(n||o||!r)&&(Ze?Xe(t,"length",e,!0,!0):Xe(t,"length",e)),t};!function(t){var e=Ht,r=Te,n=nr,o=Gt,i=r("%Function.prototype.apply%"),s=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||e.call(s,i),l=Ee,c=r("%Math.max%");t.exports=function(t){if("function"!=typeof t)throw new o("a function is required");var r=a(e,s,arguments);return n(r,1+c(0,t.length-(arguments.length-1)),!0)};var h=function(){return a(e,i,arguments)};l?l(t.exports,"apply",{value:h}):t.exports.apply=h}(Qe);var or=Qe.exports,ir=Te,sr=or,ar=sr(ir("String.prototype.indexOf")),lr=function(t,e){var r=ir(t,!!e);return"function"==typeof r&&ar(t,".prototype.")>-1?sr(r):r},cr=Et,hr=Bt(),ur=lr,pr=Object,yr=ur("Array.prototype.push"),fr=ur("Object.prototype.propertyIsEnumerable"),dr=hr?Object.getOwnPropertySymbols:null,gr=function(t,e){if(null==t)throw new TypeError("target must be an object");var r=pr(t);if(1===arguments.length)return r;for(var n=1;n2&&!!arguments[2]&&!Fr||(Cr?Mr(t,"name",e,!0,!0):Mr(t,"name",e)),t}((function(){if(null==this||this!==Gr(this))throw new Rr("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t}),"get flags",!0),Br=Nr,Lr=Ke.supportsDescriptors,Ur=Object.getOwnPropertyDescriptor,Wr=function(){if(Lr&&"gim"===/a/gim.flags){var t=Ur(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(r,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return Br},_r=Ke.supportsDescriptors,zr=Wr,$r=Object.getOwnPropertyDescriptor,qr=Object.defineProperty,Vr=TypeError,Hr=Object.getPrototypeOf,Yr=/a/,Kr=Ke,Qr=Nr,Jr=Wr,Xr=or(Jr());Kr(Xr,{getPolyfill:Jr,implementation:Qr,shim:function(){if(!_r||!Hr)throw new Vr("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=zr(),e=Hr(Yr),r=$r(e,"flags");return r&&r.get===t||qr(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Zr=Xr,tn={exports:{}},en=Bt,rn=function(){return en()&&!!Symbol.toStringTag},nn=rn(),on=lr("Object.prototype.toString"),sn=function(t){return!(nn&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===on(t)},an=function(t){return!!sn(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==on(t)&&"[object Function]"===on(t.callee)},ln=function(){return sn(arguments)}();sn.isLegacyArguments=an;var cn=ln?sn:an;const hn=n(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var un="function"==typeof Map&&Map.prototype,pn=Object.getOwnPropertyDescriptor&&un?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,yn=un&&pn&&"function"==typeof pn.get?pn.get:null,fn=un&&Map.prototype.forEach,dn="function"==typeof Set&&Set.prototype,gn=Object.getOwnPropertyDescriptor&&dn?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,mn=dn&&gn&&"function"==typeof gn.get?gn.get:null,bn=dn&&Set.prototype.forEach,vn="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,wn="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,xn="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,Sn=Boolean.prototype.valueOf,kn=Object.prototype.toString,jn=Function.prototype.toString,On=String.prototype.match,Pn=String.prototype.slice,An=String.prototype.replace,Tn=String.prototype.toUpperCase,In=String.prototype.toLowerCase,En=RegExp.prototype.test,Mn=Array.prototype.concat,Cn=Array.prototype.join,Fn=Array.prototype.slice,Dn=Math.floor,Rn="function"==typeof BigInt?BigInt.prototype.valueOf:null,Gn=Object.getOwnPropertySymbols,Nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,Bn="function"==typeof Symbol&&"object"==typeof Symbol.iterator,Ln="function"==typeof Symbol&&Symbol.toStringTag&&(Symbol.toStringTag,1)?Symbol.toStringTag:null,Un=Object.prototype.propertyIsEnumerable,Wn=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function _n(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||En.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-Dn(-t):Dn(t);if(n!==t){var o=String(n),i=Pn.call(e,o.length+1);return An.call(o,r,"$&_")+"."+An.call(An.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return An.call(e,r,"$&_")}var zn=hn,$n=zn.custom,qn=Qn($n)?$n:null;function Vn(t,e,r){var n="double"===(r.quoteStyle||e)?'"':"'";return n+t+n}function Hn(t){return An.call(String(t),/"/g,""")}function Yn(t){return!("[object Array]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}function Kn(t){return!("[object RegExp]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}function Qn(t){if(Bn)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!Nn)return!1;try{return Nn.call(t),!0}catch(bl){}return!1}var Jn=Object.prototype.hasOwnProperty||function(t){return t in this};function Xn(t,e){return Jn.call(t,e)}function Zn(t){return kn.call(t)}function to(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return eo(Pn.call(t,0,e.maxStringLength),e)+n}return Vn(An.call(An.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ro),"single",e)}function ro(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Tn.call(e.toString(16))}function no(t){return"Object("+t+")"}function oo(t){return t+" { ? }"}function io(t,e,r,n){return t+" ("+e+") {"+(n?so(r,n):Cn.call(r,", "))+"}"}function so(t,e){if(0===t.length)return"";var r="\n"+e.prev+e.base;return r+Cn.call(t,","+r)+"\n"+e.prev}function ao(t,e){var r=Yn(t),n=[];if(r){n.length=t.length;for(var o=0;o0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Xn(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return eo(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var c=String(e);return l?_n(e,c):c}if("bigint"==typeof e){var h=String(e)+"n";return l?_n(e,h):h}var u=void 0===s.depth?5:s.depth;if(void 0===n&&(n=0),n>=u&&u>0&&"object"==typeof e)return Yn(e)?"[Array]":"[Object]";var p,y=function(t,e){var r;if("\t"===t.indent)r="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;r=Cn.call(Array(t.indent+1)," ")}return{base:r,prev:Cn.call(Array(e+1),r)}}(s,n);if(void 0===i)i=[];else if(to(i,e)>=0)return"[Circular]";function f(e,r,o){if(r&&(i=Fn.call(i)).push(r),o){var a={depth:s.depth};return Xn(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,n+1,i)}return t(e,s,n+1,i)}if("function"==typeof e&&!Kn(e)){var d=function(t){if(t.name)return t.name;var e=On.call(jn.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}(e),g=ao(e,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(g.length>0?" { "+Cn.call(g,", ")+" }":"")}if(Qn(e)){var m=Bn?An.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Nn.call(e);return"object"!=typeof e||Bn?m:no(m)}if((p=e)&&"object"==typeof p&&("undefined"!=typeof HTMLElement&&p instanceof HTMLElement||"string"==typeof p.nodeName&&"function"==typeof p.getAttribute)){for(var b="<"+In.call(String(e.nodeName)),v=e.attributes||[],w=0;w"}if(Yn(e)){if(0===e.length)return"[]";var x=ao(e,f);return y&&!function(t){for(var e=0;e=0)return!1;return!0}(x)?"["+so(x,y)+"]":"[ "+Cn.call(x,", ")+" ]"}if(function(t){return!("[object Error]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}(e)){var S=ao(e,f);return"cause"in Error.prototype||!("cause"in e)||Un.call(e,"cause")?0===S.length?"["+String(e)+"]":"{ ["+String(e)+"] "+Cn.call(S,", ")+" }":"{ ["+String(e)+"] "+Cn.call(Mn.call("[cause]: "+f(e.cause),S),", ")+" }"}if("object"==typeof e&&a){if(qn&&"function"==typeof e[qn]&&zn)return zn(e,{depth:u-n});if("symbol"!==a&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!yn||!t||"object"!=typeof t)return!1;try{yn.call(t);try{mn.call(t)}catch(b){return!0}return t instanceof Map}catch(bl){}return!1}(e)){var k=[];return fn&&fn.call(e,(function(t,r){k.push(f(r,e,!0)+" => "+f(t,e))})),io("Map",yn.call(e),k,y)}if(function(t){if(!mn||!t||"object"!=typeof t)return!1;try{mn.call(t);try{yn.call(t)}catch(e){return!0}return t instanceof Set}catch(bl){}return!1}(e)){var j=[];return bn&&bn.call(e,(function(t){j.push(f(t,e))})),io("Set",mn.call(e),j,y)}if(function(t){if(!vn||!t||"object"!=typeof t)return!1;try{vn.call(t,vn);try{wn.call(t,wn)}catch(b){return!0}return t instanceof WeakMap}catch(bl){}return!1}(e))return oo("WeakMap");if(function(t){if(!wn||!t||"object"!=typeof t)return!1;try{wn.call(t,wn);try{vn.call(t,vn)}catch(b){return!0}return t instanceof WeakSet}catch(bl){}return!1}(e))return oo("WeakSet");if(function(t){if(!xn||!t||"object"!=typeof t)return!1;try{return xn.call(t),!0}catch(bl){}return!1}(e))return oo("WeakRef");if(function(t){return!("[object Number]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}(e))return no(f(Number(e)));if(function(t){if(!t||"object"!=typeof t||!Rn)return!1;try{return Rn.call(t),!0}catch(bl){}return!1}(e))return no(f(Rn.call(e)));if(function(t){return!("[object Boolean]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}(e))return no(Sn.call(e));if(function(t){return!("[object String]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}(e))return no(f(String(e)));if("undefined"!=typeof window&&e===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&e===globalThis||void 0!==o&&e===o)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==Zn(t)||Ln&&"object"==typeof t&&Ln in t)}(e)&&!Kn(e)){var O=ao(e,f),P=Wn?Wn(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",T=!P&&Ln&&Object(e)===e&&Ln in e?Pn.call(Zn(e),8,-1):A?"Object":"",I=(P||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(T||A?"["+Cn.call(Mn.call([],T||[],A||[]),": ")+"] ":"");return 0===O.length?I+"{}":y?I+"{"+so(O,y)+"}":I+"{ "+Cn.call(O,", ")+" }"}return String(e)},uo=Gt,po=lo("%WeakMap%",!0),yo=lo("%Map%",!0),fo=co("WeakMap.prototype.get",!0),go=co("WeakMap.prototype.set",!0),mo=co("WeakMap.prototype.has",!0),bo=co("Map.prototype.get",!0),vo=co("Map.prototype.set",!0),wo=co("Map.prototype.has",!0),xo=function(t,e){for(var r,n=t;null!==(r=n.next);n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},So=function(){var t,e,r,n={assert:function(t){if(!n.has(t))throw new uo("Side channel does not contain "+ho(t))},get:function(n){if(po&&n&&("object"==typeof n||"function"==typeof n)){if(t)return fo(t,n)}else if(yo){if(e)return bo(e,n)}else if(r)return function(t,e){var r=xo(t,e);return r&&r.value}(r,n)},has:function(n){if(po&&n&&("object"==typeof n||"function"==typeof n)){if(t)return mo(t,n)}else if(yo){if(e)return wo(e,n)}else if(r)return function(t,e){return!!xo(t,e)}(r,n);return!1},set:function(n,o){po&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new po),go(t,n,o)):yo?(e||(e=new yo),vo(e,n,o)):(r||(r={key:{},next:null}),function(t,e,r){var n=xo(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}}(r,n,o))}};return n},ko=Qt,jo=So(),Oo=Gt,Po={assert:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Oo("`O` is not an object");if("string"!=typeof e)throw new Oo("`slot` must be a string");if(jo.assert(t),!Po.has(t,e))throw new Oo("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Oo("`O` is not an object");if("string"!=typeof e)throw new Oo("`slot` must be a string");var r=jo.get(t);return r&&r["$"+e]},has:function(t,e){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Oo("`O` is not an object");if("string"!=typeof e)throw new Oo("`slot` must be a string");var r=jo.get(t);return!!r&&ko(r,"$"+e)},set:function(t,e,r){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new Oo("`O` is not an object");if("string"!=typeof e)throw new Oo("`slot` must be a string");var n=jo.get(t);n||(n={},jo.set(t,n)),n["$"+e]=r}};Object.freeze&&Object.freeze(Po);var Ao,To=Po,Io=SyntaxError,Eo="object"==typeof StopIteration?StopIteration:null,Mo={}.toString,Co=Array.isArray||function(t){return"[object Array]"==Mo.call(t)},Fo=String.prototype.valueOf,Do=Object.prototype.toString,Ro=rn(),Go=function(t){return"string"==typeof t||"object"==typeof t&&(Ro?function(t){try{return Fo.call(t),!0}catch(bl){return!1}}(t):"[object String]"===Do.call(t))},No="function"==typeof Map&&Map.prototype?Map:null,Bo="function"==typeof Set&&Set.prototype?Set:null;No||(Ao=function(t){return!1});var Lo=No?Map.prototype.has:null,Uo=Bo?Set.prototype.has:null;Ao||Lo||(Ao=function(t){return!1});var Wo,_o=Ao||function(t){if(!t||"object"!=typeof t)return!1;try{if(Lo.call(t),Uo)try{Uo.call(t)}catch(bl){return!0}return t instanceof No}catch(bl){}return!1},zo="function"==typeof Map&&Map.prototype?Map:null,$o="function"==typeof Set&&Set.prototype?Set:null;$o||(Wo=function(t){return!1});var qo=zo?Map.prototype.has:null,Vo=$o?Set.prototype.has:null;Wo||Vo||(Wo=function(t){return!1});var Ho=Wo||function(t){if(!t||"object"!=typeof t)return!1;try{if(Vo.call(t),qo)try{qo.call(t)}catch(bl){return!0}return t instanceof $o}catch(bl){}return!1},Yo=cn,Ko=function(t){if(!Eo)throw new Io("this environment lacks StopIteration");To.set(t,"[[Done]]",!1);var e={next:function(){var t=To.get(this,"[[Iterator]]"),e=To.get(t,"[[Done]]");try{return{done:e,value:e?void 0:t.next()}}catch(bl){if(To.set(t,"[[Done]]",!0),bl!==Eo)throw bl;return{done:!0,value:void 0}}}};return To.set(e,"[[Iterator]]",t),e};if(Wt()||Bt()){var Qo=Symbol.iterator;tn.exports=function(t){return null!=t&&void 0!==t[Qo]?t[Qo]():Yo(t)?Array.prototype[Qo].call(t):void 0}}else{var Jo=Co,Xo=Go,Zo=Te,ti=Zo("%Map%",!0),ei=Zo("%Set%",!0),ri=lr,ni=ri("Array.prototype.push"),oi=ri("String.prototype.charCodeAt"),ii=ri("String.prototype.slice"),si=function(t){var e=0;return{next:function(){var r,n=e>=t.length;return n||(r=t[e],e+=1),{done:n,value:r}}}},ai=function(t,e){if(Jo(t)||Yo(t))return si(t);if(Xo(t)){var r=0;return{next:function(){var e=function(t,e){if(e+1>=t.length)return e+1;var r=oi(t,e);if(r<55296||r>56319)return e+1;var n=oi(t,e+1);return n<56320||n>57343?e+1:e+2}(t,r),n=ii(t,r,e);return r=e,{done:e>t.length,value:n}}}}return e&&void 0!==t["_es6-shim iterator_"]?t["_es6-shim iterator_"]():void 0};if(ti||ei){var li=_o,ci=Ho,hi=ri("Map.prototype.forEach",!0),ui=ri("Set.prototype.forEach",!0);if("undefined"==typeof process||!process.versions||!process.versions.node)var pi=ri("Map.prototype.iterator",!0),yi=ri("Set.prototype.iterator",!0);var fi=ri("Map.prototype.@@iterator",!0)||ri("Map.prototype._es6-shim iterator_",!0),di=ri("Set.prototype.@@iterator",!0)||ri("Set.prototype._es6-shim iterator_",!0);tn.exports=function(t){return function(t){if(li(t)){if(pi)return Ko(pi(t));if(fi)return fi(t);if(hi){var e=[];return hi(t,(function(t,r){ni(e,[r,t])})),si(e)}}if(ci(t)){if(yi)return Ko(yi(t));if(di)return di(t);if(ui){var r=[];return ui(t,(function(t){ni(r,t)})),si(r)}}}(t)||ai(t)}}else tn.exports=function(t){if(null!=t)return ai(t,!0)}}var gi=tn.exports,mi=function(t){return t!=t},bi=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!mi(t)||!mi(e))},vi=bi,wi=function(){return"function"==typeof Object.is?Object.is:vi},xi=wi,Si=Ke,ki=Ke,ji=bi,Oi=wi,Pi=or(Oi(),Object);ki(Pi,{getPolyfill:Oi,implementation:ji,shim:function(){var t=xi();return Si(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Ai,Ti,Ii,Ei,Mi=Pi,Ci=or,Fi=lr,Di=Te("%ArrayBuffer%",!0),Ri=Fi("ArrayBuffer.prototype.byteLength",!0),Gi=Fi("Object.prototype.toString"),Ni=!!Di&&!Ri&&new Di(0).slice,Bi=!!Ni&&Ci(Ni),Li=Ri||Bi?function(t){if(!t||"object"!=typeof t)return!1;try{return Ri?Ri(t):Bi(t,0),!0}catch(bl){return!1}}:Di?function(t){return"[object ArrayBuffer]"===Gi(t)}:function(t){return!1},Ui=Date.prototype.getDay,Wi=Object.prototype.toString,_i=rn(),zi=lr,$i=rn();if($i){Ai=zi("Object.prototype.hasOwnProperty"),Ti=zi("RegExp.prototype.exec"),Ii={};var qi=function(){throw Ii};Ei={toString:qi,valueOf:qi},"symbol"==typeof Symbol.toPrimitive&&(Ei[Symbol.toPrimitive]=qi)}var Vi=zi("Object.prototype.toString"),Hi=Object.getOwnPropertyDescriptor,Yi=$i?function(t){if(!t||"object"!=typeof t)return!1;var e=Hi(t,"lastIndex");if(!e||!Ai(e,"value"))return!1;try{Ti(t,Ei)}catch(bl){return bl===Ii}}:function(t){return!(!t||"object"!=typeof t&&"function"!=typeof t)&&"[object RegExp]"===Vi(t)},Ki=lr("SharedArrayBuffer.prototype.byteLength",!0),Qi=Ki?function(t){if(!t||"object"!=typeof t)return!1;try{return Ki(t),!0}catch(bl){return!1}}:function(t){return!1},Ji=Number.prototype.toString,Xi=Object.prototype.toString,Zi=rn(),ts=lr,es=ts("Boolean.prototype.toString"),rs=ts("Object.prototype.toString"),ns=rn(),os={exports:{}},is=Object.prototype.toString;if(Wt()){var ss=Symbol.prototype.toString,as=/^Symbol\(.*\)$/;os.exports=function(t){if("symbol"==typeof t)return!0;if("[object Symbol]"!==is.call(t))return!1;try{return function(t){return"symbol"==typeof t.valueOf()&&as.test(ss.call(t))}(t)}catch(bl){return!1}}}else os.exports=function(t){return!1};var ls=os.exports,cs={exports:{}},hs="undefined"!=typeof BigInt&&BigInt;if("function"==typeof hs&&"function"==typeof BigInt&&"bigint"==typeof hs(42)&&"bigint"==typeof BigInt(42)){var us=BigInt.prototype.valueOf;cs.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 us.call(t),!0}catch(bl){}return!1}(t))}}else cs.exports=function(t){return!1};var ps,ys=cs.exports,fs=Go,ds=ls,gs=ys,ms="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,bs="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;ms||(ps=function(t){return!1});var vs=ms?ms.prototype.has:null,ws=bs?bs.prototype.has:null;ps||vs||(ps=function(t){return!1});var xs=ps||function(t){if(!t||"object"!=typeof t)return!1;try{if(vs.call(t,vs),ws)try{ws.call(t,ws)}catch(bl){return!0}return t instanceof ms}catch(bl){}return!1},Ss={exports:{}},ks=lr,js=Te("%WeakSet%",!0),Os=ks("WeakSet.prototype.has",!0);if(Os){var Ps=ks("WeakMap.prototype.has",!0);Ss.exports=function(t){if(!t||"object"!=typeof t)return!1;try{if(Os(t,Os),Ps)try{Ps(t,Ps)}catch(bl){return!0}return t instanceof js}catch(bl){}return!1}}else Ss.exports=function(t){return!1};var As,Ts,Is=Ss.exports,Es=_o,Ms=Ho,Cs=xs,Fs=Is,Ds=Function.prototype.toString,Rs="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof Rs&&"function"==typeof Object.defineProperty)try{As=Object.defineProperty({},"length",{get:function(){throw Ts}}),Ts={},Rs((function(){throw 42}),null,As)}catch(vl){vl!==Ts&&(Rs=null)}else Rs=null;var Gs=/^\s*class\b/,Ns=function(t){try{var e=Ds.call(t);return Gs.test(e)}catch(bl){return!1}},Bs=function(t){try{return!Ns(t)&&(Ds.call(t),!0)}catch(bl){return!1}},Ls=Object.prototype.toString,Us="function"==typeof Symbol&&!!Symbol.toStringTag,Ws=!(0 in[,]),_s=function(){return!1};if("object"==typeof document){var zs=document.all;Ls.call(zs)===Ls.call(document.all)&&(_s=function(t){if((Ws||!t)&&(void 0===t||"object"==typeof t))try{var e=Ls.call(t);return("[object HTMLAllCollection]"===e||"[object HTML document.all class]"===e||"[object HTMLCollection]"===e||"[object Object]"===e)&&null==t("")}catch(bl){}return!1})}var $s=Rs?function(t){if(_s(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{Rs(t,null,As)}catch(bl){if(bl!==Ts)return!1}return!Ns(t)&&Bs(t)}:function(t){if(_s(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(Us)return Bs(t);if(Ns(t))return!1;var e=Ls.call(t);return!("[object Function]"!==e&&"[object GeneratorFunction]"!==e&&!/^\[object HTML/.test(e))&&Bs(t)},qs=Object.prototype.toString,Vs=Object.prototype.hasOwnProperty,Hs=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],Ys="undefined"==typeof globalThis?o:globalThis,Ks=function(t,e,r){if(!$s(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=r),"[object Array]"===qs.call(t)?function(t,e,r){for(var n=0,o=t.length;n-1?e:"Object"===e&&function(t){var e=!1;return Ks(sa,(function(r,n){if(!e)try{r(t),e=na(n,1)}catch(bl){}})),e}(t)}return Xs?function(t){var e=!1;return Ks(sa,(function(r,n){if(!e)try{"$"+r(t)===n&&(e=na(n,1))}catch(bl){}})),e}(t):null},Pa=function(t){return la(t)?aa?aa(t):t.byteLength:NaN},Aa=ha("SharedArrayBuffer.prototype.byteLength",!0),Ta=ha("Date.prototype.getTime"),Ia=Object.getPrototypeOf,Ea=ha("Object.prototype.toString"),Ma=pa("%Set%",!0),Ca=ha("Map.prototype.has",!0),Fa=ha("Map.prototype.get",!0),Da=ha("Map.prototype.size",!0),Ra=ha("Set.prototype.add",!0),Ga=ha("Set.prototype.delete",!0),Na=ha("Set.prototype.has",!0),Ba=ha("Set.prototype.size",!0);function La(t,e,r,n){for(var o,i=ya(t);(o=i.next())&&!o.done;)if($a(e,o.value,r,n))return Ga(t,o.value),!0;return!1}function Ua(t){return void 0===t?null:"object"!=typeof t?"symbol"!=typeof t&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function Wa(t,e,r,n,o,i){var s=Ua(r);if(null!=s)return s;var a=Fa(e,s),l=ca({},o,{strict:!1});return!(void 0===a&&!Ca(e,s)||!$a(n,a,l,i))&&!Ca(t,s)&&$a(n,a,l,i)}function _a(t,e,r){var n=Ua(r);return null!=n?n:Na(e,n)&&!Na(t,n)}function za(t,e,r,n,o,i){for(var s,a,l=ya(t);(s=l.next())&&!s.done;)if($a(r,a=s.value,o,i)&&$a(n,Fa(e,a),o,i))return Ga(t,a),!0;return!1}function $a(t,e,r,n){var o=r||{};if(o.strict?da(t,e):t===e)return!0;if(ka(t)!==ka(e))return!1;if(!t||!e||"object"!=typeof t&&"object"!=typeof e)return o.strict?da(t,e):t==e;var i,s=n.has(t),a=n.has(e);if(s&&a){if(n.get(t)===n.get(e))return!0}else i={};return s||n.set(t,i),a||n.set(e,i),function(t,e,r,n){var o,i;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Ea(t)!==Ea(e))return!1;if(ga(t)!==ga(e))return!1;if(ma(t)!==ma(e))return!1;var s=t instanceof Error,a=e instanceof Error;if(s!==a)return!1;if((s||a)&&(t.name!==e.name||t.message!==e.message))return!1;var l=wa(t),c=wa(e);if(l!==c)return!1;if((l||c)&&(t.source!==e.source||ua(t)!==ua(e)))return!1;var h=va(t),u=va(e);if(h!==u)return!1;if((h||u)&&Ta(t)!==Ta(e))return!1;if(r.strict&&Ia&&Ia(t)!==Ia(e))return!1;var p=Oa(t),y=Oa(e);if(p!==y)return!1;if(p||y){if(t.length!==e.length)return!1;for(o=0;o=0;o--)if(w[o]!=x[o])return!1;for(o=w.length-1;o>=0;o--)if(!$a(t[i=w[o]],e[i],r,n))return!1;var S=ja(t),k=ja(e);return S===k&&("Set"===S||"Set"===k?function(t,e,r,n){if(Ba(t)!==Ba(e))return!1;for(var o,i,s,a=ya(t),l=ya(e);(o=a.next())&&!o.done;)if(o.value&&"object"==typeof o.value)s||(s=new Ma),Ra(s,o.value);else if(!Na(e,o.value)){if(r.strict)return!1;if(!_a(t,e,o.value))return!1;s||(s=new Ma),Ra(s,o.value)}if(s){for(;(i=l.next())&&!i.done;)if(i.value&&"object"==typeof i.value){if(!La(s,i.value,r.strict,n))return!1}else if(!r.strict&&!Na(t,i.value)&&!La(s,i.value,r.strict,n))return!1;return 0===Ba(s)}return!0}(t,e,r,n):"Map"!==S||function(t,e,r,n){if(Da(t)!==Da(e))return!1;for(var o,i,s,a,l,c,h=ya(t),u=ya(e);(o=h.next())&&!o.done;)if(a=o.value[0],l=o.value[1],a&&"object"==typeof a)s||(s=new Ma),Ra(s,a);else if(void 0===(c=Fa(e,a))&&!Ca(e,a)||!$a(l,c,r,n)){if(r.strict)return!1;if(!Wa(t,e,a,l,r,n))return!1;s||(s=new Ma),Ra(s,a)}if(s){for(;(i=u.next())&&!i.done;)if(a=i.value[0],c=i.value[1],a&&"object"==typeof a){if(!za(s,t,a,c,r,n))return!1}else if(!(r.strict||t.has(a)&&$a(Fa(t,a),c,r,n)||za(s,t,a,c,ca({},r,{strict:!1}),n)))return!1;return 0===Ba(s)}return!0}(t,e,r,n))}(t,e,o,n)}function qa(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0]||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))}const Va=i((function(t,e,r){return $a(t,e,r,fa())})),Ha={player:{x:mt.x,y:mt.y,flip:!1},journal:[],inventory:[],quests:[],warpers:[],settings:{gamepad:s(),debug:!1}},Ya={player:{x:mt.x-200,y:mt.y,flip:!1},journal:[F.FixTheClock,F.SphinxRiddleSolved,F.MetTheMayor],inventory:[I.Wrench,I.Gear1],quests:[{id:E.SphinxRiddle,completed:!0}],warpers:[{warpType:T.TownEast,state:!0},{warpType:T.ClockSquareNorth,state:!0}],settings:{gamepad:!1,debug:!0}};function Ka(t){let e,r=localStorage.getItem("save");try{r&&(e=JSON.parse(r))}catch(n){console.error(n),new nt(t,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4)}try{const r=e||Ha;if(r.settings.debug!==p.debug)return p.debug=r.settings.debug,void t.scene.restart();t.player.setX(r.player.x),t.player.setY(r.player.y),t.player.setFlipX(r.player.flip),r.journal.forEach((e=>t.player.journal.addEntry(e,!0))),r.inventory.forEach((e=>t.player.inventory.addItem(e,!0))),r.quests.forEach((e=>t.player.quests.addQuest(e,!0))),function(t,e){const r=H(t,W);e.forEach((t=>{const e=r.find((e=>e.warpType===t.warpType));e&&e.setVisible(t.state)}))}(t,r.warpers),t.gamepad.setVisible(r.settings.gamepad);const n=Va(e,Ha)?"[New]":Va(e,Ya)?"[Debug]":"[Storage]";new nt(t,`Game Loaded ${n}`)}catch(n){console.error(n),new nt(t,"Unfortunately, it looks like this save is corrupted.\nFailed to Load Game",1e4),Qa(t,Ha),Ka(t)}}function Qa(t,e){const r={player:{x:t.player.x,y:t.player.y,flip:t.player.flipX},journal:t.player.journal.journal,inventory:t.player.inventory.inventory,quests:t.player.quests.quests,warpers:Ja(t),settings:{gamepad:t.gamepad.visible,debug:p.debug}};localStorage.setItem("save",JSON.stringify(e||r)),new nt(t,"Game Saved")}function Ja(t){return H(t,W).map((t=>({warpType:t.warpType,state:t.visible})))}r.GameObjects.Container;class Xa extends r.GameObjects.Container{constructor(t,r){super(t,100,p.height-100),e(this,"buttons",[]),e(this,"lastAxisKey"),this.setScrollFactor(0).setDepth(x.Overlay),t.add.existing(this),this.createDPad(),r||this.createButtons(),this.createControllerListeners()}update(t,e){var r,n,o,i,s,a;const l=null==(r=this.scene.input.gamepad)?void 0:r.pad1;if(!l)return;const c=l.axes[0].getValue();if(Math.abs(c)<=.1&&this.lastAxisKey)return null==(n=this.scene.input.keyboard)||n.emit("keyup-"+this.lastAxisKey),void(this.lastAxisKey=void 0);if(c>.1){if("RIGHT"===this.lastAxisKey)return;"LEFT"===this.lastAxisKey&&(null==(o=this.scene.input.keyboard)||o.emit("keyup-LEFT")),null==(i=this.scene.input.keyboard)||i.emit("keydown-RIGHT"),this.lastAxisKey="RIGHT"}if(c<-.1){if("LEFT"===this.lastAxisKey)return;"RIGHT"===this.lastAxisKey&&(null==(s=this.scene.input.keyboard)||s.emit("keyup-RIGHT")),null==(a=this.scene.input.keyboard)||a.emit("keydown-LEFT"),this.lastAxisKey="LEFT"}}createDPad(){const t=this.scene.add.container(20,-10);this.add(t);const e=this.scene.add.circle(0,0,60,v(g),.45).setStrokeStyle(3,v(m));t.add(e),this.button(-57,0,"LEFT",t),this.button(57,0,"RIGHT",t),this.button(0,-57,"UP",t),this.button(0,57,"DOWN",t)}createButtons(){const t=this.scene.add.container(p.width-300,0);this.add(t);const e=this.scene.add.circle(40,0,65,v(g),.45).setStrokeStyle(3,v(m)).setScale(1,.6).setAngle(-30);t.add(e),this.button(80,-20,"ENTER",t),this.button(0,20,"BACKSPACE",t)}createControllerListeners(){var t,e,r,n;null==(t=this.scene.input.gamepad)||t.on("connected",(t=>{new nt(this.scene,"Gamepad connected")})),null==(e=this.scene.input.gamepad)||e.on("disconnected",(t=>{new nt(this.scene,"Gamepad disconnected")})),null==(r=this.scene.input.gamepad)||r.on("down",((t,e)=>{var r;const n=this.getKeyFromButton(e);n&&(null==(r=this.scene.input.keyboard)||r.emit(`keydown-${n}`)),console.log("down",e)})),null==(n=this.scene.input.gamepad)||n.on("up",((t,e)=>{var r;const n=this.getKeyFromButton(e);n&&(null==(r=this.scene.input.keyboard)||r.emit(`keyup-${n}`)),console.log("up",e)}))}getKeyFromButton(t){let e;switch(t.index){case 0:e=t.pad.id.toLowerCase().includes("nintendo")?"BACKSPACE":"ENTER";break;case 1:e=t.pad.id.toLowerCase().includes("nintendo")?"ENTER":"BACKSPACE";break;case 9:e="ESC";break;case 12:e="UP";break;case 13:e="DOWN";break;case 14:e="LEFT";break;case 15:e="RIGHT"}return e}button(t,e,r,n){const o="ENTER"===r||"ESCAPE"===r?35:38,i=this.scene.add.circle(t,e,o,v(f),.8).setStrokeStyle(3,v(m));i.setInteractive({useHandCursor:!0}).setScrollFactor(0),n.add(i),i.on("pointerdown",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keydown-${r}`),i.setFillStyle(v(g),Math.min(1,1.05))})),i.on("pointerup",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keyup-${r}`),i.setFillStyle(v(f),.8)})),i.on("pointerout",(()=>{var t;null==(t=this.scene.input.keyboard)||t.emit(`keyup-${r}`),i.setFillStyle(v(f),.8)})),this.buttons.push(i)}offsetButtons(t){t?this.setPosition(100,p.height-300):this.setPosition(100,p.height-100)}}class Za extends r.GameObjects.Text{constructor(t){super(t,24,p.height-22,"⚙",{fontSize:"48px",backgroundColor:`#${g}`,padding:{x:3,y:3},align:"center"}),t.add.existing(this),this.setOrigin(.5).setScrollFactor(0).setDepth(x.Ui).setInteractive({useHandCursor:!0}).on("pointerdown",(()=>{t.scene.pause(),t.scene.launch("Paused",{game:this})}))}}class tl extends r.Scene{constructor(){super("Game"),e(this,"player"),e(this,"interactiveObjects"),e(this,"clock"),e(this,"gamepad")}create(){this.createBackgrounds(),this.player=new bt(this);const t=new L(this),e=this.createWarpers(),r=this.createNpcs(),n=this.createItems(),o=this.createSlopes(),i=new P(this,3100,600);this.createLights(),new Za(this),this.gamepad=new Xa(this);const s=[this.player];this.clock=new S(this,s,this.player),this.interactiveObjects=this.add.group([...e,...r,...n],{runChildUpdate:!0}),this.add.group([this.player,this.clock,this.gamepad,i,...o],{runChildUpdate:!0}),this.physics.add.collider(this.player,t),this.createEventListeners();const a=this.cameras.main;a.startFollow(this.player,!0),a.setFollowOffset(0,p.cameraOffset),Ka(this)}update(){this.physics.overlap(this.interactiveObjects,this.player,this.player.setInteractiveObject,((t,e)=>void 0===t.visible||t.visible),this.player)||this.player.setInteractiveObject(void 0)}createBackgrounds(){const t=[this.physics.add.sprite(0,0,"town").setOrigin(0),this.physics.add.sprite(500,-1100,"clock_outside").setOrigin(0),this.physics.add.sprite(500,-2400,"clock_inner").setOrigin(0),this.physics.add.sprite(2300,0,"forest").setOrigin(0),this.physics.add.sprite(4400,100,"lake").setOrigin(0)];return t.forEach((t=>{"clock_inner"!==t.texture.key&&t.setPipeline("Light2D"),p.debug&&t.setInteractive({draggable:!0})})),t}createWarpers(){const t=[];for(const e in T)isNaN(Number(e))&&t.push(new W(this,T[e],this.player));return t}createNpcs(){return[new N(this,M.Inventor,this.player),new N(this,M.Stranger,this.player),new N(this,M.Sphinx,this.player),new N(this,M.Mayor,this.player),new N(this,M.ClockTower,this.player)]}createItems(){return[new rt(this,I.Gear1,this.player)]}createSlopes(){return[new vt(this,740,-1370,170,95),new vt(this,815,-2010,90,70)]}createLights(){this.lights.enable().setAmbientColor(v("335588")),[{x:135,y:462,radius:150,color:v(d),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}].forEach((t=>{p.debug?new k(this,t.x,t.y,t.radius||100,t.color||v(b),t.intensity||1):this.lights.addLight(t.x,t.y,t.radius||100,t.color||v(b),t.intensity||1)}))}createEventListeners(){var t,e;null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>{this.scene.pause(),this.scene.launch("Paused",{game:this})})),null==(e=this.input.keyboard)||e.on("keydown-J",(()=>{this.player.journal.openJournal()})),this.events.on("resume",(()=>{this.player.keys.resetKeys()}))}}class el extends r.GameObjects.Container{constructor(t,n,o,i,s){var a,l;super(t,n,o),e(this,"textObject"),e(this,"maskGraphics"),e(this,"scrollbar"),e(this,"scrollY"),e(this,"boxHeight"),t.add.existing(this),this.scrollY=0,this.boxHeight=0,this.textObject=new r.GameObjects.Text(t,0,0,i,{...w,padding:{x:10,y:10},...s}),this.textObject.setOrigin(0).setScrollFactor(0).setInteractive(),this.add(this.textObject),t.input.on("wheel",this.handleScroll,this),this.textObject.on("pointermove",this.handleDrag,this),null==(a=t.input.keyboard)||a.on("keydown-UP",(()=>{this.scrollY-=30,this.updateTextPosition()})),null==(l=t.input.keyboard)||l.on("keydown-DOWN",(()=>{this.scrollY+=30,this.updateTextPosition()})),this.maskGraphics=t.add.graphics().setPosition(n,o).setScrollFactor(0).setVisible(!1),this.add(this.maskGraphics),this.scrollbar=t.add.rectangle(0,0,4,0,5592405).setScrollFactor(0),this.add(this.scrollbar)}setBoxSize(t,e){this.boxHeight=e,this.maskGraphics.clear(),this.maskGraphics.fillStyle(16777215),this.maskGraphics.fillRect(0,0,t,e);const r=this.maskGraphics.createGeometryMask();this.textObject.setMask(r),this.textObject.setWordWrapWidth(t-4),this.textObject.setFixedSize(t-4,0),this.updateTextPosition()}handleDrag(t){t.isDown&&(this.scrollY-=t.velocity.y,this.updateTextPosition())}handleScroll(t,e,r,n,o){this.scrollY+=.5*n,this.updateTextPosition()}updateTextPosition(){const t=Math.max(0,this.textObject.height-this.boxHeight);this.scrollY=Phaser.Math.Clamp(this.scrollY,0,t),this.textObject.y=-this.scrollY;const e=this.scrollY/t,r=this.boxHeight/this.textObject.height;this.scrollbar.height=r*this.boxHeight,this.scrollbar.setPosition(this.textObject.width-4,e*(this.boxHeight-r*this.boxHeight))}}const rl={[F.FixTheClock]:"The inventor gave me a wrench to help fix the clock tower. I will also need three gears to repair it.",[F.ForestMazeSolved]:"I finally got through the forest maze. Next time should be much easier.",[F.SphinxRiddleSolved]:"I solved the sphinx’s riddle. Now I can pass through the forest.",[F.MetTheMayor]:"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.",[F.ClockFirstGear]:"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."};class nl extends r.Scene{constructor(){super("JournalDialog"),e(this,"player")}init(t){this.player=t.player}create(){var t,e,r;const n=this.add.container(p.width/2,p.height/2);n.add(this.add.rectangle(0,0,.8*p.width,.8*p.height,0,.75).setStrokeStyle(4,v(d))),n.add(new ct(this,.35*p.width,-.33*p.height,"X",(()=>this.close()))),n.add(this.add.text(0,-.33*p.height,"Journal",{...w,fontSize:48}).setOrigin(.5));const o=this.player.journal.journal.map((t=>`- ${rl[t]}\n\n`)).reverse();new el(this,.13*p.width,.25*p.height,o,{fontSize:32}).setBoxSize(.74*p.width,.62*p.height),new Xa(this).setVisible(!1),null==(t=this.input.keyboard)||t.on("keydown-J",(()=>{this.close()})),null==(e=this.input.keyboard)||e.on("keydown-ESC",(()=>{this.close()})),null==(r=this.input.keyboard)||r.on("keydown-BACKSPACE",(()=>{this.close()}))}close(){this.scene.stop(),this.scene.resume("Game")}}function ol(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function il(t){for(var e=1;ee+t)):Array.from(Array(t).keys())}function cl(t){return[...new Set(t)]}function hl(t,e){const r=cl(t.map((t=>t.set))).filter(Boolean),n=(o=ll(1,t.length+1),i=r,[o,i].reduce(((t,e)=>t.filter((t=>!e.includes(t)))))).sort((()=>.5-e()));var o,i;t.filter((t=>!t.set)).forEach(((t,e)=>t.set=n[e]))}function ul(t,e,r=.5){al(t).forEach(((n,o)=>{const i=t[o+1],s=n.set!==i.set,a=e()<=r;var l,c,h;s&&a&&(l=t,c=i.set,h=n.set,l.forEach((t=>{t.set===c&&(t.set=h)})),n.right=!1,i.left=!1)}))}const pl=48;class yl extends r.Scene{constructor(){super("Maze"),e(this,"parent"),e(this,"graphics"),e(this,"keys"),e(this,"maze"),e(this,"mazePlayer"),e(this,"nextUpdate")}init(t){this.parent=t.parent}create(){this.createMaze(),this.mazePlayer=this.add.ellipse(0,0,.8*pl,.8*pl,5601177).setSmoothness(32).setOrigin(-.13),this.cameras.main.startFollow(this.mazePlayer),this.keys=this.parent.keys}createMaze(){const t=K(this.parent.player.scene);this.maze=function(t=8,e=t,r=!0,n=1){const o=function(t){return function(){let e=t+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n),i=[],s=ll(t);for(let c=0;c({x:n,y:c,top:r||c>0,left:r||n>0,bottom:r||c{hl(t,o),ul(t,o),function(t,e,r){const n=Object.values(function(t,e){let r=cl(t.map((t=>t.set))).reduce(((t,e)=>il(il({},t),{},{[e]:[]})),{});return t.forEach((t=>r[t.set].push(t))),r}(t)),{ceil:o}=Math;n.forEach((t=>{(function(t,e,r){e=null==e?1:e;const n=null==t?0:t.length;if(!n||e<1)return[];e=e>n?n:e;let o=-1;const i=n-1,s=[...t];for(;++o{if(t){const r=e[t.x];t.bottom=!1,r.top=!1,r.set=t.set}}))}))}(t,i[e+1],o)}));const a=(l=i)[l.length-1];var l;return hl(a,o),ul(a,o,1),i}(24,24,!0,t),this.graphics=this.add.graphics(),this.graphics.fillStyle(10040098,.5),this.graphics.fillRect(1104,1104,pl,pl),this.graphics.lineStyle(3,3385907),this.maze.forEach((t=>{t.forEach((t=>{if(t.top){const e=new Phaser.Geom.Line(t.x*pl,t.y*pl,t.x*pl+pl,t.y*pl);this.graphics.strokeLineShape(e)}if(t.bottom){const e=new Phaser.Geom.Line(t.x*pl,t.y*pl+pl,t.x*pl+pl,t.y*pl+pl);this.graphics.strokeLineShape(e)}if(t.left){const e=new Phaser.Geom.Line(t.x*pl,t.y*pl,t.x*pl,t.y*pl+pl);this.graphics.strokeLineShape(e)}if(t.right){const e=new Phaser.Geom.Line(t.x*pl+pl,t.y*pl,t.x*pl+pl,t.y*pl+pl);this.graphics.strokeLineShape(e)}}))})),this.cameras.main.setViewport(50,130,p.width-100,p.height-170)}update(t,e){if(t=24||i>=24)return!1;const s=r.Math.FloorTo(this.mazePlayer.x/pl),a=r.Math.FloorTo(this.mazePlayer.y/pl),l=this.maze[a][s];return!(l.top&&nthis.mazePlayer.y||l.left&&ethis.mazePlayer.x)}}class fl extends r.Scene{constructor(){super("MazeDialog"),e(this,"player"),e(this,"container"),e(this,"arrow"),e(this,"keys")}init(t){this.player=t.player}create(){var t,e;this.container=this.add.container(p.width/2,p.height/2),this.container.add(this.add.rectangle(0,0,.95*p.width,.95*p.height,0,.9).setStrokeStyle(4,v(d))),this.container.add(new ct(this,.44*p.width,-.4*p.height,"X",(()=>this.close(!1)))),this.container.add(this.add.text(0,-.4*p.height,"Find your way through the forest",{...w,fontSize:48}).setOrigin(.5)),this.arrow=this.add.sprite(.4*-p.width,.4*-p.height,"arrow").setScale(.5).setRotation(.75*Math.PI),this.container.add(this.arrow),null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>{this.close(!1)})),null==(e=this.input.keyboard)||e.on("keydown-BACKSPACE",(()=>{this.close(!1)})),new Xa(this,!0).setVisible(this.player.scene.gamepad.visible),this.keys=new R(this),this.scene.launch("Maze",{parent:this})}setAngle(t){this.arrow.setRotation(t+Math.PI/2)}close(t){this.scene.stop(),this.scene.stop("Maze"),this.scene.resume("Game"),t?(_(T.Forest,this.player),this.player.journal.addEntry(F.ForestMazeSolved)):this.player.setPosition(U[T.TownEast].x-40,U[T.TownEast].y)}}class dl extends r.Scene{constructor(){super("Paused"),e(this,"parent")}init(t){this.parent=t.game}create(){var t;const{width:e,height:r}=p;this.add.rectangle(e/2,r/2,e,r,0,.75).setInteractive().on("pointerdown",(()=>this.resume())),this.add.text(e/2,100,"Game Paused",{...w,fontSize:72}).setOrigin(.5),this.add.text(e-20,20,`Build Time: ${new Date("2024-07-22T03:00:49.566Z").toLocaleString()}`,{...w,fontSize:16}).setOrigin(1,0);const n=!p.zoomed,o=n?100:88,i=r/2-(n?100:70),s=new ht(this);s.addButton(new ct(this,e/2,i,"Resume",(()=>this.resume()))),s.addButton(new ct(this,e/2,i+o,"Save",(()=>{this.resume(),Qa(this.parent)}))),s.addButton(new ct(this,e/2,i+2*o,"Load",(()=>{this.resume(),this.parent.scene.restart()}))),s.addButton(new ct(this,e/2,i+3*o,"Toggle Gamepad",(()=>{this.parent.gamepad.setVisible(!this.parent.gamepad.visible)}))),null==(t=this.input.keyboard)||t.on("keydown-ESC",(()=>this.resume())),new Xa(this).setVisible(!1)}resume(){this.scene.stop(),this.scene.resume("Game")}}class gl extends r.Scene{constructor(){super("Preloader")}init(){const t=this.add.rectangle(p.width/2,p.height/2,.75*p.width,32).setStrokeStyle(1,16777215),e=this.add.rectangle(4+t.x-t.width/2,p.height/2,4,27,16777215);this.load.on("progress",(t=>{e.width=.75*p.width*t-5}))}preload(){this.load.setPath("assets"),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("ladder","ladder.png"),this.load.image("warp","warp.png"),this.load.image("watch","watch.png"),this.load.image("arrow","arrow.png"),this.load.image("gear","items/gear.png"),this.load.image("journal","items/journal.png"),this.load.image("wrench","items/wrench.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")}create(){this.scene.start("Game")}}const ml={type:Phaser.AUTO,width:p.width,height:p.height,parent:"game-container",backgroundColor:1118481,scale:{mode:Phaser.Scale.FIT,autoCenter:Phaser.Scale.CENTER_BOTH},scene:[y,gl,tl,dl,nl,fl,yl],input:{gamepad:!0},physics:{default:"arcade"},render:{pixelArt:!0,antialias:!1}};("m6x11","assets/m6x11.ttf",new FontFace("m6x11","url(assets/m6x11.ttf)").load().then((function(t){document.fonts.add(t)})).catch((function(t){return t}))).then((()=>{new r.Game(ml)})); diff --git a/index.html b/index.html index 276a9d8..8bde918 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ Chrono Sleuth - + diff --git a/sw.js b/sw.js index 3bb52f2..fc3c18c 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const a=(a,r)=>(a=new URL(a+".js",r).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(r,c)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let t={};const n=e=>a(e,i),f={module:{uri:i},exports:t,require:n};s[i]=Promise.all(r.map((e=>f[e]||n(e)))).then((e=>(c(...e),t)))}}define(["./workbox-7cfec069"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index-_jfZM_XL.js",revision:null},{url:"assets/phaser-pZmLa9DQ.js",revision:null},{url:"index.html",revision:"9d2e67adddcecc6f2f09027a852b26be"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"style.css",revision:"3fafb78cc03cddae52a5b86f6144ec15"},{url:"./favicon.webp",revision:"780a123387c540776001414720d7883e"},{url:"style.css",revision:"3fafb78cc03cddae52a5b86f6144ec15"},{url:"assets/arrow.png",revision:"5e98a0c3f8ba773d97f2f0a5ecd1c069"},{url:"assets/ladder.png",revision:"b3241d6091484698a0a18d161188d515"},{url:"assets/m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"assets/warp.png",revision:"372b674eeb453314d66a245f047d3611"},{url:"assets/watch.png",revision:"115e1ee5ef980df844b62503bd519496"},{url:"assets/characters/clock_portrait.png",revision:"1df5c510a75311533cddd9cd65a62acf"},{url:"assets/characters/inventor.png",revision:"5485cd4ff4c7c428c79fa815090078f5"},{url:"assets/characters/inventor_portrait.png",revision:"d2556ae1e1262bd2ce33f584670772e7"},{url:"assets/characters/mayor.png",revision:"cf2d6227d8b6c7963dd531b4b017908d"},{url:"assets/characters/mayor_portrait.png",revision:"e2fd6db5709f822ec6674bec059ff236"},{url:"assets/characters/player.png",revision:"6f7b701b47e29fa1d8820deecc7d6860"},{url:"assets/characters/player_portrait.png",revision:"cf67927eccc0bcd6a6e8051133db6b80"},{url:"assets/characters/sphinx.png",revision:"1e4b56ed598d25f97b58896ff12ab5a2"},{url:"assets/characters/sphinx_portrait.png",revision:"798ffa3cfb6410aeed4895afe774b76e"},{url:"assets/characters/stranger.png",revision:"5ffa23d7d026527010bfee487f9c6240"},{url:"assets/characters/stranger_portrait.png",revision:"259f9cecd6f070b23b2e0548a8d80550"},{url:"assets/items/book.png",revision:"92f0d78f5aa51a14fcd2f2a0b4fef30e"},{url:"assets/items/candle.png",revision:"48c48eae6e97c910ba0d36a05b6915ba"},{url:"assets/items/dagger.png",revision:"2b4b8e537033b36bc19e03ebe740a5bb"},{url:"assets/items/gear.png",revision:"96b9e8302f223a315acd854acb3e1a1c"},{url:"assets/items/journal.png",revision:"2e23989db6896b2c0b6711875bf89463"},{url:"assets/items/lantern.png",revision:"57e3733c3e92400206a7036c789d29ec"},{url:"assets/items/letter.png",revision:"a7c58a865987a55a304c3aaf08ea7594"},{url:"assets/items/lockpick.png",revision:"e4f9cea2cf45eb3275d90cbbf058a0d4"},{url:"assets/items/map.png",revision:"116082e99e71eb199de518b6832a0ab9"},{url:"assets/items/wrench.png",revision:"11dcc67bf3b5a56e9e6ad8f4743bdebc"},{url:"assets/maps/clock_inner.jpg",revision:"c1fce93f8fafba55438f64dc53bed98b"},{url:"assets/maps/clock_outside.jpg",revision:"c0ea232d05c4148804010eaa2044b2fa"},{url:"assets/maps/forest.jpg",revision:"fbac7057eb5bc73b21722985eb7735e6"},{url:"assets/maps/lake.jpg",revision:"d5bec2d85eb9da6feb3f85c6fac50866"},{url:"assets/maps/town.jpg",revision:"b53c3a2a1966829458188f937b22279b"},{url:"manifest.webmanifest",revision:"b617f64f983347246b48963c8d689d9c"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,s={};const a=(a,r)=>(a=new URL(a+".js",r).href,s[a]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=a,e.onload=s,document.head.appendChild(e)}else e=a,importScripts(a),s()})).then((()=>{let e=s[a];if(!e)throw new Error(`Module ${a} didn’t register its module`);return e})));self.define=(r,i)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let t={};const n=e=>a(e,c),f={module:{uri:c},exports:t,require:n};s[c]=Promise.all(r.map((e=>f[e]||n(e)))).then((e=>(i(...e),t)))}}define(["./workbox-7cfec069"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index-77bP2BB0.js",revision:null},{url:"assets/phaser-pZmLa9DQ.js",revision:null},{url:"index.html",revision:"7466d53f400f3a289e52f4de21390920"},{url:"registerSW.js",revision:"402b66900e731ca748771b6fc5e7a068"},{url:"style.css",revision:"3fafb78cc03cddae52a5b86f6144ec15"},{url:"./favicon.webp",revision:"780a123387c540776001414720d7883e"},{url:"style.css",revision:"3fafb78cc03cddae52a5b86f6144ec15"},{url:"assets/arrow.png",revision:"5e98a0c3f8ba773d97f2f0a5ecd1c069"},{url:"assets/ladder.png",revision:"b3241d6091484698a0a18d161188d515"},{url:"assets/m6x11.ttf",revision:"cc8dfaa3938829493e45c4a13b6629c3"},{url:"assets/warp.png",revision:"372b674eeb453314d66a245f047d3611"},{url:"assets/watch.png",revision:"115e1ee5ef980df844b62503bd519496"},{url:"assets/characters/clock_portrait.png",revision:"1df5c510a75311533cddd9cd65a62acf"},{url:"assets/characters/inventor.png",revision:"5485cd4ff4c7c428c79fa815090078f5"},{url:"assets/characters/inventor_portrait.png",revision:"d2556ae1e1262bd2ce33f584670772e7"},{url:"assets/characters/mayor.png",revision:"cf2d6227d8b6c7963dd531b4b017908d"},{url:"assets/characters/mayor_portrait.png",revision:"e2fd6db5709f822ec6674bec059ff236"},{url:"assets/characters/player.png",revision:"6f7b701b47e29fa1d8820deecc7d6860"},{url:"assets/characters/player_portrait.png",revision:"cf67927eccc0bcd6a6e8051133db6b80"},{url:"assets/characters/sphinx.png",revision:"1e4b56ed598d25f97b58896ff12ab5a2"},{url:"assets/characters/sphinx_portrait.png",revision:"798ffa3cfb6410aeed4895afe774b76e"},{url:"assets/characters/stranger.png",revision:"5ffa23d7d026527010bfee487f9c6240"},{url:"assets/characters/stranger_portrait.png",revision:"259f9cecd6f070b23b2e0548a8d80550"},{url:"assets/items/book.png",revision:"92f0d78f5aa51a14fcd2f2a0b4fef30e"},{url:"assets/items/candle.png",revision:"48c48eae6e97c910ba0d36a05b6915ba"},{url:"assets/items/dagger.png",revision:"2b4b8e537033b36bc19e03ebe740a5bb"},{url:"assets/items/gear.png",revision:"96b9e8302f223a315acd854acb3e1a1c"},{url:"assets/items/journal.png",revision:"2e23989db6896b2c0b6711875bf89463"},{url:"assets/items/lantern.png",revision:"57e3733c3e92400206a7036c789d29ec"},{url:"assets/items/letter.png",revision:"a7c58a865987a55a304c3aaf08ea7594"},{url:"assets/items/lockpick.png",revision:"e4f9cea2cf45eb3275d90cbbf058a0d4"},{url:"assets/items/map.png",revision:"116082e99e71eb199de518b6832a0ab9"},{url:"assets/items/wrench.png",revision:"11dcc67bf3b5a56e9e6ad8f4743bdebc"},{url:"assets/maps/clock_inner.jpg",revision:"c1fce93f8fafba55438f64dc53bed98b"},{url:"assets/maps/clock_outside.jpg",revision:"c0ea232d05c4148804010eaa2044b2fa"},{url:"assets/maps/forest.jpg",revision:"fbac7057eb5bc73b21722985eb7735e6"},{url:"assets/maps/lake.jpg",revision:"d5bec2d85eb9da6feb3f85c6fac50866"},{url:"assets/maps/town.jpg",revision:"b53c3a2a1966829458188f937b22279b"},{url:"manifest.webmanifest",revision:"b617f64f983347246b48963c8d689d9c"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));