diff --git a/assets/gameLoop.b6c8f87a.js b/assets/gameLoop.708e7c33.js similarity index 92% rename from assets/gameLoop.b6c8f87a.js rename to assets/gameLoop.708e7c33.js index f412f2e..25a10e7 100644 --- a/assets/gameLoop.b6c8f87a.js +++ b/assets/gameLoop.708e7c33.js @@ -1 +1 @@ -import{_ as d,s as p,p as e,a as o,l as T,D as l,b as m,g as u}from"./index.8dbb25be.js";import"./vue.c16a309b.js";import{b2 as c}from"./@vue.6b211d3c.js";/* empty css */import"./nanoevents.1080beb7.js";import"./lz-string.dccec454.js";import"./vue-next-select.ded54c4a.js";import"./vuedraggable.1879de79.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-panzoom.8ce6f9b1.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";import"./vue-toastification.9c2dad53.js";let n=null,f=null;function a(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const r=i;if(o.lastTenTicks.push(r),o.lastTenTicks.length>10&&(o.lastTenTicks=o.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!o.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,m.offlineLimit*3600)&&(e.offlineTime=m.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,m.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,r),p.unthrottled?(requestAnimationFrame(a),n!=null&&(clearInterval(n),n=null)):n==null&&(n=setInterval(a,50)))}}async function A(){f=(await d(()=>import("./index.8dbb25be.js").then(function(t){return t.c}),["assets/index.8dbb25be.js","assets/index.6cff6927.css","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.ded54c4a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.1879de79.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.8ce6f9b1.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.9c2dad53.js","assets/vue-toastification.4b5f8ac8.css"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(a):n=setInterval(a,50)}export{A as startGameLoop}; +import{_ as d,s as p,p as e,a as o,l as T,D as l,b as m,g as u}from"./index.15c6e2b7.js";import"./vue.c16a309b.js";import{b2 as c}from"./@vue.6b211d3c.js";/* empty css */import"./nanoevents.1080beb7.js";import"./lz-string.dccec454.js";import"./vue-next-select.ded54c4a.js";import"./vuedraggable.1879de79.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-panzoom.8ce6f9b1.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";import"./vue-toastification.9c2dad53.js";let n=null,f=null;function a(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const r=i;if(o.lastTenTicks.push(r),o.lastTenTicks.length>10&&(o.lastTenTicks=o.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!o.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,m.offlineLimit*3600)&&(e.offlineTime=m.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,m.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,r),p.unthrottled?(requestAnimationFrame(a),n!=null&&(clearInterval(n),n=null)):n==null&&(n=setInterval(a,50)))}}async function A(){f=(await d(()=>import("./index.15c6e2b7.js").then(function(t){return t.c}),["assets/index.15c6e2b7.js","assets/index.6cff6927.css","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.ded54c4a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.1879de79.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.8ce6f9b1.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.9c2dad53.js","assets/vue-toastification.4b5f8ac8.css"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(a):n=setInterval(a,50)}export{A as startGameLoop}; diff --git a/assets/index.8dbb25be.js b/assets/index.15c6e2b7.js similarity index 59% rename from assets/index.8dbb25be.js rename to assets/index.15c6e2b7.js index 1bc695b..b592392 100644 --- a/assets/index.8dbb25be.js +++ b/assets/index.15c6e2b7.js @@ -1,18 +1,18 @@ -/* empty css */import"./vue.c16a309b.js";import{_ as N,C as s,l as Fe,q as fn,t as z,b2 as vt,ab as J,aF as M,a1 as A,a2 as C,aL as Tt,G as Ne,aD as br,w as ht,b3 as It,a9 as p,O as re,ap as ta,az as gi,as as Ut,aH as ii,A as Te,$ as ne,b7 as Y,b9 as Oi,ar as Wt,bv as $n,a8 as P,bt as na,bc as zn,T as ia,u as qi,j as ra,bw as At,aM as kt,a0 as j,aO as Ke,J as de,I as Be,aI as gn,aG as mn,z as tn,bo as aa,bs as sa,aK as En,bd as ir,am as li,H as oa,bx as la,bf as ua}from"./@vue.6b211d3c.js";import{c as yr}from"./nanoevents.1080beb7.js";import{L as Kt}from"./lz-string.dccec454.js";import{Y as ca}from"./vue-next-select.ded54c4a.js";import{D as da}from"./vuedraggable.1879de79.js";import{p as pa}from"./vue-textarea-autosize.35804eaf.js";import{P as fa}from"./vue-panzoom.8ce6f9b1.js";import{s as ga,u as mi}from"./vue-toastification.9c2dad53.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";const ma=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}};ma();const va="modulepreload",rr={},ha="./",Gn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${ha}${i}`,i in rr)return;rr[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const u=document.createElement("link");if(u.rel=r?"stylesheet":va,r||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),r)return new Promise((l,c)=>{u.addEventListener("load",l),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},ba="./projInfo-schema.json",ya="Planar Pioneers",wa="A game about controlling and exploiting planes!",_a="planar-pioneers",Na="thepaperpilot",Ca="",ka="",Ma="0.0",Sa="Initial Commit",Ia=!1,xa=!1,$a=2,Ea=!0,Pa=null,Da="",Ta=["main"],Aa=3600,Ra=0,Fa=!0,Oa="base64";var we={$schema:ba,title:ya,description:wa,id:_a,author:Na,discordName:Ca,discordLink:ka,versionNumber:Ma,versionTitle:Sa,allowGoBack:Ia,defaultShowSmall:xa,defaultDecimalsShown:$a,useHeader:Ea,banner:Pa,logo:Da,initialTabs:Ta,maxTickLength:Aa,offlineLimit:Ra,enablePausing:Fa,exportEncoding:Oa};class qa{constructor(t){this.map=new Map,this.first=void 0,this.last=void 0,this.maxSize=t}get size(){return this.map.size}get(t){const n=this.map.get(t);if(n!==void 0)return n!==this.first&&(n===this.last?(this.last=n.prev,this.last.next=void 0):(n.prev.next=n.next,n.next.prev=n.prev),n.next=this.first,this.first.prev=n,this.first=n),n.value}set(t,n){if(this.maxSize<1)return;if(this.map.has(t))throw new Error("Cannot update existing keys in the cache");const i=new Va(t,n);for(this.first===void 0?(this.first=i,this.last=i):(i.next=this.first,this.first.prev=i,this.first=i),this.map.set(t,i);this.map.size>this.maxSize;){const r=this.last;this.map.delete(r.key),this.last=r.prev,this.last.next=void 0}}}class Va{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const $i=17,Ba=9e15,La=Math.log10(9e15),ja=1/9e15,za=308,Ga=-324,ar=5,Ua=(1<<10)-1,Wa=function(){const e=[];for(let n=Ga+1;n<=za;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),sn=[2,Math.E,3,4,5,6,7,8,9,10],Ha=[[1,1.0891180521811203,1.1789767925673957,1.2701455431742086,1.3632090180450092,1.4587818160364217,1.5575237916251419,1.6601571006859253,1.767485818836978,1.8804192098842727,2],[1,1.1121114330934079,1.231038924931609,1.3583836963111375,1.4960519303993531,1.6463542337511945,1.8121385357018724,1.996971324618307,2.2053895545527546,2.4432574483385254,Math.E],[1,1.1187738849693603,1.2464963939368214,1.38527004705667,1.5376664685821402,1.7068895236551784,1.897001227148399,2.1132403089001035,2.362480153784171,2.6539010333870774,3],[1,1.1367350847096405,1.2889510672956703,1.4606478703324786,1.6570295196661111,1.8850062585672889,2.1539465047453485,2.476829779693097,2.872061932789197,3.3664204535587183,4],[1,1.1494592900767588,1.319708228183931,1.5166291280087583,1.748171114438024,2.0253263297298045,2.3636668498288547,2.7858359149579424,3.3257226212448145,4.035730287722532,5],[1,1.159225940787673,1.343712473580932,1.5611293155111927,1.8221199554561318,2.14183924486326,2.542468319282638,3.0574682501653316,3.7390572020926873,4.6719550537360774,6],[1,1.1670905356972596,1.3632807444991446,1.5979222279405536,1.8842640123816674,2.2416069644878687,2.69893426559423,3.3012632110403577,4.121250340630164,5.281493033448316,7],[1,1.1736630594087796,1.379783782386201,1.6292821855668218,1.9378971836180754,2.3289975651071977,2.8384347394720835,3.5232708454565906,4.478242031114584,5.868592169644505,8],[1,1.1793017514670474,1.394054150657457,1.65664127441059,1.985170999970283,2.4069682290577457,2.9647310119960752,3.7278665320924946,4.814462547283592,6.436522247411611,9],[1,1.1840100246247336,1.4061375836156955,1.6802272208863964,2.026757028388619,2.4770056063449646,3.080525271755482,3.9191964192627284,5.135152840833187,6.989961179534715,10]],Ya=[[-1,-.9194161097107025,-.8335625019330468,-.7425599821143978,-.6466611521029437,-.5462617907227869,-.4419033816638769,-.3342645487554494,-.224140440909962,-.11241087890006762,0],[-1,-.90603157029014,-.80786507256596,-.7064666939634,-.60294836853664,-.49849837513117,-.39430303318768,-.29147201034755,-.19097820800866,-.09361896280296,0],[-1,-.9021579584316141,-.8005762598234203,-.6964780623319391,-.5911906810998454,-.486050182576545,-.3823089430815083,-.28106046722897615,-.1831906535795894,-.08935809204418144,0],[-1,-.8917227442365535,-.781258746326964,-.6705130326902455,-.5612813129406509,-.4551067709033134,-.35319256652135966,-.2563741554088552,-.1651412821106526,-.0796919581982668,0],[-1,-.8843387974366064,-.7678744063886243,-.6529563724510552,-.5415870994657841,-.4352842206588936,-.33504449124791424,-.24138853420685147,-.15445285440944467,-.07409659641336663,0],[-1,-.8786709358426346,-.7577735191184886,-.6399546189952064,-.527284921869926,-.4211627631006314,-.3223479611761232,-.23107655627789858,-.1472057700818259,-.07035171210706326,0],[-1,-.8740862815291583,-.7497032990976209,-.6297119746181752,-.5161838335958787,-.41036238255751956,-.31277212146489963,-.2233976621705518,-.1418697367979619,-.06762117662323441,0],[-1,-.8702632331800649,-.7430366914122081,-.6213373075161548,-.5072025698095242,-.40171437727184167,-.30517930701410456,-.21736343968190863,-.137710238299109,-.06550774483471955,0],[-1,-.8670016295947213,-.7373984232432306,-.6143173985094293,-.49973884395492807,-.394584953527678,-.2989649949848695,-.21245647317021688,-.13434688362382652,-.0638072667348083,0],[-1,-.8641642839543857,-.732534623168535,-.6083127477059322,-.4934049257184696,-.3885773075899922,-.29376029055315767,-.2083678561173622,-.13155653399373268,-.062401588652553186,0]];let k=function(t){return o.fromValue_noAlloc(t)},X=function(e,t,n){return o.fromComponents(e,t,n)},ie=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Xt=function(t,n){const i=n+1,r=Math.ceil(Math.log10(Math.abs(t))),a=Math.round(t*Math.pow(10,i-r))*Math.pow(10,r-i);return parseFloat(a.toFixed(Math.max(i-r,0)))},Ei=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Za=function(e){if(!isFinite(e))return e;if(e<-50)return e===Math.trunc(e)?Number.NEGATIVE_INFINITY:0;let t=1;for(;e<10;)t=t*e,++e;e-=1;let n=.9189385332046727;n=n+(e+.5)*Math.log(e),n=n-e;const i=e*e;let r=e;return n=n+1/(12*r),r=r*i,n=n+1/(360*r),r=r*i,n=n+1/(1260*r),r=r*i,n=n+1/(1680*r),r=r*i,n=n+1/(1188*r),r=r*i,n=n+691/(360360*r),r=r*i,n=n+7/(1092*r),r=r*i,n=n+3617/(122400*r),Math.exp(n)/t},wr=.5671432904097838,sr=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return wr;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let r=0;r<100;++r){if(i=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(i-n).5?1:-1;if(Math.random()*20<1)return ie(t,0,1);const n=Math.floor(Math.random()*(e+1));let i=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(i=Math.trunc(i));let r=Math.pow(10,i);return Math.random()>.9&&(r=Math.trunc(r)),X(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return w.floor(e.div(r).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,i){return t.mul(n.pow(i)).mul(w.sub(1,n.pow(e))).div(w.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),u=a.pow(2);return a.neg().add(u.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,i){const r=t.add(i.mul(n));return e.div(2).mul(r.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag=Ba)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=w.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const y=parseFloat(i[0]),_=parseFloat(i[1]),I=i[1].split(";");let D=1;if(I.length===2&&(D=parseFloat(I[1]),isFinite(D)||(D=1)),isFinite(y)&&isFinite(_)){const S=w.pentate(y,_,D);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const y=parseFloat(r[0]),_=parseFloat(r[1]),I=r[1].split(";");let D=1;if(I.length===2&&(D=parseFloat(I[1]),isFinite(D)||(D=1)),isFinite(y)&&isFinite(_)){const S=w.tetrate(y,_,D);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const y=parseFloat(a[0]),_=parseFloat(a[1]);if(isFinite(y)&&isFinite(_)){const I=w.pow(y,_);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}e=e.trim().toLowerCase();let u,l,c=e.split("pt");if(c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const _=w.tetrate(u,l,y);return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const _=w.tetrate(u,l,y);return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const d=e.split("e"),h=d.length-1;if(h===0){const y=parseFloat(e);if(isFinite(y))return this.fromNumber(y),w.fromStringCache.size>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else if(h===1){const y=parseFloat(e);if(isFinite(y)&&y!==0)return this.fromNumber(y),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}const f=e.split("e^");if(f.length===2){this.sign=1,f[0].charAt(0)=="-"&&(this.sign=-1);let y="";for(let _=0;_=43&&I<=57||I===101)y+=f[1].charAt(_);else return this.layer=parseFloat(y),this.mag=parseFloat(f[1].substr(_+1)),this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(h<1)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;const b=parseFloat(d[0]);if(b===0)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;let v=parseFloat(d[d.length-1]);if(h>=2){const y=parseFloat(d[d.length-2]);isFinite(y)&&(v*=Math.sign(y),v+=Ei(y))}if(!isFinite(b))this.sign=d[0]==="-"?-1:1,this.layer=h,this.mag=v;else if(h===1)this.sign=Math.sign(b),this.layer=1,this.mag=v+Math.log10(Math.abs(b));else if(this.sign=Math.sign(b),this.layer=h,h===2){const y=w.mul(X(1,2,v),k(b));return this.sign=y.sign,this.layer=y.layer,this.mag=y.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else this.mag=v;return this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}fromValue(e){return e instanceof w?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"?this.fromString(e):(this.sign=0,this.layer=0,this.mag=0,this)}toNumber(){return Number.isFinite(this.layer)?this.layer===0?this.sign*this.mag:this.layer===1?this.sign*Math.pow(10,this.mag):this.mag>0?this.sign>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:0:Number.NaN}mantissaWithDecimalPlaces(e){return isNaN(this.m)?Number.NaN:this.m===0?0:Xt(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Xt(this.mag,e)}toString(){return isNaN(this.layer)||isNaN(this.sign)||isNaN(this.mag)?"NaN":this.mag===Number.POSITIVE_INFINITY||this.layer===Number.POSITIVE_INFINITY?this.sign===1?"Infinity":"-Infinity":this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toString():this.m+"e"+this.e:this.layer===1?this.m+"e"+this.e:this.layer<=ar?(this.sign===-1?"-":"")+"e".repeat(this.layer)+this.mag:(this.sign===-1?"-":"")+"(e^"+this.layer+")"+this.mag}toExponential(e){return this.layer===0?(this.sign*this.mag).toExponential(e):this.toStringWithDecimalPlaces(e)}toFixed(e){return this.layer===0?(this.sign*this.mag).toFixed(e):this.toStringWithDecimalPlaces(e)}toPrecision(e){return this.e<=-7?this.toExponential(e-1):e>this.e?this.toFixed(e-this.exponent-1):this.toExponential(e-1)}valueOf(){return this.toString()}toJSON(){return this.toString()}toStringWithDecimalPlaces(e){return this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toFixed(e):Xt(this.m,e)+"e"+Xt(this.e,e):this.layer===1?Xt(this.m,e)+"e"+Xt(this.e,e):this.layer<=ar?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Xt(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Xt(this.mag,e)}abs(){return ie(this.sign===0?0:1,this.layer,this.mag)}neg(){return ie(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=k(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer)||this.sign===0)return t;if(t.sign===0)return this;if(this.sign===-t.sign&&this.layer===t.layer&&this.mag===t.mag)return ie(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(w.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return w.fromNumber(n.sign*n.mag+i.sign*i.mag);const r=n.layer*Math.sign(n.mag),a=i.layer*Math.sign(i.mag);if(r-a>=2)return n;if(r===0&&a===-1){if(Math.abs(i.mag-Math.log10(n.mag))>$i)return n;{const u=Math.pow(10,Math.log10(n.mag)-i.mag),l=i.sign+n.sign*u;return X(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>$i)return n;{const u=Math.pow(10,n.mag-Math.log10(i.mag)),l=i.sign+n.sign*u;return X(Math.sign(l),1,Math.log10(i.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-i.mag)>$i)return n;{const u=Math.pow(10,n.mag-i.mag),l=i.sign+n.sign*u;return X(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}plus(e){return this.add(e)}sub(e){return this.add(k(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=k(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return ie(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return ie(this.sign*t.sign,0,1);let n,i;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return w.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return X(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return X(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return X(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.mag)}throw Error("Bad arguments to mul: "+this+", "+e)}multiply(e){return this.mul(e)}times(e){return this.mul(e)}div(e){const t=k(e);return this.mul(t.recip())}divide(e){return this.div(e)}divideBy(e){return this.div(e)}dividedBy(e){return this.div(e)}recip(){return this.mag===0?w.dNaN:this.layer===0?X(this.sign,0,1/this.mag):X(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=k(e);return this.sign>t.sign?1:this.sign0?this.layer:-this.layer,i=t.mag>0?t.layer:-t.layer;return n>i?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)?0:this.cmp(n)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const n=k(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let i=this.mag,r=n.mag;return this.layer>n.layer&&(r=Ei(r)),this.layer0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?w.dNaN:this.layer>0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(this.sign,0,Math.log10(this.mag))}log(e){return e=k(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?w.dNaN:this.layer===0&&e.layer===0?X(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):w.div(this.log10(),e.log10())}log2(){return this.sign<=0?w.dNaN:this.layer===0?X(this.sign,0,Math.log2(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?w.dNaN:this.layer===0?X(this.sign,0,Math.log(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=k(e),n=this,i=t;if(n.sign===0)return i.eq(0)?ie(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return ie(1,0,1);if(i.sign===1&&i.layer===0&&i.mag===1)return n;const r=n.absLog10().mul(i).pow10();return this.sign===-1?Math.abs(i.toNumber()%2)%2===1?r.neg():Math.abs(i.toNumber()%2)%2===0?r:w.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return w.dNaN;let e=this;if(e.layer===0){const t=Math.pow(10,e.sign*e.mag);if(Number.isFinite(t)&&Math.abs(t)>=.1)return X(1,0,t);if(e.sign===0)return w.dOne;e=ie(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?X(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?X(-e.sign,e.layer+1,-e.mag):w.dOne}pow_base(e){return k(e).pow(this)}root(e){const t=k(e);return this.pow(t.recip())}factorial(){return this.mag<0?this.add(1).gamma():this.layer===0?this.add(1).gamma():this.layer===1?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(ie(1,0,24)))return w.fromNumber(Za(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let i=e,r=12*i,a=1/r,u=t+a;if(u===t||(t=u,i=i*n,r=360*i,a=1/r,u=t-a,u===t))return w.exp(t);t=u,i=i*n,r=1260*i;let l=1/r;return t=t+l,i=i*n,r=1680*i,l=1/r,t=t-l,w.exp(t)}else return this.layer===1?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?w.dOne:this.layer===0&&this.mag<=709.7?w.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?X(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?X(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):X(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return w.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return X(1,2,Math.log10(this.mag)-.3010299956639812);{const e=w.div(ie(this.sign,this.layer-1,this.mag),ie(1,0,2));return e.layer+=1,e.normalize(),e}}cube(){return this.pow(3)}cbrt(){return this.pow(1/3)}tetrate(e=2,t=ie(1,0,1)){if(e===1)return w.pow(this,t);if(e===0)return new w(t);if(this.eq(w.dOne))return w.dOne;if(this.eq(-1))return w.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return w.fromNumber(Math.E);const a=w.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?w.fromNumber(Number.POSITIVE_INFINITY):w.dNaN}if(this.eq(w.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),w.fromNumber(r)}if(e<0)return w.iteratedlog(t,this,-e);t=k(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(w.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r3)return ie(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=ie(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return w.tetrate(e,-t,this);e=k(e);let n=w.fromDecimal(this);const i=t;t=Math.trunc(t);const r=i-t;if(n.layer-e.layer>3){const a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a1e4)return n}return r>0&&r<1&&(e.eq(10)?n=n.layeradd10(-r):n=n.layeradd(-r,e)),n}slog(e=10,t=100){let n=.001,i=!1,r=!1,a=this.slog_internal(e).toNumber();for(let u=1;u1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return w.fromNumber(a)}slog_internal(e=10){if(e=k(e),e.lte(w.dZero)||e.eq(w.dOne))return w.dNaN;if(e.lt(w.dOne))return this.eq(w.dOne)?w.dZero:this.eq(w.dZero)?w.dNegOne:w.dNaN;if(this.mag<0||this.eq(w.dZero))return w.dNegOne;let t=0,n=w.fromDecimal(this);if(n.layer-e.layer>3){const i=n.layer-e.layer-3;t+=i,n.layer-=i}for(let i=0;i<100;++i)if(n.lt(w.dZero))n=w.pow(e,n),t-=1;else{if(n.lte(w.dOne))return w.fromNumber(t+w.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=w.log(n,e)}return w.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:w.critical_section(e,t,Ya)}static tetrate_critical(e,t){return w.critical_section(e,t,Ha)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let i=0,r=0;for(let u=0;ue){const l=(e-sn[u])/(sn[u+1]-sn[u]);i=n[u][Math.floor(t)]*(1-l)+n[u+1][Math.floor(t)]*l,r=n[u][Math.ceil(t)]*(1-l)+n[u+1][Math.ceil(t)]*l;break}const a=t-Math.floor(t);return i<=0||r<=0?i*(1-a)+r*a:Math.pow(e,Math.log(i)/Math.log(e)*(1-a)+Math.log(r)/Math.log(e)*a)}layeradd10(e){e=w.fromValue_noAlloc(e).toNumber();const t=w.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let i=0;i<100;++i){if(t.layer++,t.mag=Math.log10(t.mag),!isFinite(t.mag))return t.sign===0&&(t.sign=1),t.layer<0&&(t.layer=0),t.normalize();if(t.layer>=0)break}}for(;t.layer<0;)t.layer++,t.mag=Math.log10(t.mag);return t.sign===0&&(t.sign=1,t.mag===0&&t.layer>=1&&(t.layer-=1,t.mag=1)),t.normalize(),e!==0?t.layeradd(e,10):t}layeradd(e,t){const i=this.slog(t).toNumber()+e;return i>=0?w.tetrate(t,i):Number.isFinite(i)?i>=-1?w.log(w.tetrate(t,i+1),t):w.log(w.log(w.tetrate(t,i+2),t),t):w.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return w.fromNumber(sr(this.toNumber()));if(this.layer===0)return w.fromNumber(sr(this.sign*this.mag));if(this.layer===1)return or(this);if(this.layer===2)return or(this);if(this.layer>=3)return ie(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return ie(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=ie(1,0,1)){t=k(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(w.dOne)?(++e,t=w.fromNumber(i)):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r10)return t}return t}sin(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.sin(this.sign*this.mag)):ie(0,0,0)}cos(){return this.mag<0?w.dOne:this.layer===0?w.fromNumber(Math.cos(this.sign*this.mag)):ie(0,0,0)}tan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.tan(this.sign*this.mag)):ie(0,0,0)}asin(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.asin(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?w.fromNumber(Math.acos(this.toNumber())):this.layer===0?w.fromNumber(Math.acos(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.atan(this.sign*this.mag)):w.fromNumber(Math.atan(this.sign*(1/0)))}sinh(){return this.exp().sub(this.negate().exp()).div(2)}cosh(){return this.exp().add(this.negate().exp()).div(2)}tanh(){return this.sinh().div(this.cosh())}asinh(){return w.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return w.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?ie(Number.NaN,Number.NaN,Number.NaN):w.ln(this.add(1).div(w.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(w.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let o=w;o.fromStringCache=new qa(Ua);o.dZero=ie(0,0,0);o.dOne=ie(1,0,1);o.dNegOne=ie(-1,0,1);o.dTwo=ie(1,0,2);o.dTen=ie(1,0,10);o.dNaN=ie(Number.NaN,Number.NaN,Number.NaN);o.dInf=ie(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=ie(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=X(1,0,Number.MAX_VALUE);o.dNumberMin=X(1,0,Number.MIN_VALUE);k=o.fromValue_noAlloc;X=o.fromComponents;ie=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const Xa=new o(1);function Vn(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=Xa,i=i.add(1));const a=i.gte(1e9)?bt(i,Math.max(Math.max(t,3),we.defaultDecimalsShown)):i.gte(1e4)?ui(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function ui(e,t){if(e==null)return"NaN";if(e=new o(e),e.mag<.001)return 0 .toFixed(t);const i=e.toStringWithDecimalPlaces(t).split(".");return i[0]=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),i.length==1?i[0]:i[0]+"."+i[1]}function _r(e,t){return e==null?"NaN":(e=new o(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),we.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Ja=new o("eeee1000"),Ka=new o("e100000"),lr=new o("e1000"),Nr=new o(1e9),Qa=new o(1e6),es=new o(1e3),ts=new o(.98),ns=new o(.001),Cr=new o(0);function bt(e,t,n){if(t==null&&(t=we.defaultDecimalsShown),n=n!=null?n:we.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+bt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Ja)){const i=e.slog();return i.gte(Qa)?"F"+bt(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+ui(i.floor(),0)}else{if(e.gte(Ka))return Vn(e,0,!1);if(e.gte(lr))return Vn(e,0);if(e.gte(Nr))return Vn(e,t);if(e.gte(es))return ui(e,0);if(e.gte(ns)||!n)return _r(e,t);if(e.eq(Cr))return 0 .toFixed(t)}return e=Mr(e),e.lt(lr)?Vn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):bt(e,t)+"\u207B\xB9"}function We(e){return e=new o(e),e.sign<0?"-"+We(e.neg()):e.gte(Nr)||e.lte(ts)&&!e.eq(Cr)?bt(e):bt(e,0)}function kr(e){return o.lt(e,0)?"-"+kr(o.neg(e)):o.gt(e,2**51)?bt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?bt(e)+"s":e<3600?We(Math.floor(e/60))+"m "+bt(e%60)+"s":e<86400?We(Math.floor(e/3600))+"h "+We(Math.floor(e/60)%60)+"m "+We(e%60)+"s":e<31536e3?We(Math.floor(e/84600)%365)+"d "+We(Math.floor(e/3600)%24)+"h "+We(Math.floor(e/60)%60)+"m":We(Math.floor(e/31536e3))+"y "+We(Math.floor(e/84600)%365)+"d "+We(Math.floor(e/3600)%24)+"h")}function is(e,t,n){e=new o(e);let i=e.toStringWithDecimalPlaces(t);return new o(i).gte(n)&&(i=o.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),i}function rs(e,t){return bt(e,t,!0)}function Mr(e){let t=o.log10(e).ceil();const n=o.div(e,o.pow(10,t));return t=t.neg(),e=new o(10).pow(t).times(n),e}var as=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Vn,commaFormat:ui,regularFormat:_r,format:bt,formatWhole:We,formatTime:kr,toPlaces:is,formatSmall:rs,invertOOM:Mr},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Vi,commaFormat:ss,regularFormat:os,format:xe,formatWhole:dt,formatTime:vi,toPlaces:ls,formatSmall:Gt,invertOOM:us}=as;window.Decimal=o;window.exponentialFormat=Vi;window.commaFormat=ss;window.regularFormat=os;window.format=xe;window.formatWhole=dt;window.formatTime=vi;window.toPlaces=ls;window.formatSmall=Gt;window.invertOOM=us;function at(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Un(e){return typeof e=="function"}var W=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(W||{});const Wn=Symbol("DoNotCache");function $(e,t){const n=e[t];Un(n)&&n.length===0&&!n[Wn]?e[t]=N(n.bind(e)):Un(n)&&(e[t]=n.bind(e),e[t][Wn]=!0)}function _e(e){return Un(e)&&!e[Wn]&&(e=N(e)),e}const yt=Symbol("Component"),pt=Symbol("GatherProps");let cs=0;function rn(e="feature-"){return e+cs++}var Me=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Me||{});function He(e){const t=s(e);return t!==2&&t!==!1}function vn(e){return s(e)===1}function Z(e){return e[Wn]=!0,e}function oe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Hn(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const u=r[a];u!=null&&typeof u=="object"&&(t.includes(u.type)?n.push(u):!(u instanceof o)&&!Fe(u)&&i(u))})};return i(e),n}const on={variables:{"--foreground":"#dfdfdf","--background":"#0f0f0f","--feature-foreground":"#0f0f0f","--tooltip-background":"rgba(0, 0, 0, 0.75)","--raised-background":"#0f0f0f","--points":"#ffffff","--locked":"#bf8f8f","--highlighted":"#333","--bought":"#77bf5f","--danger":"rgb(220, 53, 69)","--link":"#02f2f2","--outline":"#dfdfdf","--accent1":"#627a82","--accent2":"#658262","--accent3":"#7c6282","--border-radius":"15px","--modal-border":"solid 2px var(--color)","--feature-margin":"0px"},floatingTabs:!0,mergeAdjacent:!0,showPin:!0};var Bi=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Bi||{}),Nt={classic:on,paper:{...on,variables:{...on.variables,"--background":"#2a323d","--feature-foreground":"#000","--raised-background":"#333c4a","--locked":"#3a3e45","--bought":"#5C8A58","--outline":"#333c4a","--border-radius":"4px","--modal-border":"","--feature-margin":"5px"},floatingTabs:!1},nordic:{...on,variables:{...on.variables,"--foreground":"#D8DEE9","--background":"#2E3440","--feature-foreground":"#000","--raised-background":"#3B4252","--points":"#E5E9F0","--locked":"#4c566a","--highlighted":"#434c5e","--bought":"#8FBCBB","--danger":"#D08770","--link":"#88C0D0","--outline":"#3B4252","--accent1":"#B48EAD","--accent2":"#A3BE8C","--accent3":"#EBCB8B","--border-radius":"4px","--modal-border":"solid 2px #3B4252","--feature-margin":"5px"},floatingTabs:!1},aqua:{...on,variables:{...on.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Qe=yr();"fonts"in document&&(document.fonts.onloadingdone=()=>Qe.emit("fontsLoaded"));var ds=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Qe},Symbol.toStringTag,{value:"Module"}));const ps=fn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Q=window.player=ps;function Sr(e){return JSON.stringify(e,(t,n)=>s(n))}function Ir(e={}){return Object.assign({id:`${we.id}-0`,name:"Default Save",tabs:we.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:we.id,modVersion:we.versionNumber,layers:{}},e)}function mt(e){const t=Kt.compressToUTF16(Sr(e!=null?e:Q));return localStorage.setItem((e!=null?e:Q).id,t),t}async function fs(){vs();try{let e=localStorage.getItem(ce.active);if(e==null){await cn(xn());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==we.id){await cn(xn());return}t.id=ce.active,await cn(t)}catch(e){console.error(`Failed to load save. Falling back to new save. -`,e),await cn(xn())}}function xn(){const e=oi(),t=Ir({id:e});return mt(t),ce.saves.push(e),t}function oi(){let e,t=0;do e=`${we.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const gs=z(!1);async function cn(e){console.info("Loading save",e),gs.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await Gn(()=>Promise.resolve().then(function(){return pl}),void 0),{fixOldSave:r,getInitialLayers:a}=await Gn(()=>Promise.resolve().then(function(){return vp}),void 0);for(const u in t){const l=t[u];l&&n(l)}a(e).forEach(u=>i(u,e)),e=Ir(e),e.offlineProd&&e.time!=null&&e.time&&e.devSpeed!==0&&(e.offlineTime==null&&(e.offlineTime=0),e.offlineTime+=Math.min(e.offlineTime+(Date.now()-e.time)/1e3,we.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==we.versionNumber&&(r(e.modVersion,e),e.modVersion=we.versionNumber),Object.assign(Q,e),ce.active=Q.id,Qe.emit("onLoad")}setInterval(()=>{Q.autosave&&mt()},1e3);window.onbeforeunload=()=>{Q.autosave&&mt()};window.save=mt;const ms=window.hardReset=async()=>{await cn(xn())};window.deleteLowerSaves=()=>{const e=Object.values(ce.saves).indexOf(Q.id)+1;Object.values(ce.saves).slice(e).forEach(t=>localStorage.removeItem(t)),ce.saves=ce.saves.slice(0,e)};const Yn=fn({active:"",saves:[],showTPS:!0,theme:Bi.Nordic,unthrottled:!1,alignUnits:!1});vt(Yn,e=>{const t=Kt.compressToUTF16(JSON.stringify(e));localStorage.setItem(we.id,t)},{deep:!0});var ce=window.settings=Yn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Bi.Nordic,alignUnits:!1};Qe.emit("loadSettings",e),Object.assign(Yn,e),ms()};function vs(){try{let e=localStorage.getItem(we.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Yn,t)}Qe.emit("loadSettings",Yn)}catch{}}const xr=fn([]);function hs(e){xr.push(e)}const bs=fn([]),ys=fn([]),ws={class:"table"},_s=J({__name:"Column",setup(e){const t=N(()=>Nt[ce.theme].mergeAdjacent);return(n,i)=>(M(),A("div",ws,[C("div",{class:Ne(["col",{mergeAdjacent:s(t)}])},[Tt(n.$slots,"default")],2)]))}}),Ns={class:"table"},Cs=J({__name:"Row",setup(e){const t=N(()=>Nt[ce.theme].mergeAdjacent);return(n,i)=>(M(),A("div",Ns,[C("div",{class:Ne(["row",{mergeAdjacent:s(t)}])},[Tt(n.$slots,"default")],2)]))}});function $r(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ta(e)}function pe(e,t="span"){return typeof e=="function"?J({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}`),J({template:e})):J({render:()=>({})}):e}function ot(e){if(xt(e))return typeof e=="function"?e():pe(e);const t=e[yt];return p(t,e[pt](),null)}function Pi(...e){let t;return p(Cs,null,$r(t=e.map(ot))?t:{default:()=>[t]})}function ks(...e){let t;return p(_s,null,$r(t=e.map(ot))?t:{default:()=>[t]})}function Ct(e){if(xt(e))return typeof e=="function"?e():typeof e=="string"?p(re,null,[e]):p(e,null,null);const t=e[yt];return p(t,e[pt](),null)}function ur(e,t){return e.reduce((n,i)=>p(re,null,[n,t,i]))}function xt(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Wn]===!0}function Er(e,t){const n=z(null),i=z(void 0);function r(l){n.value||(n.value=setInterval(u,250)),i.value=l}function a(){n.value&&(clearInterval(n.value),n.value=null)}function u(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return br(a),{start:r,stop:a,handleHolding:u}}function Pr(e,t="div"){const n=ht();return It(()=>{n.value=pe(Ee(e),t)}),n}function Dn(e,t="div"){const n=ht(null);return It(()=>{const i=Ee(e);n.value=i==""||i==null?null:pe(i,t)}),n}function Ee(e){return s(s(e))}function q(...e){return e.includes(Object)||e.push(Object),e}function cr(e){const t=z(!1),n=e[pt].bind(e);return e[pt]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var ve=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const Ms=J({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=z({}),i=new ResizeObserver(l),r=z(null);gi(()=>{const f=r.value;f!=null&&i.observe(f)});let a=!0,u=z((h=r.value)==null?void 0:h.getBoundingClientRect());function l(){a&&(a=!1,Ut(()=>{var f;u.value=(f=r.value)==null?void 0:f.getBoundingClientRect(),Object.values(n.value).filter(b=>b).forEach(b=>b.rect=b.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}Qe.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};ii(Li,(f,b)=>{const v=new MutationObserver(()=>d(f));v.observe(b,c),n.value[f]={element:b,observer:v,rect:b.getBoundingClientRect()},l()}),ii(ji,f=>{var b;(b=n.value[f])==null||b.observer.disconnect(),n.value[f]=void 0,l()}),ii(zi,n),ii(Gi,u);function d(f){const b=n.value[f];b!=null&&(b.rect=b.element.getBoundingClientRect(),t("updateNodes",n.value))}return(f,b)=>(M(),A(re,null,[Tt(f.$slots,"default",{},void 0,!0),C("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Dr=ve(Ms,[["__scopeId","data-v-2b1dc1bc"]]);const Ss=["onPointerdown"],Is={class:"modal-wrapper"},xs={class:"modal-container"},$s={class:"modal-header"},Es={class:"modal-body"},Ps={class:"modal-footer"},Ds=C("div",{class:"modal-default-flex-grow"},null,-1),Rt=J({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=Te(e),a=N(()=>s(r.modelValue)||l.value);function u(){n("update:modelValue",!1)}const l=z(!1),c=z(null),d=N(()=>{var h,f;return(f=(h=c.value)==null?void 0:h.nodes)!=null?f:null});return t({isOpen:a,nodes:d}),(h,f)=>(M(),ne(ia,{to:"#modal-root"},[p(zn,{name:"modal",onBeforeEnter:f[0]||(f[0]=b=>l.value=!0),onAfterLeave:f[1]||(f[1]=b=>l.value=!1)},{default:Y(()=>[Oi(C("div",Wt({class:"modal-mask",onPointerdown:$n(u,["self"])},h.$attrs),[C("div",Is,[C("div",xs,[C("div",$s,[Tt(h.$slots,"header",{shown:s(a)},()=>[P(" default header ")])]),C("div",Es,[p(Dr,{ref_key:"contextRef",ref:c},{default:Y(()=>[Tt(h.$slots,"body",{shown:s(a)},()=>[P(" default body ")])]),_:3},512)]),C("div",Ps,[Tt(h.$slots,"footer",{shown:s(a)},()=>[C("div",{class:"modal-default-footer"},[Ds,C("button",{class:"button modal-default-button",onClick:u}," Close ")])])])])])],16,Ss),[[na,e.modelValue]])]),_:3})]))}}),Jt=Symbol("ProxyState");function et(e,t={}){const n=t;let i=!1;function r(){return i||(Object.assign(n,e.call(n,n)),i=!0),n}return new Proxy(n,{get(a,u){if(u===Jt)return r();const l=r()[u];return l!=null&&typeof l=="object"&&Dt in l?l[Dt]:l},set(a,u,l){return r()[u]=l,!0},has(a,u){return u===Jt?!0:Reflect.has(r(),u)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,u){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,u)}})}var Ue=window.state=qi({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const Tr=o.ln(10);function Bn(e){return e}function Ts(e,t){if(O(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function As(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return g.neg(t.getIntegralFormula(e))}throw new Error("Could not integrate due to no input being a variable")}function Rs(e){return g.neg(e)}function Fs(e,t,n){if(O(t))return t.invert(o.sub(e,Se(n)));if(O(n))return n.invert(o.sub(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function Os(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.times(n,(i=t.innermostVariable)!=null?i:0).add(a)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).add(a)}throw new Error("Could not integrate due to no input being a variable")}function qs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.add(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Vs(e,t,n){if(O(t))return t.invert(o.add(e,Se(n)));if(O(n))return n.invert(o.sub(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function Bs(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.sub(a,g.times(n,(i=t.innermostVariable)!=null?i:0))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).sub(a)}throw new Error("Could not integrate due to no input being a variable")}function Ls(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.sub(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function js(e,t,n){if(O(t))return t.invert(o.div(e,Se(n)));if(O(n))return n.invert(o.div(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function zs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.times(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Gs(e,t,n){if(O(t))return g.div(e,n);if(O(n))return g.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Us(e,t,n){if(O(t))return t.invert(o.mul(e,Se(n)));if(O(n))return n.invert(o.div(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function Ws(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.div(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function Hs(e,t,n){if(O(t))return g.mul(e,n);if(O(n))return g.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Ys(e,t){if(O(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Zs(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Xs(e,t){if(O(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Js(e){return o.ln(e).sub(1).times(e).div(Tr)}function Ks(e,t){if(O(t)){const n=Tr.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function Qs(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:Js,invert:Ks})}throw new Error("Could not integrate due to no input being a variable")}function eo(e,t,n){if(O(t))return t.invert(o.pow(Se(n),e));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function to(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function no(e,t,n){if(O(t)){const i=o.ln(Se(n)).times(e);return t.invert(i.div(i.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function io(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e),n],evaluate:to,invert:no})}throw new Error("Could not integrate due to no input being a variable")}function ro(e,t){if(O(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function ao(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function so(e,t){if(O(t)){const n=o.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function oo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:ao,invert:so})}throw new Error("Could not integrate due to no input being a variable")}function lo(e,t){if(O(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function uo(e){return o.ln(e).sub(1).times(e)}function co(e,t){if(O(t))return t.invert(o.div(e,o.div(e,Math.E).lambertw()));throw new Error("Could not invert due to no input being a variable")}function po(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:uo,invert:co})}throw new Error("Could not integrate due to no input being a variable")}function fo(e,t,n){if(O(t))return t.invert(o.root(e,Se(n)));if(O(n))return n.invert(o.ln(e).div(o.ln(Se(t))));throw new Error("Could not invert due to no input being a variable")}function go(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=g.add(n,1);return g.pow(i,r).div(r)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.pow(t,i).div(g.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function mo(e,t){if(O(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function vo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.pow10(n).div(g.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function ho(e,t,n){if(O(t))return t.invert(o.ln(e).div(o.ln(Se(n))));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function bo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(n,i).div(g.ln(n))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=g.add(t,1);return g.pow(i,r).div(r)}throw new Error("Could not integrate due to no input being a variable")}function yo(e,t,n){if(O(t))return t.invert(o.root(e,o.recip(Se(n))));if(O(n))return n.invert(o.ln(Se(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function wo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(i,g.recip(n).add(1)).times(n).div(g.add(n,1))}throw new Error("Could not integrate due to no input being a variable")}function _o(e,t){if(O(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function No(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function Co(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function ko(e,t,n,i){if(O(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function Mo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.iteratedexp(e,i,new o(n))}function So(e,t,n,i){if(O(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Io(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function xo(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function $o(e,t,n){if(O(t))return t.invert(o.tetrate(e,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Eo(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function Po(e,t,n,i){if(O(t))return t.invert(o.layeradd(e,o.minabs(1e308,Se(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function Do(e,t){if(O(t))return t.invert(o.pow(Math.E,e).times(e));throw new Error("Could not invert due to no input being a variable")}function To(e,t){if(O(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function Ao(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function Ro(e,t){if(O(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function Fo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function Oo(e,t){if(O(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function qo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function Vo(e,t){if(O(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function Bo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function Lo(e,t){if(O(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function jo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asin(n).times(n).add(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function zo(e,t){if(O(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function Go(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acos(n).times(n).sub(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Uo(e,t){if(O(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function Wo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atan(n).times(n).sub(g.ln(g.pow(n,2).add(1)).div(2))}throw new Error("Could not integrate due to no input being a variable")}function Ho(e,t){if(O(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Yo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function Zo(e,t){if(O(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Xo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Jo(e,t){if(O(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function Ko(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function Qo(e,t){if(O(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function el(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asinh(n).times(n).sub(g.pow(n,2).add(1).sqrt())}throw new Error("Could not integrate due to no input being a variable")}function tl(e,t){if(O(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function nl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acosh(n).times(n).sub(g.add(n,1).sqrt().times(g.sub(n,1).sqrt()))}throw new Error("Could not integrate due to no input being a variable")}function il(e,t){if(O(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function rl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atanh(n).times(n).add(g.sub(1,g.pow(n,2)).ln().div(2))}throw new Error("Could not integrate due to no input being a variable")}function Tn(e){return(t,n)=>new g({inputs:[t,n],evaluate:e,invert:Bn})}function O(e){return e instanceof Pe&&e.hasVariable()}function Se(e,t){return e instanceof Pe?e.evaluate(t):s(e)}function al(){return g.pow(this,2).div(2)}function sl(){return this}const Oe=class{constructor(e){this.negate=this.neg,this.negated=this.neg,this.sgn=this.sign,this.plus=this.add,this.subtract=this.sub,this.minus=this.sub,this.multiply=this.mul,this.times=this.mul,this.divide=this.div,this.divideBy=this.div,this.dividedBy=this.div,this.reciprocal=this.recip,this.reciprocate=this.recip,this.logarithm=this.log;let t;"inputs"in e&&(e.inputs=e.inputs.map(n=>typeof n=="object"&&Dt in n?n[Dt]:n)),"variable"in e?(typeof e.variable=="object"&&Dt in e.variable&&(e.variable=e.variable[Dt]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:al,internalIntegrateInner:sl,applySubstitution:Bn}}setupConstant({inputs:e}){if(e.length!==1)throw new Error("Evaluate function is required if inputs is not length 1");return{inputs:e,internalVariables:0}}setupFormula(e){var b,v;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:u}=e,l=t.reduce((y,_)=>y+(_ instanceof Oe?_.internalVariables:0),0),c=t.find(y=>y instanceof Oe&&y.hasVariable()),d=l===1?c==null?void 0:c.innermostVariable:void 0,h=(b=c==null?void 0:c.isInvertible())!=null?b:!1,f=(v=c==null?void 0:c.isIntegrable())!=null?v:!1;return{inputs:t,internalEvaluate:n,internalInvert:h?i:void 0,internalIntegrate:f?r:void 0,internalIntegrateInner:a,applySubstitution:u,innermostVariable:d,internalVariables:l}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,i;return(i=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(r=>Se(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:Se(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Oe&&e.inputs[n]instanceof Oe?t.equals(e.inputs[n]):!(t instanceof Oe)&&!(e.inputs[n]instanceof Oe)&&o.eq(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new g({inputs:[e]})}static variable(e){return new g({variable:e})}static step(e,t,n){const i=n(g.variable(0)),r=_e(t);function a(l){return o.lt(l,s(r))?l:o.add(i.evaluate(o.sub(l,s(r))),s(r))}function u(l,c){if(O(c)&&i.isInvertible())return o.gt(l,s(r))&&(l=o.add(i.invert(o.sub(l,s(r))),s(r))),c.invert(l);throw new Error("Could not invert due to no input being a variable")}return new g({inputs:[e],evaluate:a,invert:i.isInvertible()&&i.hasVariable()?u:void 0})}static if(e,t,n,i){const r=z(0),a=g.variable(r),u=n(a),l=i==null?void 0:i(a),c=_e(t);function d(f){return s(c)?(r.value=f,u.evaluate()):l?(r.value=f,l.evaluate()):f}function h(f,b){if(!O(b)||!u.isInvertible()||l!=null&&!l.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?b.invert(u.invert(f)):l?b.invert(l.invert(f)):b.invert(f)}return new g({inputs:[e],evaluate:d,invert:u.isInvertible()&&u.hasVariable()?h:void 0})}static conditional(e,t,n,i){return g.if(e,t,n,i)}static abs(e){return new g({inputs:[e],evaluate:o.abs})}static neg(e){return new g({inputs:[e],evaluate:o.neg,invert:Ts,applySubstitution:Rs,integrate:As})}static sign(e){return new g({inputs:[e],evaluate:o.sign})}static round(e){return new g({inputs:[e],evaluate:o.round})}static floor(e){return new g({inputs:[e],evaluate:o.floor})}static ceil(e){return new g({inputs:[e],evaluate:o.ceil})}static trunc(e){return new g({inputs:[e],evaluate:o.trunc})}static add(e,t){return new g({inputs:[e,t],evaluate:o.add,invert:Fs,integrate:Os,integrateInner:qs,applySubstitution:Bn})}static sub(e,t){return new g({inputs:[e,t],evaluate:o.sub,invert:Vs,integrate:Bs,integrateInner:Ls,applySubstitution:Bn})}static mul(e,t){return new g({inputs:[e,t],evaluate:o.mul,invert:js,integrate:zs,applySubstitution:Gs})}static div(e,t){return new g({inputs:[e,t],evaluate:o.div,invert:Us,integrate:Ws,applySubstitution:Hs})}static recip(e){return new g({inputs:[e],evaluate:o.recip,invert:Ys,integrate:Zs})}static clamp(e,t,n){return new g({inputs:[e,t,n],evaluate:o.clamp,invert:Bn})}static pLog10(e){return new g({inputs:[e],evaluate:o.pLog10})}static absLog10(e){return new g({inputs:[e],evaluate:o.absLog10})}static log10(e){return new g({inputs:[e],evaluate:o.log10,invert:Xs,integrate:Qs})}static log(e,t){return new g({inputs:[e,t],evaluate:o.log,invert:eo,integrate:io})}static log2(e){return new g({inputs:[e],evaluate:o.log2,invert:ro,integrate:oo})}static ln(e){return new g({inputs:[e],evaluate:o.ln,invert:lo,integrate:po})}static pow(e,t){return new g({inputs:[e,t],evaluate:o.pow,invert:fo,integrate:go})}static pow10(e){return new g({inputs:[e],evaluate:o.pow10,invert:mo,integrate:vo})}static pow_base(e,t){return new g({inputs:[e,t],evaluate:o.pow_base,invert:ho,integrate:bo})}static root(e,t){return new g({inputs:[e,t],evaluate:o.root,invert:yo,integrate:wo})}static factorial(e){return new g({inputs:[e],evaluate:o.factorial})}static gamma(e){return new g({inputs:[e],evaluate:o.gamma})}static lngamma(e){return new g({inputs:[e],evaluate:o.lngamma})}static exp(e){return new g({inputs:[e],evaluate:o.exp,invert:_o,integrate:No})}static sqr(e){return g.pow(e,2)}static sqrt(e){return g.root(e,2)}static cube(e){return g.pow(e,3)}static cbrt(e){return g.root(e,3)}static tetrate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Co,invert:ko})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Mo,invert:So})}static iteratedlog(e,t=10,n=1){return new g({inputs:[e,t,n],evaluate:Io})}static slog(e,t=10){return new g({inputs:[e,t],evaluate:xo,invert:$o})}static layeradd10(e,t){return new g({inputs:[e,t],evaluate:o.layeradd10})}static layeradd(e,t,n=10){return new g({inputs:[e,t,n],evaluate:Eo,invert:Po})}static lambertw(e){return new g({inputs:[e],evaluate:o.lambertw,invert:Do})}static ssqrt(e){return new g({inputs:[e],evaluate:o.ssqrt,invert:To})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Ao})}static sin(e){return new g({inputs:[e],evaluate:o.sin,invert:Lo,integrate:Fo})}static cos(e){return new g({inputs:[e],evaluate:o.cos,invert:zo,integrate:qo})}static tan(e){return new g({inputs:[e],evaluate:o.tan,invert:Uo,integrate:Bo})}static asin(e){return new g({inputs:[e],evaluate:o.asin,invert:Ro,integrate:jo})}static acos(e){return new g({inputs:[e],evaluate:o.acos,invert:Oo,integrate:Go})}static atan(e){return new g({inputs:[e],evaluate:o.atan,invert:Vo,integrate:Wo})}static sinh(e){return new g({inputs:[e],evaluate:o.sinh,invert:Qo,integrate:Yo})}static cosh(e){return new g({inputs:[e],evaluate:o.cosh,invert:tl,integrate:Xo})}static tanh(e){return new g({inputs:[e],evaluate:o.tanh,invert:il,integrate:Ko})}static asinh(e){return new g({inputs:[e],evaluate:o.asinh,invert:Ho,integrate:el})}static acosh(e){return new g({inputs:[e],evaluate:o.acosh,invert:Zo,integrate:nl})}static atanh(e){return new g({inputs:[e],evaluate:o.atanh,invert:Jo,integrate:rl})}step(e,t){return g.step(this,e,t)}if(e,t){return g.if(this,e,t)}conditional(e,t){return g.if(this,e,t)}abs(){return g.abs(this)}neg(){return g.neg(this)}sign(){return g.sign(this)}round(){return g.round(this)}floor(){return g.floor(this)}ceil(){return g.ceil(this)}trunc(){return g.trunc(this)}add(e){return g.add(this,e)}sub(e){return g.sub(this,e)}mul(e){return g.mul(this,e)}div(e){return g.div(this,e)}recip(){return g.recip(this)}max(e){return g.max(this,e)}min(e){return g.min(this,e)}maxabs(e){return g.maxabs(this,e)}minabs(e){return g.minabs(this,e)}clamp(e,t){return g.clamp(this,e,t)}clampMin(e){return g.clampMin(this,e)}clampMax(e){return g.clampMax(this,e)}pLog10(){return g.pLog10(this)}absLog10(){return g.absLog10(this)}log10(){return g.log10(this)}log(e){return g.log(this,e)}log2(){return g.log2(this)}ln(){return g.ln(this)}pow(e){return g.pow(this,e)}pow10(){return g.pow10(this)}pow_base(e){return g.pow_base(this,e)}root(e){return g.root(this,e)}factorial(){return g.factorial(this)}gamma(){return g.gamma(this)}lngamma(){return g.lngamma(this)}exp(){return g.exp(this)}sqr(){return g.pow(this,2)}sqrt(){return g.root(this,2)}cube(){return g.pow(this,3)}cbrt(){return g.root(this,3)}tetrate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.tetrate(this,e,t)}iteratedexp(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return g.iteratedlog(this,e,t)}slog(e=10){return g.slog(this,e)}layeradd10(e){return g.layeradd10(this,e)}layeradd(e,t){return g.layeradd(this,e,t)}lambertw(){return g.lambertw(this)}ssqrt(){return g.ssqrt(this)}pentate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.pentate(this,e,t)}sin(){return g.sin(this)}cos(){return g.cos(this)}tan(){return g.tan(this)}asin(){return g.asin(this)}acos(){return g.acos(this)}atan(){return g.atan(this)}sinh(){return g.sinh(this)}cosh(){return g.cosh(this)}tanh(){return g.tanh(this)}asinh(){return g.asinh(this)}acosh(){return g.acosh(this)}atanh(){return g.atanh(this)}};let Pe=Oe;Pe.negate=Oe.neg;Pe.negated=Oe.neg;Pe.sgn=Oe.sign;Pe.plus=Oe.add;Pe.subtract=Oe.sub;Pe.minus=Oe.sub;Pe.multiply=Oe.mul;Pe.times=Oe.mul;Pe.divide=Oe.div;Pe.divideBy=Oe.div;Pe.dividedBy=Oe.div;Pe.reciprocal=Oe.recip;Pe.reciprocate=Oe.recip;Pe.max=Tn(o.max);Pe.min=Tn(o.min);Pe.minabs=Tn(o.minabs);Pe.maxabs=Tn(o.maxabs);Pe.clampMin=Tn(o.clampMin);Pe.clampMax=Tn(o.clampMax);Pe.logarithm=Oe.log;class g extends Pe{invert(t){if(this.internalInvert&&this.hasVariable())return this.internalInvert.call(this,t,...this.inputs);if(this.inputs.length===1&&this.hasVariable())return t;throw new Error("Cannot invert non-invertible formula")}evaluateIntegral(t){if(!this.isIntegrable())throw new Error("Cannot evaluate integral of formula without integral");return this.getIntegralFormula().evaluate(t)}invertIntegral(t){if(!this.isIntegrable()||!this.getIntegralFormula().isInvertible())throw new Error("Cannot invert integral of formula without invertible integral");return this.getIntegralFormula().invert(t)}calculateConstantOfIntegration(){const t=this.getIntegralFormula().evaluate(1),n=o.add(this.evaluate(0),this.evaluate(1)).div(2);return o.sub(n,t)}getIntegralFormula(t){if(this.integralFormula!=null&&t==null)return this.integralFormula;if(t==null){if(this.applySubstitution==null){if(t=[],this.internalIntegrate==null)throw new Error("Cannot integrate formula with non-integrable operation");let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(i=>n=i(n)),this.integralFormula=n}else if(this.internalIntegrate)this.integralFormula=this.internalIntegrate.call(this,void 0,...this.inputs);else if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())this.integralFormula=this;else throw new Error("Cannot integrate formula without variable");return this.integralFormula}else{if(this.applySubstitution==null)throw new Error("Cannot have two complex operations in an integrable formula");if(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner)return this.internalIntegrateInner.call(this,t,...this.inputs);if(this.internalIntegrate)return this.internalIntegrate.call(this,t,...this.inputs);if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())return this;throw new Error("Cannot integrate formula without variable")}}}function Ar(e,t,n=!0,i,r=o.dInf){const a=_e(n),u=_e(i),l=_e(r);return N(()=>{var b,v,y,_;const c=s(l);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const d=s(a),h=(b=s(u))!=null?b:d?10:0;let f=0;if(o.gt(c,h)){if(!e.isInvertible())throw new Error("Cannot calculate max affordable of non-invertible formula with more maxBulkAmount than directSum");if(d){if(!e.isIntegralInvertible())throw new Error("Cannot calculate max affordable of formula with non-invertible integral");f=o.floor(e.invertIntegral(o.add(t.value,e.evaluateIntegral()))).sub((v=s(e.innermostVariable))!=null?v:0)}else f=o.floor(e.invert(t.value))}if(f=o.clampMax(f,c),h>0){const I=f;f=o.sub(f,h).clampMin(0);let D;for(d?D=Qt(e,f,!0,0):D=e.evaluate(o.add((y=s(e.innermostVariable))!=null?y:0,f));o.lt(f,c)&&o.lt(f,Number.MAX_SAFE_INTEGER)&&o.add(I,1).gte(f);){const S=e.evaluate(f.add((_=s(e.innermostVariable))!=null?_:0));if(o.add(D,S).lte(t.value))f=f.add(1),D=o.add(D,S);else break}}return f})}function Qt(e,t,n=!0,i){var c;if(o.eq(t,1))return e.evaluate();const r=(c=s(e.innermostVariable))!=null?c:0;let a=o.add(t,r);const u=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let l=0;if(o.gt(t,i)){if(!e.isInvertible())throw new Error("Cannot calculate cost with indirect sum of non-invertible formula");if(n){if(!e.isIntegrable())throw new Error("Cannot calculate cost with cumulative cost of non-integrable formula");if(l=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),u.gt(1e308))return o.add(l,o.sub(u,a).times(e.evaluate(a)))}else if(l=e.evaluate(a),a=a.add(1),u.gt(1e308))return o.sub(u,a).add(1).times(l)}for(let d=a.toNumber();d{for(const a of r)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerpolicy&&(a.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?a.credentials="include":r.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}};ma();const va="modulepreload",rr={},ha="./",Gn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${ha}${i}`,i in rr)return;rr[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const u=document.createElement("link");if(u.rel=r?"stylesheet":va,r||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),r)return new Promise((l,c)=>{u.addEventListener("load",l),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},ba="./projInfo-schema.json",ya="Planar Pioneers",wa="A game about controlling and exploiting planes!",_a="planar-pioneers",Na="thepaperpilot",Ca="",ka="",Ma="0.0",Sa="Initial Commit",Ia=!1,xa=!1,$a=2,Ea=!0,Da=null,Pa="",Ta=["main"],Aa=3600,Ra=0,Fa=!0,Oa="base64";var we={$schema:ba,title:ya,description:wa,id:_a,author:Na,discordName:Ca,discordLink:ka,versionNumber:Ma,versionTitle:Sa,allowGoBack:Ia,defaultShowSmall:xa,defaultDecimalsShown:$a,useHeader:Ea,banner:Da,logo:Pa,initialTabs:Ta,maxTickLength:Aa,offlineLimit:Ra,enablePausing:Fa,exportEncoding:Oa};class qa{constructor(t){this.map=new Map,this.first=void 0,this.last=void 0,this.maxSize=t}get size(){return this.map.size}get(t){const n=this.map.get(t);if(n!==void 0)return n!==this.first&&(n===this.last?(this.last=n.prev,this.last.next=void 0):(n.prev.next=n.next,n.next.prev=n.prev),n.next=this.first,this.first.prev=n,this.first=n),n.value}set(t,n){if(this.maxSize<1)return;if(this.map.has(t))throw new Error("Cannot update existing keys in the cache");const i=new Va(t,n);for(this.first===void 0?(this.first=i,this.last=i):(i.next=this.first,this.first.prev=i,this.first=i),this.map.set(t,i);this.map.size>this.maxSize;){const r=this.last;this.map.delete(r.key),this.last=r.prev,this.last.next=void 0}}}class Va{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Di=17,Ba=9e15,La=Math.log10(9e15),ja=1/9e15,za=308,Ga=-324,ar=5,Ua=(1<<10)-1,Wa=function(){const e=[];for(let n=Ga+1;n<=za;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),sn=[2,Math.E,3,4,5,6,7,8,9,10],Ha=[[1,1.0891180521811203,1.1789767925673957,1.2701455431742086,1.3632090180450092,1.4587818160364217,1.5575237916251419,1.6601571006859253,1.767485818836978,1.8804192098842727,2],[1,1.1121114330934079,1.231038924931609,1.3583836963111375,1.4960519303993531,1.6463542337511945,1.8121385357018724,1.996971324618307,2.2053895545527546,2.4432574483385254,Math.E],[1,1.1187738849693603,1.2464963939368214,1.38527004705667,1.5376664685821402,1.7068895236551784,1.897001227148399,2.1132403089001035,2.362480153784171,2.6539010333870774,3],[1,1.1367350847096405,1.2889510672956703,1.4606478703324786,1.6570295196661111,1.8850062585672889,2.1539465047453485,2.476829779693097,2.872061932789197,3.3664204535587183,4],[1,1.1494592900767588,1.319708228183931,1.5166291280087583,1.748171114438024,2.0253263297298045,2.3636668498288547,2.7858359149579424,3.3257226212448145,4.035730287722532,5],[1,1.159225940787673,1.343712473580932,1.5611293155111927,1.8221199554561318,2.14183924486326,2.542468319282638,3.0574682501653316,3.7390572020926873,4.6719550537360774,6],[1,1.1670905356972596,1.3632807444991446,1.5979222279405536,1.8842640123816674,2.2416069644878687,2.69893426559423,3.3012632110403577,4.121250340630164,5.281493033448316,7],[1,1.1736630594087796,1.379783782386201,1.6292821855668218,1.9378971836180754,2.3289975651071977,2.8384347394720835,3.5232708454565906,4.478242031114584,5.868592169644505,8],[1,1.1793017514670474,1.394054150657457,1.65664127441059,1.985170999970283,2.4069682290577457,2.9647310119960752,3.7278665320924946,4.814462547283592,6.436522247411611,9],[1,1.1840100246247336,1.4061375836156955,1.6802272208863964,2.026757028388619,2.4770056063449646,3.080525271755482,3.9191964192627284,5.135152840833187,6.989961179534715,10]],Ya=[[-1,-.9194161097107025,-.8335625019330468,-.7425599821143978,-.6466611521029437,-.5462617907227869,-.4419033816638769,-.3342645487554494,-.224140440909962,-.11241087890006762,0],[-1,-.90603157029014,-.80786507256596,-.7064666939634,-.60294836853664,-.49849837513117,-.39430303318768,-.29147201034755,-.19097820800866,-.09361896280296,0],[-1,-.9021579584316141,-.8005762598234203,-.6964780623319391,-.5911906810998454,-.486050182576545,-.3823089430815083,-.28106046722897615,-.1831906535795894,-.08935809204418144,0],[-1,-.8917227442365535,-.781258746326964,-.6705130326902455,-.5612813129406509,-.4551067709033134,-.35319256652135966,-.2563741554088552,-.1651412821106526,-.0796919581982668,0],[-1,-.8843387974366064,-.7678744063886243,-.6529563724510552,-.5415870994657841,-.4352842206588936,-.33504449124791424,-.24138853420685147,-.15445285440944467,-.07409659641336663,0],[-1,-.8786709358426346,-.7577735191184886,-.6399546189952064,-.527284921869926,-.4211627631006314,-.3223479611761232,-.23107655627789858,-.1472057700818259,-.07035171210706326,0],[-1,-.8740862815291583,-.7497032990976209,-.6297119746181752,-.5161838335958787,-.41036238255751956,-.31277212146489963,-.2233976621705518,-.1418697367979619,-.06762117662323441,0],[-1,-.8702632331800649,-.7430366914122081,-.6213373075161548,-.5072025698095242,-.40171437727184167,-.30517930701410456,-.21736343968190863,-.137710238299109,-.06550774483471955,0],[-1,-.8670016295947213,-.7373984232432306,-.6143173985094293,-.49973884395492807,-.394584953527678,-.2989649949848695,-.21245647317021688,-.13434688362382652,-.0638072667348083,0],[-1,-.8641642839543857,-.732534623168535,-.6083127477059322,-.4934049257184696,-.3885773075899922,-.29376029055315767,-.2083678561173622,-.13155653399373268,-.062401588652553186,0]];let k=function(t){return o.fromValue_noAlloc(t)},X=function(e,t,n){return o.fromComponents(e,t,n)},ie=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Xt=function(t,n){const i=n+1,r=Math.ceil(Math.log10(Math.abs(t))),a=Math.round(t*Math.pow(10,i-r))*Math.pow(10,r-i);return parseFloat(a.toFixed(Math.max(i-r,0)))},Pi=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Za=function(e){if(!isFinite(e))return e;if(e<-50)return e===Math.trunc(e)?Number.NEGATIVE_INFINITY:0;let t=1;for(;e<10;)t=t*e,++e;e-=1;let n=.9189385332046727;n=n+(e+.5)*Math.log(e),n=n-e;const i=e*e;let r=e;return n=n+1/(12*r),r=r*i,n=n+1/(360*r),r=r*i,n=n+1/(1260*r),r=r*i,n=n+1/(1680*r),r=r*i,n=n+1/(1188*r),r=r*i,n=n+691/(360360*r),r=r*i,n=n+7/(1092*r),r=r*i,n=n+3617/(122400*r),Math.exp(n)/t},wr=.5671432904097838,sr=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return wr;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let r=0;r<100;++r){if(i=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(i-n).5?1:-1;if(Math.random()*20<1)return ie(t,0,1);const n=Math.floor(Math.random()*(e+1));let i=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(i=Math.trunc(i));let r=Math.pow(10,i);return Math.random()>.9&&(r=Math.trunc(r)),X(t,n,r)}static affordGeometricSeries_core(e,t,n,i){const r=t.mul(n.pow(i));return w.floor(e.div(r).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,i){return t.mul(n.pow(i)).mul(w.sub(1,n.pow(e))).div(w.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),u=a.pow(2);return a.neg().add(u.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,i){const r=t.add(i.mul(n));return e.div(2).mul(r.mul(2).plus(e.sub(1).mul(n)))}static efficiencyOfPurchase_core(e,t,n){return e.div(t).add(e.div(n))}normalize(){if(this.sign===0||this.mag===0&&this.layer===0)return this.sign=0,this.mag=0,this.layer=0,this;if(this.layer===0&&this.mag<0&&(this.mag=-this.mag,this.sign=-this.sign),this.layer===0&&this.mag=Ba)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=w.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const y=parseFloat(i[0]),_=parseFloat(i[1]),I=i[1].split(";");let P=1;if(I.length===2&&(P=parseFloat(I[1]),isFinite(P)||(P=1)),isFinite(y)&&isFinite(_)){const S=w.pentate(y,_,P);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const y=parseFloat(r[0]),_=parseFloat(r[1]),I=r[1].split(";");let P=1;if(I.length===2&&(P=parseFloat(I[1]),isFinite(P)||(P=1)),isFinite(y)&&isFinite(_)){const S=w.tetrate(y,_,P);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const y=parseFloat(a[0]),_=parseFloat(a[1]);if(isFinite(y)&&isFinite(_)){const I=w.pow(y,_);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}e=e.trim().toLowerCase();let u,l,c=e.split("pt");if(c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const _=w.tetrate(u,l,y);return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let y=parseFloat(c[1]);if(isFinite(y)||(y=1),isFinite(u)&&isFinite(l)){const _=w.tetrate(u,l,y);return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}const d=e.split("e"),h=d.length-1;if(h===0){const y=parseFloat(e);if(isFinite(y))return this.fromNumber(y),w.fromStringCache.size>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else if(h===1){const y=parseFloat(e);if(isFinite(y)&&y!==0)return this.fromNumber(y),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}const f=e.split("e^");if(f.length===2){this.sign=1,f[0].charAt(0)=="-"&&(this.sign=-1);let y="";for(let _=0;_=43&&I<=57||I===101)y+=f[1].charAt(_);else return this.layer=parseFloat(y),this.mag=parseFloat(f[1].substr(_+1)),this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}}if(h<1)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;const b=parseFloat(d[0]);if(b===0)return this.sign=0,this.layer=0,this.mag=0,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this;let v=parseFloat(d[d.length-1]);if(h>=2){const y=parseFloat(d[d.length-2]);isFinite(y)&&(v*=Math.sign(y),v+=Pi(y))}if(!isFinite(b))this.sign=d[0]==="-"?-1:1,this.layer=h,this.mag=v;else if(h===1)this.sign=Math.sign(b),this.layer=1,this.mag=v+Math.log10(Math.abs(b));else if(this.sign=Math.sign(b),this.layer=h,h===2){const y=w.mul(X(1,2,v),k(b));return this.sign=y.sign,this.layer=y.layer,this.mag=y.mag,w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}else this.mag=v;return this.normalize(),w.fromStringCache.maxSize>=1&&w.fromStringCache.set(t,w.fromDecimal(this)),this}fromValue(e){return e instanceof w?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"?this.fromString(e):(this.sign=0,this.layer=0,this.mag=0,this)}toNumber(){return Number.isFinite(this.layer)?this.layer===0?this.sign*this.mag:this.layer===1?this.sign*Math.pow(10,this.mag):this.mag>0?this.sign>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:0:Number.NaN}mantissaWithDecimalPlaces(e){return isNaN(this.m)?Number.NaN:this.m===0?0:Xt(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Xt(this.mag,e)}toString(){return isNaN(this.layer)||isNaN(this.sign)||isNaN(this.mag)?"NaN":this.mag===Number.POSITIVE_INFINITY||this.layer===Number.POSITIVE_INFINITY?this.sign===1?"Infinity":"-Infinity":this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toString():this.m+"e"+this.e:this.layer===1?this.m+"e"+this.e:this.layer<=ar?(this.sign===-1?"-":"")+"e".repeat(this.layer)+this.mag:(this.sign===-1?"-":"")+"(e^"+this.layer+")"+this.mag}toExponential(e){return this.layer===0?(this.sign*this.mag).toExponential(e):this.toStringWithDecimalPlaces(e)}toFixed(e){return this.layer===0?(this.sign*this.mag).toFixed(e):this.toStringWithDecimalPlaces(e)}toPrecision(e){return this.e<=-7?this.toExponential(e-1):e>this.e?this.toFixed(e-this.exponent-1):this.toExponential(e-1)}valueOf(){return this.toString()}toJSON(){return this.toString()}toStringWithDecimalPlaces(e){return this.layer===0?this.mag<1e21&&this.mag>1e-7||this.mag===0?(this.sign*this.mag).toFixed(e):Xt(this.m,e)+"e"+Xt(this.e,e):this.layer===1?Xt(this.m,e)+"e"+Xt(this.e,e):this.layer<=ar?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Xt(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Xt(this.mag,e)}abs(){return ie(this.sign===0?0:1,this.layer,this.mag)}neg(){return ie(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?w.dZero:this.layer===0?X(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=k(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer)||this.sign===0)return t;if(t.sign===0)return this;if(this.sign===-t.sign&&this.layer===t.layer&&this.mag===t.mag)return ie(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(w.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return w.fromNumber(n.sign*n.mag+i.sign*i.mag);const r=n.layer*Math.sign(n.mag),a=i.layer*Math.sign(i.mag);if(r-a>=2)return n;if(r===0&&a===-1){if(Math.abs(i.mag-Math.log10(n.mag))>Di)return n;{const u=Math.pow(10,Math.log10(n.mag)-i.mag),l=i.sign+n.sign*u;return X(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>Di)return n;{const u=Math.pow(10,n.mag-Math.log10(i.mag)),l=i.sign+n.sign*u;return X(Math.sign(l),1,Math.log10(i.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-i.mag)>Di)return n;{const u=Math.pow(10,n.mag-i.mag),l=i.sign+n.sign*u;return X(Math.sign(l),1,i.mag+Math.log10(Math.abs(l)))}}plus(e){return this.add(e)}sub(e){return this.add(k(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=k(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return ie(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return ie(this.sign*t.sign,0,1);let n,i;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return w.fromNumber(n.sign*i.sign*n.mag*i.mag);if(n.layer>=3||n.layer-i.layer>=2)return X(n.sign*i.sign,n.layer,n.mag);if(n.layer===1&&i.layer===0)return X(n.sign*i.sign,1,n.mag+Math.log10(i.mag));if(n.layer===1&&i.layer===1)return X(n.sign*i.sign,1,n.mag+i.mag);if(n.layer===2&&i.layer===1){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.mag)}if(n.layer===2&&i.layer===2){const r=X(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(X(Math.sign(i.mag),i.layer-1,Math.abs(i.mag)));return X(n.sign*i.sign,r.layer+1,r.sign*r.mag)}throw Error("Bad arguments to mul: "+this+", "+e)}multiply(e){return this.mul(e)}times(e){return this.mul(e)}div(e){const t=k(e);return this.mul(t.recip())}divide(e){return this.div(e)}divideBy(e){return this.div(e)}dividedBy(e){return this.div(e)}recip(){return this.mag===0?w.dNaN:this.layer===0?X(this.sign,0,1/this.mag):X(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=k(e);return this.sign>t.sign?1:this.sign0?this.layer:-this.layer,i=t.mag>0?t.layer:-t.layer;return n>i?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)?0:this.cmp(n)}compare_tolerance(e,t){return this.cmp_tolerance(e,t)}eq_tolerance(e,t){const n=k(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let i=this.mag,r=n.mag;return this.layer>n.layer&&(r=Pi(r)),this.layer0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?w.dNaN:this.layer>0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(this.sign,0,Math.log10(this.mag))}log(e){return e=k(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?w.dNaN:this.layer===0&&e.layer===0?X(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):w.div(this.log10(),e.log10())}log2(){return this.sign<=0?w.dNaN:this.layer===0?X(this.sign,0,Math.log2(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?w.dNaN:this.layer===0?X(this.sign,0,Math.log(this.mag)):this.layer===1?X(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?X(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=k(e),n=this,i=t;if(n.sign===0)return i.eq(0)?ie(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return ie(1,0,1);if(i.sign===1&&i.layer===0&&i.mag===1)return n;const r=n.absLog10().mul(i).pow10();return this.sign===-1?Math.abs(i.toNumber()%2)%2===1?r.neg():Math.abs(i.toNumber()%2)%2===0?r:w.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return w.dNaN;let e=this;if(e.layer===0){const t=Math.pow(10,e.sign*e.mag);if(Number.isFinite(t)&&Math.abs(t)>=.1)return X(1,0,t);if(e.sign===0)return w.dOne;e=ie(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?X(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?X(-e.sign,e.layer+1,-e.mag):w.dOne}pow_base(e){return k(e).pow(this)}root(e){const t=k(e);return this.pow(t.recip())}factorial(){return this.mag<0?this.add(1).gamma():this.layer===0?this.add(1).gamma():this.layer===1?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(ie(1,0,24)))return w.fromNumber(Za(this.sign*this.mag));const e=this.mag-1;let t=.9189385332046727;t=t+(e+.5)*Math.log(e),t=t-e;const n=e*e;let i=e,r=12*i,a=1/r,u=t+a;if(u===t||(t=u,i=i*n,r=360*i,a=1/r,u=t-a,u===t))return w.exp(t);t=u,i=i*n,r=1260*i;let l=1/r;return t=t+l,i=i*n,r=1680*i,l=1/r,t=t-l,w.exp(t)}else return this.layer===1?w.exp(w.mul(this,w.ln(this).sub(1))):w.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?w.dOne:this.layer===0&&this.mag<=709.7?w.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?X(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?X(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):X(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return w.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return X(1,2,Math.log10(this.mag)-.3010299956639812);{const e=w.div(ie(this.sign,this.layer-1,this.mag),ie(1,0,2));return e.layer+=1,e.normalize(),e}}cube(){return this.pow(3)}cbrt(){return this.pow(1/3)}tetrate(e=2,t=ie(1,0,1)){if(e===1)return w.pow(this,t);if(e===0)return new w(t);if(this.eq(w.dOne))return w.dOne;if(this.eq(-1))return w.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return w.fromNumber(Math.E);const a=w.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?w.fromNumber(Number.POSITIVE_INFINITY):w.dNaN}if(this.eq(w.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),w.fromNumber(r)}if(e<0)return w.iteratedlog(t,this,-e);t=k(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(w.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r3)return ie(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=ie(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return w.tetrate(e,-t,this);e=k(e);let n=w.fromDecimal(this);const i=t;t=Math.trunc(t);const r=i-t;if(n.layer-e.layer>3){const a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a1e4)return n}return r>0&&r<1&&(e.eq(10)?n=n.layeradd10(-r):n=n.layeradd(-r,e)),n}slog(e=10,t=100){let n=.001,i=!1,r=!1,a=this.slog_internal(e).toNumber();for(let u=1;u1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return w.fromNumber(a)}slog_internal(e=10){if(e=k(e),e.lte(w.dZero)||e.eq(w.dOne))return w.dNaN;if(e.lt(w.dOne))return this.eq(w.dOne)?w.dZero:this.eq(w.dZero)?w.dNegOne:w.dNaN;if(this.mag<0||this.eq(w.dZero))return w.dNegOne;let t=0,n=w.fromDecimal(this);if(n.layer-e.layer>3){const i=n.layer-e.layer-3;t+=i,n.layer-=i}for(let i=0;i<100;++i)if(n.lt(w.dZero))n=w.pow(e,n),t-=1;else{if(n.lte(w.dOne))return w.fromNumber(t+w.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=w.log(n,e)}return w.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:w.critical_section(e,t,Ya)}static tetrate_critical(e,t){return w.critical_section(e,t,Ha)}static critical_section(e,t,n){t*=10,t<0&&(t=0),t>10&&(t=10),e<2&&(e=2),e>10&&(e=10);let i=0,r=0;for(let u=0;ue){const l=(e-sn[u])/(sn[u+1]-sn[u]);i=n[u][Math.floor(t)]*(1-l)+n[u+1][Math.floor(t)]*l,r=n[u][Math.ceil(t)]*(1-l)+n[u+1][Math.ceil(t)]*l;break}const a=t-Math.floor(t);return i<=0||r<=0?i*(1-a)+r*a:Math.pow(e,Math.log(i)/Math.log(e)*(1-a)+Math.log(r)/Math.log(e)*a)}layeradd10(e){e=w.fromValue_noAlloc(e).toNumber();const t=w.fromDecimal(this);if(e>=1){t.mag<0&&t.layer>0?(t.sign=0,t.mag=0,t.layer=0):t.sign===-1&&t.layer==0&&(t.sign=1,t.mag=-t.mag);const n=Math.trunc(e);e-=n,t.layer+=n}if(e<=-1){const n=Math.trunc(e);if(e-=n,t.layer+=n,t.layer<0)for(let i=0;i<100;++i){if(t.layer++,t.mag=Math.log10(t.mag),!isFinite(t.mag))return t.sign===0&&(t.sign=1),t.layer<0&&(t.layer=0),t.normalize();if(t.layer>=0)break}}for(;t.layer<0;)t.layer++,t.mag=Math.log10(t.mag);return t.sign===0&&(t.sign=1,t.mag===0&&t.layer>=1&&(t.layer-=1,t.mag=1)),t.normalize(),e!==0?t.layeradd(e,10):t}layeradd(e,t){const i=this.slog(t).toNumber()+e;return i>=0?w.tetrate(t,i):Number.isFinite(i)?i>=-1?w.log(w.tetrate(t,i+1),t):w.log(w.log(w.tetrate(t,i+2),t),t):w.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return w.fromNumber(sr(this.toNumber()));if(this.layer===0)return w.fromNumber(sr(this.sign*this.mag));if(this.layer===1)return or(this);if(this.layer===2)return or(this);if(this.layer>=3)return ie(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return ie(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=ie(1,0,1)){t=k(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(w.dOne)?(++e,t=w.fromNumber(i)):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r10)return t}return t}sin(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.sin(this.sign*this.mag)):ie(0,0,0)}cos(){return this.mag<0?w.dOne:this.layer===0?w.fromNumber(Math.cos(this.sign*this.mag)):ie(0,0,0)}tan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.tan(this.sign*this.mag)):ie(0,0,0)}asin(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.asin(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?w.fromNumber(Math.acos(this.toNumber())):this.layer===0?w.fromNumber(Math.acos(this.sign*this.mag)):ie(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?w.fromNumber(Math.atan(this.sign*this.mag)):w.fromNumber(Math.atan(this.sign*(1/0)))}sinh(){return this.exp().sub(this.negate().exp()).div(2)}cosh(){return this.exp().add(this.negate().exp()).div(2)}tanh(){return this.sinh().div(this.cosh())}asinh(){return w.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return w.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?ie(Number.NaN,Number.NaN,Number.NaN):w.ln(this.add(1).div(w.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(w.pow(10,e))}egg(){return this.add(9)}lessThanOrEqualTo(e){return this.cmp(e)<1}lessThan(e){return this.cmp(e)<0}greaterThanOrEqualTo(e){return this.cmp(e)>-1}greaterThan(e){return this.cmp(e)>0}};let o=w;o.fromStringCache=new qa(Ua);o.dZero=ie(0,0,0);o.dOne=ie(1,0,1);o.dNegOne=ie(-1,0,1);o.dTwo=ie(1,0,2);o.dTen=ie(1,0,10);o.dNaN=ie(Number.NaN,Number.NaN,Number.NaN);o.dInf=ie(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=ie(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=X(1,0,Number.MAX_VALUE);o.dNumberMin=X(1,0,Number.MIN_VALUE);k=o.fromValue_noAlloc;X=o.fromComponents;ie=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const Xa=new o(1);function Vn(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=Xa,i=i.add(1));const a=i.gte(1e9)?bt(i,Math.max(Math.max(t,3),we.defaultDecimalsShown)):i.gte(1e4)?di(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function di(e,t){if(e==null)return"NaN";if(e=new o(e),e.mag<.001)return 0 .toFixed(t);const i=e.toStringWithDecimalPlaces(t).split(".");return i[0]=i[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),i.length==1?i[0]:i[0]+"."+i[1]}function _r(e,t){return e==null?"NaN":(e=new o(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),we.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Ja=new o("eeee1000"),Ka=new o("e100000"),lr=new o("e1000"),Nr=new o(1e9),Qa=new o(1e6),es=new o(1e3),ts=new o(.98),ns=new o(.001),Cr=new o(0);function bt(e,t,n){if(t==null&&(t=we.defaultDecimalsShown),n=n!=null?n:we.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+bt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Ja)){const i=e.slog();return i.gte(Qa)?"F"+bt(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+di(i.floor(),0)}else{if(e.gte(Ka))return Vn(e,0,!1);if(e.gte(lr))return Vn(e,0);if(e.gte(Nr))return Vn(e,t);if(e.gte(es))return di(e,0);if(e.gte(ns)||!n)return _r(e,t);if(e.eq(Cr))return 0 .toFixed(t)}return e=Mr(e),e.lt(lr)?Vn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):bt(e,t)+"\u207B\xB9"}function He(e){return e=new o(e),e.sign<0?"-"+He(e.neg()):e.gte(Nr)||e.lte(ts)&&!e.eq(Cr)?bt(e):bt(e,0)}function kr(e){return o.lt(e,0)?"-"+kr(o.neg(e)):o.gt(e,2**51)?bt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?bt(e)+"s":e<3600?He(Math.floor(e/60))+"m "+bt(e%60)+"s":e<86400?He(Math.floor(e/3600))+"h "+He(Math.floor(e/60)%60)+"m "+He(e%60)+"s":e<31536e3?He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h "+He(Math.floor(e/60)%60)+"m":He(Math.floor(e/31536e3))+"y "+He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h")}function is(e,t,n){e=new o(e);let i=e.toStringWithDecimalPlaces(t);return new o(i).gte(n)&&(i=o.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),i}function rs(e,t){return bt(e,t,!0)}function Mr(e){let t=o.log10(e).ceil();const n=o.div(e,o.pow(10,t));return t=t.neg(),e=new o(10).pow(t).times(n),e}var as=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Vn,commaFormat:di,regularFormat:_r,format:bt,formatWhole:He,formatTime:kr,toPlaces:is,formatSmall:rs,invertOOM:Mr},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Li,commaFormat:ss,regularFormat:os,format:xe,formatWhole:dt,formatTime:bi,toPlaces:ls,formatSmall:Gt,invertOOM:us}=as;window.Decimal=o;window.exponentialFormat=Li;window.commaFormat=ss;window.regularFormat=os;window.format=xe;window.formatWhole=dt;window.formatTime=bi;window.toPlaces=ls;window.formatSmall=Gt;window.invertOOM=us;function at(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Un(e){return typeof e=="function"}var W=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(W||{});const Wn=Symbol("DoNotCache");function E(e,t){const n=e[t];Un(n)&&n.length===0&&!n[Wn]?e[t]=N(n.bind(e)):Un(n)&&(e[t]=n.bind(e),e[t][Wn]=!0)}function _e(e){return Un(e)&&!e[Wn]&&(e=N(e)),e}const yt=Symbol("Component"),pt=Symbol("GatherProps");let cs=0;function rn(e="feature-"){return e+cs++}var Me=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Me||{});function Ye(e){const t=s(e);return t!==2&&t!==!1}function vn(e){return s(e)===1}function Y(e){return e[Wn]=!0,e}function oe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Hn(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const u=r[a];u!=null&&typeof u=="object"&&(t.includes(u.type)?n.push(u):!(u instanceof o)&&!Fe(u)&&i(u))})};return i(e),n}const on={variables:{"--foreground":"#dfdfdf","--background":"#0f0f0f","--feature-foreground":"#0f0f0f","--tooltip-background":"rgba(0, 0, 0, 0.75)","--raised-background":"#0f0f0f","--points":"#ffffff","--locked":"#bf8f8f","--highlighted":"#333","--bought":"#77bf5f","--danger":"rgb(220, 53, 69)","--link":"#02f2f2","--outline":"#dfdfdf","--accent1":"#627a82","--accent2":"#658262","--accent3":"#7c6282","--border-radius":"15px","--modal-border":"solid 2px var(--color)","--feature-margin":"0px"},floatingTabs:!0,mergeAdjacent:!0,showPin:!0};var ji=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(ji||{}),Nt={classic:on,paper:{...on,variables:{...on.variables,"--background":"#2a323d","--feature-foreground":"#000","--raised-background":"#333c4a","--locked":"#3a3e45","--bought":"#5C8A58","--outline":"#333c4a","--border-radius":"4px","--modal-border":"","--feature-margin":"5px"},floatingTabs:!1},nordic:{...on,variables:{...on.variables,"--foreground":"#D8DEE9","--background":"#2E3440","--feature-foreground":"#000","--raised-background":"#3B4252","--points":"#E5E9F0","--locked":"#4c566a","--highlighted":"#434c5e","--bought":"#8FBCBB","--danger":"#D08770","--link":"#88C0D0","--outline":"#3B4252","--accent1":"#B48EAD","--accent2":"#A3BE8C","--accent3":"#EBCB8B","--border-radius":"4px","--modal-border":"solid 2px #3B4252","--feature-margin":"5px"},floatingTabs:!1},aqua:{...on,variables:{...on.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Qe=yr();"fonts"in document&&(document.fonts.onloadingdone=()=>Qe.emit("fontsLoaded"));var ds=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Qe},Symbol.toStringTag,{value:"Module"}));const ps=fn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Q=window.player=ps;function Sr(e){return JSON.stringify(e,(t,n)=>s(n))}function Ir(e={}){return Object.assign({id:`${we.id}-0`,name:"Default Save",tabs:we.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:we.id,modVersion:we.versionNumber,layers:{}},e)}function mt(e){const t=Kt.compressToUTF16(Sr(e!=null?e:Q));return localStorage.setItem((e!=null?e:Q).id,t),t}async function fs(){vs();try{let e=localStorage.getItem(ce.active);if(e==null){await cn(xn());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==we.id){await cn(xn());return}t.id=ce.active,await cn(t)}catch(e){console.error(`Failed to load save. Falling back to new save. +`,e),await cn(xn())}}function xn(){const e=ui(),t=Ir({id:e});return mt(t),ce.saves.push(e),t}function ui(){let e,t=0;do e=`${we.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const gs=z(!1);async function cn(e){console.info("Loading save",e),gs.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await Gn(()=>Promise.resolve().then(function(){return pl}),void 0),{fixOldSave:r,getInitialLayers:a}=await Gn(()=>Promise.resolve().then(function(){return bp}),void 0);for(const u in t){const l=t[u];l&&n(l)}a(e).forEach(u=>i(u,e)),e=Ir(e),e.offlineProd&&e.time!=null&&e.time&&e.devSpeed!==0&&(e.offlineTime==null&&(e.offlineTime=0),e.offlineTime+=Math.min(e.offlineTime+(Date.now()-e.time)/1e3,we.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==we.versionNumber&&(r(e.modVersion,e),e.modVersion=we.versionNumber),Object.assign(Q,e),ce.active=Q.id,Qe.emit("onLoad")}setInterval(()=>{Q.autosave&&mt()},1e3);window.onbeforeunload=()=>{Q.autosave&&mt()};window.save=mt;const ms=window.hardReset=async()=>{await cn(xn())};window.deleteLowerSaves=()=>{const e=Object.values(ce.saves).indexOf(Q.id)+1;Object.values(ce.saves).slice(e).forEach(t=>localStorage.removeItem(t)),ce.saves=ce.saves.slice(0,e)};const Yn=fn({active:"",saves:[],showTPS:!0,theme:ji.Nordic,unthrottled:!1,alignUnits:!1});vt(Yn,e=>{const t=Kt.compressToUTF16(JSON.stringify(e));localStorage.setItem(we.id,t)},{deep:!0});var ce=window.settings=Yn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:ji.Nordic,alignUnits:!1};Qe.emit("loadSettings",e),Object.assign(Yn,e),ms()};function vs(){try{let e=localStorage.getItem(we.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Kt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Yn,t)}Qe.emit("loadSettings",Yn)}catch{}}const xr=fn([]);function hs(e){xr.push(e)}const bs=fn([]),ys=fn([]),ws={class:"table"},_s=J({__name:"Column",setup(e){const t=N(()=>Nt[ce.theme].mergeAdjacent);return(n,i)=>(M(),A("div",ws,[C("div",{class:Ne(["col",{mergeAdjacent:s(t)}])},[Tt(n.$slots,"default")],2)]))}}),Ns={class:"table"},Cs=J({__name:"Row",setup(e){const t=N(()=>Nt[ce.theme].mergeAdjacent);return(n,i)=>(M(),A("div",Ns,[C("div",{class:Ne(["row",{mergeAdjacent:s(t)}])},[Tt(n.$slots,"default")],2)]))}});function $r(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ta(e)}function pe(e,t="span"){return typeof e=="function"?J({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}`),J({template:e})):J({render:()=>({})}):e}function ot(e){if(xt(e))return typeof e=="function"?e():pe(e);const t=e[yt];return p(t,e[pt](),null)}function Ti(...e){let t;return p(Cs,null,$r(t=e.map(ot))?t:{default:()=>[t]})}function ks(...e){let t;return p(_s,null,$r(t=e.map(ot))?t:{default:()=>[t]})}function Ct(e){if(xt(e))return typeof e=="function"?e():typeof e=="string"?p(re,null,[e]):p(e,null,null);const t=e[yt];return p(t,e[pt](),null)}function ur(e,t){return e.reduce((n,i)=>p(re,null,[n,t,i]))}function xt(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Wn]===!0}function Er(e,t){const n=z(null),i=z(void 0);function r(l){n.value||(n.value=setInterval(u,250)),i.value=l}function a(){n.value&&(clearInterval(n.value),n.value=null)}function u(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return br(a),{start:r,stop:a,handleHolding:u}}function Dr(e,t="div"){const n=ht();return It(()=>{n.value=pe(Ee(e),t)}),n}function Pn(e,t="div"){const n=ht(null);return It(()=>{const i=Ee(e);n.value=i==""||i==null?null:pe(i,t)}),n}function Ee(e){return s(s(e))}function q(...e){return e.includes(Object)||e.push(Object),e}function cr(e){const t=z(!1),n=e[pt].bind(e);return e[pt]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var ve=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const Ms=J({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=z({}),i=new ResizeObserver(l),r=z(null);vi(()=>{const f=r.value;f!=null&&i.observe(f)});let a=!0,u=z((h=r.value)==null?void 0:h.getBoundingClientRect());function l(){a&&(a=!1,Ut(()=>{var f;u.value=(f=r.value)==null?void 0:f.getBoundingClientRect(),Object.values(n.value).filter(b=>b).forEach(b=>b.rect=b.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}Qe.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};ai(zi,(f,b)=>{const v=new MutationObserver(()=>d(f));v.observe(b,c),n.value[f]={element:b,observer:v,rect:b.getBoundingClientRect()},l()}),ai(Gi,f=>{var b;(b=n.value[f])==null||b.observer.disconnect(),n.value[f]=void 0,l()}),ai(Ui,n),ai(Wi,u);function d(f){const b=n.value[f];b!=null&&(b.rect=b.element.getBoundingClientRect(),t("updateNodes",n.value))}return(f,b)=>(M(),A(re,null,[Tt(f.$slots,"default",{},void 0,!0),C("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Pr=ve(Ms,[["__scopeId","data-v-2b1dc1bc"]]);const Ss=["onPointerdown"],Is={class:"modal-wrapper"},xs={class:"modal-container"},$s={class:"modal-header"},Es={class:"modal-body"},Ds={class:"modal-footer"},Ps=C("div",{class:"modal-default-flex-grow"},null,-1),Rt=J({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=Te(e),a=N(()=>s(r.modelValue)||l.value);function u(){n("update:modelValue",!1)}const l=z(!1),c=z(null),d=N(()=>{var h,f;return(f=(h=c.value)==null?void 0:h.nodes)!=null?f:null});return t({isOpen:a,nodes:d}),(h,f)=>(M(),ne(ia,{to:"#modal-root"},[p(zn,{name:"modal",onBeforeEnter:f[0]||(f[0]=b=>l.value=!0),onAfterLeave:f[1]||(f[1]=b=>l.value=!1)},{default:Z(()=>[Vi(C("div",Wt({class:"modal-mask",onPointerdown:$n(u,["self"])},h.$attrs),[C("div",Is,[C("div",xs,[C("div",$s,[Tt(h.$slots,"header",{shown:s(a)},()=>[$(" default header ")])]),C("div",Es,[p(Pr,{ref_key:"contextRef",ref:c},{default:Z(()=>[Tt(h.$slots,"body",{shown:s(a)},()=>[$(" default body ")])]),_:3},512)]),C("div",Ds,[Tt(h.$slots,"footer",{shown:s(a)},()=>[C("div",{class:"modal-default-footer"},[Ps,C("button",{class:"button modal-default-button",onClick:u}," Close ")])])])])])],16,Ss),[[na,e.modelValue]])]),_:3})]))}}),Jt=Symbol("ProxyState");function et(e,t={}){const n=t;let i=!1;function r(){return i||(Object.assign(n,e.call(n,n)),i=!0),n}return new Proxy(n,{get(a,u){if(u===Jt)return r();const l=r()[u];return l!=null&&typeof l=="object"&&Pt in l?l[Pt]:l},set(a,u,l){return r()[u]=l,!0},has(a,u){return u===Jt?!0:Reflect.has(r(),u)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,u){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,u)}})}var We=window.state=Bi({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const Tr=o.ln(10);function Bn(e){return e}function Ts(e,t){if(O(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function As(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return g.neg(t.getIntegralFormula(e))}throw new Error("Could not integrate due to no input being a variable")}function Rs(e){return g.neg(e)}function Fs(e,t,n){if(O(t))return t.invert(o.sub(e,Se(n)));if(O(n))return n.invert(o.sub(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function Os(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.times(n,(i=t.innermostVariable)!=null?i:0).add(a)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).add(a)}throw new Error("Could not integrate due to no input being a variable")}function qs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.add(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.add(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Vs(e,t,n){if(O(t))return t.invert(o.add(e,Se(n)));if(O(n))return n.invert(o.sub(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function Bs(e,t,n){var i,r;if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=t.getIntegralFormula(e);return g.sub(a,g.times(n,(i=t.innermostVariable)!=null?i:0))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const a=n.getIntegralFormula(e);return g.times(t,(r=n.innermostVariable)!=null?r:0).sub(a)}throw new Error("Could not integrate due to no input being a variable")}function Ls(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.sub(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.sub(i,t)}throw new Error("Could not integrate due to no input being a variable")}function js(e,t,n){if(O(t))return t.invert(o.div(e,Se(n)));if(O(n))return n.invert(o.div(e,Se(t)));throw new Error("Could not invert due to no input being a variable")}function zs(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.times(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.times(i,t)}throw new Error("Could not integrate due to no input being a variable")}function Gs(e,t,n){if(O(t))return g.div(e,n);if(O(n))return g.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Us(e,t,n){if(O(t))return t.invert(o.mul(e,Se(n)));if(O(n))return n.invert(o.div(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function Ws(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.div(i,n)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.div(t,i)}throw new Error("Could not integrate due to no input being a variable")}function Hs(e,t,n){if(O(t))return g.mul(e,n);if(O(n))return g.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Ys(e,t){if(O(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Zs(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.ln(n)}throw new Error("Could not integrate due to no input being a variable")}function Xs(e,t){if(O(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function Js(e){return o.ln(e).sub(1).times(e).div(Tr)}function Ks(e,t){if(O(t)){const n=Tr.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function Qs(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:Js,invert:Ks})}throw new Error("Could not integrate due to no input being a variable")}function eo(e,t,n){if(O(t))return t.invert(o.pow(Se(n),e));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function to(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function no(e,t,n){if(O(t)){const i=o.ln(Se(n)).times(e);return t.invert(i.div(i.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function io(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e),n],evaluate:to,invert:no})}throw new Error("Could not integrate due to no input being a variable")}function ro(e,t){if(O(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function ao(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function so(e,t){if(O(t)){const n=o.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}throw new Error("Could not invert due to no input being a variable")}function oo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:ao,invert:so})}throw new Error("Could not integrate due to no input being a variable")}function lo(e,t){if(O(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function uo(e){return o.ln(e).sub(1).times(e)}function co(e,t){if(O(t))return t.invert(o.div(e,o.div(e,Math.E).lambertw()));throw new Error("Could not invert due to no input being a variable")}function po(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:uo,invert:co})}throw new Error("Could not integrate due to no input being a variable")}function fo(e,t,n){if(O(t))return t.invert(o.root(e,Se(n)));if(O(n))return n.invert(o.ln(e).div(o.ln(Se(t))));throw new Error("Could not invert due to no input being a variable")}function go(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e),r=g.add(n,1);return g.pow(i,r).div(r)}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e);return g.pow(t,i).div(g.ln(t))}throw new Error("Could not integrate due to no input being a variable")}function mo(e,t){if(O(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function vo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.pow10(n).div(g.ln(10))}throw new Error("Could not integrate due to no input being a variable")}function ho(e,t,n){if(O(t))return t.invert(o.ln(e).div(o.ln(Se(n))));if(O(n))return n.invert(o.root(Se(t),e));throw new Error("Could not invert due to no input being a variable")}function bo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(n,i).div(g.ln(n))}else if(O(n)){if(!n.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=n.getIntegralFormula(e),r=g.add(t,1);return g.pow(i,r).div(r)}throw new Error("Could not integrate due to no input being a variable")}function yo(e,t,n){if(O(t))return t.invert(o.root(e,o.recip(Se(n))));if(O(n))return n.invert(o.ln(Se(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function wo(e,t,n){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const i=t.getIntegralFormula(e);return g.pow(i,g.recip(n).add(1)).times(n).div(g.add(n,1))}throw new Error("Could not integrate due to no input being a variable")}function _o(e,t){if(O(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function No(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.exp(n)}throw new Error("Could not integrate due to no input being a variable")}function Co(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function ko(e,t,n,i){if(O(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function Mo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.iteratedexp(e,i,new o(n))}function So(e,t,n,i){if(O(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Io(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function xo(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function $o(e,t,n){if(O(t))return t.invert(o.tetrate(e,o.minabs(1e308,Se(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Eo(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function Do(e,t,n,i){if(O(t))return t.invert(o.layeradd(e,o.minabs(1e308,Se(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function Po(e,t){if(O(t))return t.invert(o.pow(Math.E,e).times(e));throw new Error("Could not invert due to no input being a variable")}function To(e,t){if(O(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function Ao(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function Ro(e,t){if(O(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function Fo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).neg()}throw new Error("Could not integrate due to no input being a variable")}function Oo(e,t){if(O(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function qo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sin(n)}throw new Error("Could not integrate due to no input being a variable")}function Vo(e,t){if(O(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function Bo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cos(n).ln().neg()}throw new Error("Could not integrate due to no input being a variable")}function Lo(e,t){if(O(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function jo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asin(n).times(n).add(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function zo(e,t){if(O(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function Go(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acos(n).times(n).sub(g.sqrt(g.sub(1,g.pow(n,2))))}throw new Error("Could not integrate due to no input being a variable")}function Uo(e,t){if(O(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function Wo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atan(n).times(n).sub(g.ln(g.pow(n,2).add(1)).div(2))}throw new Error("Could not integrate due to no input being a variable")}function Ho(e,t){if(O(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Yo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n)}throw new Error("Could not integrate due to no input being a variable")}function Zo(e,t){if(O(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Xo(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.sinh(n)}throw new Error("Could not integrate due to no input being a variable")}function Jo(e,t){if(O(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function Ko(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.cosh(n).ln()}throw new Error("Could not integrate due to no input being a variable")}function Qo(e,t){if(O(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function el(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.asinh(n).times(n).sub(g.pow(n,2).add(1).sqrt())}throw new Error("Could not integrate due to no input being a variable")}function tl(e,t){if(O(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function nl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.acosh(n).times(n).sub(g.add(n,1).sqrt().times(g.sub(n,1).sqrt()))}throw new Error("Could not integrate due to no input being a variable")}function il(e,t){if(O(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function rl(e,t){if(O(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");const n=t.getIntegralFormula(e);return g.atanh(n).times(n).add(g.sub(1,g.pow(n,2)).ln().div(2))}throw new Error("Could not integrate due to no input being a variable")}function Tn(e){return(t,n)=>new g({inputs:[t,n],evaluate:e,invert:Bn})}function O(e){return e instanceof De&&e.hasVariable()}function Se(e,t){return e instanceof De?e.evaluate(t):s(e)}function al(){return g.pow(this,2).div(2)}function sl(){return this}const Oe=class{constructor(e){this.negate=this.neg,this.negated=this.neg,this.sgn=this.sign,this.plus=this.add,this.subtract=this.sub,this.minus=this.sub,this.multiply=this.mul,this.times=this.mul,this.divide=this.div,this.divideBy=this.div,this.dividedBy=this.div,this.reciprocal=this.recip,this.reciprocate=this.recip,this.logarithm=this.log;let t;"inputs"in e&&(e.inputs=e.inputs.map(n=>typeof n=="object"&&Pt in n?n[Pt]:n)),"variable"in e?(typeof e.variable=="object"&&Pt in e.variable&&(e.variable=e.variable[Pt]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:al,internalIntegrateInner:sl,applySubstitution:Bn}}setupConstant({inputs:e}){if(e.length!==1)throw new Error("Evaluate function is required if inputs is not length 1");return{inputs:e,internalVariables:0}}setupFormula(e){var b,v;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:u}=e,l=t.reduce((y,_)=>y+(_ instanceof Oe?_.internalVariables:0),0),c=t.find(y=>y instanceof Oe&&y.hasVariable()),d=l===1?c==null?void 0:c.innermostVariable:void 0,h=(b=c==null?void 0:c.isInvertible())!=null?b:!1,f=(v=c==null?void 0:c.isIntegrable())!=null?v:!1;return{inputs:t,internalEvaluate:n,internalInvert:h?i:void 0,internalIntegrate:f?r:void 0,internalIntegrateInner:a,applySubstitution:u,innermostVariable:d,internalVariables:l}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,i;return(i=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(r=>Se(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:Se(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Oe&&e.inputs[n]instanceof Oe?t.equals(e.inputs[n]):!(t instanceof Oe)&&!(e.inputs[n]instanceof Oe)&&o.eq(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new g({inputs:[e]})}static variable(e){return new g({variable:e})}static step(e,t,n){const i=n(g.variable(0)),r=_e(t);function a(l){return o.lt(l,s(r))?l:o.add(i.evaluate(o.sub(l,s(r))),s(r))}function u(l,c){if(O(c)&&i.isInvertible())return o.gt(l,s(r))&&(l=o.add(i.invert(o.sub(l,s(r))),s(r))),c.invert(l);throw new Error("Could not invert due to no input being a variable")}return new g({inputs:[e],evaluate:a,invert:i.isInvertible()&&i.hasVariable()?u:void 0})}static if(e,t,n,i){const r=z(0),a=g.variable(r),u=n(a),l=i==null?void 0:i(a),c=_e(t);function d(f){return s(c)?(r.value=f,u.evaluate()):l?(r.value=f,l.evaluate()):f}function h(f,b){if(!O(b)||!u.isInvertible()||l!=null&&!l.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?b.invert(u.invert(f)):l?b.invert(l.invert(f)):b.invert(f)}return new g({inputs:[e],evaluate:d,invert:u.isInvertible()&&u.hasVariable()?h:void 0})}static conditional(e,t,n,i){return g.if(e,t,n,i)}static abs(e){return new g({inputs:[e],evaluate:o.abs})}static neg(e){return new g({inputs:[e],evaluate:o.neg,invert:Ts,applySubstitution:Rs,integrate:As})}static sign(e){return new g({inputs:[e],evaluate:o.sign})}static round(e){return new g({inputs:[e],evaluate:o.round})}static floor(e){return new g({inputs:[e],evaluate:o.floor})}static ceil(e){return new g({inputs:[e],evaluate:o.ceil})}static trunc(e){return new g({inputs:[e],evaluate:o.trunc})}static add(e,t){return new g({inputs:[e,t],evaluate:o.add,invert:Fs,integrate:Os,integrateInner:qs,applySubstitution:Bn})}static sub(e,t){return new g({inputs:[e,t],evaluate:o.sub,invert:Vs,integrate:Bs,integrateInner:Ls,applySubstitution:Bn})}static mul(e,t){return new g({inputs:[e,t],evaluate:o.mul,invert:js,integrate:zs,applySubstitution:Gs})}static div(e,t){return new g({inputs:[e,t],evaluate:o.div,invert:Us,integrate:Ws,applySubstitution:Hs})}static recip(e){return new g({inputs:[e],evaluate:o.recip,invert:Ys,integrate:Zs})}static clamp(e,t,n){return new g({inputs:[e,t,n],evaluate:o.clamp,invert:Bn})}static pLog10(e){return new g({inputs:[e],evaluate:o.pLog10})}static absLog10(e){return new g({inputs:[e],evaluate:o.absLog10})}static log10(e){return new g({inputs:[e],evaluate:o.log10,invert:Xs,integrate:Qs})}static log(e,t){return new g({inputs:[e,t],evaluate:o.log,invert:eo,integrate:io})}static log2(e){return new g({inputs:[e],evaluate:o.log2,invert:ro,integrate:oo})}static ln(e){return new g({inputs:[e],evaluate:o.ln,invert:lo,integrate:po})}static pow(e,t){return new g({inputs:[e,t],evaluate:o.pow,invert:fo,integrate:go})}static pow10(e){return new g({inputs:[e],evaluate:o.pow10,invert:mo,integrate:vo})}static pow_base(e,t){return new g({inputs:[e,t],evaluate:o.pow_base,invert:ho,integrate:bo})}static root(e,t){return new g({inputs:[e,t],evaluate:o.root,invert:yo,integrate:wo})}static factorial(e){return new g({inputs:[e],evaluate:o.factorial})}static gamma(e){return new g({inputs:[e],evaluate:o.gamma})}static lngamma(e){return new g({inputs:[e],evaluate:o.lngamma})}static exp(e){return new g({inputs:[e],evaluate:o.exp,invert:_o,integrate:No})}static sqr(e){return g.pow(e,2)}static sqrt(e){return g.root(e,2)}static cube(e){return g.pow(e,3)}static cbrt(e){return g.root(e,3)}static tetrate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Co,invert:ko})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Mo,invert:So})}static iteratedlog(e,t=10,n=1){return new g({inputs:[e,t,n],evaluate:Io})}static slog(e,t=10){return new g({inputs:[e,t],evaluate:xo,invert:$o})}static layeradd10(e,t){return new g({inputs:[e,t],evaluate:o.layeradd10})}static layeradd(e,t,n=10){return new g({inputs:[e,t,n],evaluate:Eo,invert:Do})}static lambertw(e){return new g({inputs:[e],evaluate:o.lambertw,invert:Po})}static ssqrt(e){return new g({inputs:[e],evaluate:o.ssqrt,invert:To})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Ao})}static sin(e){return new g({inputs:[e],evaluate:o.sin,invert:Lo,integrate:Fo})}static cos(e){return new g({inputs:[e],evaluate:o.cos,invert:zo,integrate:qo})}static tan(e){return new g({inputs:[e],evaluate:o.tan,invert:Uo,integrate:Bo})}static asin(e){return new g({inputs:[e],evaluate:o.asin,invert:Ro,integrate:jo})}static acos(e){return new g({inputs:[e],evaluate:o.acos,invert:Oo,integrate:Go})}static atan(e){return new g({inputs:[e],evaluate:o.atan,invert:Vo,integrate:Wo})}static sinh(e){return new g({inputs:[e],evaluate:o.sinh,invert:Qo,integrate:Yo})}static cosh(e){return new g({inputs:[e],evaluate:o.cosh,invert:tl,integrate:Xo})}static tanh(e){return new g({inputs:[e],evaluate:o.tanh,invert:il,integrate:Ko})}static asinh(e){return new g({inputs:[e],evaluate:o.asinh,invert:Ho,integrate:el})}static acosh(e){return new g({inputs:[e],evaluate:o.acosh,invert:Zo,integrate:nl})}static atanh(e){return new g({inputs:[e],evaluate:o.atanh,invert:Jo,integrate:rl})}step(e,t){return g.step(this,e,t)}if(e,t){return g.if(this,e,t)}conditional(e,t){return g.if(this,e,t)}abs(){return g.abs(this)}neg(){return g.neg(this)}sign(){return g.sign(this)}round(){return g.round(this)}floor(){return g.floor(this)}ceil(){return g.ceil(this)}trunc(){return g.trunc(this)}add(e){return g.add(this,e)}sub(e){return g.sub(this,e)}mul(e){return g.mul(this,e)}div(e){return g.div(this,e)}recip(){return g.recip(this)}max(e){return g.max(this,e)}min(e){return g.min(this,e)}maxabs(e){return g.maxabs(this,e)}minabs(e){return g.minabs(this,e)}clamp(e,t){return g.clamp(this,e,t)}clampMin(e){return g.clampMin(this,e)}clampMax(e){return g.clampMax(this,e)}pLog10(){return g.pLog10(this)}absLog10(){return g.absLog10(this)}log10(){return g.log10(this)}log(e){return g.log(this,e)}log2(){return g.log2(this)}ln(){return g.ln(this)}pow(e){return g.pow(this,e)}pow10(){return g.pow10(this)}pow_base(e){return g.pow_base(this,e)}root(e){return g.root(this,e)}factorial(){return g.factorial(this)}gamma(){return g.gamma(this)}lngamma(){return g.lngamma(this)}exp(){return g.exp(this)}sqr(){return g.pow(this,2)}sqrt(){return g.root(this,2)}cube(){return g.pow(this,3)}cbrt(){return g.root(this,3)}tetrate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.tetrate(this,e,t)}iteratedexp(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return g.iteratedlog(this,e,t)}slog(e=10){return g.slog(this,e)}layeradd10(e){return g.layeradd10(this,e)}layeradd(e,t){return g.layeradd(this,e,t)}lambertw(){return g.lambertw(this)}ssqrt(){return g.ssqrt(this)}pentate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return g.pentate(this,e,t)}sin(){return g.sin(this)}cos(){return g.cos(this)}tan(){return g.tan(this)}asin(){return g.asin(this)}acos(){return g.acos(this)}atan(){return g.atan(this)}sinh(){return g.sinh(this)}cosh(){return g.cosh(this)}tanh(){return g.tanh(this)}asinh(){return g.asinh(this)}acosh(){return g.acosh(this)}atanh(){return g.atanh(this)}};let De=Oe;De.negate=Oe.neg;De.negated=Oe.neg;De.sgn=Oe.sign;De.plus=Oe.add;De.subtract=Oe.sub;De.minus=Oe.sub;De.multiply=Oe.mul;De.times=Oe.mul;De.divide=Oe.div;De.divideBy=Oe.div;De.dividedBy=Oe.div;De.reciprocal=Oe.recip;De.reciprocate=Oe.recip;De.max=Tn(o.max);De.min=Tn(o.min);De.minabs=Tn(o.minabs);De.maxabs=Tn(o.maxabs);De.clampMin=Tn(o.clampMin);De.clampMax=Tn(o.clampMax);De.logarithm=Oe.log;class g extends De{invert(t){if(this.internalInvert&&this.hasVariable())return this.internalInvert.call(this,t,...this.inputs);if(this.inputs.length===1&&this.hasVariable())return t;throw new Error("Cannot invert non-invertible formula")}evaluateIntegral(t){if(!this.isIntegrable())throw new Error("Cannot evaluate integral of formula without integral");return this.getIntegralFormula().evaluate(t)}invertIntegral(t){if(!this.isIntegrable()||!this.getIntegralFormula().isInvertible())throw new Error("Cannot invert integral of formula without invertible integral");return this.getIntegralFormula().invert(t)}calculateConstantOfIntegration(){const t=this.getIntegralFormula().evaluate(1),n=o.add(this.evaluate(0),this.evaluate(1)).div(2);return o.sub(n,t)}getIntegralFormula(t){if(this.integralFormula!=null&&t==null)return this.integralFormula;if(t==null){if(this.applySubstitution==null){if(t=[],this.internalIntegrate==null)throw new Error("Cannot integrate formula with non-integrable operation");let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(i=>n=i(n)),this.integralFormula=n}else if(this.internalIntegrate)this.integralFormula=this.internalIntegrate.call(this,void 0,...this.inputs);else if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())this.integralFormula=this;else throw new Error("Cannot integrate formula without variable");return this.integralFormula}else{if(this.applySubstitution==null)throw new Error("Cannot have two complex operations in an integrable formula");if(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner)return this.internalIntegrateInner.call(this,t,...this.inputs);if(this.internalIntegrate)return this.internalIntegrate.call(this,t,...this.inputs);if(this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable())return this;throw new Error("Cannot integrate formula without variable")}}}function Ar(e,t,n=!0,i,r=o.dInf){const a=_e(n),u=_e(i),l=_e(r);return N(()=>{var b,v,y,_;const c=s(l);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const d=s(a),h=(b=s(u))!=null?b:d?10:0;let f=0;if(o.gt(c,h)){if(!e.isInvertible())throw new Error("Cannot calculate max affordable of non-invertible formula with more maxBulkAmount than directSum");if(d){if(!e.isIntegralInvertible())throw new Error("Cannot calculate max affordable of formula with non-invertible integral");f=o.floor(e.invertIntegral(o.add(t.value,e.evaluateIntegral()))).sub((v=s(e.innermostVariable))!=null?v:0)}else f=o.floor(e.invert(t.value))}if(f=o.clampMax(f,c),h>0){const I=f;f=o.sub(f,h).clampMin(0);let P;for(d?P=Qt(e,f,!0,0):P=e.evaluate(o.add((y=s(e.innermostVariable))!=null?y:0,f));o.lt(f,c)&&o.lt(f,Number.MAX_SAFE_INTEGER)&&o.add(I,1).gte(f);){const S=e.evaluate(f.add((_=s(e.innermostVariable))!=null?_:0));if(o.add(P,S).lte(t.value))f=f.add(1),P=o.add(P,S);else break}}return f})}function Qt(e,t,n=!0,i){var c;if(o.eq(t,1))return e.evaluate();const r=(c=s(e.innermostVariable))!=null?c:0;let a=o.add(t,r);const u=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let l=0;if(o.gt(t,i)){if(!e.isInvertible())throw new Error("Cannot calculate cost with indirect sum of non-invertible formula");if(n){if(!e.isIntegrable())throw new Error("Cannot calculate cost with cumulative cost of non-integrable formula");if(l=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),u.gt(1e308))return o.add(l,o.sub(u,a).times(e.evaluate(a)))}else if(l=e.evaluate(a),a=a.add(1),u.gt(1e308))return o.sub(u,a).add(1).times(l)}for(let d=a.toNumber();dn.trim()).join(` -`))!=null?t:""}function dr(e,t){var n;if(o.isNaN(t))throw Ue.hasNaN||(Q.autosave=!1,Ue.hasNaN=!0,Ue.NaNPath=e[dn],Ue.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[dn])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[en].value=t}function lt(e,t=!0){const n=Fe(e)?e:z(e);Fe(e)&&(e=e.value);const i=N({get(){return n.value},set(a){t?dr(r,a):r[en].value=a}});i[Ht]=e;const r={get value(){return n.value},set value(a){t?dr(r,a):r[en].value=a},__v_isRef:!0,[en]:n,[Ht]:e,[ci]:ol(),[di]:!1,[Dt]:i,[dn]:void 0};return ut.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,` +`))!=null?t:""}function dr(e,t){var n;if(o.isNaN(t))throw We.hasNaN||(Q.autosave=!1,We.hasNaN=!0,We.NaNPath=e[dn],We.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[dn])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[en].value=t}function lt(e,t=!0){const n=Fe(e)?e:z(e);Fe(e)&&(e=e.value);const i=N({get(){return n.value},set(a){t?dr(r,a):r[en].value=a}});i[Ht]=e;const r={get value(){return n.value},set value(a){t?dr(r,a):r[en].value=a},__v_isRef:!0,[en]:n,[Ht]:e,[pi]:ol(),[fi]:!1,[Pt]:i,[dn]:void 0};return ut.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,` Created at: -`+r[ci]):pn[ut[ut.length-1]].add(r),r}function ll(e){return e!=null&&typeof e=="object"&&en in e}function kn(e){return!(Jt in e)&&Dt in e?e[Dt]:new Proxy(e,{get(t,n){if(n!==en)return n===Zn?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===en?!1:n==Zn?!0:Reflect.has(t,n)}})}function Rr(e){ut.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):pn[ut[ut.length-1]].delete(e),e[di]=!0}Qe.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let u=!1;return Object.keys(r).forEach(l=>{let c=r[l];if(c!=null&&typeof c=="object"){if(c[Zn]===!0)return;if(Jt in c&&(c=c[Jt]),ll(c)){if(u=!0,c[di]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,` +`+r[pi]):pn[ut[ut.length-1]].add(r),r}function ll(e){return e!=null&&typeof e=="object"&&en in e}function kn(e){return!(Jt in e)&&Pt in e?e[Pt]:new Proxy(e,{get(t,n){if(n!==en)return n===Zn?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===en?!1:n==Zn?!0:Reflect.has(t,n)}})}function Rr(e){ut.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):pn[ut[ut.length-1]].delete(e),e[fi]=!0}Qe.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let u=!1;return Object.keys(r).forEach(l=>{let c=r[l];if(c!=null&&typeof c=="object"){if(c[Zn]===!0)return;if(Jt in c&&(c=c[Jt]),ll(c)){if(u=!0,c[fi]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,` Created at: -`+c[ci]);return}pn[e.id].delete(c);const d=[e.id,...a,l];c[dn]!=null&&JSON.stringify(d)!==JSON.stringify(c[dn])&&console.error(`Persistent ref is being saved to \`${d.join(".")}\` when it's already present at \`${c[dn].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[dn]=d;const h=a.reduce((b,v)=>(v in b||(b[v]={}),b[v]),t),f=h[l];h[l]=c[en],ra(h)?f!=null?h[l]=f:h[l]=c[Ht]:f!=null?h[l].value=f:h[l].value=c[Ht]}else!(c instanceof o)&&!(c instanceof g)&&!Fe(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,l])&&(At(c)&&!At(r)?console.warn("Found array that contains persistent values when adding layer. Keep in mind changing the order of elements in the array will mess with existing player saves.",Jt in r?r[Jt]:r,l):u=!0))}}),u};i(e[Jt]),pn[e.id].forEach(r=>{r[di]||console.error(`Created persistent ref in ${e.id} without registering it to the layer! Make sure to include everything persistent in the returned object`,r,` +`+c[pi]);return}pn[e.id].delete(c);const d=[e.id,...a,l];c[dn]!=null&&JSON.stringify(d)!==JSON.stringify(c[dn])&&console.error(`Persistent ref is being saved to \`${d.join(".")}\` when it's already present at \`${c[dn].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[dn]=d;const h=a.reduce((b,v)=>(v in b||(b[v]={}),b[v]),t),f=h[l];h[l]=c[en],ra(h)?f!=null?h[l]=f:h[l]=c[Ht]:f!=null?h[l].value=f:h[l].value=c[Ht]}else!(c instanceof o)&&!(c instanceof g)&&!Fe(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,l])&&(At(c)&&!At(r)?console.warn("Found array that contains persistent values when adding layer. Keep in mind changing the order of elements in the array will mess with existing player saves.",Jt in r?r[Jt]:r,l):u=!0))}}),u};i(e[Jt]),pn[e.id].forEach(r=>{r[fi]||console.error(`Created persistent ref in ${e.id} without registering it to the layer! Make sure to include everything persistent in the returned object`,r,` Created at: -`+r[ci])}),pn[e.id].clear()});const Li=Symbol("RegisterNode"),ji=Symbol("UnregisterNode"),zi=Symbol("Nodes"),Gi=Symbol("Bounds"),ge=qi({});window.layers=ge;const pn={},ut=[];function Ui(e,t){return et(()=>{const n={},i=n.emitter=yr();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=z({}),n.id=e,ut.push(e),pn[e]=new Set,n.minimized=lt(!1,!1),Object.assign(n,t.call(n,n)),ut[ut.length-1]==null||ut[ut.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen +`+r[pi])}),pn[e.id].clear()});const zi=Symbol("RegisterNode"),Gi=Symbol("UnregisterNode"),Ui=Symbol("Nodes"),Wi=Symbol("Bounds"),ge=Bi({});window.layers=ge;const pn={},ut=[];function Hi(e,t){return et(()=>{const n={},i=n.emitter=yr();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=z({}),n.id=e,ut.push(e),pn[e]=new Set,n.minimized=lt(!1,!1),Object.assign(n,t.call(n,n)),ut[ut.length-1]==null||ut[ut.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen Stack: ${ut} -Trying to pop ${n.id}`;ut.pop(),$(n,"color"),$(n,"display"),$(n,"classes"),$(n,"style"),$(n,"name"),oe(n,"name",n.id),$(n,"minWidth"),oe(n,"minWidth",600),$(n,"minimizable"),oe(n,"minimizable",!0),$(n,"minimizedDisplay");const r=n.style;return n.style=N(()=>{var u,l;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(u=s(r))!=null?u:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Wi(e,t){if(console.info("Adding layer",e.id),ge[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,ge[e.id]);return}oe(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),ge[e.id]=e,Qe.emit("addLayer",e,t.layers[e.id])}function ul(e){return ge[e]}function Hi(e){console.info("Removing layer",e.id),Qe.emit("removeLayer",e),ge[e.id]=void 0}function cl(e){Hi(e),Wi(e,Q)}function dl(e){const t=z(!1);return{openModal:()=>t.value=!0,modal:Z(()=>p(Rt,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>p("h2",null,[s(e.name)]),body:s(e.display)}))}}Qe.on("update",function(t){Object.values(ge).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("postUpdate",t)})});var pl=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Li,UnregisterNodeInjectionKey:ji,NodesInjectionKey:zi,BoundsInjectionKey:Gi,layers:ge,persistentRefs:pn,addingLayers:ut,createLayer:Ui,addLayer:Wi,getLayer:ul,removeLayer:Hi,reloadLayer:cl,setupLayerModal:dl},Symbol.toStringTag,{value:"Module"}));const fl=J({components:{Context:Dr},props:{index:{type:Number,required:!0},display:{type:q(Object,String,Function),required:!0},minimizedDisplay:q(Object,String,Function),minimized:{type:Object,required:!0},name:{type:q(String),required:!0},color:q(String),minimizable:q(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=Te(e),a=Pr(t),u=Dn(r),l=N(()=>we.allowGoBack&&n.value>0&&!Ee(i));function c(){Q.tabs.splice(s(e.index),1/0)}function d(h){e.nodes.value=h}return{component:a,minimizedComponent:u,showGoBack:l,updateNodes:d,unref:s,goBack:c}}}),gl={key:1};function ml(e,t,n,i,r,a){const u=kt("Context");return M(),A("div",{class:"layer-container",style:Be({"--layer-color":e.unref(e.color)})},[e.showGoBack?(M(),A("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...l)=>e.goBack&&e.goBack(...l))},"\u274C")):j("",!0),e.unref(e.minimized)?(M(),A("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=l=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(M(),ne(Ke(e.minimizedComponent),{key:0})):(M(),A("div",gl,de(e.unref(e.name)),1))])):(M(),A("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[p(u,{onUpdateNodes:e.updateNodes},{default:Y(()=>[(M(),ne(Ke(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(M(),A("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=l=>e.$emit("setMinimized",!0))}," \u25BC ")):j("",!0)],4)}var vl=ve(fl,[["render",ml],["__scopeId","data-v-72dd78b1"]]);const Fr=e=>(gn("data-v-4b4bda40"),e=e(),mn(),e),hl=Fr(()=>C("h2",null,"Changelog",-1)),bl=Fr(()=>C("details",{open:""},[C("summary",null,[P("v0.0 Initial Commit - "),C("time",null,"2021-09-04")]),P(" This is the first release :D "),C("ul",null,[C("li",{class:"feature"},"Did everything"),C("li",{class:"fix"},"Had some fun"),C("li",{class:"breaking"},"Removed everything"),C("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),yl=J({__name:"Changelog",setup(e,{expose:t}){const n=z(!1);return t({open(){n.value=!0}}),(i,r)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:Y(()=>[hl]),body:Y(()=>[bl]),_:1},8,["modelValue"]))}});var wl=ve(yl,[["__scopeId","data-v-4b4bda40"]]),_l=J({props:{element:Object,display:{type:q(Object,String,Function),required:!0},style:q(Object,String,Array),classes:q(Object),direction:q(String),xoffset:q(String),yoffset:q(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=Te(e),r=z(!1),a=N(()=>(Ee(i)||r.value)&&u.value),u=Dn(n),l=ht(pe(Z(()=>{const h=Ee(t);return h==null?"":Ct(h)})));function c(h){const f=i;h.shiftKey&&f&&(f.value=!f.value,h.stopPropagation(),h.preventDefault())}const d=N(()=>Ee(i)&&Nt[ce.theme].showPin);return{Direction:W,isHovered:r,isShown:a,comp:u,elementComp:l,unref:s,togglePinned:c,showPin:d}}});const Nl={key:0,class:"material-icons pinned"};function Cl(e,t,n,i,r,a){return M(),A("div",{class:Ne(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=u=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=u=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...u)=>e.togglePinned&&e.togglePinned(...u))},[Tt(e.$slots,"default",{},void 0,!0),e.elementComp?(M(),ne(Ke(e.elementComp),{key:0})):j("",!0),p(zn,{name:"fade"},{default:Y(()=>{var u;return[e.isShown?(M(),A("div",{key:0,class:Ne(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:Be([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(u=e.unref(e.style))!=null?u:{}])},[e.showPin?(M(),A("span",Nl,"push_pin")):j("",!0),e.comp?(M(),ne(Ke(e.comp),{key:1})):j("",!0)],6)):j("",!0)]}),_:1})],34)}var Re=ve(_l,[["render",Cl],["__scopeId","data-v-6102fa3a"]]);const hn=e=>(gn("data-v-4f97aa40"),e=e(),mn(),e),kl={class:"info-modal-header"},Ml=["src","alt"],Sl={class:"info-modal-title"},Il={key:0},xl={key:0},$l={key:0},El=hn(()=>C("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Pl=hn(()=>C("br",null,null,-1)),Dl=hn(()=>C("br",null,null,-1)),Tl=["href"],Al=hn(()=>C("span",{class:"material-icons info-modal-discord"},"discord",-1)),Rl=hn(()=>C("div",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[C("span",{class:"material-icons info-modal-discord"},"discord"),P(" The Paper Pilot Community ")])],-1)),Fl=hn(()=>C("div",null,[C("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[C("span",{class:"material-icons info-modal-discord"},"discord"),P(" The Modding Tree ")])],-1)),Ol=hn(()=>C("br",null,null,-1));var ql=J({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:u,discordLink:l,versionNumber:c,versionTitle:d}=we,h=Te(n),f=z(!1),b=N(()=>vi(Q.timePlayed)),v=N(()=>pe(Z(()=>p(re,null,[bs.map(ot)]))));t({open(){f.value=!0}});function y(){var _;(_=s(h.changelog))==null||_.open()}return(_,I)=>(M(),ne(Rt,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=D=>f.value=D)},{header:Y(()=>[C("div",kl,[s(r)?(M(),A("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,Ml)):j("",!0),C("div",Sl,[C("h2",null,de(s(i)),1),C("h4",null,[P(" v"+de(s(c)),1),s(d)?(M(),A("span",Il,": "+de(s(d)),1)):j("",!0)])])])]),body:Y(({shown:D})=>[D?(M(),A("div",xl,[s(a)?(M(),A("div",$l,"By "+de(s(a)),1)):j("",!0),El,Pl,C("div",{class:"link",onClick:y},"Changelog"),Dl,C("div",null,[s(l)?(M(),A("a",{key:0,href:s(l),class:"info-modal-discord-link",target:"_blank"},[Al,P(" "+de(s(u)),1)],8,Tl)):j("",!0)]),Rl,Fl,Ol,C("div",null,"Time Played: "+de(s(b)),1),(M(),ne(Ke(s(v))))])):j("",!0)]),_:1},8,["modelValue"]))}});var Vl=ve(ql,[["__scopeId","data-v-4f97aa40"]]);const Bl={class:"field"},Ll={key:0,class:"field-title"},Yi=J({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var u;const n=e,i=Dn(tn(n,"title"),"span"),r=z((u=n.options.find(l=>l.value===n.modelValue))!=null?u:null);vt(tn(n,"modelValue"),l=>{var c;Ee(r)!==l&&(r.value=(c=n.options.find(d=>d.value===l))!=null?c:null)});function a(l){t("update:modelValue",l.value)}return(l,c)=>(M(),A("div",Bl,[s(i)?(M(),A("span",Ll,[(M(),ne(Ke(s(i))))])):j("",!0),p(s(ca),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=d=>r.value=d),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const jl={class:"field"},zl=J({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=N(()=>{var a;return pe((a=s(n.title))!=null?a:"","span")}),r=N({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,u)=>(M(),A("label",jl,[Oi(C("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":u[0]||(u[0]=l=>Fe(r)?r.value=l:null)},null,512),[[aa,s(r)]]),(M(),ne(Ke(s(i))))]))}});var jt=ve(zl,[["__scopeId","data-v-11046116"]]);const Gl=["onClick"],Ul=J({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=z(!1),i=z(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,Ut(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,u)=>(M(),A("button",{onClick:$n(r,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[Tt(a.$slots,"default",{},void 0,!0)],10,Gl))}});var Or=ve(Ul,[["__scopeId","data-v-01a1b95c"]]);const Wl={class:"header"},Hl=C("h2",null,"Settings",-1),Yl={class:"option-tabs"},Zl={key:0},Xl={key:1};var Jl=J({__name:"Options",setup(e,{expose:t}){const n=z(!1),i=z("behaviour");function r(ae){return ae==i.value}function a(ae){i.value=ae}t({isTab:r,setTab:a,save:mt,open(){n.value=!0}});const u=Object.keys(Nt).map(ae=>({label:at(ae),value:ae})),l=N(()=>pe(Z(()=>p(re,null,[xr.map(ot)])))),{showTPS:c,theme:d,unthrottled:h,alignUnits:f}=Te(ce),{autosave:b,offlineProd:v}=Te(Q),y=N({get(){return Q.devSpeed===0},set(ae){Q.devSpeed=ae?0:null}}),_=Z(()=>p("span",{class:"option-title"},[P("Unthrottled"),p("desc",null,[P("Allow the game to run as fast as possible. Not battery friendly.")])])),I=Z(()=>p("span",{class:"option-title"},[P("Offline Production"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[P("*")]}),p("desc",null,[P("Simulate production that occurs while the game is closed.")])])),D=Z(()=>p("span",{class:"option-title"},[P("Autosave"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[P("*")]}),p("desc",null,[P("Automatically save the game every second or when the game is closed.")])])),S=Z(()=>p("span",{class:"option-title"},[P("Pause game"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[P("*")]}),p("desc",null,[P("Stop everything from moving.")])])),T=Z(()=>p("span",{class:"option-title"},[P("Theme"),p("desc",null,[P("How the game looks.")])])),B=Z(()=>p("span",{class:"option-title"},[P("Show TPS"),p("desc",null,[P("Show TPS meter at the bottom-left corner of the page.")])])),le=Z(()=>p("span",{class:"option-title"},[P("Align modifier units"),p("desc",null,[P("Align numbers to the beginning of the unit in modifier view.")])]));return(ae,te)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":te[10]||(te[10]=K=>n.value=K)},{header:Y(()=>[C("div",Wl,[Hl,C("div",Yl,[C("button",{class:Ne({selected:r("behaviour")}),onClick:te[0]||(te[0]=K=>a("behaviour"))},"Behaviour",2),C("button",{class:Ne({selected:r("appearance")}),onClick:te[1]||(te[1]=K=>a("appearance"))},"Appearance",2)])])]),body:Y(()=>[r("behaviour")?(M(),A("div",Zl,[p(jt,{title:s(_),modelValue:s(h),"onUpdate:modelValue":te[2]||(te[2]=K=>Fe(h)?h.value=K:null)},null,8,["title","modelValue"]),s(we).enablePausing?(M(),ne(jt,{key:0,title:s(S),modelValue:s(y),"onUpdate:modelValue":te[3]||(te[3]=K=>Fe(y)?y.value=K:null)},null,8,["title","modelValue"])):j("",!0),p(jt,{title:s(I),modelValue:s(v),"onUpdate:modelValue":te[4]||(te[4]=K=>Fe(v)?v.value=K:null)},null,8,["title","modelValue"]),p(jt,{title:s(D),modelValue:s(b),"onUpdate:modelValue":te[5]||(te[5]=K=>Fe(b)?b.value=K:null)},null,8,["title","modelValue"]),s(b)?j("",!0):(M(),ne(Or,{key:1,class:"button save-button",onClick:te[6]||(te[6]=K=>s(mt)())},{default:Y(()=>[P("Manually save")]),_:1}))])):j("",!0),r("appearance")?(M(),A("div",Xl,[p(Yi,{title:s(T),options:s(u),modelValue:s(d),"onUpdate:modelValue":te[7]||(te[7]=K=>Fe(d)?d.value=K:null)},null,8,["title","options","modelValue"]),(M(),ne(Ke(s(l)))),p(jt,{title:s(B),modelValue:s(c),"onUpdate:modelValue":te[8]||(te[8]=K=>Fe(c)?c.value=K:null)},null,8,["title","modelValue"]),p(jt,{title:s(le),modelValue:s(f),"onUpdate:modelValue":te[9]||(te[9]=K=>Fe(f)?f.value=K:null)},null,8,["title","modelValue"])])):j("",!0)]),_:1},8,["modelValue"]))}});const Kl=["onSubmit"],Ql={class:"field"},eu={key:0,class:"field-title"},tu=["placeholder"],nu=J({__name:"Text",props:{title:null,modelValue:null,textArea:{type:Boolean},placeholder:null,maxHeight:null,submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(e,{emit:t}){const n=e,i=Dn(tn(n,"title"),"span"),r=ht(null);gi(()=>{var c;(c=r.value)==null||c.focus()});const a=N({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function u(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,d)=>(M(),A("form",{onSubmit:$n(u,["prevent"])},[C("div",Ql,[s(i)?(M(),A("span",eu,[(M(),ne(Ke(s(i))))])):j("",!0),e.textArea?(M(),ne(s(pa),{key:1,modelValue:s(a),"onUpdate:modelValue":d[0]||(d[0]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Oi((M(),A("input",{key:2,type:"text","onUpdate:modelValue":d[1]||(d[1]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:r},null,42,tu)),[[sa,s(a)]])])],40,Kl))}});var qr=ve(nu,[["__scopeId","data-v-90bd4994"]]);const iu={key:0},ru=["onClick","disabled"],au={key:0},su=["onClick"],ou=J({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=Te(e),r=z(!1);vt(r,l=>{t("confirmingChanged",l)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function u(){r.value=!1}return(l,c)=>(M(),A("span",{class:Ne(["container",{confirming:r.value}])},[r.value?(M(),A("span",iu,"Are you sure?")):j("",!0),C("button",{onClick:$n(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(M(),A("span",au,"Yes")):Tt(l.$slots,"default",{key:1},void 0,!0)],8,ru),r.value?(M(),A("button",{key:1,class:"button",onClick:$n(u,["stop"])},"No",8,su)):j("",!0)],2))}});var lu=ve(ou,[["__scopeId","data-v-2f8ef34c"]]);const Yt=e=>(gn("data-v-32313015"),e=e(),mn(),e),uu=Yt(()=>C("div",{class:"handle material-icons"},"drag_handle",-1)),cu={key:0,class:"actions"},du=Yt(()=>C("span",{class:"material-icons"},"content_paste",-1)),pu=Yt(()=>C("span",{class:"material-icons"},"content_copy",-1)),fu=Yt(()=>C("span",{class:"material-icons"},"edit",-1)),gu=Yt(()=>C("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),mu={key:1,class:"actions"},vu=Yt(()=>C("span",{class:"material-icons"},"check",-1)),hu=Yt(()=>C("span",{class:"material-icons"},"close",-1)),bu={key:2,class:"details"},yu={class:"save-version"},wu=Yt(()=>C("br",null,null,-1)),_u={key:0},Nu={key:3,class:"details"},Cu={key:4,class:"details error"},ku=Yt(()=>C("br",null,null,-1)),Mu=J({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=Te(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=z(!1),u=z(!1),l=z("");vt(a,()=>{var f;return l.value=(f=i.value.name)!=null?f:""});const c=N(()=>i.value!=null&&i.value.id===Q.id),d=N(()=>{var f;return c.value?Q.time:(f=i.value!=null&&i.value.time)!=null?f:0});function h(){t("editName",l.value),a.value=!1}return(f,b)=>(M(),A("div",{class:Ne(["save",{active:s(c)}])},[uu,a.value?(M(),A("div",mu,[C("button",{onClick:h,class:"button"},[p(Re,{display:"Save",direction:s(W).Left,class:"info"},{default:Y(()=>[vu]),_:1},8,["direction"])]),C("button",{onClick:b[5]||(b[5]=v=>a.value=!a.value),class:"button"},[p(Re,{display:"Cancel",direction:s(W).Left,class:"info"},{default:Y(()=>[hu]),_:1},8,["direction"])])])):(M(),A("div",cu,[s(i).error==null&&!u.value?(M(),ne(Or,{key:0,onClick:b[0]||(b[0]=v=>t("export")),class:"button",left:""},{default:Y(()=>[p(Re,{display:"Export",direction:s(W).Left,class:"info"},{default:Y(()=>[du]),_:1},8,["direction"])]),_:1})):j("",!0),s(i).error==null&&!u.value?(M(),A("button",{key:1,onClick:b[1]||(b[1]=v=>t("duplicate")),class:"button"},[p(Re,{display:"Duplicate",direction:s(W).Left,class:"info"},{default:Y(()=>[pu]),_:1},8,["direction"])])):j("",!0),s(i).error==null&&!u.value?(M(),A("button",{key:2,onClick:b[2]||(b[2]=v=>a.value=!a.value),class:"button"},[p(Re,{display:"Edit Name",direction:s(W).Left,class:"info"},{default:Y(()=>[fu]),_:1},8,["direction"])])):j("",!0),p(lu,{disabled:s(c),onClick:b[3]||(b[3]=v=>t("delete")),onConfirmingChanged:b[4]||(b[4]=v=>u.value=v)},{default:Y(()=>[p(Re,{display:"Delete",direction:s(W).Left,class:"info"},{default:Y(()=>[gu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(M(),A("div",bu,[C("button",{class:"button open",onClick:b[6]||(b[6]=v=>t("open"))},[C("h3",null,de(s(i).name),1)]),C("span",yu,"v"+de(s(i).modVersion),1),wu,s(d)?(M(),A("div",_u,"Last played "+de(s(r).format(s(d))),1)):j("",!0)])):s(i).error==null&&a.value?(M(),A("div",Nu,[p(qr,{modelValue:l.value,"onUpdate:modelValue":b[7]||(b[7]=v=>l.value=v),class:"editname",onSubmit:h},null,8,["modelValue"])])):(M(),A("div",Cu,[P(" Error: Failed to load save with id "+de(s(i).id),1),ku,P(de(s(i).error),1)]))],2))}});var Su=ve(Mu,[["__scopeId","data-v-32313015"]]);const Zi=e=>(gn("data-v-2a4275be"),e=e(),mn(),e),Iu=Zi(()=>C("h2",null,"Saves Manager",-1)),xu={class:"modal-footer"},$u={class:"field"},Eu=Zi(()=>C("span",{class:"field-title"},"Create Save",-1)),Pu={class:"field-buttons"},Du={class:"footer"},Tu=Zi(()=>C("div",{style:{"flex-grow":"1"}},null,-1)),Au=J({__name:"SavesManager",setup(e,{expose:t}){const n=z(!1),i=z(null);t({open(){n.value=!0}});const r=z(!1),a=z(""),u=z(null);vt(a,S=>{S?Ut(()=>{try{if(S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S),r.value=!0;return}const T=JSON.parse(S);if(typeof T!="object"){r.value=!0;return}const B=oi();T.id=B,mt(T),a.value="",r.value=!1,ce.saves.push(B)}catch{r.value=!0}}):r.value=!1});let l={},c=z(Object.keys(l).reduce((S,T)=>(S.push({label:T.split("/").slice(-1)[0].slice(0,-4),value:l[T]}),S),[]));const d=qi({});function h(S){if(d[S]==null){let T=localStorage.getItem(S);if(T==null)d[S]={error:"Save doesn't exist in localStorage",id:S};else if(T==="dW5kZWZpbmVk")d[S]={error:"Save is undefined",id:S};else try{if(T[0]!=="{")if(T[0]==="e")T=decodeURIComponent(escape(atob(T)));else if(T[0]==="\u1BE1")T=Kt.decompressFromUTF16(T);else return console.warn("Unable to determine preset encoding",T),r.value=!0,d[S]={error:"Unable to determine preset encoding",id:S},d[S];d[S]={...JSON.parse(T),id:S}}catch(B){d[S]={error:B,id:S},console.warn(`SavesManager: Failed to load info about save with id ${S}: +Trying to pop ${n.id}`;ut.pop(),E(n,"color"),E(n,"display"),E(n,"classes"),E(n,"style"),E(n,"name"),oe(n,"name",n.id),E(n,"minWidth"),oe(n,"minWidth",600),E(n,"minimizable"),oe(n,"minimizable",!0),E(n,"minimizedDisplay");const r=n.style;return n.style=N(()=>{var u,l;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(u=s(r))!=null?u:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Yi(e,t){if(console.info("Adding layer",e.id),ge[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,ge[e.id]);return}oe(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),ge[e.id]=e,Qe.emit("addLayer",e,t.layers[e.id])}function ul(e){return ge[e]}function Zi(e){console.info("Removing layer",e.id),Qe.emit("removeLayer",e),ge[e.id]=void 0}function cl(e){Zi(e),Yi(e,Q)}function dl(e){const t=z(!1);return{openModal:()=>t.value=!0,modal:Y(()=>p(Rt,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>p("h2",null,[s(e.name)]),body:s(e.display)}))}}Qe.on("update",function(t){Object.values(ge).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("postUpdate",t)})});var pl=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:zi,UnregisterNodeInjectionKey:Gi,NodesInjectionKey:Ui,BoundsInjectionKey:Wi,layers:ge,persistentRefs:pn,addingLayers:ut,createLayer:Hi,addLayer:Yi,getLayer:ul,removeLayer:Zi,reloadLayer:cl,setupLayerModal:dl},Symbol.toStringTag,{value:"Module"}));const fl=J({components:{Context:Pr},props:{index:{type:Number,required:!0},display:{type:q(Object,String,Function),required:!0},minimizedDisplay:q(Object,String,Function),minimized:{type:Object,required:!0},name:{type:q(String),required:!0},color:q(String),minimizable:q(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=Te(e),a=Dr(t),u=Pn(r),l=N(()=>we.allowGoBack&&n.value>0&&!Ee(i));function c(){Q.tabs.splice(s(e.index),1/0)}function d(h){e.nodes.value=h}return{component:a,minimizedComponent:u,showGoBack:l,updateNodes:d,unref:s,goBack:c}}}),gl={key:1};function ml(e,t,n,i,r,a){const u=kt("Context");return M(),A("div",{class:"layer-container",style:Be({"--layer-color":e.unref(e.color)})},[e.showGoBack?(M(),A("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...l)=>e.goBack&&e.goBack(...l))},"\u274C")):j("",!0),e.unref(e.minimized)?(M(),A("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=l=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(M(),ne(Ke(e.minimizedComponent),{key:0})):(M(),A("div",gl,de(e.unref(e.name)),1))])):(M(),A("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[p(u,{onUpdateNodes:e.updateNodes},{default:Z(()=>[(M(),ne(Ke(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(M(),A("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=l=>e.$emit("setMinimized",!0))}," \u25BC ")):j("",!0)],4)}var vl=ve(fl,[["render",ml],["__scopeId","data-v-72dd78b1"]]);const Fr=e=>(gn("data-v-4b4bda40"),e=e(),mn(),e),hl=Fr(()=>C("h2",null,"Changelog",-1)),bl=Fr(()=>C("details",{open:""},[C("summary",null,[$("v0.0 Initial Commit - "),C("time",null,"2021-09-04")]),$(" This is the first release :D "),C("ul",null,[C("li",{class:"feature"},"Did everything"),C("li",{class:"fix"},"Had some fun"),C("li",{class:"breaking"},"Removed everything"),C("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),yl=J({__name:"Changelog",setup(e,{expose:t}){const n=z(!1);return t({open(){n.value=!0}}),(i,r)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:Z(()=>[hl]),body:Z(()=>[bl]),_:1},8,["modelValue"]))}});var wl=ve(yl,[["__scopeId","data-v-4b4bda40"]]),_l=J({props:{element:Object,display:{type:q(Object,String,Function),required:!0},style:q(Object,String,Array),classes:q(Object),direction:q(String),xoffset:q(String),yoffset:q(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=Te(e),r=z(!1),a=N(()=>(Ee(i)||r.value)&&u.value),u=Pn(n),l=ht(pe(Y(()=>{const h=Ee(t);return h==null?"":Ct(h)})));function c(h){const f=i;h.shiftKey&&f&&(f.value=!f.value,h.stopPropagation(),h.preventDefault())}const d=N(()=>Ee(i)&&Nt[ce.theme].showPin);return{Direction:W,isHovered:r,isShown:a,comp:u,elementComp:l,unref:s,togglePinned:c,showPin:d}}});const Nl={key:0,class:"material-icons pinned"};function Cl(e,t,n,i,r,a){return M(),A("div",{class:Ne(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=u=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=u=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...u)=>e.togglePinned&&e.togglePinned(...u))},[Tt(e.$slots,"default",{},void 0,!0),e.elementComp?(M(),ne(Ke(e.elementComp),{key:0})):j("",!0),p(zn,{name:"fade"},{default:Z(()=>{var u;return[e.isShown?(M(),A("div",{key:0,class:Ne(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:Be([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(u=e.unref(e.style))!=null?u:{}])},[e.showPin?(M(),A("span",Nl,"push_pin")):j("",!0),e.comp?(M(),ne(Ke(e.comp),{key:1})):j("",!0)],6)):j("",!0)]}),_:1})],34)}var Re=ve(_l,[["render",Cl],["__scopeId","data-v-6102fa3a"]]);const hn=e=>(gn("data-v-4f97aa40"),e=e(),mn(),e),kl={class:"info-modal-header"},Ml=["src","alt"],Sl={class:"info-modal-title"},Il={key:0},xl={key:0},$l={key:0},El=hn(()=>C("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Dl=hn(()=>C("br",null,null,-1)),Pl=hn(()=>C("br",null,null,-1)),Tl=["href"],Al=hn(()=>C("span",{class:"material-icons info-modal-discord"},"discord",-1)),Rl=hn(()=>C("div",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[C("span",{class:"material-icons info-modal-discord"},"discord"),$(" The Paper Pilot Community ")])],-1)),Fl=hn(()=>C("div",null,[C("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[C("span",{class:"material-icons info-modal-discord"},"discord"),$(" The Modding Tree ")])],-1)),Ol=hn(()=>C("br",null,null,-1));var ql=J({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:u,discordLink:l,versionNumber:c,versionTitle:d}=we,h=Te(n),f=z(!1),b=N(()=>bi(Q.timePlayed)),v=N(()=>pe(Y(()=>p(re,null,[bs.map(ot)]))));t({open(){f.value=!0}});function y(){var _;(_=s(h.changelog))==null||_.open()}return(_,I)=>(M(),ne(Rt,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=P=>f.value=P)},{header:Z(()=>[C("div",kl,[s(r)?(M(),A("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,Ml)):j("",!0),C("div",Sl,[C("h2",null,de(s(i)),1),C("h4",null,[$(" v"+de(s(c)),1),s(d)?(M(),A("span",Il,": "+de(s(d)),1)):j("",!0)])])])]),body:Z(({shown:P})=>[P?(M(),A("div",xl,[s(a)?(M(),A("div",$l,"By "+de(s(a)),1)):j("",!0),El,Dl,C("div",{class:"link",onClick:y},"Changelog"),Pl,C("div",null,[s(l)?(M(),A("a",{key:0,href:s(l),class:"info-modal-discord-link",target:"_blank"},[Al,$(" "+de(s(u)),1)],8,Tl)):j("",!0)]),Rl,Fl,Ol,C("div",null,"Time Played: "+de(s(b)),1),(M(),ne(Ke(s(v))))])):j("",!0)]),_:1},8,["modelValue"]))}});var Vl=ve(ql,[["__scopeId","data-v-4f97aa40"]]);const Bl={class:"field"},Ll={key:0,class:"field-title"},Xi=J({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var u;const n=e,i=Pn(tn(n,"title"),"span"),r=z((u=n.options.find(l=>l.value===n.modelValue))!=null?u:null);vt(tn(n,"modelValue"),l=>{var c;Ee(r)!==l&&(r.value=(c=n.options.find(d=>d.value===l))!=null?c:null)});function a(l){t("update:modelValue",l.value)}return(l,c)=>(M(),A("div",Bl,[s(i)?(M(),A("span",Ll,[(M(),ne(Ke(s(i))))])):j("",!0),p(s(ca),{options:e.options,modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=d=>r.value=d),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const jl={class:"field"},zl=J({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=N(()=>{var a;return pe((a=s(n.title))!=null?a:"","span")}),r=N({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,u)=>(M(),A("label",jl,[Vi(C("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":u[0]||(u[0]=l=>Fe(r)?r.value=l:null)},null,512),[[aa,s(r)]]),(M(),ne(Ke(s(i))))]))}});var jt=ve(zl,[["__scopeId","data-v-11046116"]]);const Gl=["onClick"],Ul=J({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=z(!1),i=z(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,Ut(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,u)=>(M(),A("button",{onClick:$n(r,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[Tt(a.$slots,"default",{},void 0,!0)],10,Gl))}});var Or=ve(Ul,[["__scopeId","data-v-01a1b95c"]]);const Wl={class:"header"},Hl=C("h2",null,"Settings",-1),Yl={class:"option-tabs"},Zl={key:0},Xl={key:1};var Jl=J({__name:"Options",setup(e,{expose:t}){const n=z(!1),i=z("behaviour");function r(ae){return ae==i.value}function a(ae){i.value=ae}t({isTab:r,setTab:a,save:mt,open(){n.value=!0}});const u=Object.keys(Nt).map(ae=>({label:at(ae),value:ae})),l=N(()=>pe(Y(()=>p(re,null,[xr.map(ot)])))),{showTPS:c,theme:d,unthrottled:h,alignUnits:f}=Te(ce),{autosave:b,offlineProd:v}=Te(Q),y=N({get(){return Q.devSpeed===0},set(ae){Q.devSpeed=ae?0:null}}),_=Y(()=>p("span",{class:"option-title"},[$("Unthrottled"),p("desc",null,[$("Allow the game to run as fast as possible. Not battery friendly.")])])),I=Y(()=>p("span",{class:"option-title"},[$("Offline Production"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[$("*")]}),p("desc",null,[$("Simulate production that occurs while the game is closed.")])])),P=Y(()=>p("span",{class:"option-title"},[$("Autosave"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[$("*")]}),p("desc",null,[$("Automatically save the game every second or when the game is closed.")])])),S=Y(()=>p("span",{class:"option-title"},[$("Pause game"),p(Re,{display:"Save-specific",direction:W.Right},{default:()=>[$("*")]}),p("desc",null,[$("Stop everything from moving.")])])),T=Y(()=>p("span",{class:"option-title"},[$("Theme"),p("desc",null,[$("How the game looks.")])])),B=Y(()=>p("span",{class:"option-title"},[$("Show TPS"),p("desc",null,[$("Show TPS meter at the bottom-left corner of the page.")])])),le=Y(()=>p("span",{class:"option-title"},[$("Align modifier units"),p("desc",null,[$("Align numbers to the beginning of the unit in modifier view.")])]));return(ae,te)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":te[10]||(te[10]=K=>n.value=K)},{header:Z(()=>[C("div",Wl,[Hl,C("div",Yl,[C("button",{class:Ne({selected:r("behaviour")}),onClick:te[0]||(te[0]=K=>a("behaviour"))},"Behaviour",2),C("button",{class:Ne({selected:r("appearance")}),onClick:te[1]||(te[1]=K=>a("appearance"))},"Appearance",2)])])]),body:Z(()=>[r("behaviour")?(M(),A("div",Zl,[p(jt,{title:s(_),modelValue:s(h),"onUpdate:modelValue":te[2]||(te[2]=K=>Fe(h)?h.value=K:null)},null,8,["title","modelValue"]),s(we).enablePausing?(M(),ne(jt,{key:0,title:s(S),modelValue:s(y),"onUpdate:modelValue":te[3]||(te[3]=K=>Fe(y)?y.value=K:null)},null,8,["title","modelValue"])):j("",!0),p(jt,{title:s(I),modelValue:s(v),"onUpdate:modelValue":te[4]||(te[4]=K=>Fe(v)?v.value=K:null)},null,8,["title","modelValue"]),p(jt,{title:s(P),modelValue:s(b),"onUpdate:modelValue":te[5]||(te[5]=K=>Fe(b)?b.value=K:null)},null,8,["title","modelValue"]),s(b)?j("",!0):(M(),ne(Or,{key:1,class:"button save-button",onClick:te[6]||(te[6]=K=>s(mt)())},{default:Z(()=>[$("Manually save")]),_:1}))])):j("",!0),r("appearance")?(M(),A("div",Xl,[p(Xi,{title:s(T),options:s(u),modelValue:s(d),"onUpdate:modelValue":te[7]||(te[7]=K=>Fe(d)?d.value=K:null)},null,8,["title","options","modelValue"]),(M(),ne(Ke(s(l)))),p(jt,{title:s(B),modelValue:s(c),"onUpdate:modelValue":te[8]||(te[8]=K=>Fe(c)?c.value=K:null)},null,8,["title","modelValue"]),p(jt,{title:s(le),modelValue:s(f),"onUpdate:modelValue":te[9]||(te[9]=K=>Fe(f)?f.value=K:null)},null,8,["title","modelValue"])])):j("",!0)]),_:1},8,["modelValue"]))}});const Kl=["onSubmit"],Ql={class:"field"},eu={key:0,class:"field-title"},tu=["placeholder"],nu=J({__name:"Text",props:{title:null,modelValue:null,textArea:{type:Boolean},placeholder:null,maxHeight:null,submitOnBlur:{type:Boolean}},emits:["update:modelValue","submit","cancel"],setup(e,{emit:t}){const n=e,i=Pn(tn(n,"title"),"span"),r=ht(null);vi(()=>{var c;(c=r.value)==null||c.focus()});const a=N({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function u(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,d)=>(M(),A("form",{onSubmit:$n(u,["prevent"])},[C("div",Ql,[s(i)?(M(),A("span",eu,[(M(),ne(Ke(s(i))))])):j("",!0),e.textArea?(M(),ne(s(pa),{key:1,modelValue:s(a),"onUpdate:modelValue":d[0]||(d[0]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Vi((M(),A("input",{key:2,type:"text","onUpdate:modelValue":d[1]||(d[1]=h=>Fe(a)?a.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:r},null,42,tu)),[[sa,s(a)]])])],40,Kl))}});var qr=ve(nu,[["__scopeId","data-v-90bd4994"]]);const iu={key:0},ru=["onClick","disabled"],au={key:0},su=["onClick"],ou=J({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=Te(e),r=z(!1);vt(r,l=>{t("confirmingChanged",l)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function u(){r.value=!1}return(l,c)=>(M(),A("span",{class:Ne(["container",{confirming:r.value}])},[r.value?(M(),A("span",iu,"Are you sure?")):j("",!0),C("button",{onClick:$n(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(M(),A("span",au,"Yes")):Tt(l.$slots,"default",{key:1},void 0,!0)],8,ru),r.value?(M(),A("button",{key:1,class:"button",onClick:$n(u,["stop"])},"No",8,su)):j("",!0)],2))}});var lu=ve(ou,[["__scopeId","data-v-2f8ef34c"]]);const Yt=e=>(gn("data-v-32313015"),e=e(),mn(),e),uu=Yt(()=>C("div",{class:"handle material-icons"},"drag_handle",-1)),cu={key:0,class:"actions"},du=Yt(()=>C("span",{class:"material-icons"},"content_paste",-1)),pu=Yt(()=>C("span",{class:"material-icons"},"content_copy",-1)),fu=Yt(()=>C("span",{class:"material-icons"},"edit",-1)),gu=Yt(()=>C("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),mu={key:1,class:"actions"},vu=Yt(()=>C("span",{class:"material-icons"},"check",-1)),hu=Yt(()=>C("span",{class:"material-icons"},"close",-1)),bu={key:2,class:"details"},yu={class:"save-version"},wu=Yt(()=>C("br",null,null,-1)),_u={key:0},Nu={key:3,class:"details"},Cu={key:4,class:"details error"},ku=Yt(()=>C("br",null,null,-1)),Mu=J({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=Te(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=z(!1),u=z(!1),l=z("");vt(a,()=>{var f;return l.value=(f=i.value.name)!=null?f:""});const c=N(()=>i.value!=null&&i.value.id===Q.id),d=N(()=>{var f;return c.value?Q.time:(f=i.value!=null&&i.value.time)!=null?f:0});function h(){t("editName",l.value),a.value=!1}return(f,b)=>(M(),A("div",{class:Ne(["save",{active:s(c)}])},[uu,a.value?(M(),A("div",mu,[C("button",{onClick:h,class:"button"},[p(Re,{display:"Save",direction:s(W).Left,class:"info"},{default:Z(()=>[vu]),_:1},8,["direction"])]),C("button",{onClick:b[5]||(b[5]=v=>a.value=!a.value),class:"button"},[p(Re,{display:"Cancel",direction:s(W).Left,class:"info"},{default:Z(()=>[hu]),_:1},8,["direction"])])])):(M(),A("div",cu,[s(i).error==null&&!u.value?(M(),ne(Or,{key:0,onClick:b[0]||(b[0]=v=>t("export")),class:"button",left:""},{default:Z(()=>[p(Re,{display:"Export",direction:s(W).Left,class:"info"},{default:Z(()=>[du]),_:1},8,["direction"])]),_:1})):j("",!0),s(i).error==null&&!u.value?(M(),A("button",{key:1,onClick:b[1]||(b[1]=v=>t("duplicate")),class:"button"},[p(Re,{display:"Duplicate",direction:s(W).Left,class:"info"},{default:Z(()=>[pu]),_:1},8,["direction"])])):j("",!0),s(i).error==null&&!u.value?(M(),A("button",{key:2,onClick:b[2]||(b[2]=v=>a.value=!a.value),class:"button"},[p(Re,{display:"Edit Name",direction:s(W).Left,class:"info"},{default:Z(()=>[fu]),_:1},8,["direction"])])):j("",!0),p(lu,{disabled:s(c),onClick:b[3]||(b[3]=v=>t("delete")),onConfirmingChanged:b[4]||(b[4]=v=>u.value=v)},{default:Z(()=>[p(Re,{display:"Delete",direction:s(W).Left,class:"info"},{default:Z(()=>[gu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(M(),A("div",bu,[C("button",{class:"button open",onClick:b[6]||(b[6]=v=>t("open"))},[C("h3",null,de(s(i).name),1)]),C("span",yu,"v"+de(s(i).modVersion),1),wu,s(d)?(M(),A("div",_u,"Last played "+de(s(r).format(s(d))),1)):j("",!0)])):s(i).error==null&&a.value?(M(),A("div",Nu,[p(qr,{modelValue:l.value,"onUpdate:modelValue":b[7]||(b[7]=v=>l.value=v),class:"editname",onSubmit:h},null,8,["modelValue"])])):(M(),A("div",Cu,[$(" Error: Failed to load save with id "+de(s(i).id),1),ku,$(de(s(i).error),1)]))],2))}});var Su=ve(Mu,[["__scopeId","data-v-32313015"]]);const Ji=e=>(gn("data-v-2a4275be"),e=e(),mn(),e),Iu=Ji(()=>C("h2",null,"Saves Manager",-1)),xu={class:"modal-footer"},$u={class:"field"},Eu=Ji(()=>C("span",{class:"field-title"},"Create Save",-1)),Du={class:"field-buttons"},Pu={class:"footer"},Tu=Ji(()=>C("div",{style:{"flex-grow":"1"}},null,-1)),Au=J({__name:"SavesManager",setup(e,{expose:t}){const n=z(!1),i=z(null);t({open(){n.value=!0}});const r=z(!1),a=z(""),u=z(null);vt(a,S=>{S?Ut(()=>{try{if(S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S),r.value=!0;return}const T=JSON.parse(S);if(typeof T!="object"){r.value=!0;return}const B=ui();T.id=B,mt(T),a.value="",r.value=!1,ce.saves.push(B)}catch{r.value=!0}}):r.value=!1});let l={},c=z(Object.keys(l).reduce((S,T)=>(S.push({label:T.split("/").slice(-1)[0].slice(0,-4),value:l[T]}),S),[]));const d=Bi({});function h(S){if(d[S]==null){let T=localStorage.getItem(S);if(T==null)d[S]={error:"Save doesn't exist in localStorage",id:S};else if(T==="dW5kZWZpbmVk")d[S]={error:"Save is undefined",id:S};else try{if(T[0]!=="{")if(T[0]==="e")T=decodeURIComponent(escape(atob(T)));else if(T[0]==="\u1BE1")T=Kt.decompressFromUTF16(T);else return console.warn("Unable to determine preset encoding",T),r.value=!0,d[S]={error:"Unable to determine preset encoding",id:S},d[S];d[S]={...JSON.parse(T),id:S}}catch(B){d[S]={error:B,id:S},console.warn(`SavesManager: Failed to load info about save with id ${S}: ${B} -${T}`)}}return d[S]}vt(n,S=>{S&&Object.keys(d).forEach(T=>delete d[T])});const f=N(()=>ce.saves.reduce((S,T)=>(S[T]=h(T),S),{}));function b(S){let T;switch(Q.id===S?T=Sr(Q):T=JSON.stringify(f.value[S]),we.exportEncoding){default:console.warn(`Unknown save encoding: ${we.exportEncoding}. Defaulting to lz`);case"lz":T=Kt.compressToUTF16(T);break;case"base64":T=btoa(unescape(encodeURIComponent(T)));break;case"plain":break}const B=document.createElement("textarea");B.value=T,document.body.appendChild(B),B.select(),B.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(B)}function v(S){Q.id===S&&mt();const T={...f.value[S],id:oi()};mt(T),ce.saves.push(T.id)}function y(S){ce.saves=ce.saves.filter(T=>T!==S),localStorage.removeItem(S),d[S]=void 0}function _(S){f.value[Q.id].time=Q.time,mt(),d[Q.id]=void 0,cn(f.value[S]),d[S]=void 0}function I(S){if(u.value=S,Ut(()=>{u.value=null}),S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S);return}const T=JSON.parse(S);T.id=oi(),mt(T),ce.saves.push(T.id),_(T.id)}function D(S,T){const B=f.value[S];B!=null&&(B.name=T,Q.id===S?(Q.name=T,mt()):(mt(B),d[S]=void 0))}return(S,T)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":T[4]||(T[4]=B=>n.value=B),ref_key:"modal",ref:i},{header:Y(()=>[Iu]),body:Y(({shown:B})=>[B?(M(),ne(s(da),{key:0,list:s(ce).saves,handle:".handle",itemKey:le=>le},{item:Y(({element:le})=>[p(Su,{save:s(f)[le],onOpen:ae=>_(le),onExport:ae=>b(le),onEditName:ae=>D(le,ae),onDuplicate:ae=>v(le),onDelete:ae=>y(le)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):j("",!0)]),footer:Y(()=>[C("div",xu,[p(qr,{modelValue:a.value,"onUpdate:modelValue":T[0]||(T[0]=B=>a.value=B),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:r.value})},null,8,["modelValue","class"]),C("div",$u,[Eu,C("div",Pu,[C("button",{class:"button",onClick:T[1]||(T[1]=B=>_(s(xn)().id))},"New Game"),Object.keys(s(c)).length>0?(M(),ne(Yi,{key:0,options:s(c),modelValue:u.value,"onUpdate:modelValue":T[2]||(T[2]=B=>I(B)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):j("",!0)])]),C("div",Du,[Tu,C("button",{class:"button modal-default-button",onClick:T[3]||(T[3]=B=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Vr=ve(Au,[["__scopeId","data-v-2a4275be"]]);const wt=e=>(gn("data-v-318a1c31"),e=e(),mn(),e),Ru=["src","alt"],Fu={key:1,class:"title"},Ou=wt(()=>C("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),qu={class:"discord"},Vu={class:"discord-links"},Bu={key:0},Lu=["href"],ju=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),zu=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Gu={href:"https://forums.moddingtree.com/",target:"_blank"},Uu=wt(()=>C("span",{class:"material-icons"},"forum",-1)),Wu=wt(()=>C("span",{class:"material-icons"},"info",-1)),Hu=wt(()=>C("span",{class:"material-icons"},"library_books",-1)),Yu=wt(()=>C("span",{class:"material-icons"},"settings",-1)),Zu=wt(()=>C("span",{class:"material-icons"},"library_books",-1)),Xu=wt(()=>C("span",{class:"material-icons"},"settings",-1)),Ju=wt(()=>C("span",{class:"material-icons"},"info",-1)),Ku={href:"https://forums.moddingtree.com/",target:"_blank"},Qu=wt(()=>C("span",{class:"material-icons"},"forum",-1)),ec={class:"discord"},tc={class:"discord-links"},nc={key:0},ic=["href"],rc=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),ac=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),sc=J({__name:"Nav",setup(e){const t=z(null),n=z(null),i=z(null),r=z(null),{useHeader:a,banner:u,title:l,discordName:c,discordLink:d,versionNumber:h}=we;function f(){window.open(d,"mywindow")}return(b,v)=>(M(),A(re,null,[s(a)?(M(),A("div",Wt({key:0,class:"nav"},b.$attrs),[s(u)?(M(),A("img",{key:0,src:s(u),class:"banner",alt:s(l)},null,8,Ru)):(M(),A("div",Fu,de(s(l)),1)),C("div",{onClick:v[0]||(v[0]=y=>{var _;return(_=r.value)==null?void 0:_.open()}),class:"version-container"},[p(Re,{display:"Changelog",direction:s(W).Down,class:"version"},{default:Y(()=>[C("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),Ou,C("div",qu,[C("span",{onClick:f,class:"material-icons"},"discord"),C("ul",Vu,[s(d)?(M(),A("li",Bu,[C("a",{href:s(d),target:"_blank"},de(s(c)),9,Lu)])):j("",!0),ju,zu])]),C("div",null,[C("a",Gu,[p(Re,{display:"Forums",direction:s(W).Down,yoffset:"5px"},{default:Y(()=>[Uu]),_:1},8,["direction"])])]),C("div",{onClick:v[1]||(v[1]=y=>{var _;return(_=t.value)==null?void 0:_.open()})},[p(Re,{display:"Info",direction:s(W).Down,class:"info"},{default:Y(()=>[Wu]),_:1},8,["direction"])]),C("div",{onClick:v[2]||(v[2]=y=>{var _;return(_=n.value)==null?void 0:_.open()})},[p(Re,{display:"Saves",direction:s(W).Down,xoffset:"-20px"},{default:Y(()=>[Hu]),_:1},8,["direction"])]),C("div",{onClick:v[3]||(v[3]=y=>{var _;return(_=i.value)==null?void 0:_.open()})},[p(Re,{display:"Settings",direction:s(W).Down,xoffset:"-66px"},{default:Y(()=>[Yu]),_:1},8,["direction"])])],16)):(M(),A("div",Wt({key:1,class:"overlay-nav"},b.$attrs),[C("div",{onClick:v[4]||(v[4]=y=>{var _;return(_=r.value)==null?void 0:_.open()}),class:"version-container"},[p(Re,{display:"Changelog",direction:s(W).Right,xoffset:"25%",class:"version"},{default:Y(()=>[C("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),C("div",{onClick:v[5]||(v[5]=y=>{var _;return(_=n.value)==null?void 0:_.open()})},[p(Re,{display:"Saves",direction:s(W).Right},{default:Y(()=>[Zu]),_:1},8,["direction"])]),C("div",{onClick:v[6]||(v[6]=y=>{var _;return(_=i.value)==null?void 0:_.open()})},[p(Re,{display:"Settings",direction:s(W).Right},{default:Y(()=>[Xu]),_:1},8,["direction"])]),C("div",{onClick:v[7]||(v[7]=y=>{var _;return(_=t.value)==null?void 0:_.open()})},[p(Re,{display:"Info",direction:s(W).Right},{default:Y(()=>[Ju]),_:1},8,["direction"])]),C("div",null,[C("a",Ku,[p(Re,{display:"Forums",direction:s(W).Right,xoffset:"7px"},{default:Y(()=>[Qu]),_:1},8,["direction"])])]),C("div",ec,[C("span",{onClick:f,class:"material-icons"},"discord"),C("ul",tc,[s(d)?(M(),A("li",nc,[C("a",{href:s(d),target:"_blank"},de(s(c)),9,ic)])):j("",!0),rc,ac])])],16)),p(Vl,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),p(Vr,{ref_key:"savesManager",ref:n},null,512),p(Jl,{ref_key:"options",ref:i},null,512),p(wl,{ref_key:"changelog",ref:r},null,512)],64))}});var Br=ve(sc,[["__scopeId","data-v-318a1c31"]]);const oc={class:"inner-tab"},lc=J({__name:"Game",setup(e){const t=tn(Q,"tabs"),n=N(()=>Object.keys(ge)),i=we.useHeader;function r(a){const{display:u,minimized:l,name:c,color:d,minimizable:h,nodes:f,minimizedDisplay:b}=a;return{display:u,minimized:l,name:c,color:d,minimizable:h,nodes:f,minimizedDisplay:b}}return(a,u)=>(M(),A("div",{class:Ne(["tabs-container",{useHeader:s(i)}])},[(M(!0),A(re,null,En(s(t),(l,c)=>{var d,h;return M(),A("div",{key:c,class:Ne(["tab",s((d=s(ge)[l])==null?void 0:d.classes)]),style:Be(s((h=s(ge)[l])==null?void 0:h.style))},[c===0&&!s(i)?(M(),ne(Br,{key:0})):j("",!0),C("div",oc,[s(n).includes(l)?(M(),ne(vl,Wt({key:0},r(s(ge)[l]),{index:c,onSetMinimized:f=>s(ge)[l].minimized.value=f}),null,16,["index","onSetMinimized"])):(M(),ne(Ke(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var uc=ve(lc,[["__scopeId","data-v-dcd207b4"]]);const cc=J({__name:"Sticky",setup(e){const t=z("0"),n=new ResizeObserver(r),i=ht(null);function r(){let a=i.value;if(a==null)return;let u=0;for(;a.previousSibling;){const l=a.previousSibling;l.dataset&&"vSticky"in l.dataset&&(u+=l.offsetHeight),a=l}t.value=u+"px"}return Ut(r),document.fonts.ready.then(r),gi(()=>{var u;const a=(u=i.value)==null?void 0:u.parentElement;a&&n.observe(a)}),(a,u)=>(M(),A("div",{class:"sticky",style:Be({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Tt(a.$slots,"default",{},void 0,!0)],4))}});var pi=ve(cc,[["__scopeId","data-v-cccac690"]]);const dc=["x1","y1","x2","y2"],pc=J({__name:"BoardLink",props:{link:null},setup(e){const n=Te(e),i=N(()=>{const a=n.link.value.startNode.position;return n.link.value.offsetStart&&(a.x+=s(n.link.value.offsetStart).x,a.y+=s(n.link.value.offsetStart).y),a}),r=N(()=>{const a=n.link.value.endNode.position;return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),a});return(a,u)=>(M(),A("line",Wt({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,dc))}});var fc=ve(pc,[["__scopeId","data-v-57c4970a"]]);const gc={key:0},mc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],vc=["fill","stroke-width","stroke"],hc=["fill"],bc=J({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=Te(e),r=N(()=>me(i.nodeType.value.size,s(i.node))),a=N(()=>{var h;return(h=me(i.nodeType.value.outlineColor,s(i.node)))!=null?h:Nt[ce.theme].variables["--outline"]}),u=N(()=>{var h;return(h=me(i.nodeType.value.titleColor,s(i.node)))!=null?h:Nt[ce.theme].variables["--foreground"]}),l=N(()=>me(i.nodeType.value.actionDistance,s(i.node)));function c(h,f){t("clickAction",f.id),h.preventDefault(),h.stopPropagation()}function d(h,f){var b;((b=s(i.selectedAction))==null?void 0:b.id)===f.id&&(h.preventDefault(),h.stopPropagation())}return(h,f)=>(M(),ne(zn,{name:"actions",appear:""},{default:Y(()=>[e.isSelected&&e.actions?(M(),A("g",gc,[(M(!0),A(re,null,En(e.actions,(b,v)=>{var y,_;return M(),A("g",{key:b.id,class:Ne(["action",{selected:((y=e.selectedAction)==null?void 0:y.id)===b.id}]),transform:`translate( +${T}`)}}return d[S]}vt(n,S=>{S&&Object.keys(d).forEach(T=>delete d[T])});const f=N(()=>ce.saves.reduce((S,T)=>(S[T]=h(T),S),{}));function b(S){let T;switch(Q.id===S?T=Sr(Q):T=JSON.stringify(f.value[S]),we.exportEncoding){default:console.warn(`Unknown save encoding: ${we.exportEncoding}. Defaulting to lz`);case"lz":T=Kt.compressToUTF16(T);break;case"base64":T=btoa(unescape(encodeURIComponent(T)));break;case"plain":break}const B=document.createElement("textarea");B.value=T,document.body.appendChild(B),B.select(),B.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(B)}function v(S){Q.id===S&&mt();const T={...f.value[S],id:ui()};mt(T),ce.saves.push(T.id)}function y(S){ce.saves=ce.saves.filter(T=>T!==S),localStorage.removeItem(S),d[S]=void 0}function _(S){f.value[Q.id].time=Q.time,mt(),d[Q.id]=void 0,cn(f.value[S]),d[S]=void 0}function I(S){if(u.value=S,Ut(()=>{u.value=null}),S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Kt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S);return}const T=JSON.parse(S);T.id=ui(),mt(T),ce.saves.push(T.id),_(T.id)}function P(S,T){const B=f.value[S];B!=null&&(B.name=T,Q.id===S?(Q.name=T,mt()):(mt(B),d[S]=void 0))}return(S,T)=>(M(),ne(Rt,{modelValue:n.value,"onUpdate:modelValue":T[4]||(T[4]=B=>n.value=B),ref_key:"modal",ref:i},{header:Z(()=>[Iu]),body:Z(({shown:B})=>[B?(M(),ne(s(da),{key:0,list:s(ce).saves,handle:".handle",itemKey:le=>le},{item:Z(({element:le})=>[p(Su,{save:s(f)[le],onOpen:ae=>_(le),onExport:ae=>b(le),onEditName:ae=>P(le,ae),onDuplicate:ae=>v(le),onDelete:ae=>y(le)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):j("",!0)]),footer:Z(()=>[C("div",xu,[p(qr,{modelValue:a.value,"onUpdate:modelValue":T[0]||(T[0]=B=>a.value=B),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:r.value})},null,8,["modelValue","class"]),C("div",$u,[Eu,C("div",Du,[C("button",{class:"button",onClick:T[1]||(T[1]=B=>_(s(xn)().id))},"New Game"),Object.keys(s(c)).length>0?(M(),ne(Xi,{key:0,options:s(c),modelValue:u.value,"onUpdate:modelValue":T[2]||(T[2]=B=>I(B)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):j("",!0)])]),C("div",Pu,[Tu,C("button",{class:"button modal-default-button",onClick:T[3]||(T[3]=B=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Vr=ve(Au,[["__scopeId","data-v-2a4275be"]]);const wt=e=>(gn("data-v-318a1c31"),e=e(),mn(),e),Ru=["src","alt"],Fu={key:1,class:"title"},Ou=wt(()=>C("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),qu={class:"discord"},Vu={class:"discord-links"},Bu={key:0},Lu=["href"],ju=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),zu=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Gu={href:"https://forums.moddingtree.com/",target:"_blank"},Uu=wt(()=>C("span",{class:"material-icons"},"forum",-1)),Wu=wt(()=>C("span",{class:"material-icons"},"info",-1)),Hu=wt(()=>C("span",{class:"material-icons"},"library_books",-1)),Yu=wt(()=>C("span",{class:"material-icons"},"settings",-1)),Zu=wt(()=>C("span",{class:"material-icons"},"library_books",-1)),Xu=wt(()=>C("span",{class:"material-icons"},"settings",-1)),Ju=wt(()=>C("span",{class:"material-icons"},"info",-1)),Ku={href:"https://forums.moddingtree.com/",target:"_blank"},Qu=wt(()=>C("span",{class:"material-icons"},"forum",-1)),ec={class:"discord"},tc={class:"discord-links"},nc={key:0},ic=["href"],rc=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),ac=wt(()=>C("li",null,[C("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),sc=J({__name:"Nav",setup(e){const t=z(null),n=z(null),i=z(null),r=z(null),{useHeader:a,banner:u,title:l,discordName:c,discordLink:d,versionNumber:h}=we;function f(){window.open(d,"mywindow")}return(b,v)=>(M(),A(re,null,[s(a)?(M(),A("div",Wt({key:0,class:"nav"},b.$attrs),[s(u)?(M(),A("img",{key:0,src:s(u),class:"banner",alt:s(l)},null,8,Ru)):(M(),A("div",Fu,de(s(l)),1)),C("div",{onClick:v[0]||(v[0]=y=>{var _;return(_=r.value)==null?void 0:_.open()}),class:"version-container"},[p(Re,{display:"Changelog",direction:s(W).Down,class:"version"},{default:Z(()=>[C("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),Ou,C("div",qu,[C("span",{onClick:f,class:"material-icons"},"discord"),C("ul",Vu,[s(d)?(M(),A("li",Bu,[C("a",{href:s(d),target:"_blank"},de(s(c)),9,Lu)])):j("",!0),ju,zu])]),C("div",null,[C("a",Gu,[p(Re,{display:"Forums",direction:s(W).Down,yoffset:"5px"},{default:Z(()=>[Uu]),_:1},8,["direction"])])]),C("div",{onClick:v[1]||(v[1]=y=>{var _;return(_=t.value)==null?void 0:_.open()})},[p(Re,{display:"Info",direction:s(W).Down,class:"info"},{default:Z(()=>[Wu]),_:1},8,["direction"])]),C("div",{onClick:v[2]||(v[2]=y=>{var _;return(_=n.value)==null?void 0:_.open()})},[p(Re,{display:"Saves",direction:s(W).Down,xoffset:"-20px"},{default:Z(()=>[Hu]),_:1},8,["direction"])]),C("div",{onClick:v[3]||(v[3]=y=>{var _;return(_=i.value)==null?void 0:_.open()})},[p(Re,{display:"Settings",direction:s(W).Down,xoffset:"-66px"},{default:Z(()=>[Yu]),_:1},8,["direction"])])],16)):(M(),A("div",Wt({key:1,class:"overlay-nav"},b.$attrs),[C("div",{onClick:v[4]||(v[4]=y=>{var _;return(_=r.value)==null?void 0:_.open()}),class:"version-container"},[p(Re,{display:"Changelog",direction:s(W).Right,xoffset:"25%",class:"version"},{default:Z(()=>[C("span",null,"v"+de(s(h)),1)]),_:1},8,["direction"])]),C("div",{onClick:v[5]||(v[5]=y=>{var _;return(_=n.value)==null?void 0:_.open()})},[p(Re,{display:"Saves",direction:s(W).Right},{default:Z(()=>[Zu]),_:1},8,["direction"])]),C("div",{onClick:v[6]||(v[6]=y=>{var _;return(_=i.value)==null?void 0:_.open()})},[p(Re,{display:"Settings",direction:s(W).Right},{default:Z(()=>[Xu]),_:1},8,["direction"])]),C("div",{onClick:v[7]||(v[7]=y=>{var _;return(_=t.value)==null?void 0:_.open()})},[p(Re,{display:"Info",direction:s(W).Right},{default:Z(()=>[Ju]),_:1},8,["direction"])]),C("div",null,[C("a",Ku,[p(Re,{display:"Forums",direction:s(W).Right,xoffset:"7px"},{default:Z(()=>[Qu]),_:1},8,["direction"])])]),C("div",ec,[C("span",{onClick:f,class:"material-icons"},"discord"),C("ul",tc,[s(d)?(M(),A("li",nc,[C("a",{href:s(d),target:"_blank"},de(s(c)),9,ic)])):j("",!0),rc,ac])])],16)),p(Vl,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),p(Vr,{ref_key:"savesManager",ref:n},null,512),p(Jl,{ref_key:"options",ref:i},null,512),p(wl,{ref_key:"changelog",ref:r},null,512)],64))}});var Br=ve(sc,[["__scopeId","data-v-318a1c31"]]);const oc={class:"inner-tab"},lc=J({__name:"Game",setup(e){const t=tn(Q,"tabs"),n=N(()=>Object.keys(ge)),i=we.useHeader;function r(a){const{display:u,minimized:l,name:c,color:d,minimizable:h,nodes:f,minimizedDisplay:b}=a;return{display:u,minimized:l,name:c,color:d,minimizable:h,nodes:f,minimizedDisplay:b}}return(a,u)=>(M(),A("div",{class:Ne(["tabs-container",{useHeader:s(i)}])},[(M(!0),A(re,null,En(s(t),(l,c)=>{var d,h;return M(),A("div",{key:c,class:Ne(["tab",s((d=s(ge)[l])==null?void 0:d.classes)]),style:Be(s((h=s(ge)[l])==null?void 0:h.style))},[c===0&&!s(i)?(M(),ne(Br,{key:0})):j("",!0),C("div",oc,[s(n).includes(l)?(M(),ne(vl,Wt({key:0},r(s(ge)[l]),{index:c,onSetMinimized:f=>s(ge)[l].minimized.value=f}),null,16,["index","onSetMinimized"])):(M(),ne(Ke(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var uc=ve(lc,[["__scopeId","data-v-dcd207b4"]]);const cc=J({__name:"Sticky",setup(e){const t=z("0"),n=new ResizeObserver(r),i=ht(null);function r(){let a=i.value;if(a==null)return;let u=0;for(;a.previousSibling;){const l=a.previousSibling;l.dataset&&"vSticky"in l.dataset&&(u+=l.offsetHeight),a=l}t.value=u+"px"}return Ut(r),document.fonts.ready.then(r),vi(()=>{var u;const a=(u=i.value)==null?void 0:u.parentElement;a&&n.observe(a)}),(a,u)=>(M(),A("div",{class:"sticky",style:Be({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Tt(a.$slots,"default",{},void 0,!0)],4))}});var gi=ve(cc,[["__scopeId","data-v-cccac690"]]);const dc=["x1","y1","x2","y2"],pc=J({__name:"BoardLink",props:{link:null},setup(e){const n=Te(e),i=N(()=>{const a=n.link.value.startNode.position;return n.link.value.offsetStart&&(a.x+=s(n.link.value.offsetStart).x,a.y+=s(n.link.value.offsetStart).y),a}),r=N(()=>{const a=n.link.value.endNode.position;return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),a});return(a,u)=>(M(),A("line",Wt({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,dc))}});var fc=ve(pc,[["__scopeId","data-v-57c4970a"]]);const gc={key:0},mc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],vc=["fill","stroke-width","stroke"],hc=["fill"],bc=J({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=Te(e),r=N(()=>me(i.nodeType.value.size,s(i.node))),a=N(()=>{var h;return(h=me(i.nodeType.value.outlineColor,s(i.node)))!=null?h:Nt[ce.theme].variables["--outline"]}),u=N(()=>{var h;return(h=me(i.nodeType.value.titleColor,s(i.node)))!=null?h:Nt[ce.theme].variables["--foreground"]}),l=N(()=>me(i.nodeType.value.actionDistance,s(i.node)));function c(h,f){t("clickAction",f.id),h.preventDefault(),h.stopPropagation()}function d(h,f){var b;((b=s(i.selectedAction))==null?void 0:b.id)===f.id&&(h.preventDefault(),h.stopPropagation())}return(h,f)=>(M(),ne(zn,{name:"actions",appear:""},{default:Z(()=>[e.isSelected&&e.actions?(M(),A("g",gc,[(M(!0),A(re,null,En(e.actions,(b,v)=>{var y,_;return M(),A("g",{key:b.id,class:Ne(["action",{selected:((y=e.selectedAction)==null?void 0:y.id)===b.id}]),transform:`translate( ${(-s(r)-30)*Math.sin(((e.actions.length-1)/2-v)*s(l))}, ${(s(r)+30)*Math.cos(((e.actions.length-1)/2-v)*s(l))} - )`,onMousedown:I=>c(I,b),onTouchstart:I=>c(I,b),onMouseup:I=>d(I,b),onTouchend:$n(I=>d(I,b),["stop"])},[C("circle",{fill:s(me)(b.fillColor,e.node),r:"20","stroke-width":((_=e.selectedAction)==null?void 0:_.id)===b.id?4:0,stroke:s(a)},null,8,vc),C("text",{fill:s(u),class:"material-icons"},de(s(me)(b.icon,e.node)),9,hc)],42,mc)}),128))])):j("",!0)]),_:1}))}});var yc=ve(bc,[["__scopeId","data-v-9efb2a56"]]);const wc=["transform"],_c={key:0},Nc=["r","fill","stroke"],Cc=["r","fill","stroke"],kc=["r","fill"],Mc=["r","stroke-dasharray","stroke-dashoffset","stroke"],Sc={key:1,transform:"rotate(45, 0, 0)"},Ic=["width","height","transform","fill","stroke"],xc=["width","height","transform","fill","stroke"],$c=["width","height","transform","fill"],Ec=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],Pc=["fill","y"],Dc=["fill"],Tc=["fill","y"],Ac={key:0},Rc=["fill","y"],Fc=["fill","y"],Oc=J({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},isSelected:{type:Boolean},selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=Te(n),a=N(()=>me(r.nodeType.value.draggable,s(r.node)));vt(a,U=>{const be=s(r.node);s(r.dragging)===be&&!U&&t("endDragging",be)});const u=N(()=>{var be;const U=s(r.node);return(be=me(r.nodeType.value.actions,U))==null?void 0:be.filter(je=>He(me(je.visibility,U)))}),l=N(()=>{var be;const U=s(r.node);if(me(r.nodeType.value.draggable,U)&&((be=s(r.dragging))==null?void 0:be.id)===U.id&&s(r.dragged)!=null){const{x:je,y:ft}=s(r.dragged);return{x:U.position.x+Math.round(je/25)*25,y:U.position.y+Math.round(ft/25)*25}}return U.position}),c=N(()=>me(r.nodeType.value.shape,s(r.node))),d=N(()=>me(r.nodeType.value.title,s(r.node))),h=N(()=>me(r.nodeType.value.subtitle,s(r.node))),f=N(()=>me(r.nodeType.value.otherSubtitle,s(r.node))),b=N(()=>{var U;return(U=r.isSelected.value?s(r.selectedAction)&&me(s(r.selectedAction).tooltip,s(r.node)):null)!=null?U:me(r.nodeType.value.label,s(r.node))}),v=N(()=>{var U,be;return me((be=(U=s(r.selectedAction))==null?void 0:U.confirmationLabel)!=null?be:{text:"Tap again to confirm"},s(r.node))}),y=N(()=>me(r.nodeType.value.size,s(r.node))),_=N(()=>{var U;return(U=me(r.nodeType.value.progress,s(r.node)))!=null?U:0}),I=N(()=>Nt[ce.theme].variables["--background"]),D=N(()=>{var U;return(U=me(r.nodeType.value.outlineColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--outline"]}),S=N(()=>{var U;return(U=me(r.nodeType.value.fillColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--raised-background"]}),T=N(()=>me(r.nodeType.value.progressColor,s(r.node))),B=N(()=>{var U;return(U=me(r.nodeType.value.titleColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--foreground"]}),le=N(()=>me(r.nodeType.value.progressDisplay,s(r.node))),ae=N(()=>r.dragging.value!=null&&s(r.hasDragged)&&me(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),te=N(()=>me(r.nodeType.value.style,s(r.node))),K=N(()=>me(r.nodeType.value.classes,s(r.node)));function Ie(U){t("mouseDown",U,r.node.value,a.value)}function he(U){var be,je,ft;(be=r.hasDragged)!=null&&be.value||(t("endDragging",r.node.value),(ft=(je=r.nodeType.value).onClick)==null||ft.call(je,r.node.value),U.stopPropagation())}return(U,be)=>{var je,ft,Ot;return M(),A("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:s(a),...s(K)}]),style:Be([{opacity:((je=e.dragging)==null?void 0:je.id)===e.node.id&&e.hasDragged?.5:1},(ft=s(te))!=null?ft:[]]),transform:`translate(${s(l).x},${s(l).y})${e.isSelected?" scale(1.2)":""}`},[p(yc,{actions:(Ot=s(u))!=null?Ot:[],"is-selected":e.isSelected,node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:be[0]||(be[0]=gt=>t("clickAction",gt))},null,8,["actions","is-selected","node","node-type","selected-action"]),C("g",{class:"node-container",onMousedown:Ie,onTouchstartPassive:Ie,onMouseup:he,onTouchendPassive:he},[s(c)===s(Le).Circle?(M(),A("g",_c,[s(ae)?(M(),A("circle",{key:0,class:"receiver",r:s(y)+8,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Nc)):j("",!0),C("circle",{class:"body",r:s(y),fill:s(S),stroke:s(D),"stroke-width":4},null,8,Cc),s(le)===s(nn).Fill?(M(),A("circle",{key:1,class:"progress progressFill",r:Math.max(s(y)*s(_)-2,0),fill:s(T)},null,8,kc)):(M(),A("circle",{key:2,r:s(y)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(y)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(y)+4.5)*2*Math.PI-s(_)*(s(y)+4.5)*2*Math.PI,stroke:s(T)},null,8,Mc))])):s(c)===s(Le).Diamond?(M(),A("g",Sc,[s(ae)?(M(),A("rect",{key:0,class:"receiver",width:s(y)*s(i)+16,height:s(y)*s(i)+16,transform:`translate(${-(s(y)*s(i)+16)/2}, ${-(s(y)*s(i)+16)/2})`,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Ic)):j("",!0),C("rect",{class:"body",width:s(y)*s(i),height:s(y)*s(i),transform:`translate(${-s(y)*s(i)/2}, ${-s(y)*s(i)/2})`,fill:s(S),stroke:s(D),"stroke-width":4},null,8,xc),s(le)===s(nn).Fill?(M(),A("rect",{key:1,class:"progress progressFill",width:Math.max(s(y)*s(i)*s(_)-2,0),height:Math.max(s(y)*s(i)*s(_)-2,0),transform:`translate(${-Math.max(s(y)*s(i)*s(_)-2,0)/2}, ${-Math.max(s(y)*s(i)*s(_)-2,0)/2})`,fill:s(T)},null,8,$c)):(M(),A("rect",{key:2,class:"progress progressDiamond",width:s(y)*s(i)+9,height:s(y)*s(i)+9,transform:`translate(${-(s(y)*s(i)+9)/2}, ${-(s(y)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(y)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(y)*s(i)+9)*4-s(_)*(s(y)*s(i)+9)*4,stroke:s(T)},null,8,Ec))])):j("",!0),C("text",{fill:s(B),class:"node-title",y:s(f)&&!s(h)?-10:0},de(s(d)),9,Pc),s(h)?(M(),A("text",{key:2,fill:s(B),class:"node-subtitle",y:"-25"},de(s(h)),9,Dc)):j("",!0),s(f)?(M(),A("text",{key:3,fill:s(B),class:"node-subtitle",y:s(h)?25:15},de(s(f)),9,Tc)):j("",!0)],32),p(zn,{name:"fade",appear:""},{default:Y(()=>{var gt;return[s(b)?(M(),A("g",Ac,[C("text",{fill:(gt=s(b).color)!=null?gt:s(B),class:Ne(["node-title",{pulsing:s(b).pulsing}]),y:-s(y)-20},de(s(b).text),11,Rc)])):j("",!0)]}),_:1}),p(zn,{name:"fade",appear:""},{default:Y(()=>{var gt;return[e.isSelected&&e.selectedAction?(M(),A("text",{key:0,fill:(gt=s(v).color)!=null?gt:s(B),class:Ne(["node-title",{pulsing:s(v).pulsing}]),y:s(y)+75},de(s(v).text),11,Fc)):j("",!0)]}),_:1})],14,wc)}}});var qc=ve(Oc,[["__scopeId","data-v-19cf948c"]]);const Vc={class:"stage",width:"100%",height:"100%"},Bc={class:"g1"},Lc=J({__name:"Board",props:{nodes:null,types:null,state:null,visibility:null,width:null,height:null,style:null,classes:null,links:null,selectedAction:null,selectedNode:null,draggingNode:null,receivingNode:null,mousePosition:null,setReceivingNode:{type:Function},setDraggingNode:{type:Function}},setup(e){const n=Te(e),i=z({x:0,y:0}),r=z({x:0,y:0}),a=z(!1),u=z(null),l=N(()=>{const v=n.nodes.value.slice();if(n.selectedNode.value){const y=v.splice(v.indexOf(n.selectedNode.value),1)[0];v.push(y)}if(n.draggingNode.value){const y=v.splice(v.indexOf(n.draggingNode.value),1)[0];v.push(y)}return v});It(()=>{const v=n.draggingNode.value;if(v==null)return null;const y={x:v.position.x+r.value.x,y:v.position.y+r.value.y};let _=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((I,D)=>{if(D.id===v.id)return I;const S=n.types.value[D.type];if(!me(S.canAccept,D,v))return I;const B=Math.pow(y.x-D.position.x,2)+Math.pow(y.y-D.position.y,2);let le=me(S.size,D);return B>_||B>le*le?I:(_=B,D)},null))});function c(v){v.setTransformOrigin(null),v.moveTo(u.value.$el.clientWidth/2,u.value.$el.clientHeight/2)}function d(v,y=null,_=!1){if(n.draggingNode.value==null){v.preventDefault(),v.stopPropagation();let I,D;if("touches"in v)if(v.touches.length===1)I=v.touches[0].clientX,D=v.touches[0].clientY;else return;else I=v.clientX,D=v.clientY;i.value={x:I,y:D},r.value={x:0,y:0},a.value=!1,_&&n.setDraggingNode.value(y)}y!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(v){const{x:y,y:_,scale:I}=u.value.panZoomInstance.getTransform();let D,S;if("touches"in v)if(v.touches.length===1)D=v.touches[0].clientX,S=v.touches[0].clientY;else{f(n.draggingNode.value),n.mousePosition.value=null;return}else D=v.clientX,S=v.clientY;n.mousePosition.value={x:(D-y)/I,y:(S-_)/I},r.value={x:r.value.x+(D-i.value.x)/I,y:r.value.y+(S-i.value.y)/I},i.value={x:D,y:S},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(v.preventDefault(),v.stopPropagation())}function f(v,y=!1){var _,I;if(n.draggingNode.value!=null&&n.draggingNode.value===v){n.receivingNode.value==null&&(n.draggingNode.value.position.x+=Math.round(r.value.x/25)*25,n.draggingNode.value.position.y+=Math.round(r.value.y/25)*25);const D=n.nodes.value;D.push(D.splice(D.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((I=(_=n.types.value[n.receivingNode.value.type]).onDrop)==null||I.call(_,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!y&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(v,y){var I,D;const _=n.types.value[v.type];me((D=(I=_.actions)==null?void 0:I.find(S=>S.id===y))==null?void 0:D.confirmationLabel,v)==null&&(n.state.value.selectedAction=y),n.state.value.selectedAction===y?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:y}}return(v,y)=>{const _=kt("panZoom");return s(He)(e.visibility)?(M(),ne(_,{key:0,style:Be([{width:e.width,height:e.height},e.style]),class:Ne(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:u,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:y[0]||(y[0]=I=>d(I)),onTouchstart:y[1]||(y[1]=I=>d(I)),onMouseup:y[2]||(y[2]=()=>f(s(e.draggingNode))),onTouchendPassive:y[3]||(y[3]=()=>f(s(e.draggingNode))),onMouseleave:y[4]||(y[4]=()=>f(s(e.draggingNode),!0))},{default:Y(()=>[(M(),A("svg",Vc,[C("g",Bc,[p(ir,{name:"link",appear:""},{default:Y(()=>[(M(!0),A(re,null,En(s(e.links)||[],I=>(M(),A("g",{key:`${I.startNode.id}-${I.endNode.id}`},[p(fc,{link:I},null,8,["link"])]))),128))]),_:1}),p(ir,{name:"grow",duration:500,appear:""},{default:Y(()=>[(M(!0),A(re,null,En(s(l),I=>(M(),A("g",{key:I.id,style:{"transition-duration":"0s"}},[p(qc,{node:I,nodeType:e.types[I.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===I?r.value:void 0,hasDragged:s(e.draggingNode)==null?!1:a.value,receivingNode:s(e.receivingNode)===I,isSelected:s(e.selectedNode)===I,selectedAction:s(e.selectedNode)===I?s(e.selectedAction):null,onMouseDown:d,onEndDragging:f,onClickAction:D=>b(I,D)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","isSelected","selectedAction","onClickAction"])]))),128))]),_:1})])]))]),_:1},8,["style","class","options"])):j("",!0)}}});Qe.on("setupVue",e=>fa.install(e));const Lr=Symbol("Board");var nn=(e=>(e.Outline="Outline",e.Fill="Fill",e))(nn||{}),Le=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Le||{});function jc(e){const t=lt({nodes:[],selectedNode:null,selectedAction:null},!1);return et(n=>{const i=e.call(n,n);i.id=rn("board-"),i.type=Lr,i[yt]=Lc,i.state?(Rr(t),$(i,"state")):(t[Ht]={nodes:i.startNodes().map((l,c)=>(l.id=c,l)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=N(()=>s(u.state).nodes),i.selectedNode=N({get(){return u.nodes.value.find(l=>l.id===s(u.state).selectedNode)||null},set(l){var c,d;Fe(u.state)?u.state.value={...u.state.value,selectedNode:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedNode=(d=l==null?void 0:l.id)!=null?d:null}}),i.selectedAction=N({get(){const l=u.selectedNode.value;if(l==null)return null;const c=u.types[l.type];return c.actions==null?null:c.actions.find(d=>d.id===s(u.state).selectedAction)||null},set(l){var c,d;Fe(u.state)?u.state.value={...u.state.value,selectedAction:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedAction=(d=l==null?void 0:l.id)!=null?d:null}}),i.mousePosition=z(null),i.links?$(i,"links"):i.links=N(()=>u.selectedAction.value==null?null:u.selectedAction.value.links&&u.selectedNode.value?me(u.selectedAction.value.links,u.selectedNode.value):null),i.draggingNode=z(null),i.receivingNode=z(null),$(i,"visibility"),oe(i,"visibility",Me.Visible),$(i,"width"),oe(i,"width","100%"),$(i,"height"),oe(i,"height","100%"),$(i,"classes"),$(i,"style");for(const l in i.types){const c=i.types[l];if($(c,"title"),$(c,"subtitle"),$(c,"otherSubtitle"),$(c,"label"),$(c,"size"),oe(c,"size",50),$(c,"style"),$(c,"classes"),$(c,"draggable"),oe(c,"draggable",!1),$(c,"shape"),oe(c,"shape","Circle"),$(c,"canAccept"),oe(c,"canAccept",!1),$(c,"progress"),$(c,"progressDisplay"),oe(c,"progressDisplay","Fill"),$(c,"progressColor"),oe(c,"progressColor","none"),$(c,"fillColor"),$(c,"outlineColor"),$(c,"titleColor"),$(c,"actionDistance"),oe(c,"actionDistance",Math.PI/6),c.nodes=N(()=>s(u.state).nodes.filter(d=>d.type===l)),oe(c,"onClick",function(d){s(u.state).selectedNode=d.id}),c.actions)for(const d of c.actions)$(d,"visibility"),oe(d,"visibility",Me.Visible),$(d,"icon"),$(d,"fillColor"),$(d,"tooltip"),$(d,"confirmationLabel"),oe(d,"confirmationLabel",{text:"Tap again to confirm"}),$(d,"links")}function r(l){i.draggingNode.value=l}function a(l){i.receivingNode.value=l}i.placeInAvailableSpace=function(l,c=100,d=W.Right){const h=u.nodes.value.slice().filter(f=>f===l||(d===W.Down||d===W.Up)&&Math.abs(f.position.x-l.position.x)>c||(d===W.Left||d===W.Right)&&Math.abs(f.position.y-l.position.y)>c?!1:!(d===W.Right&&f.position.xl.position.x+c||d===W.Up&&f.position.y>l.position.y+c||d===W.Down&&f.position.yf.position.x-b.position.x:d===W.Left?(f,b)=>b.position.x-f.position.x:d===W.Up?(f,b)=>b.position.y-f.position.y:(f,b)=>f.position.y-b.position.y);for(let f=0;f0&&v>c)break}},i[pt]=function(){const{nodes:l,types:c,state:d,visibility:h,width:f,height:b,style:v,classes:y,links:_,selectedAction:I,selectedNode:D,mousePosition:S,draggingNode:T,receivingNode:B}=this;return{nodes:l,types:c,state:d,visibility:h,width:f,height:b,style:s(v),classes:y,links:_,selectedAction:I,selectedNode:D,mousePosition:S,draggingNode:T,receivingNode:B,setDraggingNode:r,setReceivingNode:a}};const u=i;return u})}function me(e,t,...n){return Un(e)?e(t,...n):s(e)}function Pn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const Ln={};Qe.on("addLayer",e=>{const t=Hn(e,Lr);Ln[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var u;return(u=r.update)==null?void 0:u.call(r,a,n)}))})})});Qe.on("removeLayer",e=>{var t;(t=Ln[e.id])==null||t.call(Ln),Ln[e.id]=void 0});function Sn(e,t="points",n=0,i=void 0){const r=Fe(e)?e:lt(e);if(r.displayName=t,r.precision=n,r.small=i,!Fe(e)){const a=r[Dt];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function fi(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?dt(e.small?n:o.floor(n)):xe(n,e.precision,e.small)}Qe.on("setupVue",e=>e.use(ga));function zc(e="white",t="8px"){return{transform:"scale(1.05, 1.05)",borderColor:"rgba(0, 0, 0, 0.125)",boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 ${t} ${e}`,zIndex:1}}const Gc=J({props:{visibility:{type:q(Number,Boolean),required:!0},display:{type:q(Object,String,Function),required:!0},style:q(String,Object,Array),classes:q(Object),glowColor:q(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=Te(e),a=Pr(n),u=N(()=>{const c=Ee(i);return c==null||c===""?{}:s(r)?zc(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:a,glowColorStyle:u,unref:s,Visibility:Me,isVisible:He,isHidden:vn}}});function Uc(e,t,n,i,r,a){var u;return e.isVisible(e.visibility)?(M(),A("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(u=e.unref(e.style))!=null?u:{}])},[(M(),ne(Ke(e.component)))],6)):j("",!0)}var jr=ve(Gc,[["render",Uc],["__scopeId","data-v-21427abb"]]);const Wc=J({props:{visibility:{type:q(Number,Boolean),required:!0},activeTab:{type:q(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:q(Object),required:!0},style:q(String,Object,Array),classes:q(Object),buttonContainerStyle:q(String,Object,Array),buttonContainerClasses:q(Object)},components:{Sticky:pi,TabButton:jr},setup(e){const{activeTab:t}=Te(e),n=N(()=>Nt[ce.theme].floatingTabs),i=ht("");It(()=>{const l=Ee(t);if(l==null){i.value="";return}if(xt(l)){i.value=pe(l);return}i.value=pe(s(l.display))});const r=N(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.classes)}),a=N(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.style)});function u(l){const{display:c,style:d,classes:h,glowColor:f,visibility:b}=l;return{display:c,style:s(d),classes:h,glowColor:f,visibility:b}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:Me,component:i,gatherButtonProps:u,unref:s,isVisible:He,isHidden:vn}}});function Hc(e,t,n,i,r,a){var c,d;const u=kt("TabButton"),l=kt("Sticky");return e.isVisible(e.visibility)?(M(),A("div",{key:0,class:Ne(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(d=e.tabStyle)!=null?d:[]])},[p(l,{class:Ne(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Be(e.unref(e.buttonContainerStyle))},{default:Y(()=>[C("div",{class:Ne(["tab-buttons",{floating:e.floating}])},[(M(!0),A(re,null,En(e.unref(e.tabs),(h,f)=>(M(),ne(u,Wt({onSelectTab:b=>e.selected.value=f,floating:e.floating,key:f,active:e.unref(h.tab)===e.unref(e.activeTab)},e.gatherButtonProps(h)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(M(),ne(Ke(e.unref(e.component)),{key:0})):j("",!0)],6)):j("",!0)}var Yc=ve(Wc,[["render",Hc],["__scopeId","data-v-58dbf83a"]]);const Zc=Symbol("TabButton"),Xc=Symbol("TabFamily");function Jc(e,t){if(Object.keys(e).length===0)throw console.warn("Cannot create tab family with 0 tabs"),new Error("Cannot create tab family with 0 tabs");const n=lt(Object.keys(e)[0],!1);return et(i=>{var u;const r=(u=t==null?void 0:t.call(i,i))!=null?u:{};r.id=rn("tabFamily-"),r.type=Xc,r[yt]=Yc,r.tabs=Object.keys(e).reduce((l,c)=>{const d=e[c]();return d.type=Zc,d[yt]=jr,$(d,"visibility"),oe(d,"visibility",Me.Visible),$(d,"tab"),$(d,"display"),$(d,"classes"),$(d,"style"),$(d,"glowColor"),l[c]=d,l},{}),r.selected=n,r.activeTab=N(()=>{const l=s(a.tabs);if(n.value in l&&He(l[n.value].visibility))return s(l[n.value].tab);const c=Object.values(l).find(d=>He(d.visibility));return c?s(c.tab):null}),$(r,"visibility"),oe(r,"visibility",Me.Visible),$(r,"classes"),$(r,"style"),$(r,"buttonContainerClasses"),$(r,"buttonContainerStyle"),r[pt]=function(){const{visibility:l,activeTab:c,selected:d,tabs:h,style:f,classes:b,buttonContainerClasses:v,buttonContainerStyle:y}=this;return{visibility:l,activeTab:c,selected:d,tabs:h,style:s(f),classes:b,buttonContainerClasses:v,buttonContainerStyle:y}};const a=r;return a})}function zt(e){return et(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:d=>o.add(d,s(u)),invert:d=>o.sub(d,s(u)),getFormula:d=>g.add(d,u),enabled:c,description:i==null?void 0:Z(()=>p("div",{class:"modifier-container"},[s(l)!=null?p("span",{class:"modifier-description"},[Ct(s(l))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),0):o.lt(s(u),0))?"color: var(--danger)":""},[o.gte(s(u),0)?"+":"",Gt(s(u))])]))}})}function ke(e){return et(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:d=>o.times(d,s(u)),invert:d=>o.div(d,s(u)),getFormula:d=>g.times(d,u),enabled:c,description:i==null?void 0:Z(()=>p("div",{class:"modifier-container"},[s(l)!=null?p("span",{class:"modifier-description"},[Ct(s(l))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[P("\xD7"),Gt(s(u))])]))}})}function Kc(e){return et(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:u}=e.call(t,t),l=_e(n),c=_e(i),d=r==null?void 0:_e(r);return{apply:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.pow(f,s(l)),a&&(f=o.sub(f,1)),f},invert:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.root(f,s(l)),a&&(f=o.sub(f,1)),f},getFormula:h=>a?g.add(h,1).pow(l).sub(1):g.pow(h,l),enabled:d,description:i==null?void 0:Z(()=>p("div",{class:"modifier-container"},[s(c)!=null?p("span",{class:"modifier-description"},[Ct(s(c)),a?" (+1 effective)":null]):null,p("span",{class:"modifier-amount",style:(u===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[P("^"),Gt(s(l))])]))}})}function _t(e){return et(()=>{const t=e();return{apply:n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.apply(i),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduceRight((i,r)=>r.invert(i),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.getFormula(i),n):void 0,enabled:t.some(n=>n.enabled!=null)?N(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?Z(()=>p(re,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(Ct)])):void 0}})}const Fi=g.variable(0).step(2e3,e=>e.pow_base(1.02)).step(100,e=>e.pow(1.5)).step(o.pow(900,1.5).add(100),e=>e.pow(1.5)).pow(1.5),an={id:"deselect",icon:"close",tooltip:e=>({text:"portals"in e.state?"Disconnect portals":"tools"in e.state?"Disconnect tools":"Disconnect resources"}),onClick(e){var t;Array.isArray((t=e.state)==null?void 0:t.data)?e.state={...e.state,data:[]}:"portals"in e.state?e.state={...e.state,portals:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"portals"in e.state?e.state.portals.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},Ft={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${dt(m.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},m.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function bn(e,t=1/0){const n=e(g.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(i){return{text:`Increase Connections - ${dt(n.evaluate(i.state.maxConnections))} energy`}},fillColor(i){return o.gte(m.energy.value,n.evaluate(i.state.maxConnections))?"var(--bought)":"var(--locked)"},confirmationLabel:i=>o.gte(m.energy.value,n.evaluate(i.state.maxConnections))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(i){const r=n.evaluate(i.state.maxConnections);o.gte(m.energy.value,r)&&(m.energy.value=o.sub(m.energy.value,r),i.state={...i.state,maxConnections:o.add(i.state.maxConnections,1)},m.board.selectedAction.value=null)},visibility:i=>o.add(i.state.maxConnections,m.computedBonusConnectionsModifier.value).lt(t)}}function zr(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="resource"){const r=((i=m.board.draggingNode.value)==null?void 0:i.state).type,{maxConnections:a,resources:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Qc(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="passive"){const r=(i=m.board.draggingNode.value)==null?void 0:i.state,{maxConnections:a,tools:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function hi(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="portal"){const r=((i=m.board.draggingNode.value)==null?void 0:i.state).id,{maxConnections:a,portals:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Gr(e,t){if(t.type!=="resource")return!1;const n=t.state.type,{maxConnections:i,resources:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function Ur(e,t){if(t.type!=="resource")return;const n=t.state.type,i=e.state.resources;i.includes(n)?e.state={...e.state,resources:i.filter(r=>r!==n)}:e.state={...e.state,resources:[...i,n]},m.board.selectedNode.value=e}function ed(e,t){if(t.type!=="passive")return!1;const n=t.state,{maxConnections:i,tools:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function td(e,t){if(t.type!=="passive")return;const n=t.state,i=e.state.tools;i.includes(n)?e.state={...e.state,tools:i.filter(r=>r!==n)}:e.state={...e.state,tools:[...i,n]},m.board.selectedNode.value=e}function bi(e,t){if(t.type!=="portal")return!1;const n=t.state.id,{maxConnections:i,portals:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function yi(e,t){if(t.type!=="portal")return;const n=t.state.id,{portals:i}=e.state;i.includes(n)?e.state={...e.state,portals:i.filter(r=>r!==n)}:e.state={...e.state,portals:[...i,n]},m.board.selectedNode.value=e}function Ce(e){return e===m.board.selectedNode.value||e.state.powered}function ee(e){return m.empowerer.value!=null&&Ce(m.empowerer.value)&&m.empowerer.value.state.tools.includes(e)}function nd(e){var a,u,l;const t=(l=(u=(a=m.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:u.amount)!=null?l:0,n=m.resourceLevels.value[e],i=Fi.evaluate(n),r=Fi.evaluate(o.add(n,1));return o.sub(t,i).max(0).div(o.sub(r,i)).toNumber()}function ln(e,t,n){if(t.value){const i=t.value.state,r=i[n],a=i.maxConnections;o.gt(r.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:r.slice(0,o.add(a,e).toNumber())})}}function Xi(e){return{id:"help",icon:"question_mark",tooltip:{text:"Help"},onClick(){m.helpModals[e].showModal.value=!0,m.board.selectedAction.value=null},confirmationLabel:null}}const id={key:0},rd={key:0,class:"mark star"},ad=["src"],sd=J({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(M(),A("div",id,[e.mark===!0?(M(),A("div",rd)):(M(),A("img",{key:1,class:"mark",src:e.mark},null,8,ad))])):j("",!0)}});var Xn=ve(sd,[["__scopeId","data-v-2207999f"]]);const od=J({__name:"Node",props:{id:null},setup(e){const n=Te(e),i=li(Li,()=>{}),r=li(ji,()=>{}),a=ht(null),u=N(()=>a.value&&a.value.parentElement);return vt([u,n.id],([l,c],[d,h])=>{d&&r(s(h)),l&&i(c,l)}),br(()=>r(s(n.id))),(l,c)=>(M(),A("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Jn=ve(od,[["__scopeId","data-v-a48cb382"]]),ld=J({props:{display:{type:q(Object,String,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),onClick:Function,onHold:Function,canClick:{type:q(Boolean),required:!0},small:Boolean,mark:q(Boolean,String),id:{type:String,required:!0}},components:{Node:Jn,MarkNode:Xn},setup(e){const{display:t,onClick:n,onHold:i}=Te(e),r=ht("");It(()=>{var h;const l=Ee(t);if(l==null){r.value="";return}if(xt(l)){r.value=pe(l);return}const c=pe((h=l.title)!=null?h:"","h3"),d=pe(l.description,"div");r.value=pe(Z(()=>p("span",null,[l.title!=null?p("div",null,[p(c,null,null)]):null,p(d,null,null)])))});const{start:a,stop:u}=Er(n,i);return{start:a,stop:u,comp:r,Visibility:Me,isVisible:He,isHidden:vn,unref:s}}});function ud(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...d)=>e.onClick&&e.onClick(...d)),onMousedown:t[1]||(t[1]=(...d)=>e.start&&e.start(...d)),onMouseleave:t[2]||(t[2]=(...d)=>e.stop&&e.stop(...d)),onMouseup:t[3]||(t[3]=(...d)=>e.stop&&e.stop(...d)),onTouchstartPassive:t[4]||(t[4]=(...d)=>e.start&&e.start(...d)),onTouchendPassive:t[5]||(t[5]=(...d)=>e.stop&&e.stop(...d)),onTouchcancelPassive:t[6]||(t[6]=(...d)=>e.stop&&e.stop(...d)),class:Ne({feature:!0,clickable:!0,can:e.unref(e.canClick),locked:!e.unref(e.canClick),small:e.small,...e.unref(e.classes)})},[e.unref(e.comp)?(M(),ne(Ke(e.unref(e.comp)),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],38)):j("",!0)}var Wr=ve(ld,[["render",ud],["__scopeId","data-v-211328c0"]]);const Hr=Symbol("Clickable");function cd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return et(i=>{var u,l,c;const r=(u=e==null?void 0:e.call(i,i))!=null?u:{};r.id=rn("clickable-"),r.type=Hr,r[yt]=Wr;for(const d of t)(l=d.preConstruct)==null||l.call(d,r);if(Object.assign(r,n),$(r,"visibility"),oe(r,"visibility",Me.Visible),$(r,"canClick"),oe(r,"canClick",!0),$(r,"classes"),$(r,"style"),$(r,"mark"),$(r,"display"),r.onClick){const d=r.onClick.bind(r);r.onClick=function(h){s(r.canClick)!==!1&&d(h)}}if(r.onHold){const d=r.onHold.bind(r);r.onHold=function(){s(r.canClick)!==!1&&d()}}for(const d of t)(c=d.postConstruct)==null||c.call(d,r);const a=t.reduce((d,h)=>{var f;return Object.assign(d,(f=h.getGatheredProps)==null?void 0:f.call(h,r))},{});return r[pt]=function(){const{display:d,visibility:h,style:f,classes:b,onClick:v,onHold:y,canClick:_,small:I,mark:D,id:S}=this;return{display:d,visibility:h,style:s(f),classes:b,onClick:v,onHold:y,canClick:_,small:I,mark:D,id:S,...a}},r})}function dd(e,t,n=[]){n=n.length===0?Hn(e,Hr):n;const i=typeof t=="function"?N(t):t;return e.on("update",()=>{s(i)&&n.filter(r=>s(r.canClick)).forEach(r=>{var a;return(a=r.onClick)==null?void 0:a.call(r)})})}const pd=["x1","y1","x2","y2"],fd=J({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=Te(e),i=N(()=>{const a=n.startNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),r=N(()=>{const a=n.endNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(a,u)=>(M(),A("line",Wt({"stroke-width":"15px",stroke:"white"},e.link,{x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,pd))}});const gd=J({__name:"Links",props:{links:null},setup(e){var c;const n=tn(e,"links"),i=z(null),r=li(zi,z({})),a=li(Gi,z(void 0)),u=z((c=i.value)==null?void 0:c.getBoundingClientRect());vt(a,()=>{var d;return u.value=(d=i.value)==null?void 0:d.getBoundingClientRect()}),gi(()=>{var d;return u.value=(d=i.value)==null?void 0:d.getBoundingClientRect()});const l=N(()=>{var h,f;const d=r.value;return(f=(h=n.value)==null?void 0:h.filter(b=>{var v,y;return((v=d[b.startNode.id])==null?void 0:v.rect)&&((y=d[b.startNode.id])==null?void 0:y.rect)}))!=null?f:[]});return(d,h)=>(M(),A(re,null,[s(l)?(M(),A("svg",oa(Wt({key:0},d.$attrs)),[(M(!0),A(re,null,En(s(l),(f,b)=>(M(),ne(fd,{key:b,link:f,boundingRect:u.value,startNode:s(r)[f.startNode.id],endNode:s(r)[f.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):j("",!0),C("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var md=ve(gd,[["__scopeId","data-v-063f6d6b"]]);J({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:md},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=Te(e),r=ht();It(()=>{const l=Ee(t);r.value=pe(Z(()=>p(re,null,[l.map(c=>p("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(Ct)]))])))});const a=ht();It(()=>{const l=Ee(n);a.value=l?pe(Z(()=>p("span",{class:"left-side-nodes small"},[l.map(Ct)]))):""});const u=ht();return It(()=>{const l=Ee(i);u.value=l?pe(Z(()=>p("span",{class:"side-nodes small"},[l.map(Ct)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:u}}});J({props:{display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),onClick:Function,onHold:Function,color:q(String),glowColor:q(String),canClick:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Xn,Node:Jn},setup(e){const{onClick:t,onHold:n,display:i}=Te(e),r=Dn(i),{start:a,stop:u}=Er(t,n);return{start:a,stop:u,comp:r,unref:s,Visibility:Me,isCoercableComponent:xt,isVisible:He,isHidden:vn}}});function jn(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(l=>_e(l.base)),n.baseText=t.map(l=>_e(l.baseText)),n.visible=t.map(l=>_e(l.visible)),n.title=t.map(l=>_e(l.title)),n.subtitle=t.map(l=>_e(l.subtitle)),i=!0),t}const a=lt({},!1);return[Z(()=>{const l=r();let c=!0;const d=l.map((h,f)=>{var D,S,T;if(s(n.visible[f])===!1)return null;const b=p("h3",{onClick:()=>a.value[f]=!a.value[f],style:"cursor: pointer"},[p("span",{class:"modifier-toggle"+(s(a.value[f])?" collapsed":"")},[P("\u25BC")]),s(n.title[f]),s(n.subtitle[f])!=null?p("span",{class:"subtitle"},[P(" ("),s(n.subtitle[f]),P(")")]):null]),v=s(a.value[f])?null:p(re,null,[p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[Ct((D=s(n.baseText[f]))!=null?D:"Base")]),p("span",{class:"modifier-amount"},[xe((S=s(n.base[f]))!=null?S:1),h.unit])]),h.modifier.description==null?null:Ct(s(h.modifier.description))]),y=!c;c=!1;const _=(T=s(n.base[f]))!=null?T:1,I=h.modifier.apply(_);return p(re,null,[y?p("br",null,null):null,p("div",{style:{"--unit":ce.alignUnits&&h.unit!=null?"'"+h.unit+"'":""}},[b,p("br",null,null),v,p("hr",null,null),p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[P("Total")]),p("span",{class:"modifier-amount",style:(h.smallerIsBetter===!0?o.gt(I,_!=null?_:1):o.lt(I,_!=null?_:1))?"color: var(--danger)":""},[Gt(I),h.unit])])])])});return p(re,null,[d])}),a]}function Di(e,t,n){const i=_e(t),r=_e(n);return N(()=>{const a=s(i),u=s(r);return o.gte(e.value,u)?"Now":o.lte(a,0)?"Never":vi(o.sub(u,e.value).div(a))})}function un(e,t,n=1){const i=_e(t),r=_e(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return Z(()=>{var a;if(s(i)){const u=Gt(e.evaluate()),l=Gt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return p(re,null,[p("b",null,[p("i",null,[u,P(" \u2192 "),l])])])}return p(re,null,[Gt(e.evaluate())])})}const St={dirt:120,sand:60,gravel:40,wood:30,stone:24,coal:20,copper:15,iron:12,silver:10,gold:8,emerald:6,platinum:5,diamond:4,berylium:3,unobtainium:2,ultimatum:1},Lt=Object.keys(St),Ve={dirt:{cost:1e3,name:"Pickaxe",type:"passive",state:"dirt"},sand:{cost:1e4,name:"Dowsing Rod",type:"dowsing",state:{resources:[],maxConnections:1,powered:!1}},gravel:{cost:1e5,name:"Ore Processor",type:"passive",state:"gravel"},wood:{cost:1e6,name:"Quarry",type:"quarry",state:{resources:[],maxConnections:1,powered:!1,progress:0}},stone:{cost:1e7,name:"Energizer",type:"passive",state:"stone"},coal:{cost:1e8,name:"Tool Empowerer",type:"empowerer",state:{tools:[],maxConnections:1,powered:!1}},copper:{cost:1e9,name:"Book",type:"passive",state:"copper"},iron:{cost:1e10,name:"Portal Generator",type:"portalGenerator",state:{tier:void 0,influences:[]}},silver:{cost:1e12,name:"Robotics",type:"passive",state:"silver"},gold:{cost:1e15,name:"Booster",type:"booster",state:{portals:[],maxConnections:1,powered:!1,level:1}},emerald:{cost:1e19,name:"AI",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"ML",type:"passive",state:"diamond"},berylium:{cost:1e37,name:"Automator",type:"automator",state:{portals:[],maxConnections:1,powered:!1}},unobtainium:{cost:1e45,name:"National Grid",type:"passive",state:"unobtainium"},ultimatum:{cost:1e54,name:"Investments",type:"investments",state:{portals:[],maxConnections:1,powered:!1}}},Pt={dirt:"BOGO Coupon",sand:"Metal Detector",gravel:"Neural Nets",wood:"Mining Laser",stone:"Replicator",coal:"Planar Intelligence",copper:"Efficient Code",iron:"Trade Agreements",silver:"Machine Synergizer",gold:"XP Market",emerald:"Efficient Portals",platinum:"Time Dilation",diamond:"Paypal",berylium:"Tiered Mining",unobtainium:"OC'ed Portals",ultimatum:"Rebates"},vd={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 40% stronger":"Material level is 20% stronger"},silver:{description:e=>e?"Quadruples each plane's resource gain":"Doubles each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase (diminishing)":"+1% plane's resource gain per repeatable purchase (diminishing)"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"All upgrades apply twice":"Non-multiplicative upgrades apply twice"},coalRelic:{description:e=>e?"Every treasure boosts planar speed by +20%":"Every treasure boosts planar speed by +10%"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give quadruple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Powered machines)^2 boost quarry speed":"Powered machines boost quarry speed"},goldRelic:{description:e=>e?"Each treasure gives +50% XP gain":"Each treasure gives +25% XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs 20x less energy":"Creating portals costs 10x less energy"},platinumRelic:{description:e=>e?"Quadruple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"log(energy)^0.5 boosts planes' resource gain":"log(energy)^0.25 boosts planes' resource gain"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},ct={increaseResources:{display:"+resource",description:e=>{const t=e.data;return t.length===0?"Increase resource odds - Drag a resource to me!":t.length===1?`Increase ${t[0]}'s odds`:`Increase ${t.length} resources' odds`},cost:2,initialData:[]},decreaseResources:{display:"-resource",description:e=>{const t=e.data;return t.length===0?"Decrease resource odds - Drag a resource to me!":t.length===1?`Decrease ${t[0]}'s odds`:`Decrease ${t.length} resources' odds`},cost:2,initialData:[]},increaseLength:{display:"+length",description:"Increase length",cost:100,initialData:void 0},increaseCaches:{display:"+caches",description:"Increase caches odds",cost:10,initialData:void 0},increaseGens:{display:"+gens",description:"Increase generators odds",cost:10,initialData:void 0},increaseInfluences:{display:"+influences",description:"Increase influences odds",cost:10,initialData:void 0},increaseEnergyMults:{display:"+energy mults",description:"Increase energy mults odds",cost:10,initialData:void 0},increaseResourceMults:{display:"+resource mults",description:"Increase resource mults odds",cost:10,initialData:void 0},increaseDiff:{display:"+difficulty",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-difficulty",description:"Decrease difficulty/rewards odds",cost:10,initialData:void 0},increaseRewards:{display:"+rewards",description:"Increase rewards level",cost:1e4,initialData:void 0},relic:{display:"+relic",description:"Max length/difficulty, add tier-unique relic",cost:1e6,initialData:void 0}},ri=g.variable(0).add(8).times(2).pow10();const hd=J({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(M(),A("div",{style:Be({width:e.width,height:e.height})},null,4))}});function On(e){return et(t=>{var i;const n=e.call(t,t);return n.partialDisplay=r=>p("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[fi(n.resource,n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=r=>p("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",fi(n.resource,n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),$(n,"visibility"),oe(n,"visibility",Me.Visible),$(n,"cost"),$(n,"requiresPay"),oe(n,"requiresPay",!0),$(n,"cumulativeCost"),oe(n,"cumulativeCost",!0),$(n,"maxBulkAmount"),oe(n,"maxBulkAmount",1),$(n,"directSum"),oe(n,"pay",function(r){const a=n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost);n.resource.value=o.sub(n.resource.value,a).max(0)}),n.canMaximize=N(()=>{var l;if(!(n.cost instanceof g))return!1;const r=s(n.maxBulkAmount);if(o.lte(r,1))return!1;const a=s(n.cumulativeCost),u=(l=s(n.directSum))!=null?l:a?10:0;return o.lte(r,u)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof g?n.requirementMet=Ar(n.cost,n.resource,(i=n.cumulativeCost)!=null?i:!0,n.directSum,n.maxBulkAmount):n.requirementMet=N(()=>o.gte(n.resource.value,s(n.cost))),n})}function Ji(e){return et(()=>({requirementMet:N(()=>He(e.visibility)),visibility:Me.None,requiresPay:!1}))}function bd(e,t){return et(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:Z(()=>Ct(t)),display:t==null?void 0:Z(()=>p(re,null,[P("Req: "),Ct(t)])),visibility:t==null?Me.None:Me.Visible,requiresPay:!1}))}function wi(e){if(At(e))return e.every(wi);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Yr(e){if(At(e))return e.map(Yr).reduce(o.min);const t=s(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&s(e.canMaximize)!==!0?1:t}function _i(e,t=1){var n,i;if(At(e)&&(e=e.filter(r=>He(r.visibility)),e.length===1&&(e=e[0])),At(e)){e=e.filter(u=>"partialDisplay"in u);const r=e.filter(u=>s(u.requiresPay)),a=e.filter(u=>!s(u.requiresPay));return p(re,null,[r.length>0?p("div",null,[P("Costs:")," ",ur(r.map(u=>u.partialDisplay(t)),p(re,null,[P(", ")]))]):null,a.length>0?p("div",null,[P("Requires:")," ",ur(a.map(u=>u.partialDisplay(t)),p(re,null,[P(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:p(re,null,null)}function Zr(e,t=1){var n;At(e)?e.filter(i=>s(i.requiresPay)).forEach(i=>{var r;return(r=i.pay)==null?void 0:r.call(i,t)}):s(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var yd=J({props:{visibility:{type:q(Number,Boolean),required:!0},display:q(Object,String,Function),earned:{type:q(Boolean),required:!0},requirements:q(Object,Array),image:q(String),style:q(String,Object,Array),classes:q(Object),mark:q(Boolean,String),small:q(Boolean),id:{type:String,required:!0}},components:{Node:Jn,MarkNode:Xn},setup(e){const{display:t,requirements:n,earned:i}=Te(e),r=ht("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.requirement?a.requirement:Z(()=>{var d;return _i((d=Ee(n))!=null?d:[])}),"h3"),l=pe(a.effectDisplay||"","b"),c=Ee(i)?pe(a.optionsDisplay||"","span"):"";r.value=pe(Z(()=>p("span",null,[p(u,null,null),a.effectDisplay!=null?p("div",null,[p(l,null,null)]):null,a.optionsDisplay!=null?p("div",{class:"equal-spaced"},[p(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:Me,isVisible:He,isHidden:vn}}});function wd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("div",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:Ne({feature:!0,achievement:!0,locked:!e.unref(e.earned),done:e.unref(e.earned),small:e.unref(e.small),...e.unref(e.classes)})},[e.comp?(M(),ne(Ke(e.comp),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var _d=ve(yd,[["render",wd],["__scopeId","data-v-5673325a"]]);const Nd=mi(),Cd=Symbol("Achievement");let In=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function kd(e,...t){const n=lt(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var c,d,h;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=rn("achievement-"),a.type=Cd,a[yt]=_d;for(const f of t)(d=f.preConstruct)==null||d.call(f,a);a.earned=n,a.complete=function(){var b,v;if(n.value)return;n.value=!0;const f=a;if((b=f.onComplete)==null||b.call(f),f.display!=null&&s(f.showPopups)===!0){const y=s(f.display);let _;xt(y)?_=pe(y):y.requirement!=null?_=pe(y.requirement):_=_i((v=f.requirements)!=null?v:[]),Nd.info(p("div",null,[p("h3",null,[P("Treasure earned!")]),p("div",null,[p(_,null,null)])]))}},Object.assign(a,i),$(a,"visibility"),oe(a,"visibility",Me.Visible);const u=a.visibility;a.visibility=la(()=>{const f=s(a.display);switch(ce.msDisplay){default:case In.All:return s(u);case In.Configurable:return s(a.earned)&&!(f!=null&&typeof f=="object"&&"optionsDisplay"in f)?Me.None:s(u);case In.Incomplete:return s(a.earned)?Me.None:s(u);case In.None:return Me.None}}),$(a,"display"),$(a,"mark"),$(a,"small"),$(a,"image"),$(a,"style"),$(a,"classes"),$(a,"showPopups"),oe(a,"showPopups",!0);for(const f of t)(h=f.postConstruct)==null||h.call(f,a);const l=t.reduce((f,b)=>{var v;return Object.assign(f,(v=b.getGatheredProps)==null?void 0:v.call(b,a))},{});if(a[pt]=function(){const{visibility:f,display:b,requirements:v,earned:y,image:_,style:I,classes:D,mark:S,small:T,id:B}=this;return{visibility:f,display:b,requirements:v,earned:y,image:_,style:s(I),classes:D,mark:S,small:T,id:B,...l}},a.requirements){const f=a,b=[Ji(f),bd(()=>!f.earned.value),...At(a.requirements)?a.requirements:[a.requirements]];It(()=>{ce.active===Q.id&&wi(b)&&f.complete()})}return a})}Qe.on("loadSettings",e=>{oe(e,"msDisplay",In.All)});const Md=Object.values(In).map(e=>({label:at(e),value:e}));hs(Z(()=>p(Yi,{title:Z(()=>p("span",{class:"option-title"},[P("Show achievements"),p("desc",null,[P("Select which achievements to display based on criterias.")])])),options:Md,"onUpdate:modelValue":e=>ce.msDisplay=e,modelValue:ce.msDisplay},null)));const Sd=J({props:{progress:{type:q(String,Object,Number),required:!0},width:{type:q(Number),required:!0},height:{type:q(Number),required:!0},direction:{type:q(String),required:!0},display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),borderStyle:q(Object,String,Array),textStyle:q(Object,String,Array),baseStyle:q(Object,String,Array),fillStyle:q(Object,String,Array),mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Xn,Node:Jn},setup(e){const{progress:t,width:n,height:i,direction:r,display:a}=Te(e),u=N(()=>{let d=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(d,0),1))*100}),l=N(()=>{const d={width:Ee(n)+.5+"px",height:Ee(i)+.5+"px"};switch(s(r)){case W.Up:d.clipPath=`inset(${u.value}% 0% 0% 0%)`,d.width=Ee(n)+1+"px";break;case W.Down:d.clipPath=`inset(0% 0% ${u.value}% 0%)`,d.width=Ee(n)+1+"px";break;case W.Right:d.clipPath=`inset(0% ${u.value}% 0% 0%)`;break;case W.Left:d.clipPath=`inset(0% 0% 0% ${u.value} + '%)`;break;case W.Default:d.clipPath="inset(0% 50% 0% 0%)";break}return d}),c=Dn(a);return{normalizedProgress:u,barStyle:l,component:c,unref:s,Visibility:Me,isVisible:He,isHidden:vn}}});function Id(e,t,n,i,r,a){var c,d,h,f,b,v,y;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("div",{key:0,style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px",visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),class:Ne({bar:!0,...e.unref(e.classes)})},[C("div",{class:"overlayTextContainer border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(d=e.unref(e.borderStyle))!=null?d:{}])},[e.component?(M(),A("span",{key:0,class:"overlayText",style:Be(e.unref(e.textStyle))},[(M(),ne(Ke(e.component)))],4)):j("",!0)],4),C("div",{class:"border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(h=e.unref(e.style))!=null?h:{},(f=e.unref(e.baseStyle))!=null?f:{},(b=e.unref(e.borderStyle))!=null?b:{}])},[C("div",{class:"fill",style:Be([e.barStyle,(v=e.unref(e.style))!=null?v:{},(y=e.unref(e.fillStyle))!=null?y:{}])},null,4)],4),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var xd=ve(Sd,[["render",Id],["__scopeId","data-v-6bd06b56"]]);const $d=Symbol("Bar");function Ed(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return et(i=>{var u,l;const r=e.call(i,i);r.id=rn("bar-"),r.type=$d,r[yt]=xd;for(const c of t)(u=c.preConstruct)==null||u.call(c,r);Object.assign(r,n),$(r,"visibility"),oe(r,"visibility",Me.Visible),$(r,"width"),$(r,"height"),$(r,"direction"),$(r,"style"),$(r,"classes"),$(r,"borderStyle"),$(r,"baseStyle"),$(r,"textStyle"),$(r,"fillStyle"),$(r,"progress"),$(r,"display"),$(r,"mark");for(const c of t)(l=c.postConstruct)==null||l.call(c,r);const a=t.reduce((c,d)=>{var h;return Object.assign(c,(h=d.getGatheredProps)==null?void 0:h.call(d,r))},{});return r[pt]=function(){const{progress:c,width:d,height:h,direction:f,display:b,visibility:v,style:y,classes:_,borderStyle:I,textStyle:D,baseStyle:S,fillStyle:T,mark:B,id:le}=this;return{progress:c,width:d,height:h,direction:f,display:b,visibility:v,style:s(y),classes:_,borderStyle:I,textStyle:D,baseStyle:S,fillStyle:T,mark:B,id:le,...a}},r})}function Pd(e,...t){return et(n=>{var r,a;const i=e.call(n,n);for(const u of t)(r=u.preConstruct)==null||r.call(u,i);i.formula=i.formula(g.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=N(()=>{let u=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(u=u.min(1)),u})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=N(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=N(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var l;const u=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,u),i.spend(u),(l=i.onConvert)==null||l.call(i,u)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),$(i,"currentGain"),$(i,"actualGain"),$(i,"currentAt"),$(i,"nextAt"),$(i,"buyMax"),oe(i,"buyMax",!0);for(const u of t)(a=u.postConstruct)==null||a.call(u,i);return i})}function Dd(e){return Pd(e)}function Td(e,t,n=1,i=o.dInf){const r=_e(n),a=_e(i);e.on("preUpdate",u=>{const l=s(r);o.neq(l,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(l,u).times(o.ceil(s(t.actualGain)))).min(s(a)).max(t.gainResource.value))})}const Ad={postConstruct(e){e.amount===void 0&&console.error(`Decorated feature ${e.id} does not contain the required 'amount' property"`),$(e,"bonusAmount"),e.totalAmount===void 0&&(e.totalAmount=N(()=>{var t;return o.add(s((t=e.amount)!=null?t:0),s(e.bonusAmount))}))}},Xr=Symbol("Repeatable");function pr(e,...t){const n=lt(0),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var b,v,y;const a=e.call(r,r);a.id=rn("repeatable-"),a.type=Xr,a[yt]=Wr;for(const _ of t)(b=_.preConstruct)==null||b.call(_,a);a.amount=n,a.amount[Ht]=(v=a.initialAmount)!=null?v:0,Object.assign(a,i);const u={requirementMet:N(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:Me.None,canMaximize:!0},l=Ji(a);At(a.requirements)?(a.requirements.unshift(l),a.requirements.push(u)):a.requirements=[l,a.requirements,u],a.maxed=N(()=>o.gte(a.amount.value,s(a.limit))),$(a,"classes");const c=a.classes;a.classes=N(()=>{const _=s(c)||{};return a.maxed.value&&(_.bought=!0),_}),a.amountToIncrease=N(()=>o.clampMin(Yr(a.requirements),1)),a.canClick=N(()=>wi(a.requirements));const d=a.onClick;a.onClick=function(_){var S;const I=a;if(!s(I.canClick))return;const D=(S=s(a.amountToIncrease))!=null?S:1;Zr(a.requirements,D),I.amount.value=o.add(I.amount.value,D),d==null||d(_)},$(a,"display");const h=a.display;a.display=Z(()=>{var I,D,S;const _=s(h);if(xt(_)){const T=pe(_);return p(T,null,null)}if(_!=null){const T=a,B=pe((I=_.title)!=null?I:"","h3"),le=pe((D=_.description)!=null?D:""),ae=pe((S=_.effectDisplay)!=null?S:"");return p("span",null,[_.title==null?null:p("div",null,[p(B,null,null)]),_.description==null?null:p(le,null,null),_.showAmount===!1?null:p("div",null,[p("br",null,null),p(re,null,[P("Amount: "),dt(T.amount.value)]),o.isFinite(s(T.limit))?p(re,null,[P(" / "),dt(s(T.limit))]):void 0]),_.effectDisplay==null?null:p("div",null,[p("br",null,null),P("Currently: "),p(ae,null,null)]),T.maxed.value?null:p("div",null,[p("br",null,null),_i(T.requirements,s(a.amountToIncrease))])])}return""}),$(a,"visibility"),oe(a,"visibility",Me.Visible),$(a,"limit"),oe(a,"limit",o.dInf),$(a,"style"),$(a,"mark"),$(a,"small");for(const _ of t)(y=_.postConstruct)==null||y.call(_,a);const f=t.reduce((_,I)=>{var D;return Object.assign(_,(D=I.getGatheredProps)==null?void 0:D.call(I,a))},{});return a[pt]=function(){const{display:_,visibility:I,style:D,classes:S,onClick:T,canClick:B,small:le,mark:ae,id:te}=this;return{display:_,visibility:I,style:s(D),classes:S,onClick:T,canClick:B,small:le,mark:ae,id:te,...f}},a})}const Rd=Symbol("Reset");function Fd(e){return et(t=>{const n=e.call(t,t);return n.id=rn("reset-"),n.type=Rd,n.reset=function(){var r;const i=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof o)&&!(a instanceof g)){if(Zn in a&&a[Zn]===!0)return;if(Ht in a){const u=a;u.value=u[Ht]}else!(a instanceof o)&&!Fe(a)&&Object.values(a).forEach(u=>i(u))}};s(n.thingsToReset).forEach(i),Qe.emit("reset",n),(r=n.onReset)==null||r.call(n)},$(n,"thingsToReset"),n})}const ai={};Qe.on("removeLayer",e=>{var t;(t=ai[e.id])==null||t.call(ai),ai[e.id]=void 0});function Ti(e,t){return $(t,"display"),$(t,"classes"),$(t,"style"),$(t,"direction"),oe(t,"direction",W.Up),$(t,"xoffset"),$(t,"yoffset"),t.pinnable&&(t.pinned=lt(!1,!1)),Ut(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Rr(t.pinned)):e.pinned=t.pinned);const n=e[yt];e[yt]=Re;const i=e[pt].bind(e);e[pt]=function(){const{display:a,classes:u,style:l,direction:c,xoffset:d,yoffset:h,pinned:f}=this;return{element:{[yt]:n,[pt]:i},display:a,classes:u,style:s(l),direction:c,xoffset:d,yoffset:h,pinned:f}}.bind(t)}),t}var Od=J({props:{display:{type:q(String,Object,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),requirements:{type:Object,required:!0},canPurchase:{type:q(Boolean),required:!0},bought:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:Jn,MarkNode:Xn},setup(e){const{display:t,requirements:n,bought:i}=Te(e),r=ht("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.title||"","h3"),l=pe(a.description,"div"),c=pe(a.effectDisplay||"");r.value=pe(Z(()=>p("span",null,[a.title!=null?p("div",null,[p(u,null,null)]):null,p(l,null,null),a.effectDisplay!=null?p("div",null,[P("Currently: "),p(c,null,null)]):null,i.value?null:p(re,null,[p("br",null,null),_i(n.value)])])))}),{component:r,unref:s,Visibility:Me,isVisible:He,isHidden:vn}}});const qd=["disabled"];function Vd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...d)=>e.purchase&&e.purchase(...d)),class:Ne({feature:!0,upgrade:!0,can:e.unref(e.canPurchase),locked:!e.unref(e.canPurchase),bought:e.unref(e.bought),...e.unref(e.classes)}),disabled:!e.unref(e.canPurchase)},[e.unref(e.component)?(M(),ne(Ke(e.unref(e.component)),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],14,qd)):j("",!0)}var Bd=ve(Od,[["render",Vd],["__scopeId","data-v-9be6bac0"]]);const Ki=Symbol("Upgrade");function fr(e,...t){const n=lt(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var c,d;const a=e.call(r,r);a.id=rn("upgrade-"),a.type=Ki,a[yt]=Bd;for(const h of t)(c=h.preConstruct)==null||c.call(h,a);a.bought=n,Object.assign(a,i),a.canPurchase=N(()=>!n.value&&wi(a.requirements)),a.purchase=function(){var f;const h=a;!s(h.canPurchase)||(Zr(a.requirements),n.value=!0,(f=h.onPurchase)==null||f.call(h))};const u=Ji(a);At(a.requirements)?a.requirements.unshift(u):a.requirements=[u,a.requirements],$(a,"visibility"),oe(a,"visibility",Me.Visible),$(a,"classes"),$(a,"style"),$(a,"display"),$(a,"mark");for(const h of t)(d=h.postConstruct)==null||d.call(h,a);const l=t.reduce((h,f)=>{var b;return Object.assign(h,(b=f.getGatheredProps)==null?void 0:b.call(f,a))},{});return a[pt]=function(){const{display:h,visibility:f,style:b,classes:v,requirements:y,canPurchase:_,bought:I,mark:D,id:S,purchase:T}=this;return{display:h,visibility:f,style:s(b),classes:v,requirements:y,canPurchase:_,bought:I,mark:D,id:S,purchase:T,...l}},a})}function Ld(e,t,n=[]){n=n.length===0?Hn(e,Ki):n;const i=Un(t)?N(t):t;e.on("update",()=>{s(i)&&n.forEach(r=>r.purchase())})}function jd(e,t,n,i){return function(){e>>>=0,t>>>=0,n>>>=0,i>>>=0;let r=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,i=i+1|0,r=r+i|0,n=n+r|0,(r>>>0)/4294967296}}const zd={1:["b","c","d","f","g","h","i","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"],2:["a","e","o","u"],3:["br","cr","dr","fr","gr","pr","str","tr","bl","cl","fl","gl","pl","sl","sc","sk","sm","sn","sp","st","sw","ch","sh","th","wh"],4:["ae","ai","ao","au","a","ay","ea","ei","eo","eu","e","ey","ua","ue","ui","uo","u","uy","ia","ie","iu","io","iy","oa","oe","ou","oi","o","oy"],5:["turn","ter","nus","rus","tania","hiri","hines","gawa","nides","carro","rilia","stea","lia","lea","ria","nov","phus","mia","nerth","wei","ruta","tov","zuno","vis","lara","nia","liv","tera","gantu","yama","tune","ter","nus","cury","bos","pra","thea","nope","tis","clite"],6:["una","ion","iea","iri","illes","ides","agua","olla","inda","eshan","oria","ilia","erth","arth","orth","oth","illon","ichi","ov","arvis","ara","ars","yke","yria","onoe","ippe","osie","one","ore","ade","adus","urn","ypso","ora","iuq","orix","apus","ion","eon","eron","ao","omia"]},gr=[[1,2,5],[2,3,6],[3,4,5],[4,3,6],[3,4,2,5],[2,1,3,6],[3,4,2,5],[4,3,1,6],[3,4,1,4,5],[4,1,4,3,6]];function Ai(e){const t=gr[Math.floor(e()*gr.length)];let n="";for(let i=0;in-n*t*Math.max(Math.min(a,4-a,1),0);return[i(5),i(3),i(1)]}const vr=mi();function Jr(e,t,n,i){return Ui(e,function(){const r=jd(0,n>>0,n>>32,1);for(let V=0;V<12;V++)r();const a=Ai(r),u=qn([.64,.75,.55],r),l=qn([.18,.2,.25],r),c=Sn(0,Ai(r)),d=lt(0),h=Lt.indexOf(t);let f=r();const b=i.reduce((V,L)=>(V[L.type]=L.data,V),{});"increaseDiff"in b&&(f=f/2+.5),"decreaseDiff"in b&&(f=f/2),"relic"in b&&(f=1);const v=f+h+1,y=m.toolNodes.value.sandRelic!=null?ee("sandRelic")?2:1:0,_=lt(y),I=N(()=>("increaseRewards"in b?v+1:v)+_.value);let D="relic"in b?h+2:Math.ceil(r()*(h+2));"increaseLength"in b&&D++;const S=[],T=_t(()=>S),B=N(()=>T.apply(0)),le=[],ae={};function te({feature:V,canClick:L,modifier:$e,cost:nt,previewModifier:_n,showETA:ze,previewCost:Et}){L=_e(L),ze=_e(ze);const Vt=cr(V);le.push({shouldShowPreview:N(()=>s(L)&&Vt.value),modifier:_t(()=>{const Bt=S.slice();return Bt.splice(Bt.indexOf($e),1,_n),Bt}),cost:Et!=null?Et:nt}),S.push($e);const Mt=Di(c,B,()=>Se(nt)),it=Ti(V,{display:ze==null?Mt:()=>s(ze)?Mt.value:"",direction:W.Down});return{isHovering:Vt,eta:Mt,tooltip:it}}const K=[],Ie=z(0);let he=g.variable(Ie).times(0),U=0,be=!0;const je=N(()=>o.add(v,r()-.5).pow_base(2).times(10).times(he.evaluate())),ft=[];for(let V=0;V=D-1?0:4};switch(si(L,r)){case"upgrades":const E=[];for(let R=0;R<4;R++){const H=si({add:1,mult:V===0&&R===0?0:1},r),Ge=je.value,Ye=Mn(r);let qe="",Ae,fe;switch(H){case"add":{const ue=o.add(Ge,10).pow(r()/4+1);qe=`Gain ${xe(ue)} ${c.displayName}/s`,he=he.add(ue),Ae=rt=>zt(()=>({addend:ue,description:Ye,enabled:rt==null?ye.bought:()=>rt()&&ye.bought.value})),fe=zt(()=>({addend:ue}));break}case"mult":{const ue=r()*5+1;qe=`Multiply previous ${c.displayName} gain by x${xe(ue)}.`;const rt=U;he=he.add(o.sub(ue,1).times(rt)),Ae=Ze=>ke(()=>({multiplier:ue,description:Ye,enabled:Ze==null?ye.bought:()=>Ze()&&ye.bought.value})),fe=ke(()=>({multiplier:ue}));break}}U=he.evaluate(),Ie.value++;const De=be,ye=fr(()=>({requirements:On(()=>({resource:kn(c),cost:Ge,requiresPay:()=>m.toolNodes.value.unobtainiumRelic==null})),display:{title:Ye,description:qe},visibility:De}));te({feature:ye,canClick:()=>ye.canPurchase.value,modifier:Ae(),cost:Ge,previewCost:N(()=>m.toolNodes.value.unobtainiumRelic==null?Ge:0),showETA:()=>!ye.bought.value,previewModifier:fe}),S.push(Ae(()=>H==="add"?m.toolNodes.value.stoneRelic!=null:ee("stoneRelic"))),E.push(ye)}K.push(E);break;case"repeatables":const F=[];for(let R=0;R<3;R++){const H=si({add:1.5,mult:3},r),Ge=Ie.value,Ye=je.value,qe=Mn(r);let Ae="",fe,De,ye,ue;const rt=g.variable(N(()=>se.amount.value)).times(2);switch(H){case"add":{const Xe=o.add(Ye,10).times(r()+.5);Ae=`Gain ${xe(Xe)} ${c.displayName}/s`,ue=rt.add(1).times(Ye),he=he.add(N(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).times(Xe))),fe=N(()=>xe(o.times(Xe,s(se.totalAmount)))+"/s"),De=zt(()=>({addend:()=>o.times(Xe,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=zt(()=>({addend:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).times(Xe)}));break}case"mult":{const Xe=r()*.75+1.25;Ae=`Multiply previous ${c.displayName} gain by x${xe(Xe)}.`,ue=rt.add(1).times(Ye);const st=U;he=he.add(N(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).pow_base(Xe).sub(1).times(st))),fe=N(()=>"x"+xe(o.pow(Xe,s(se.totalAmount)))),De=ke(()=>({multiplier:()=>o.pow(Xe,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=ke(()=>({multiplier:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).pow_base(Xe)}));break}}U=he.evaluate(),Ie.value++;const Ze=be,se=pr(()=>({requirements:On(()=>({resource:kn(c),cost:ue,maxBulkAmount:()=>m.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>m.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:qe,description:`${Ae}

Amount: ${dt(se.amount.value)}${o.gt(s(se.bonusAmount),0)?` [+${dt(s(se.bonusAmount))}]`:""}`,effectDisplay:s(fe),showAmount:!1}),visibility:Ze,limit:100,bonusAmount:()=>o.gt(se.amount.value,0)?ee("dirtRelic")?2:m.toolNodes.value.dirtRelic!=null?1:0:0}),Ad);te({feature:se,canClick:()=>s(se.canClick),modifier:De,cost:ue,previewModifier:ye,previewCost:N(()=>m.toolNodes.value.unobtainiumRelic==null?Qt(ue,se.amountToIncrease.value):0),showETA:()=>!se.maxed.value}),F.push(se)}K.push(F);break;case"conversion":{const R=Sn(0,Ai(r)),G=qn([.64,.75,.55],r),H=je.value,Ge=r()/2+.25,Ye=r()/2+.25,qe=Ie.value,Ae=U;he=he.add(N(()=>o.sub(Ie.value,qe).add(1).times(2).pow10().times(Ae)));const fe=Dd(()=>({baseResource:kn(c),gainResource:R,formula:xi=>xi.div(H).pow(Ge).times(N(()=>m.toolNodes.value.ironRelic!=null?ee("ironRelic")?4:2:1)),spend(){c.value=0}}));U=he.evaluate(),Ie.value+=2;const De=be,ye=Mn(r),ue=g.variable(R).pow(Ye).add(1),rt=ke(()=>({multiplier:()=>ue.evaluate(),description:ye,enabled:()=>o.gt(R.value,0)})),Ze=ke(()=>({multiplier:()=>ue.evaluate(o.add(R.value,fe.actualGain.value))})),se=cd(()=>({display:{title:ye,description:Z(()=>p("span",null,[P("Reset "),c.displayName,P(" for")," ",fi(R,o.clampMin(fe.actualGain.value,1))," ",R.displayName,p("br",null,null),p("div",null,[P("Next:")," ",fi(c,o.lt(fe.actualGain.value,1)?fe.currentAt.value:fe.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(fe.actualGain.value,1),prestigeResource:R,onClick:fe.convert,visibility:De})),{isHovering:Xe}=te({feature:se,canClick:()=>s(se.canClick),modifier:rt,cost:H,previewCost:c,previewModifier:Ze}),st=N(()=>Xe.value&&se.canClick.value);K.push([se]);const Fn=un(g.variable(R),st,fe.actualGain),Je=un(ue,st,fe.actualGain);ae[V*2]=Z(()=>p(re,null,[He(se.visibility)?p("div",{style:"margin: 10px"},[P("You have")," ",p("h2",{style:{color:G,textShadow:`0px 0px 10px ${G}`}},[Fn()])," ",R.displayName,P(","),p("br",null,null),P("providing a "),Je(),P("x multiplier to previous")," ",c.displayName,P(" gain")]):null,Pi(se)])),Td(this,fe,()=>tt.value.lengthQt(fe,De.value,!0,10)),ue=N(()=>Qt(fe,o.add(De.value,1),!0,10)),rt=N(()=>o.pow(Ae,De.value)),Ze=ke(()=>({multiplier:rt,description:Ge,enabled:()=>He(st.visibility)})),se=U;he=he.add(N(()=>o.sub(Ie.value,H).add(1).times(3).pow(Ae).times(se))),U=he.evaluate(),Ie.value+=3;const Xe=qn([.64,.75,.55],r),st=Ed(()=>({direction:W.Right,width:300,height:20,progress:()=>o.sub(R.value,ye.value).div(o.sub(ue.value,ye.value)).toNumber(),visibility:G,xp:R,display:Z(()=>p("span",null,[xe(R.value),P("/"),xe(ue.value)])),fillStyle:`background-color: ${Xe}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",Fn=>{if(tt.value.lengthJe.state.id===e)&&He(st.visibility)){let Je=o.times($t.value,Fn);m.toolNodes.value.goldRelic!=null&&(Je=o.times(ee("goldRelic")?.5:.25,tt.value.length).add(1).times(Je)),R.value=o.add(Je,R.value)}}),S.push(Ze),K.push([st]),ae[V*2]=Z(()=>p(re,null,[He(st.visibility)?p("div",{style:"margin: 10px"},[P("You have "),p("h3",null,[Ge]),P(" Lv. "),dt(De.value),P(","),p("br",null,null),P("providing a "),xe(rt.value),P("x multiplier to previous")," ",c.displayName,P(" gain"),p("br",null,null)]):null,Pi(st)]));break}case"dimensions":{const R=Mn(r),G=Sn(0,R+" energy"),H=qn([.64,.75,.55],r),Ge=Ie.value,Ye=U;he=he.add(N(()=>o.sub(Ie.value,Ge).add(1).pow_base(32).add(1).log2().add(1).times(Ye)));const qe=N(()=>o.add(G.value,1).log2().add(1)),Ae=ke(()=>({multiplier:qe,description:R,enabled:()=>o.gt(G.value,0)}));S.push(Ae);const fe=be,De=[];for(let ye=0;ye<4;ye++){const ue=o.add(v,r()-.5).pow_base(2).times(10).recip(),rt=je.value,Ze=g.variable(N(()=>Je.amount.value)),se=Ze.pow_base(o.pow10(ye+1)).times(rt),Xe=["First","Second","Third","Fourth"][ye]+" "+R+" Dimension",st=Sn(0,Xe),Fn=Ze.sub(1).pow_base(2).times(ue).times(N(()=>o.add(Je.amount.value,st.value))),Je=pr(()=>({display:{title:Xe,description:Z(()=>p("div",null,[p("div",null,[P("Amount:")," ",xe(o.add(st.value,Je.amount.value))," ",P("["),dt(Je.amount.value),P("]")])])),effectDisplay:Z(()=>p("span",null,[Qr()," ",ye===0?G.displayName:["First","Second","Third","Fourth"][ye-1]+" "+R+" Dimension",P("/s")])),showAmount:!1},style:{width:"400px"},effect:Fn,dimensions:st,limit:100,energy:ye===0?G:void 0,requirements:On(()=>({resource:kn(c),cost:se,maxBulkAmount:()=>ee("diamondRelic")!=null?o.dInf:1,requiresPay:()=>!ee("unobtainiumRelic")})),visibility:fe}));De.push(Je);const xi=cr(Je),tr=N(()=>s(Je.canClick)&&xi.value),Kr=new g({inputs:[Ze],evaluate(nr){return o.sub(nr,1).pow_base(2).times(ue).times(o.add(nr,st.value))}}),Qr=un(Kr,tr);le.push({shouldShowPreview:tr,cost:N(()=>ee("unobtainiumRelic")?0:Qt(se,Je.amountToIncrease.value))});const ea=Di(c,B,()=>Se(se));Ti(Je,{display:ea,direction:W.Down}),U=he.evaluate(),Ie.value++}this.on("preUpdate",ye=>{if(tt.value.lengthue.state.id===e)&&He(fe)){let ue=o.times($t.value,ye);m.toolNodes.value.platinumRelic!=null&&(ue=o.times(ee("platinumRelic")?4:2,ue));const rt=De[0].effect.evaluate();G.value=o.times(rt,ue).add(G.value);for(let Ze=1;Ze<4;Ze++){const se=De[Ze].effect.evaluate();De[Ze-1].dimensions.value=o.times(se,ue).add(De[Ze-1].dimensions.value)}}}),K.push(De),ae[V*2]=Z(()=>p(re,null,[He(fe)?p("div",{style:"margin: 10px"},[P("You have")," ",p("h2",{style:{color:H,textShadow:`0px 0px 10px ${H}`}},[xe(G.value)])," ",G.displayName,P(","),p("br",null,null),P("providing a "),xe(qe.value),P("x multiplier to previous")," ",c.displayName,P(" gain")]):null,ks(...De)]));break}case"prestige":{const R=Mn(r),G=be,H=r()/10+1.1,Ge=je.value;he=he.pow(H);const Ye=Kc(()=>({exponent:H,description:R,enabled:fe.bought}));U=he.evaluate(),Ie.value+=20;const qe=K.filter((ye,ue)=>ue%2===0),Ae=Fd(()=>({thingsToReset:qe,onReset(){c.value=0}})),fe=fr(()=>({display:{title:R,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${xe(H)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{ee("unobtainiumRelic")||Ae.reset()},visibility:G,requirements:On(()=>({resource:kn(c),cost:Ge,requiresPay:!1}))})),De=ke(()=>({multiplier:0}));te({feature:fe,canClick:()=>s(fe.canPurchase),modifier:Ye,cost:Ge,previewCost:N(()=>ee("unobtainiumRelic")?0:c.value),previewModifier:De,showETA:()=>!s(fe.bought)}),K.push([fe]);break}}const nt={cache:"increaseCaches"in b?10:1,generation:"increaseGens"in b?10:1,resourceMulti:"increaseResourceMults"in b?10:1,energyMulti:"increaseEnergyMults"in b?2.5:.25,influences:Object.keys(m.influenceNodes.value).length+ft.length===Object.keys(ct).length?0:"increaseInfluences"in b?20:2,relic:0};let _n=si(nt,r);V===D-1&&"relic"in b&&(_n="relic");let ze="",Et,Vt,Mt,it,Bt,Zt;switch(_n){case"cache":it=Ri(r,i),ze=`Gain ${xe(o.div(I.value,12))}x your current ${it} (no modifiers).`,Vt=()=>{var R,G,H;return m.grantResource(it,o.times((H=(G=(R=m.resourceNodes.value[it])==null?void 0:R.state)==null?void 0:G.amount)!=null?H:0,o.div(I.value,12)))};break;case"generation":it=Ri(r,i);const E=o.div(I.value,40).times(St[it]);ze=`Gain ${xe(E)} ${it}/s while plane is active.`,Et=R=>m.grantResource(it,o.times(R,E)),Mt=N(()=>m.resourceNodes.value[it]);break;case"resourceMulti":Bt=it=Ri(r,i),Zt=o.div(I.value,10).pow_base(2),ze=`Gain ${xe(Zt)}x ${it} while plane is active.`;break;case"energyMulti":Bt="energy",Zt=o.div(I.value,8).add(1),ze=`Gain ${xe(Zt)}x energy while plane is active.`;break;case"influences":const F=Object.keys(ct)[Math.floor(r()*Object.keys(ct).length)];ft.push(F),ze=`Gain a portal influence (${ct[F].display})`,Vt=()=>{if(F in m.influenceNodes.value){vr.warning(`You already have a ${ct[F].display} influence, skipping treasure`);return}const R={id:Pn(m.board),position:{...m.board.types.portal.nodes.value.find(G=>G.state.id===e).position},type:"influence",state:{type:F,data:ct[F].initialData}};m.board.placeInAvailableSpace(R),m.board.nodes.value.push(R)};break;case"relic":ze=t==="ultimatum"?"Win the game!":`Gain the ${t}-tier planar relic (${Pt[t]})`,Vt=()=>{if(t==="ultimatum"){er.value=!0;return}if(`${t}Relic`in m.toolNodes.value)vr.warning(`You already have a ${Pt[t]} relic, skipping treasure`);else{const R={id:Pn(m.board),position:{...m.board.types.portal.nodes.value.find(G=>G.state.id===e).position},type:"passive",state:`${t}Relic`};m.board.placeInAvailableSpace(R),m.board.nodes.value.push(R)}}}const Ii=be,Nn=je.value,Cn=kd(()=>({requirements:On(()=>({resource:kn(c),cost:Nn})),visibility:Ii,display:{requirement:`${xe(Nn)} ${c.displayName}`,effectDisplay:ze},style:"width: 100%",classes:{final:V===D-1},update:Et,onComplete:Vt,link:Mt,effectedResource:Bt,resourceMulti:Zt})),x=Di(c,B,Nn);Ti(Cn,{display:()=>Cn.earned.value?"":x.value,direction:W.Down}),K.push([Cn]),be=N(()=>Cn.earned.value)}const Ot=Hn(K,Ki),gt=Hn(K,Xr);S.push(ke(()=>({multiplier:()=>ee("silver")?4:2,description:()=>(ee("silver")?"Empowered ":"")+Ve.silver.name,enabled:()=>m.toolNodes.value.silver!=null})),ke(()=>({multiplier:()=>o.add(1,(ee("diamond")?2:1)*Ot.filter(V=>V.bought.value).length/10),description:()=>(ee("diamond")?"Empowered ":"")+Ve.diamond.name,enabled:()=>m.toolNodes.value.diamond!=null})),ke(()=>({multiplier:()=>o.div(d.value,6e3).times(ee("emerald")?2:1).add(1),description:()=>(ee("emerald")?"Empowered ":"")+Ve.emerald.name,enabled:()=>m.toolNodes.value.emerald!=null})),ke(()=>({multiplier:()=>o.div(gt.reduce((V,L)=>V.add(s(L.totalAmount)),o.dZero),100).times(ee("gravelRelic")?2:1).add(1).pow(.75),description:()=>(ee("gravelRelic")?"Empowered ":"")+Pt.gravel,enabled:()=>m.toolNodes.value.gravelRelic!=null})),ke(()=>({multiplier:()=>o.add(m.energy.value,1).log10().add(1).pow(ee("beryliumRelic")?.5:.25),description:()=>(ee("beryliumRelic")?"Empowered ":"")+Pt.berylium,enabled:()=>m.toolNodes.value.beryliumRelic!=null})));const yn=_t(()=>[ke(()=>({multiplier:()=>{var V,L,$e;return o.add(($e=(L=(V=m.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.level)!=null?$e:0,1)},description:"Booster",enabled:()=>{var V,L,$e;return($e=(L=(V=m.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.portals.includes(e))!=null?$e:!1}})),ke(()=>({multiplier:()=>o.times(ee("coalRelic")?.2:.1,tt.value.length).add(1),description:()=>(ee("coalRelic")?"Empowered ":"")+Pt.coal,enabled:()=>m.toolNodes.value.coalRelic!=null}))]),$t=N(()=>yn.apply(1)),[Ci,Qn]=jn(()=>[{title:`${at(c.displayName)} Gain`,modifier:T,base:0,unit:"/s"},{title:`${at(c.displayName)} Time Speed`,modifier:yn,base:1,visible:()=>o.gt($t.value,1)}]),wn=z(!1),ei=Z(()=>p(Rt,{modelValue:wn.value,"onUpdate:modelValue":V=>wn.value=V},{header:()=>p("h2",null,[P("Modifiers")]),body:()=>ot(Ci)}));this.on("preUpdate",V=>{if(!m.activePortals.value.some($e=>$e.state.id===e))return;const L=o.times($t.value,V);d.value=o.add(d.value,L),tt.value.length{var nt;(nt=$e.update)==null||nt.call($e,L)})}),Ld(this,()=>tt.value.lengthtt.value.length{const V=le.find(L=>L.shouldShowPreview.value);return V?o.neg(Se(V.cost)):0}),qt=N(()=>{const V=le.find(L=>L.shouldShowPreview.value);return V&&V.modifier?o.sub(V.modifier.apply(0),B.value):0}),Rn=un(g.variable(0).add(c),()=>o.neq(An.value,0),An),ti=un(g.variable(0).add(B),()=>o.neq(qt.value,0),qt),ni=N(()=>{const V=[];return tt.value.forEach(L=>{L.link&&V.push(L.link)}),V}),ki=N(()=>{const V={};return tt.value.forEach(L=>{L.effectedResource!=null&&L.resourceMulti!=null&&(V[L.effectedResource]!=null?V[L.effectedResource]=o.times(V[L.effectedResource],L.resourceMulti):V[L.effectedResource]=L.resourceMulti)}),V}),tt=N(()=>{const V=[];for(let L=1;Lo.lt(tt.value.length,D)&&K.some(V=>V.some(L=>"earned"in L&&s(L.earned)||"bought"in L&&s(L.bought)?!1:("canClick"in L&&s(L.canClick)||"canPurchase"in L&&s(L.canPurchase),!0)))),Si=N(()=>{const V=K.findIndex(($e,nt)=>nt>0&&nt%2===0&&!K[nt-1][0].earned.value);let L;return V===-1?L=K:L=K.slice(0,V),L.map(($e,nt)=>nt in ae?ot(ae[nt]):Pi(...$e))});return{tier:lt(t),seed:lt(n),influences:lt(i),name:a,color:u,resource:c,background:l,style:{background:l,"--background":l},features:K,resourceTabCollapsed:Qn,links:ni,resourceMultis:ki,earnedTreasures:tt,showNotif:Mi,timeActive:d,bonusRewardsLevel:_,display:Z(()=>p(re,null,[p(pi,{class:"nav-container",style:"z-index: 5"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",null,[a])]),p("span",{class:"nav-segment"},[p("h3",null,[t,P("-tier")])]),i.length===0?null:p("span",{class:"nav-segment"},[p(Re,{display:i.map(V=>{const L=ct[V.type].description;return typeof L=="function"?L(V):L}).join("
"),direction:W.Down,style:"width: 300px"},{default:()=>[p("h3",null,[i.length,P(" influences")])]})]),p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>wn.value=!0},[P("modifiers")])])]}),p(pi,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[ot(Rn)])," ",c.displayName]),p("span",{class:"nav-segment"},[P("("),p("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[o.gt(B.value,0)?"+":"",ot(ti)]),P("/s)")]),o.neq($t.value,1)?p("span",{class:"nav-segment"},[P("Speed: "),xe($t.value),P("x")]):null]}),p(hd,{height:"60px"},null),Si.value,ot(ei)])),minimizedDisplay:Z(()=>p("div",null,[p("span",null,[a]),p("span",{style:"font-size: large; vertical-align: sub;"},[" ",tt.value.length,P("/"),D,P(" treasures")])]))}})}function Ri(e,t){t=t.filter(l=>l.type==="increaseResources"||l.type==="decreaseResources");const n=Object.keys(St).reduce((l,c)=>{let d=St[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?d*=1e3:d/=1e3}),l+d},0),i=Object.keys(St),r=Math.floor(e()*n);let a=0,u;for(let l=0;ll+c),i=Object.keys(e);let r=0,a=null;const u=t()*n;for(let l=0;le===m.board.selectedNode.value?{text:"Mining"}:Object.keys(m.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[Ft,Xi("mine")],progress:e=>Ce(e)?new o(e.state.progress).toNumber():0,progressDisplay:nn.Outline,progressColor:"var(--accent2)",classes:e=>({running:Ce(e)}),draggable:!0},Yd={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===m.board.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:Math.PI/4,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 100 energy"},onClick(e){o.gte(m.energy.value,100)&&(e.type="factory",m.energy.value=o.sub(m.energy.value,100),m.helpModals.factory.showModal.value=!0)},confirmationLabel:()=>o.gte(m.energy.value,1e3)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},Zd={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===m.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${Ve[e.state].name}`};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="resource"){const i=((n=m.board.draggingNode.value)==null?void 0:n.state).type,r=e.state===i?"Disconnect":m.toolNodes.value[i]==null?Ve[i].name:"Already crafted",a=e.state===i||m.toolNodes.value[i]==null?"var(--accent2)":"var(--danger)";return{text:r,color:a}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(e){e.state=void 0,m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${Ve[e.state].name} - ${We(Ve[e.state].cost)} energy`}),onClick(e){const t=Ve[e.state];if(o.gte(m.energy.value,t.cost)&&m.toolNodes.value[e.state]==null){m.energy.value=o.sub(m.energy.value,t.cost);const n={id:Pn(m.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};if(m.board.placeInAvailableSpace(n),m.board.nodes.value.push(n),e.state==="iron"){const i={id:Pn(m.board),position:{...e.position},type:"trashCan"};m.board.placeInAvailableSpace(i),m.board.nodes.value.push(i)}m.board.selectedAction.value=null,m.board.selectedNode.value=null,e.state=void 0,t.type in m.helpModals&&(m.helpModals[t.type].showModal.value=!0)}},fillColor:e=>o.gte(m.energy.value,Ve[e.state].cost)&&m.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(m.energy.value,Ve[e.state].cost)?m.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}},Xi("factory")],progress:e=>e.state==null||m.toolNodes.value[e.state]!=null?0:o.div(o.sqrt(m.energy.value),o.sqrt(Ve[e.state].cost)).clampMax(1).toNumber(),progressDisplay:nn.Fill,progressColor:e=>e.state!=null&&o.gte(m.energy.value,Ve[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){var i;if(t.type!=="resource")return!1;const n=((i=m.board.draggingNode.value)==null?void 0:i.state).type;return m.toolNodes.value[n]==null},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,m.board.selectedNode.value=e},draggable:!0},Xd=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],Jd={shape:Le.Circle,size:50,title:e=>at(e.state.type),subtitle:e=>We(e.state.amount),otherSubtitle:e=>Xd[Lt.indexOf(e.state.type)],progress:e=>nd(e.state.type),onClick(){},progressDisplay:nn.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":m.dowsing.value!=null&&Ce(m.dowsing.value)&&m.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=m.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0},Kd={shape:Le.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?Pt[t.slice(0,-5)]:Ve[t].name},label:e=>e===m.board.selectedNode.value?{text:vd[e.state].description(ee(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":ee(e.state)}),draggable:!0},Qd={shape:Le.Diamond,size:50,title:"\u{1F962}",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Dowsing - Drag a resource to me!":`Dowsing (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(2).pow_base(100),16),Ft,Xi("dowsing")],classes:e=>({running:Ce(e)}),canAccept:Gr,onDrop:Ur,draggable:!0},ep={shape:Le.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Quarry - Drag a resource to me!":`Quarrying (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Gather ${bt(o.div(m.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(2).pow_base(1e4),16),Ft],progress:e=>Ce(e)?o.eq(m.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(m.quarryProgressRequired.value).toNumber():0,progressDisplay:nn.Outline,progressColor:"var(--accent2)",canAccept:Gr,onDrop:Ur,classes:e=>({running:Ce(e)}),draggable:!0},tp={shape:Le.Diamond,size:50,title:"\u{1F50C}",label:e=>e===m.board.selectedNode.value?{text:e.state.tools.length===0?"Empowerer - Drag a tool to me!":`Empowering (${e.state.tools.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:Qc(e,t=>t.includes("Relic")?`Double ${Pt[t.slice(0,-5)]}'s effect`:`Double ${Ve[t].name}'s effect`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(3).pow_base(1e3),24),Ft],canAccept:ed,onDrop:td,classes:e=>({running:Ce(e)}),draggable:!0},np={shape:Le.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===m.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${at(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type;if(e.state.influences.includes(n))return{text:"Disconnect",color:"var(--accent2)"};const r=ct[n].cost;let a;return o.lt(r,1e3)?a=We(r):a=Vi(r,0),{text:`Add influence (${a}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${ge[t.state.id].name}`};return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(e){e.state={...e.state,tier:void 0,influences:[]},m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{const{tier:t,influences:n}=e.state;return t!=null||n.length>0}},{id:"makePortal",icon:"done",tooltip:e=>({text:`Spawn ${e.state.tier}-tier portal - ${We(m.computedPortalCost.value)} energy`}),fillColor:()=>o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--danger)",confirmationLabel:()=>o.gte(m.energy.value,m.computedPortalCost.value)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(e){if(o.lt(m.energy.value,m.computedPortalCost.value))return;let t=0;for(;`portal-${t}`in ge;)t++;m.energy.value=o.sub(m.energy.value,m.computedPortalCost.value);const{tier:n,influences:i}=e.state;Wi(Jr(`portal-${t}`,n,Math.floor(Math.random()*4294967296),i.map(a=>m.influenceNodes.value[a].state)),Q);const r={id:Pn(m.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};m.board.placeInAvailableSpace(r),m.board.nodes.value.push(r),m.board.selectedAction.value=null,m.board.selectedNode.value=null,e.state={tier:void 0,influences:[]}},visibility:e=>e.state.tier!=null}],canAccept(e,t){return t.type==="resource"||t.type==="influence"||t.type==="portal"},onDrop(e,t){if(t.type==="resource"){const n=t.state.type,i=e.state.tier;e.state={...e.state,tier:n===i?void 0:n}}else if(t.type==="influence"){const n=t.state.type,i=e.state.influences;i.includes(n)?e.state={...e.state,influences:i.filter(r=>r!==n)}:e.state={...e.state,influences:[...i,n]}}else if(t.type==="portal"){const n=ge[t.state.id];e.state={...e.state,tier:n.tier.value,influences:n.influences.value.map(i=>i.type)}}m.board.selectedNode.value=e},progress:e=>e.state.tier==null?0:o.div(o.sqrt(m.energy.value),o.sqrt(m.computedPortalCost.value)).clampMax(1).toNumber(),progressDisplay:nn.Fill,progressColor:e=>e.state.tier!=null&&o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},ip={shape:Le.Diamond,size:50,title:"\u{1F300}",label:e=>e===m.board.selectedNode.value?{text:`Portal to ${ge[e.state.id].name}`,color:ge[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[Ft],classes:e=>({running:Ce(e),showNotif:ge[e.state.id].showNotif.value,"affected-node":m.booster.value!=null&&Ce(m.booster.value)&&m.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>ge[e.state.id].background,draggable:!0},rp={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?Le.Diamond:Le.Circle,size:50,title:e=>ct[e.state.type].display,otherSubtitle:e=>{const t=ct[e.state.type].cost;return o.lt(t,1e3)?`${We(t)}x cost`:`${Vi(t,0)}x cost`},label:e=>{if(e===m.board.selectedNode.value){const n=e.state,i=ct[n.type].description;return{text:typeof i=="function"?i(n):i}}const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type,{type:i,data:r}=e.state;let a;if(Array.isArray(r)&&r.includes(n))a="Disconnect";else if(i==="increaseResources")a=`Increase ${at(n)} odds`;else if(i==="decreaseResources")a=`Decrease ${at(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[an],canAccept:(e,t)=>t.type!=="resource"?!1:Array.isArray(e.state.data),onDrop:(e,t)=>{if(t.type!=="resource")return;const n=t.state.type,i=e.state.data;i!=null&&(i.includes(n)?e.state={...e.state,data:i.filter(r=>r!==n)}:e.state={...e.state,data:[...i,n]},m.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},ap={shape:Le.Diamond,size:50,title:"\u231B",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${We(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:hi(e,t=>`Boost ${ge[t].name}'s speed`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${We(ri.evaluate(e.state.level))} energy`}},fillColor(e){return o.gte(m.energy.value,ri.evaluate(e.state.level))?"var(--bought)":"var(--locked)"},confirmationLabel(e){return o.gte(m.energy.value,ri.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=ri.evaluate(e.state.level);o.gte(m.energy.value,t)&&(m.energy.value=o.sub(m.energy.value,t),e.state={...e.state,level:o.add(e.state.level,1)},m.board.selectedAction.value=null)}},Ft],canAccept:bi,onDrop:yi,classes:e=>({running:Ce(e)}),draggable:!0},sp={shape:Le.Diamond,size:50,title:"\u{1F916}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Upgrader - Drag a portal to me!":`Auto-Upgrading (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:hi(e,t=>`Auto-buy ${ge[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(4).pow_base(1e6)),Ft],canAccept:bi,onDrop:yi,classes:e=>({running:Ce(e)}),draggable:!0},op={shape:Le.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Automator - Drag a portal to me!":`Automatating (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:hi(e,t=>`Auto-buy ${ge[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(4).pow_base(1e6)),Ft],canAccept:bi,onDrop:yi,classes:e=>({running:Ce(e)}),draggable:!0},lp={shape:Le.Diamond,size:50,title:"\u{1F4B1}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Investments - Drag a portal to me!":`Investing (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:hi(e,t=>`Passively generate ${ge[t].name}'s conversions`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(3).pow_base(1e8)),Ft],canAccept:bi,onDrop:yi,classes:e=>({running:Ce(e)}),draggable:!0},up={shape:Le.Diamond,size:50,title:"\u{1F5D1}\uFE0F",label:e=>{var t;if(e===m.board.selectedNode.value)return{text:"Trash Can - Drag a portal to me!"};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="portal"){const n=m.board.draggingNode.value.state.id;return{text:`Delete ${ge[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;Hi(ge[n]),delete Q.layers[n],m.board.state.value.nodes=m.board.state.value.nodes.filter(i=>i!==t),m.booster.value&&(m.booster.value.state={...m.booster.value.state,portals:m.booster.value.state.portals.filter(i=>i!==n)}),m.upgrader.value&&(m.upgrader.value.state={...m.upgrader.value.state,portals:m.upgrader.value.state.portals.filter(i=>i!==n)}),m.automator.value&&(m.automator.value.state={...m.automator.value.state,portals:m.automator.value.state.portals.filter(i=>i!==n)}),m.investments.value&&(m.investments.value.state={...m.investments.value.state,portals:m.investments.value.state.portals.filter(i=>i!==n)})},draggable:!0};function Qi(e,t){const n=lt(!1);return{modal:Z(()=>p(Rt,{modelValue:n.value,"onUpdate:modelValue":r=>n.value=r},{header:()=>p("h2",null,[e]),body:t})),showModal:n}}function cp(){return Qi("Getting Started",Z(()=>p("div",null,[p("p",null,[P(`Welcome to Planar Pioneers! Your job is to gather resources and eventually explore and conquer increasingly difficult "planes", which are like alien worlds. To start you'll use the mine (\u{1FAA8}) machine to gather resources.`)]),p("br",null,null),p("p",null,[P(`You'll gain energy every second based on how much of each resource you have. You can check the exact calculation and various other information by clicking the "modifiers" button near the top of the screen.`)]),p("br",null,null),p("p",null,[P("Select the machine by clicking it to make the mine active. You can also drag them around to organize your various machines and other objects. While selected machines will have various actions you can take, such as viewing the help for that machine. There's also an action to power the machine, allowing it to be active even while not selected, at the cost of energy per second (cost increases based on the total number of machines being powered).")])])))}function dp(){return Qi("Forging",Z(()=>p("div",null,[p("p",null,[P("You've repaired the forge (\u{1F6E0}\uFE0F)! This is the next main line of progression. Here you'll be able to craft a total of 16 machines and passive bonuses to create - one for each resource!")]),p("br",null,null),p("p",null,[P("Drag a resource onto the forge to select that resource tier. You can then use an action on the forge to create that item, at the cost of energy based on the resource tier. You can only have 1 of each item.")])])))}function pp(){return Qi("Dowsing",Z(()=>p("div",null,[p("p",null,[P("You've created the dowsing rod (\u{1F962})! This machine let's you bias the odds of specified resources from mining. It will double the odds of each specified resource, so keep in mind rare resources will still be fairly rare.")]),p("br",null,null),p("p",null,[P("Specify resources to boost by dragging them to the dowsing rod. You can only select a single resource to start, but that can be increased using an action.")])])))}const hr=mi(),fp={mine:Hd,brokenFactory:Yd,factory:Zd,resource:Jd,passive:Kd,dowsing:Qd,quarry:ep,empowerer:tp,portalGenerator:np,portal:ip,influence:rp,booster:ap,upgrader:sp,automator:op,investments:lp,trashCan:up},m=Ui("main",function(){const e=Sn(0,"energy"),t=N(()=>v.types.resource.nodes.value.reduce((x,E)=>(x[E.state.type]=E,x),{})),n=N(()=>({...v.types.passive.nodes.value.reduce((x,E)=>(x[E.state]=E,x),{}),sand:v.types.dowsing.nodes.value[0],wood:v.types.quarry.nodes.value[0],coal:v.types.empowerer.nodes.value[0],iron:v.types.portalGenerator.nodes.value[0],gold:v.types.booster.nodes.value[0],platinum:v.types.upgrader.nodes.value[0],berylium:v.types.automator.nodes.value[0],ultimatum:v.types.investments.nodes.value[0]})),i=N(()=>Object.keys(Pt).filter(x=>`${x}Relic`in n.value).length),r=N(()=>({...v.types.influence.nodes.value.reduce((x,E)=>(x[E.state.type]=E,x),{})})),a=N(()=>({...v.types.portal.nodes.value.reduce((x,E)=>(x[E.state.id]=E,x),{})})),u=N(()=>Lt.reduce((x,E)=>{var R,G,H;const F=(H=(G=(R=t.value[E])==null?void 0:R.state)==null?void 0:G.amount)!=null?H:0;return x[E]=o.floor(Fi.invert(F)),x},{})),l=fn({}),c=fn({});Ut(()=>{Lt.forEach(x=>{vt(()=>u.value[x],(E,F)=>{const R=o.sub(E,F);o.gt(R,1)&&ce.active===Q.id&&hr.info(p("div",null,[p("h3",null,[o.eq(E,1)?`${at(x)} discovered`:`${at(x)} is now Level ${dt(E)}`,P("!")]),o.gt(R,1)?p("div",null,[P("Gained "),dt(R),P(" levels")]):null]))})})});const d=N(()=>K.filter(x=>{var E,F;return(F=(E=x.value)==null?void 0:E.state)==null?void 0:F.powered}).length+v.types.portal.nodes.value.filter(x=>x.state.powered).length),h=N(()=>{let x=d.value;return n.value.copperRelic!=null&&(x--,ee("copperRelic")&&x--),x}),f=N(()=>{const x=h.value;return o.lt(x,0)?0:o.eq(x,0)?10:o.add(x,1).pow_base(100).div(10).times(.99)}),b=N(()=>{if(D.value==null)return 0;let E=D.value.state.resources.reduce((F,R)=>o.div(100,qt[R].computedModifier.value).add(F),o.dZero);return n.value.silverRelic!=null&&(E=o.div(E,o.add(d.value,1)),ee("silverRelic")&&(E=o.div(E,o.add(d.value,1)))),E}),v=jc(x=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:fp,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const E=[];if(E.push(...Object.keys(l).map(F=>({startNode:y.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),_.value!=null&&_.value.state!=null&&E.push({startNode:_.value,endNode:t.value[_.value.state],stroke:"var(--foreground)",strokeWidth:4}),I.value!=null&&I.value.state.resources.forEach(F=>{E.push({startNode:I.value,endNode:t.value[F],stroke:Ce(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),D.value!=null&&D.value.state.resources.forEach(F=>{E.push({startNode:D.value,endNode:t.value[F],stroke:"var(--foreground)",strokeWidth:4})}),E.push(...Object.keys(c).map(F=>({startNode:D.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),S.value!=null&&S.value.state.tools.forEach(F=>{E.push({startNode:S.value,endNode:n.value[F],stroke:Ce(S.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),T.value!=null){const F=T.value.state;F.tier!=null&&E.push({startNode:T.value,endNode:t.value[F.tier],stroke:"var(--foreground)",strokeWidth:4}),F.influences.forEach(R=>{E.push({startNode:T.value,endNode:r.value[R],stroke:"var(--foreground)",strokeWidth:4})}),x.types.portal.nodes.value.forEach(R=>{const G=ge[R.state.id];return G.links.value.forEach(H=>{H.value!=null&&E.push({startNode:R,endNode:H.value,stroke:Ce(R)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(G.resourceMultis.value).forEach(H=>{H!=="energy"&&H in t.value&&E.push({startNode:R,endNode:t.value[H],stroke:Ce(R)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),E})}return B.value!=null&&B.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{E.push({startNode:B.value,endNode:a.value[F],stroke:Ce(B.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),le.value!=null&&le.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{E.push({startNode:le.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{E.push({startNode:ae.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),te.value!=null&&te.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{E.push({startNode:te.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(r.value).forEach(F=>{const R=F.state;(R.type==="increaseResources"||R.type==="decreaseResources")&&R.data.forEach(G=>{E.push({startNode:F,endNode:t.value[G],stroke:"var(--foreground)",strokeWidth:4})})}),E}})),y=N(()=>v.types.mine.nodes.value[0]),_=N(()=>v.types.factory.nodes.value[0]),I=N(()=>n.value.sand),D=N(()=>n.value.wood),S=N(()=>n.value.coal),T=N(()=>n.value.iron),B=N(()=>n.value.gold),le=N(()=>n.value.platinum),ae=N(()=>n.value.berylium),te=N(()=>n.value.ultimatum),K=[y,I,D,S,B,le,ae,te];function Ie(x,E){let F=t.value[x];if(E=o.times(E,Rn[x].computedModifier.value),F==null)F={id:Pn(v),position:{...y.value.position},type:"resource",state:{type:x,amount:E}},v.placeInAvailableSpace(F),v.nodes.value.push(F);else{const R=F.state;F.state={...R,amount:o.add(R.amount,E)}}}const he=N(()=>Object.keys(St).reduce((x,E)=>x+new o(qt[E].computedModifier.value).toNumber(),0)),U=N(()=>{const x={};return v.types.portal.nodes.value.forEach(E=>{if(!Ce(E))return;const R=ge[E.state.id].resourceMultis.value;Object.keys(R).forEach(G=>{x[G]!=null?x[G]=o.times(x[G],R[G]):x[G]=R[G]})}),x}),be=_t(()=>Lt.map(x=>zt(()=>({description:()=>at(x),addend:()=>u.value[x],enabled:()=>o.gt(u.value[x],0)})))),je=N(()=>be.apply(0)),ft=_t(()=>[zt(()=>({addend:je,description:"Resource Levels"})),ke(()=>({multiplier:()=>o.pow(An.value,je.value),description:()=>`${Gt(An.value,3)}x per Resource Level`})),ke(()=>({multiplier:()=>ee("stone")?4:2,description:()=>(ee("stone")?"Empowered ":"")+Ve.stone.name,enabled:()=>n.value.stone!=null})),ke(()=>({multiplier:()=>{var x;return(x=U.value.energy)!=null?x:1},description:"Planar Treasures",enabled:()=>{var x;return o.neq((x=U.value.energy)!=null?x:1,1)}})),zt(()=>({addend:()=>o.pow(100,h.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(h.value,0)}))]),Ot=N(()=>ft.apply(0)),gt=_t(()=>[zt(()=>({addend:()=>ee("unobtainium")?2:1,description:()=>(ee("unobtainium")?"Empowered ":"")+Ve.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),yn=N(()=>gt.apply(0)),$t=_t(()=>[ke(()=>({multiplier:()=>ee("dirt")?4:2,description:()=>(ee("dirt")?"Empowered ":"")+Ve.dirt.name,enabled:()=>n.value.dirt!=null})),ke(()=>({multiplier:()=>o.pow(i.value,ee("woodRelic")?2:1),description:()=>(ee("woodRelic")?"Empowered ":"")+Pt.wood,enabled:()=>n.value.woodRelic!=null}))]),Ci=N(()=>$t.apply(1)),Qn=_t(()=>[ke(()=>({multiplier:()=>ee("gravel")?4:2,description:()=>(ee("gravel")?"Empowered ":"")+Ve.gravel.name,enabled:()=>n.value.gravel!=null}))]),wn=N(()=>Qn.apply(1)),ei=_t(()=>[zt(()=>({addend:()=>ee("copper")?.004:.002,description:()=>(ee("copper")?"Empowered ":"")+Ve.copper.name,enabled:()=>n.value.copper!=null}))]),An=N(()=>ei.apply(1.01)),qt=Object.keys(St).reduce((x,E)=>{const F=_t(()=>[ke(()=>({multiplier:2,description:"Dowsing",enabled:()=>I.value!=null&&Ce(I.value)&&I.value.state.resources.includes(E)}))]),R=N(()=>F.apply(St[E])),G={title:`${at(E)} Drop Rate`,modifier:F,base:St[E]};return x[E]={modifier:F,computedModifier:R,section:G},x},{}),Rn=Object.keys(St).reduce((x,E)=>{const F=_t(()=>[ke(()=>({multiplier:()=>{var H;return(H=U.value[E])!=null?H:1},description:"Planar Treasures",enabled:()=>{var H;return o.neq((H=U.value[E])!=null?H:1,1)}}))]),R=N(()=>F.apply(1)),G={title:`${at(E)} Gain`,modifier:F};return x[E]={modifier:F,computedModifier:R,section:G},x},{}),ti=N(()=>{var E,F,R;const x=Lt.indexOf((R=(F=(E=T.value)==null?void 0:E.state)==null?void 0:F.tier)!=null?R:"dirt");return o.add(x,1).times(x).div(2).add(9).pow10()}),ni=_t(()=>[...Object.keys(ct).map(x=>ke(()=>({multiplier:ct[x].cost,description:ct[x].display,enabled:()=>{var E,F,R;return(R=(F=(E=T.value)==null?void 0:E.state)==null?void 0:F.influences.includes(x))!=null?R:!1},smallerIsBetter:!0}))),ke(()=>({multiplier:()=>ee("emeraldRelic")?.05:.1,description:()=>(ee("emeraldRelic")?"Empowered ":"")+Pt.emerald,enabled:()=>n.value.emeraldRelic!=null,smallerIsBetter:!0}))]),ki=N(()=>ni.apply(ti.value)),[tt,Mi]=jn(()=>[{title:"Resource Levels",modifier:be,base:0},{title:"Energy Gain",modifier:ft,base:0,unit:"/s"},{title:"Portal Cost",modifier:ni,base:ti,unit:" energy",baseText:()=>{var x,E,F;return`${at((F=(E=(x=T.value)==null?void 0:x.state)==null?void 0:E.tier)!=null?F:"dirt")}-tier Base Cost`},visible:()=>T.value!=null,smallerIsBetter:!0},{title:"Bonus Connections",modifier:gt,base:0,visible:()=>o.gt(yn.value,0)}]),[Si,V]=jn(()=>[{title:"Mining Speed",modifier:$t,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:Qn,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:ei,base:1.01,visible:()=>n.value.copper!=null}]),[L,$e]=jn(()=>Object.values(qt).map(x=>x.section)),[nt,_n]=jn(()=>Object.values(Rn).map(x=>x.section)),ze=Jc({general:()=>({display:"General",glowColor(){return ze.activeTab.value===this.tab?"white":""},tab:tt,energyTabCollapsed:Mi}),mining:()=>({display:"Mine",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(n.value).length>0,tab:Si,miningTabCollapsed:V}),resources:()=>({display:"Ore Rates",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>I.value!=null,tab:L,resourcesCollapsed:$e}),resourcesGain:()=>({display:"Ore Gain",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(Rn).some(x=>o.neq(x.computedModifier.value,1)),tab:nt,resourceGainCollapsed:_n})}),Et=z(!1),Vt=Z(()=>p(Rt,{modelValue:Et.value,"onUpdate:modelValue":x=>Et.value=x},{header:()=>p("h2",null,[P("Modifiers")]),body:()=>ot(ze)})),Mt={mine:cp(),factory:dp(),dowsing:pp()};Mt.mine.showModal[Ht]=!0,Mt.mine.showModal.value=!0,this.on("preUpdate",x=>{if(Object.keys(l).forEach(E=>{l[E]-=x,l[E]<=0&&delete l[E]}),Object.keys(c).forEach(E=>{c[E]-=x,c[E]<=0&&delete c[E]}),Ce(y.value)){const E=o.add(y.value.state.progress,o.times(Ci.value,x)),F=E.floor();y.value.state={...y.value.state,progress:o.sub(E,F)};const R=F.div(he.value).floor();R.gt(0)&&Lt.forEach(H=>{Ie(H,o.times(new o(qt[H].computedModifier.value).toNumber(),R).times(wn.value)),l[H]=.3});const G=o.sub(F,R).toNumber();for(let H=0;H0){let R=o.add(E,x);const G=o.div(E,b.value).floor();R=o.sub(R,o.times(G,b.value)),D.value.state={...D.value.state,progress:R},o.gt(G,0)&&F.forEach(H=>{Ie(H,G),c[H]=.3})}}e.value=o.add(e.value,o.times(Ot.value,x)),o.lt(e.value,0)&&(e.value=0,K.forEach(E=>{var F;((F=E.value)==null?void 0:F.state).powered=!1}),Object.values(a.value).forEach(E=>{E.state.powered=!1}),y.value.state={...y.value.state,powered:!1},hr.warning(p("div",null,[p("h3",null,[P("Ran out of energy!")]),p("div",null,[P("All machines have been turned off.")])])))});const it=N(()=>{var x,E;return v.selectedAction.value===v.types.brokenFactory.actions[0]?-100:v.selectedAction.value===v.types.factory.actions[1]?o.neg(Ve[v.selectedNode.value.state].cost):((x=v.selectedAction.value)==null?void 0:x.id)==="moreConnections"?o.neg(v.selectedAction.value.formula.evaluate(((E=v.selectedNode.value)==null?void 0:E.state).maxConnections)):0}),Bt=un(g.variable(0).add(e),()=>o.neq(it.value,0),it),Zt=N(()=>{var x;return v.selectedAction.value===Ft?((x=v.selectedNode.value)==null?void 0:x.state).powered?o.eq(d.value,1)?10:o.pow(100,d.value).div(10).times(.99):o.neg(f.value):0}),Ii=un(g.variable(0).add(Ot),()=>o.neq(Zt.value,0),Zt),Nn=N(()=>v.types.portal.nodes.value.filter(x=>Ce(x))),Cn=N(()=>Nn.value.sort((x,E)=>{var G,H;const F=(G=ge[x.state.id])!=null&&G.minimized.value?1:0,R=(H=ge[E.state.id])!=null&&H.minimized.value?1:0;return F-R}).map(x=>x.state.id));return vt(Cn,x=>{Ut(()=>{Q.tabs=["main",...x]})}),vt(yn,(x,E)=>{o.lt(x,E)&&(ln(x,I,"resources"),ln(x,D,"resources"),ln(x,S,"tools"),ln(x,B,"portals"),ln(x,le,"portals"),ln(x,ae,"portals"),ln(x,te,"portals"))}),{name:"World",board:v,energy:e,modifierTabs:ze,resourceNodes:t,toolNodes:n,influenceNodes:r,grantResource:Ie,activePortals:Nn,nextPowerCost:f,computedBonusConnectionsModifier:yn,quarryProgressRequired:b,dropRates:qt,dowsing:I,empowerer:S,booster:B,upgrader:le,automator:ae,investments:te,resourceLevels:u,planarMultis:U,computedPortalCost:ki,helpModals:Mt,display:Z(()=>p(re,null,[p(pi,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[ot(Bt)])," ",P("energy")]),p("span",{class:"nav-segment"},[P("("),p("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(Ot.value,0)?"+":"",ot(Ii)]),P("/s)")]),o.gt(d.value,0)?p("span",{class:"nav-segment"},[p("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[dt(d.value)])," ",P("machines powered")]):null,p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>Et.value=!0},[P("modifiers")])]),Q.devSpeed===0?p("span",{class:"nav-segment"},[P("Game Paused")]):Q.devSpeed!=null&&Q.devSpeed!==1?p("span",{class:"nav-segment"},[P("Dev Speed: "),xe(Q.devSpeed),P("x")]):null]}),ot(v),ot(Vt),Object.values(Mt).map(({modal:x})=>x())]))}}),gp=e=>{var n,i,r,a,u;const t=[m];return(u=(a=(r=(i=(n=e.layers)==null?void 0:n.main)==null?void 0:i.board)==null?void 0:r.state)==null?void 0:a.nodes)==null||u.filter(l=>(l==null?void 0:l.type)==="portal").map(l=>{var c,d;return(d=(c=l==null?void 0:l.state)==null?void 0:c.id)!=null?d:""}).forEach(l=>{var d,h,f,b;const c=(d=e.layers)==null?void 0:d[l];t.push(Jr(l,(h=c.tier)!=null?h:"dirt",(f=c.seed)!=null?f:Math.floor(Math.random()*4294967296),(b=c.influences)!=null?b:[]))}),t},er=z(!1);function mp(e,t){}var vp=Object.freeze(Object.defineProperty({__proto__:null,main:m,getInitialLayers:gp,hasWon:er,fixOldSave:mp},Symbol.toStringTag,{value:"Module"}));const Kn=e=>(gn("data-v-4a50ce42"),e=e(),mn(),e),hp={class:"game-over-modal-header"},bp=["src","alt"],yp={class:"game-over-modal-title"},wp=Kn(()=>C("h2",null,"Congratulations!",-1)),_p={key:0},Np=Kn(()=>C("br",null,null,-1)),Cp=Kn(()=>C("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),kp=Kn(()=>C("br",null,null,-1)),Mp=["href"],Sp=Kn(()=>C("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),Ip=J({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:u}=we,l=N(()=>vi(Q.timePlayed)),c=N(()=>er.value&&!Q.keepGoing),d=tn(Q,"autosave");function h(){Q.keepGoing=!0}function f(){cn(xn())}return(b,v)=>(M(),ne(Rt,{"model-value":s(c)},{header:Y(()=>[C("div",hp,[s(n)?(M(),A("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,bp)):j("",!0),C("div",yp,[wp,C("h4",null,"You've beaten "+de(s(t))+" v"+de(s(a))+": "+de(s(u)),1)])])]),body:Y(({shown:y})=>[y?(M(),A("div",_p,[C("div",null,"It took you "+de(s(l))+" to beat the game.",1),Np,Cp,kp,C("div",null,[C("a",{href:s(r),class:"game-over-modal-discord-link"},[Sp,P(" "+de(s(i)),1)],8,Mp)]),p(jt,{title:"Autosave",modelValue:s(d),"onUpdate:modelValue":v[0]||(v[0]=_=>Fe(d)?d.value=_:null)},null,8,["modelValue"])])):j("",!0)]),footer:Y(()=>[C("div",{class:"game-over-footer"},[C("button",{onClick:h,class:"button"},"Keep Going"),C("button",{onClick:f,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var xp=ve(Ip,[["__scopeId","data-v-4a50ce42"]]);const Ni=e=>(gn("data-v-2776d67d"),e=e(),mn(),e),$p=Ni(()=>C("div",{class:"nan-modal-header"},[C("h2",null,"NaN value detected!")],-1)),Ep={key:0},Pp=Ni(()=>C("br",null,null,-1)),Dp=["href"],Tp=Ni(()=>C("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Ap=Ni(()=>C("br",null,null,-1)),Rp={class:"nan-footer"},Fp=J({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=we,i=z(!0),r=z(!0),a=tn(Ue,"hasNaN"),u=z(null);vt(a,b=>{b?(i.value=Q.autosave,r.value=Q.devSpeed===0):(Q.autosave=i.value,Q.devSpeed=r.value?0:null)});const l=N(()=>{var b;return(b=Ue.NaNPath)==null?void 0:b.join(".")}),c=N(()=>Ue.NaNPersistent!=null?Ue.NaNPersistent.value:null);function d(){Ue.NaNPersistent!=null&&(Ue.NaNPersistent.value=new o(0),Ue.hasNaN=!1)}function h(){Ue.NaNPersistent&&(Ue.NaNPersistent.value=new o(1),Ue.hasNaN=!1)}function f(){Ue.NaNPersistent&&(Ue.NaNPersistent.value=new o(NaN),Ue.hasNaN=!1)}return(b,v)=>(M(),A(re,null,[p(Rt,Wt({modelValue:s(a),"onUpdate:modelValue":v[4]||(v[4]=y=>Fe(a)?a.value=y:null)},b.$attrs),{header:Y(()=>[$p]),body:Y(()=>[C("div",null,[P(' Attempted to assign "'+de(s(l))+'" to NaN',1),s(c)?(M(),A("span",Ep,de(" ")+"(previously "+de(s(xe)(s(c)))+")",1)):j("",!0),P(". Auto-saving has been "+de(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Pp,C("div",null,[C("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Tp,P(" "+de(s(t)||"The Paper Pilot Community"),1)],8,Dp)]),Ap,p(jt,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":v[0]||(v[0]=y=>i.value=y)},null,8,["modelValue"]),s(we).enablePausing?(M(),ne(jt,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":v[1]||(v[1]=y=>r.value=y)},null,8,["modelValue"])):j("",!0)]),footer:Y(()=>[C("div",Rp,[C("button",{onClick:v[2]||(v[2]=y=>{var _;return(_=u.value)==null?void 0:_.open()}),class:"button"},"Open Saves Manager"),C("button",{onClick:d,class:"button"},"Set to 0"),C("button",{onClick:h,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(M(),A("button",{key:0,onClick:v[3]||(v[3]=y=>a.value=!1),class:"button"}," Set to previous ")):j("",!0),C("button",{onClick:f,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),p(Vr,{ref_key:"savesManager",ref:u},null,512)],64))}});var Op=ve(Fp,[["__scopeId","data-v-2776d67d"]]);const qp={key:0,class:"tpsDisplay"},Vp=J({__name:"TPS",setup(e){const t=N(()=>o.div(Ue.lastTenTicks.length,Ue.lastTenTicks.reduce((n,i)=>n+i,0)));return(n,i)=>s(t).isNan()?j("",!0):(M(),A("div",qp,"TPS: "+de(s(dt)(s(t))),1))}});var Bp=ve(Vp,[["__scopeId","data-v-89b89152"]]);var Lp=J({__name:"App",setup(e){const t=we.useHeader,n=N(()=>Nt[ce.theme].variables),i=tn(ce,"showTPS"),r=N(()=>pe(Z(()=>p(re,null,[ys.map(ot)]))));return(a,u)=>(M(),A(re,null,[C("div",{id:"modal-root",style:Be(s(n))},null,4),C("div",{class:Ne(["app",{useHeader:s(t)}]),style:Be(s(n))},[s(t)?(M(),ne(Br,{key:0})):j("",!0),p(uc),s(s(i))?(M(),ne(Bp,{key:1})):j("",!0),p(xp),p(Op),(M(),ne(Ke(s(r))))],6)],64))}});var jp=ve(Lp,[["__scopeId","data-v-41d15e5e"]]);function zp(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e;let l,c,d,h;const f=async(v=!0)=>{await d,v&&(l==null||l.addEventListener("controlling",y=>{y.isUpdate&&window.location.reload()})),await(h==null?void 0:h())};async function b(){if("serviceWorker"in navigator){const{Workbox:v,messageSW:y}=await Gn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await y(c.waiting,{type:"SKIP_WAITING"})},l=new v("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",_=>{_.isUpdate||i==null||i()});{const _=()=>{n==null||n()};l.addEventListener("waiting",_),l.addEventListener("externalwaiting",_)}l.register({immediate:t}).then(_=>{c=_,a?a("./sw.js",_):r==null||r(_)}).catch(_=>{u==null||u(_)})}}return d=b(),f}function Gp(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e,l=z(!1),c=z(!1);return{updateServiceWorker:zp({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:u}),offlineReady:c,needRefresh:l}}document.title=we.title;window.projInfo=we;if(we.id==="")throw new Error("Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json");requestAnimationFrame(async()=>{console.log(`%cMade in Profectus%c -Learn more at www.moddingtree.com`,"font-weight: bold; font-size: 24px; color: #A3BE8C; background: #2E3440; padding: 4px 8px; border-radius: 8px;","padding: 4px;"),await fs();const{globalBus:e}=await Gn(()=>Promise.resolve().then(function(){return ds}),void 0),{startGameLoop:t}=await Gn(()=>import("./gameLoop.b6c8f87a.js"),["assets/gameLoop.b6c8f87a.js","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.ded54c4a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.1879de79.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.8ce6f9b1.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.9c2dad53.js","assets/vue-toastification.4b5f8ac8.css"]),n=window.vue=ua(jp);e.emit("setupVue",n),n.mount("#app"),Ut(()=>{const i=mi(),{updateServiceWorker:r}=Gp({onNeedRefresh(){i.info("New content available, click here to update.",{timeout:!1,closeOnClick:!1,draggable:!1,icon:{iconClass:"material-icons",iconChildren:"refresh",iconTag:"i"},rtl:!1,onClick(){r()}})},onOfflineReady(){i.info("App ready to work offline")},onRegisterError:console.warn,onRegistered(a){a&&setInterval(()=>a.update(),60*60*1e3)}})}),t()});export{o as D,Gn as _,Ue as a,we as b,vp as c,Qe as g,gs as l,Q as p,ce as s}; + )`,onMousedown:I=>c(I,b),onTouchstart:I=>c(I,b),onMouseup:I=>d(I,b),onTouchend:$n(I=>d(I,b),["stop"])},[C("circle",{fill:s(me)(b.fillColor,e.node),r:"20","stroke-width":((_=e.selectedAction)==null?void 0:_.id)===b.id?4:0,stroke:s(a)},null,8,vc),C("text",{fill:s(u),class:"material-icons"},de(s(me)(b.icon,e.node)),9,hc)],42,mc)}),128))])):j("",!0)]),_:1}))}});var yc=ve(bc,[["__scopeId","data-v-9efb2a56"]]);const wc=["transform"],_c={key:0},Nc=["r","fill","stroke"],Cc=["r","fill","stroke"],kc=["r","fill"],Mc=["r","stroke-dasharray","stroke-dashoffset","stroke"],Sc={key:1,transform:"rotate(45, 0, 0)"},Ic=["width","height","transform","fill","stroke"],xc=["width","height","transform","fill","stroke"],$c=["width","height","transform","fill"],Ec=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],Dc=["fill","y"],Pc=["fill"],Tc=["fill","y"],Ac={key:0},Rc=["fill","y"],Fc=["fill","y"],Oc=J({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},isSelected:{type:Boolean},selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=Te(n),a=N(()=>me(r.nodeType.value.draggable,s(r.node)));vt(a,U=>{const be=s(r.node);s(r.dragging)===be&&!U&&t("endDragging",be)});const u=N(()=>{var be;const U=s(r.node);return(be=me(r.nodeType.value.actions,U))==null?void 0:be.filter(je=>Ye(me(je.visibility,U)))}),l=N(()=>{var be;const U=s(r.node);if(me(r.nodeType.value.draggable,U)&&((be=s(r.dragging))==null?void 0:be.id)===U.id&&s(r.dragged)!=null){const{x:je,y:ft}=s(r.dragged);return{x:U.position.x+Math.round(je/25)*25,y:U.position.y+Math.round(ft/25)*25}}return U.position}),c=N(()=>me(r.nodeType.value.shape,s(r.node))),d=N(()=>me(r.nodeType.value.title,s(r.node))),h=N(()=>me(r.nodeType.value.subtitle,s(r.node))),f=N(()=>me(r.nodeType.value.otherSubtitle,s(r.node))),b=N(()=>{var U;return(U=r.isSelected.value?s(r.selectedAction)&&me(s(r.selectedAction).tooltip,s(r.node)):null)!=null?U:me(r.nodeType.value.label,s(r.node))}),v=N(()=>{var U,be;return me((be=(U=s(r.selectedAction))==null?void 0:U.confirmationLabel)!=null?be:{text:"Tap again to confirm"},s(r.node))}),y=N(()=>me(r.nodeType.value.size,s(r.node))),_=N(()=>{var U;return(U=me(r.nodeType.value.progress,s(r.node)))!=null?U:0}),I=N(()=>Nt[ce.theme].variables["--background"]),P=N(()=>{var U;return(U=me(r.nodeType.value.outlineColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--outline"]}),S=N(()=>{var U;return(U=me(r.nodeType.value.fillColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--raised-background"]}),T=N(()=>me(r.nodeType.value.progressColor,s(r.node))),B=N(()=>{var U;return(U=me(r.nodeType.value.titleColor,s(r.node)))!=null?U:Nt[ce.theme].variables["--foreground"]}),le=N(()=>me(r.nodeType.value.progressDisplay,s(r.node))),ae=N(()=>r.dragging.value!=null&&s(r.hasDragged)&&me(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),te=N(()=>me(r.nodeType.value.style,s(r.node))),K=N(()=>me(r.nodeType.value.classes,s(r.node)));function Ie(U){t("mouseDown",U,r.node.value,a.value)}function he(U){var be,je,ft;(be=r.hasDragged)!=null&&be.value||(t("endDragging",r.node.value),(ft=(je=r.nodeType.value).onClick)==null||ft.call(je,r.node.value),U.stopPropagation())}return(U,be)=>{var je,ft,Ot;return M(),A("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:s(a),...s(K)}]),style:Be([{opacity:((je=e.dragging)==null?void 0:je.id)===e.node.id&&e.hasDragged?.5:1},(ft=s(te))!=null?ft:[]]),transform:`translate(${s(l).x},${s(l).y})${e.isSelected?" scale(1.2)":""}`},[p(yc,{actions:(Ot=s(u))!=null?Ot:[],"is-selected":e.isSelected,node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:be[0]||(be[0]=gt=>t("clickAction",gt))},null,8,["actions","is-selected","node","node-type","selected-action"]),C("g",{class:"node-container",onMousedown:Ie,onTouchstartPassive:Ie,onMouseup:he,onTouchendPassive:he},[s(c)===s(Le).Circle?(M(),A("g",_c,[s(ae)?(M(),A("circle",{key:0,class:"receiver",r:s(y)+8,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Nc)):j("",!0),C("circle",{class:"body",r:s(y),fill:s(S),stroke:s(P),"stroke-width":4},null,8,Cc),s(le)===s(nn).Fill?(M(),A("circle",{key:1,class:"progress progressFill",r:Math.max(s(y)*s(_)-2,0),fill:s(T)},null,8,kc)):(M(),A("circle",{key:2,r:s(y)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(y)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(y)+4.5)*2*Math.PI-s(_)*(s(y)+4.5)*2*Math.PI,stroke:s(T)},null,8,Mc))])):s(c)===s(Le).Diamond?(M(),A("g",Sc,[s(ae)?(M(),A("rect",{key:0,class:"receiver",width:s(y)*s(i)+16,height:s(y)*s(i)+16,transform:`translate(${-(s(y)*s(i)+16)/2}, ${-(s(y)*s(i)+16)/2})`,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Ic)):j("",!0),C("rect",{class:"body",width:s(y)*s(i),height:s(y)*s(i),transform:`translate(${-s(y)*s(i)/2}, ${-s(y)*s(i)/2})`,fill:s(S),stroke:s(P),"stroke-width":4},null,8,xc),s(le)===s(nn).Fill?(M(),A("rect",{key:1,class:"progress progressFill",width:Math.max(s(y)*s(i)*s(_)-2,0),height:Math.max(s(y)*s(i)*s(_)-2,0),transform:`translate(${-Math.max(s(y)*s(i)*s(_)-2,0)/2}, ${-Math.max(s(y)*s(i)*s(_)-2,0)/2})`,fill:s(T)},null,8,$c)):(M(),A("rect",{key:2,class:"progress progressDiamond",width:s(y)*s(i)+9,height:s(y)*s(i)+9,transform:`translate(${-(s(y)*s(i)+9)/2}, ${-(s(y)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(y)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(y)*s(i)+9)*4-s(_)*(s(y)*s(i)+9)*4,stroke:s(T)},null,8,Ec))])):j("",!0),C("text",{fill:s(B),class:"node-title",y:s(f)&&!s(h)?-10:0},de(s(d)),9,Dc),s(h)?(M(),A("text",{key:2,fill:s(B),class:"node-subtitle",y:"-25"},de(s(h)),9,Pc)):j("",!0),s(f)?(M(),A("text",{key:3,fill:s(B),class:"node-subtitle",y:s(h)?25:15},de(s(f)),9,Tc)):j("",!0)],32),p(zn,{name:"fade",appear:""},{default:Z(()=>{var gt;return[s(b)?(M(),A("g",Ac,[C("text",{fill:(gt=s(b).color)!=null?gt:s(B),class:Ne(["node-title",{pulsing:s(b).pulsing}]),y:-s(y)-20},de(s(b).text),11,Rc)])):j("",!0)]}),_:1}),p(zn,{name:"fade",appear:""},{default:Z(()=>{var gt;return[e.isSelected&&e.selectedAction?(M(),A("text",{key:0,fill:(gt=s(v).color)!=null?gt:s(B),class:Ne(["node-title",{pulsing:s(v).pulsing}]),y:s(y)+75},de(s(v).text),11,Fc)):j("",!0)]}),_:1})],14,wc)}}});var qc=ve(Oc,[["__scopeId","data-v-19cf948c"]]);const Vc={class:"stage",width:"100%",height:"100%"},Bc={class:"g1"},Lc=J({__name:"Board",props:{nodes:null,types:null,state:null,visibility:null,width:null,height:null,style:null,classes:null,links:null,selectedAction:null,selectedNode:null,draggingNode:null,receivingNode:null,mousePosition:null,setReceivingNode:{type:Function},setDraggingNode:{type:Function}},setup(e){const n=Te(e),i=z({x:0,y:0}),r=z({x:0,y:0}),a=z(!1),u=z(null),l=N(()=>{const v=n.nodes.value.slice();if(n.selectedNode.value){const y=v.splice(v.indexOf(n.selectedNode.value),1)[0];v.push(y)}if(n.draggingNode.value){const y=v.splice(v.indexOf(n.draggingNode.value),1)[0];v.push(y)}return v});It(()=>{const v=n.draggingNode.value;if(v==null)return null;const y={x:v.position.x+r.value.x,y:v.position.y+r.value.y};let _=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((I,P)=>{if(P.id===v.id)return I;const S=n.types.value[P.type];if(!me(S.canAccept,P,v))return I;const B=Math.pow(y.x-P.position.x,2)+Math.pow(y.y-P.position.y,2);let le=me(S.size,P);return B>_||B>le*le?I:(_=B,P)},null))});function c(v){v.setTransformOrigin(null),v.moveTo(u.value.$el.clientWidth/2,u.value.$el.clientHeight/2)}function d(v,y=null,_=!1){if(n.draggingNode.value==null){v.preventDefault(),v.stopPropagation();let I,P;if("touches"in v)if(v.touches.length===1)I=v.touches[0].clientX,P=v.touches[0].clientY;else return;else I=v.clientX,P=v.clientY;i.value={x:I,y:P},r.value={x:0,y:0},a.value=!1,_&&n.setDraggingNode.value(y)}y!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(v){const{x:y,y:_,scale:I}=u.value.panZoomInstance.getTransform();let P,S;if("touches"in v)if(v.touches.length===1)P=v.touches[0].clientX,S=v.touches[0].clientY;else{f(n.draggingNode.value),n.mousePosition.value=null;return}else P=v.clientX,S=v.clientY;n.mousePosition.value={x:(P-y)/I,y:(S-_)/I},r.value={x:r.value.x+(P-i.value.x)/I,y:r.value.y+(S-i.value.y)/I},i.value={x:P,y:S},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(v.preventDefault(),v.stopPropagation())}function f(v,y=!1){var _,I;if(n.draggingNode.value!=null&&n.draggingNode.value===v){n.receivingNode.value==null&&(n.draggingNode.value.position.x+=Math.round(r.value.x/25)*25,n.draggingNode.value.position.y+=Math.round(r.value.y/25)*25);const P=n.nodes.value;P.push(P.splice(P.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((I=(_=n.types.value[n.receivingNode.value.type]).onDrop)==null||I.call(_,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!y&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(v,y){var I,P;const _=n.types.value[v.type];me((P=(I=_.actions)==null?void 0:I.find(S=>S.id===y))==null?void 0:P.confirmationLabel,v)==null&&(n.state.value.selectedAction=y),n.state.value.selectedAction===y?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:y}}return(v,y)=>{const _=kt("panZoom");return s(Ye)(e.visibility)?(M(),ne(_,{key:0,style:Be([{width:e.width,height:e.height},e.style]),class:Ne(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:u,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:y[0]||(y[0]=I=>d(I)),onTouchstart:y[1]||(y[1]=I=>d(I)),onMouseup:y[2]||(y[2]=()=>f(s(e.draggingNode))),onTouchendPassive:y[3]||(y[3]=()=>f(s(e.draggingNode))),onMouseleave:y[4]||(y[4]=()=>f(s(e.draggingNode),!0))},{default:Z(()=>[(M(),A("svg",Vc,[C("g",Bc,[p(ir,{name:"link",appear:""},{default:Z(()=>[(M(!0),A(re,null,En(s(e.links)||[],I=>(M(),A("g",{key:`${I.startNode.id}-${I.endNode.id}`},[p(fc,{link:I},null,8,["link"])]))),128))]),_:1}),p(ir,{name:"grow",duration:500,appear:""},{default:Z(()=>[(M(!0),A(re,null,En(s(l),I=>(M(),A("g",{key:I.id,style:{"transition-duration":"0s"}},[p(qc,{node:I,nodeType:e.types[I.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===I?r.value:void 0,hasDragged:s(e.draggingNode)==null?!1:a.value,receivingNode:s(e.receivingNode)===I,isSelected:s(e.selectedNode)===I,selectedAction:s(e.selectedNode)===I?s(e.selectedAction):null,onMouseDown:d,onEndDragging:f,onClickAction:P=>b(I,P)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","isSelected","selectedAction","onClickAction"])]))),128))]),_:1})])]))]),_:1},8,["style","class","options"])):j("",!0)}}});Qe.on("setupVue",e=>fa.install(e));const Lr=Symbol("Board");var nn=(e=>(e.Outline="Outline",e.Fill="Fill",e))(nn||{}),Le=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Le||{});function jc(e){const t=lt({nodes:[],selectedNode:null,selectedAction:null},!1);return et(n=>{const i=e.call(n,n);i.id=rn("board-"),i.type=Lr,i[yt]=Lc,i.state?(Rr(t),E(i,"state")):(t[Ht]={nodes:i.startNodes().map((l,c)=>(l.id=c,l)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=N(()=>s(u.state).nodes),i.selectedNode=N({get(){return u.nodes.value.find(l=>l.id===s(u.state).selectedNode)||null},set(l){var c,d;Fe(u.state)?u.state.value={...u.state.value,selectedNode:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedNode=(d=l==null?void 0:l.id)!=null?d:null}}),i.selectedAction=N({get(){const l=u.selectedNode.value;if(l==null)return null;const c=u.types[l.type];return c.actions==null?null:c.actions.find(d=>d.id===s(u.state).selectedAction)||null},set(l){var c,d;Fe(u.state)?u.state.value={...u.state.value,selectedAction:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedAction=(d=l==null?void 0:l.id)!=null?d:null}}),i.mousePosition=z(null),i.links?E(i,"links"):i.links=N(()=>u.selectedAction.value==null?null:u.selectedAction.value.links&&u.selectedNode.value?me(u.selectedAction.value.links,u.selectedNode.value):null),i.draggingNode=z(null),i.receivingNode=z(null),E(i,"visibility"),oe(i,"visibility",Me.Visible),E(i,"width"),oe(i,"width","100%"),E(i,"height"),oe(i,"height","100%"),E(i,"classes"),E(i,"style");for(const l in i.types){const c=i.types[l];if(E(c,"title"),E(c,"subtitle"),E(c,"otherSubtitle"),E(c,"label"),E(c,"size"),oe(c,"size",50),E(c,"style"),E(c,"classes"),E(c,"draggable"),oe(c,"draggable",!1),E(c,"shape"),oe(c,"shape","Circle"),E(c,"canAccept"),oe(c,"canAccept",!1),E(c,"progress"),E(c,"progressDisplay"),oe(c,"progressDisplay","Fill"),E(c,"progressColor"),oe(c,"progressColor","none"),E(c,"fillColor"),E(c,"outlineColor"),E(c,"titleColor"),E(c,"actionDistance"),oe(c,"actionDistance",Math.PI/6),c.nodes=N(()=>s(u.state).nodes.filter(d=>d.type===l)),oe(c,"onClick",function(d){s(u.state).selectedNode=d.id}),c.actions)for(const d of c.actions)E(d,"visibility"),oe(d,"visibility",Me.Visible),E(d,"icon"),E(d,"fillColor"),E(d,"tooltip"),E(d,"confirmationLabel"),oe(d,"confirmationLabel",{text:"Tap again to confirm"}),E(d,"links")}function r(l){i.draggingNode.value=l}function a(l){i.receivingNode.value=l}i.placeInAvailableSpace=function(l,c=100,d=W.Right){const h=u.nodes.value.slice().filter(f=>f===l||(d===W.Down||d===W.Up)&&Math.abs(f.position.x-l.position.x)>c||(d===W.Left||d===W.Right)&&Math.abs(f.position.y-l.position.y)>c?!1:!(d===W.Right&&f.position.xl.position.x+c||d===W.Up&&f.position.y>l.position.y+c||d===W.Down&&f.position.yf.position.x-b.position.x:d===W.Left?(f,b)=>b.position.x-f.position.x:d===W.Up?(f,b)=>b.position.y-f.position.y:(f,b)=>f.position.y-b.position.y);for(let f=0;f0&&v>c)break}},i[pt]=function(){const{nodes:l,types:c,state:d,visibility:h,width:f,height:b,style:v,classes:y,links:_,selectedAction:I,selectedNode:P,mousePosition:S,draggingNode:T,receivingNode:B}=this;return{nodes:l,types:c,state:d,visibility:h,width:f,height:b,style:s(v),classes:y,links:_,selectedAction:I,selectedNode:P,mousePosition:S,draggingNode:T,receivingNode:B,setDraggingNode:r,setReceivingNode:a}};const u=i;return u})}function me(e,t,...n){return Un(e)?e(t,...n):s(e)}function Dn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const Ln={};Qe.on("addLayer",e=>{const t=Hn(e,Lr);Ln[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var u;return(u=r.update)==null?void 0:u.call(r,a,n)}))})})});Qe.on("removeLayer",e=>{var t;(t=Ln[e.id])==null||t.call(Ln),Ln[e.id]=void 0});function Sn(e,t="points",n=0,i=void 0){const r=Fe(e)?e:lt(e);if(r.displayName=t,r.precision=n,r.small=i,!Fe(e)){const a=r[Pt];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function mi(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?dt(e.small?n:o.floor(n)):xe(n,e.precision,e.small)}Qe.on("setupVue",e=>e.use(ga));function zc(e="white",t="8px"){return{transform:"scale(1.05, 1.05)",borderColor:"rgba(0, 0, 0, 0.125)",boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 ${t} ${e}`,zIndex:1}}const Gc=J({props:{visibility:{type:q(Number,Boolean),required:!0},display:{type:q(Object,String,Function),required:!0},style:q(String,Object,Array),classes:q(Object),glowColor:q(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=Te(e),a=Dr(n),u=N(()=>{const c=Ee(i);return c==null||c===""?{}:s(r)?zc(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:a,glowColorStyle:u,unref:s,Visibility:Me,isVisible:Ye,isHidden:vn}}});function Uc(e,t,n,i,r,a){var u;return e.isVisible(e.visibility)?(M(),A("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(u=e.unref(e.style))!=null?u:{}])},[(M(),ne(Ke(e.component)))],6)):j("",!0)}var jr=ve(Gc,[["render",Uc],["__scopeId","data-v-21427abb"]]);const Wc=J({props:{visibility:{type:q(Number,Boolean),required:!0},activeTab:{type:q(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:q(Object),required:!0},style:q(String,Object,Array),classes:q(Object),buttonContainerStyle:q(String,Object,Array),buttonContainerClasses:q(Object)},components:{Sticky:gi,TabButton:jr},setup(e){const{activeTab:t}=Te(e),n=N(()=>Nt[ce.theme].floatingTabs),i=ht("");It(()=>{const l=Ee(t);if(l==null){i.value="";return}if(xt(l)){i.value=pe(l);return}i.value=pe(s(l.display))});const r=N(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.classes)}),a=N(()=>{const l=Ee(t);return xt(l)||!l?void 0:s(l.style)});function u(l){const{display:c,style:d,classes:h,glowColor:f,visibility:b}=l;return{display:c,style:s(d),classes:h,glowColor:f,visibility:b}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:Me,component:i,gatherButtonProps:u,unref:s,isVisible:Ye,isHidden:vn}}});function Hc(e,t,n,i,r,a){var c,d;const u=kt("TabButton"),l=kt("Sticky");return e.isVisible(e.visibility)?(M(),A("div",{key:0,class:Ne(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(d=e.tabStyle)!=null?d:[]])},[p(l,{class:Ne(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Be(e.unref(e.buttonContainerStyle))},{default:Z(()=>[C("div",{class:Ne(["tab-buttons",{floating:e.floating}])},[(M(!0),A(re,null,En(e.unref(e.tabs),(h,f)=>(M(),ne(u,Wt({onSelectTab:b=>e.selected.value=f,floating:e.floating,key:f,active:e.unref(h.tab)===e.unref(e.activeTab)},e.gatherButtonProps(h)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(M(),ne(Ke(e.unref(e.component)),{key:0})):j("",!0)],6)):j("",!0)}var Yc=ve(Wc,[["render",Hc],["__scopeId","data-v-58dbf83a"]]);const Zc=Symbol("TabButton"),Xc=Symbol("TabFamily");function Jc(e,t){if(Object.keys(e).length===0)throw console.warn("Cannot create tab family with 0 tabs"),new Error("Cannot create tab family with 0 tabs");const n=lt(Object.keys(e)[0],!1);return et(i=>{var u;const r=(u=t==null?void 0:t.call(i,i))!=null?u:{};r.id=rn("tabFamily-"),r.type=Xc,r[yt]=Yc,r.tabs=Object.keys(e).reduce((l,c)=>{const d=e[c]();return d.type=Zc,d[yt]=jr,E(d,"visibility"),oe(d,"visibility",Me.Visible),E(d,"tab"),E(d,"display"),E(d,"classes"),E(d,"style"),E(d,"glowColor"),l[c]=d,l},{}),r.selected=n,r.activeTab=N(()=>{const l=s(a.tabs);if(n.value in l&&Ye(l[n.value].visibility))return s(l[n.value].tab);const c=Object.values(l).find(d=>Ye(d.visibility));return c?s(c.tab):null}),E(r,"visibility"),oe(r,"visibility",Me.Visible),E(r,"classes"),E(r,"style"),E(r,"buttonContainerClasses"),E(r,"buttonContainerStyle"),r[pt]=function(){const{visibility:l,activeTab:c,selected:d,tabs:h,style:f,classes:b,buttonContainerClasses:v,buttonContainerStyle:y}=this;return{visibility:l,activeTab:c,selected:d,tabs:h,style:s(f),classes:b,buttonContainerClasses:v,buttonContainerStyle:y}};const a=r;return a})}function zt(e){return et(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:d=>o.add(d,s(u)),invert:d=>o.sub(d,s(u)),getFormula:d=>g.add(d,u),enabled:c,description:i==null?void 0:Y(()=>p("div",{class:"modifier-container"},[s(l)!=null?p("span",{class:"modifier-description"},[Ct(s(l))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),0):o.lt(s(u),0))?"color: var(--danger)":""},[o.gte(s(u),0)?"+":"",Gt(s(u))])]))}})}function ke(e){return et(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(i),c=r==null?void 0:_e(r);return{apply:d=>o.times(d,s(u)),invert:d=>o.div(d,s(u)),getFormula:d=>g.times(d,u),enabled:c,description:i==null?void 0:Y(()=>p("div",{class:"modifier-container"},[s(l)!=null?p("span",{class:"modifier-description"},[Ct(s(l))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[$("\xD7"),Gt(s(u))])]))}})}function Kc(e){return et(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:u}=e.call(t,t),l=_e(n),c=_e(i),d=r==null?void 0:_e(r);return{apply:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.pow(f,s(l)),a&&(f=o.sub(f,1)),f},invert:h=>{let f=h;return a&&(f=o.add(f,1)),f=o.root(f,s(l)),a&&(f=o.sub(f,1)),f},getFormula:h=>a?g.add(h,1).pow(l).sub(1):g.pow(h,l),enabled:d,description:i==null?void 0:Y(()=>p("div",{class:"modifier-container"},[s(c)!=null?p("span",{class:"modifier-description"},[Ct(s(c)),a?" (+1 effective)":null]):null,p("span",{class:"modifier-amount",style:(u===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[$("^"),Gt(s(l))])]))}})}function _t(e){return et(()=>{const t=e();return{apply:n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.apply(i),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduceRight((i,r)=>r.invert(i),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(i=>s(i.enabled)!==!1).reduce((i,r)=>r.getFormula(i),n):void 0,enabled:t.some(n=>n.enabled!=null)?N(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?Y(()=>p(re,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(Ct)])):void 0}})}const qi=g.variable(0).step(2e3,e=>e.pow_base(1.02)).step(100,e=>e.pow(1.5)).step(o.pow(900,1.5).add(100),e=>e.pow(1.5)).pow(1.5),an={id:"deselect",icon:"close",tooltip:e=>({text:"portals"in e.state?"Disconnect portals":"tools"in e.state?"Disconnect tools":"Disconnect resources"}),onClick(e){var t;Array.isArray((t=e.state)==null?void 0:t.data)?e.state={...e.state,data:[]}:"portals"in e.state?e.state={...e.state,portals:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"portals"in e.state?e.state.portals.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},Ft={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${dt(m.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},m.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function bn(e,t=1/0){const n=e(g.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(i){return{text:`Increase Connections - ${dt(n.evaluate(i.state.maxConnections))} energy`}},fillColor(i){return o.gte(m.energy.value,n.evaluate(i.state.maxConnections))?"var(--bought)":"var(--locked)"},confirmationLabel:i=>o.gte(m.energy.value,n.evaluate(i.state.maxConnections))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(i){const r=n.evaluate(i.state.maxConnections);o.gte(m.energy.value,r)&&(m.energy.value=o.sub(m.energy.value,r),i.state={...i.state,maxConnections:o.add(i.state.maxConnections,1)},m.board.selectedAction.value=null)},visibility:i=>o.add(i.state.maxConnections,m.computedBonusConnectionsModifier.value).lt(t)}}function zr(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="resource"){const r=((i=m.board.draggingNode.value)==null?void 0:i.state).type,{maxConnections:a,resources:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Qc(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="passive"){const r=(i=m.board.draggingNode.value)==null?void 0:i.state,{maxConnections:a,tools:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function yi(e,t){var n,i;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="portal"){const r=((i=m.board.draggingNode.value)==null?void 0:i.state).id,{maxConnections:a,portals:u}=e.state;return u.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Gr(e,t){if(t.type!=="resource")return!1;const n=t.state.type,{maxConnections:i,resources:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function Ur(e,t){if(t.type!=="resource")return;const n=t.state.type,i=e.state.resources;i.includes(n)?e.state={...e.state,resources:i.filter(r=>r!==n)}:e.state={...e.state,resources:[...i,n]},m.board.selectedNode.value=e}function ed(e,t){if(t.type!=="passive")return!1;const n=t.state,{maxConnections:i,tools:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function td(e,t){if(t.type!=="passive")return;const n=t.state,i=e.state.tools;i.includes(n)?e.state={...e.state,tools:i.filter(r=>r!==n)}:e.state={...e.state,tools:[...i,n]},m.board.selectedNode.value=e}function wi(e,t){if(t.type!=="portal")return!1;const n=t.state.id,{maxConnections:i,portals:r}=e.state;return r.includes(n)?!0:!o.add(i,m.computedBonusConnectionsModifier.value).lte(r.length)}function _i(e,t){if(t.type!=="portal")return;const n=t.state.id,{portals:i}=e.state;i.includes(n)?e.state={...e.state,portals:i.filter(r=>r!==n)}:e.state={...e.state,portals:[...i,n]},m.board.selectedNode.value=e}function Ce(e){return e===m.board.selectedNode.value||e.state.powered}function ee(e){return m.empowerer.value!=null&&Ce(m.empowerer.value)&&m.empowerer.value.state.tools.includes(e)}function nd(e){var a,u,l;const t=(l=(u=(a=m.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:u.amount)!=null?l:0,n=m.resourceLevels.value[e],i=qi.evaluate(n),r=qi.evaluate(o.add(n,1));return o.sub(t,i).max(0).div(o.sub(r,i)).toNumber()}function ln(e,t,n){if(t.value){const i=t.value.state,r=i[n],a=i.maxConnections;o.gt(r.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:r.slice(0,o.add(a,e).toNumber())})}}function Xn(e){return{id:"help",icon:"question_mark",tooltip:{text:"Help"},onClick(){m.helpModals[e].showModal.value=!0,m.board.selectedAction.value=null},confirmationLabel:null}}const id={key:0},rd={key:0,class:"mark star"},ad=["src"],sd=J({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(M(),A("div",id,[e.mark===!0?(M(),A("div",rd)):(M(),A("img",{key:1,class:"mark",src:e.mark},null,8,ad))])):j("",!0)}});var Jn=ve(sd,[["__scopeId","data-v-2207999f"]]);const od=J({__name:"Node",props:{id:null},setup(e){const n=Te(e),i=ci(zi,()=>{}),r=ci(Gi,()=>{}),a=ht(null),u=N(()=>a.value&&a.value.parentElement);return vt([u,n.id],([l,c],[d,h])=>{d&&r(s(h)),l&&i(c,l)}),br(()=>r(s(n.id))),(l,c)=>(M(),A("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Kn=ve(od,[["__scopeId","data-v-a48cb382"]]),ld=J({props:{display:{type:q(Object,String,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),onClick:Function,onHold:Function,canClick:{type:q(Boolean),required:!0},small:Boolean,mark:q(Boolean,String),id:{type:String,required:!0}},components:{Node:Kn,MarkNode:Jn},setup(e){const{display:t,onClick:n,onHold:i}=Te(e),r=ht("");It(()=>{var h;const l=Ee(t);if(l==null){r.value="";return}if(xt(l)){r.value=pe(l);return}const c=pe((h=l.title)!=null?h:"","h3"),d=pe(l.description,"div");r.value=pe(Y(()=>p("span",null,[l.title!=null?p("div",null,[p(c,null,null)]):null,p(d,null,null)])))});const{start:a,stop:u}=Er(n,i);return{start:a,stop:u,comp:r,Visibility:Me,isVisible:Ye,isHidden:vn,unref:s}}});function ud(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...d)=>e.onClick&&e.onClick(...d)),onMousedown:t[1]||(t[1]=(...d)=>e.start&&e.start(...d)),onMouseleave:t[2]||(t[2]=(...d)=>e.stop&&e.stop(...d)),onMouseup:t[3]||(t[3]=(...d)=>e.stop&&e.stop(...d)),onTouchstartPassive:t[4]||(t[4]=(...d)=>e.start&&e.start(...d)),onTouchendPassive:t[5]||(t[5]=(...d)=>e.stop&&e.stop(...d)),onTouchcancelPassive:t[6]||(t[6]=(...d)=>e.stop&&e.stop(...d)),class:Ne({feature:!0,clickable:!0,can:e.unref(e.canClick),locked:!e.unref(e.canClick),small:e.small,...e.unref(e.classes)})},[e.unref(e.comp)?(M(),ne(Ke(e.unref(e.comp)),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],38)):j("",!0)}var Wr=ve(ld,[["render",ud],["__scopeId","data-v-211328c0"]]);const Hr=Symbol("Clickable");function cd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return et(i=>{var u,l,c;const r=(u=e==null?void 0:e.call(i,i))!=null?u:{};r.id=rn("clickable-"),r.type=Hr,r[yt]=Wr;for(const d of t)(l=d.preConstruct)==null||l.call(d,r);if(Object.assign(r,n),E(r,"visibility"),oe(r,"visibility",Me.Visible),E(r,"canClick"),oe(r,"canClick",!0),E(r,"classes"),E(r,"style"),E(r,"mark"),E(r,"display"),r.onClick){const d=r.onClick.bind(r);r.onClick=function(h){s(r.canClick)!==!1&&d(h)}}if(r.onHold){const d=r.onHold.bind(r);r.onHold=function(){s(r.canClick)!==!1&&d()}}for(const d of t)(c=d.postConstruct)==null||c.call(d,r);const a=t.reduce((d,h)=>{var f;return Object.assign(d,(f=h.getGatheredProps)==null?void 0:f.call(h,r))},{});return r[pt]=function(){const{display:d,visibility:h,style:f,classes:b,onClick:v,onHold:y,canClick:_,small:I,mark:P,id:S}=this;return{display:d,visibility:h,style:s(f),classes:b,onClick:v,onHold:y,canClick:_,small:I,mark:P,id:S,...a}},r})}function dd(e,t,n=[]){n=n.length===0?Hn(e,Hr):n;const i=typeof t=="function"?N(t):t;return e.on("update",()=>{s(i)&&n.filter(r=>s(r.canClick)).forEach(r=>{var a;return(a=r.onClick)==null?void 0:a.call(r)})})}const pd=["x1","y1","x2","y2"],fd=J({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=Te(e),i=N(()=>{const a=n.startNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),r=N(()=>{const a=n.endNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(a,u)=>(M(),A("line",Wt({"stroke-width":"15px",stroke:"white"},e.link,{x1:s(i).x,y1:s(i).y,x2:s(r).x,y2:s(r).y}),null,16,pd))}});const gd=J({__name:"Links",props:{links:null},setup(e){var c;const n=tn(e,"links"),i=z(null),r=ci(Ui,z({})),a=ci(Wi,z(void 0)),u=z((c=i.value)==null?void 0:c.getBoundingClientRect());vt(a,()=>{var d;return u.value=(d=i.value)==null?void 0:d.getBoundingClientRect()}),vi(()=>{var d;return u.value=(d=i.value)==null?void 0:d.getBoundingClientRect()});const l=N(()=>{var h,f;const d=r.value;return(f=(h=n.value)==null?void 0:h.filter(b=>{var v,y;return((v=d[b.startNode.id])==null?void 0:v.rect)&&((y=d[b.startNode.id])==null?void 0:y.rect)}))!=null?f:[]});return(d,h)=>(M(),A(re,null,[s(l)?(M(),A("svg",oa(Wt({key:0},d.$attrs)),[(M(!0),A(re,null,En(s(l),(f,b)=>(M(),ne(fd,{key:b,link:f,boundingRect:u.value,startNode:s(r)[f.startNode.id],endNode:s(r)[f.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):j("",!0),C("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var md=ve(gd,[["__scopeId","data-v-063f6d6b"]]);J({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:md},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=Te(e),r=ht();It(()=>{const l=Ee(t);r.value=pe(Y(()=>p(re,null,[l.map(c=>p("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(Ct)]))])))});const a=ht();It(()=>{const l=Ee(n);a.value=l?pe(Y(()=>p("span",{class:"left-side-nodes small"},[l.map(Ct)]))):""});const u=ht();return It(()=>{const l=Ee(i);u.value=l?pe(Y(()=>p("span",{class:"side-nodes small"},[l.map(Ct)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:u}}});J({props:{display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),onClick:Function,onHold:Function,color:q(String),glowColor:q(String),canClick:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Jn,Node:Kn},setup(e){const{onClick:t,onHold:n,display:i}=Te(e),r=Pn(i),{start:a,stop:u}=Er(t,n);return{start:a,stop:u,comp:r,unref:s,Visibility:Me,isCoercableComponent:xt,isVisible:Ye,isHidden:vn}}});function jn(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(l=>_e(l.base)),n.baseText=t.map(l=>_e(l.baseText)),n.visible=t.map(l=>_e(l.visible)),n.title=t.map(l=>_e(l.title)),n.subtitle=t.map(l=>_e(l.subtitle)),i=!0),t}const a=lt({},!1);return[Y(()=>{const l=r();let c=!0;const d=l.map((h,f)=>{var P,S,T;if(s(n.visible[f])===!1)return null;const b=p("h3",{onClick:()=>a.value[f]=!a.value[f],style:"cursor: pointer"},[p("span",{class:"modifier-toggle"+(s(a.value[f])?" collapsed":"")},[$("\u25BC")]),s(n.title[f]),s(n.subtitle[f])!=null?p("span",{class:"subtitle"},[$(" ("),s(n.subtitle[f]),$(")")]):null]),v=s(a.value[f])?null:p(re,null,[p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[Ct((P=s(n.baseText[f]))!=null?P:"Base")]),p("span",{class:"modifier-amount"},[xe((S=s(n.base[f]))!=null?S:1),h.unit])]),h.modifier.description==null?null:Ct(s(h.modifier.description))]),y=!c;c=!1;const _=(T=s(n.base[f]))!=null?T:1,I=h.modifier.apply(_);return p(re,null,[y?p("br",null,null):null,p("div",{style:{"--unit":ce.alignUnits&&h.unit!=null?"'"+h.unit+"'":""}},[b,p("br",null,null),v,p("hr",null,null),p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[$("Total")]),p("span",{class:"modifier-amount",style:(h.smallerIsBetter===!0?o.gt(I,_!=null?_:1):o.lt(I,_!=null?_:1))?"color: var(--danger)":""},[Gt(I),h.unit])])])])});return p(re,null,[d])}),a]}function Ai(e,t,n){const i=_e(t),r=_e(n);return N(()=>{const a=s(i),u=s(r);return o.gte(e.value,u)?"Now":o.lte(a,0)?"Never":bi(o.sub(u,e.value).div(a))})}function un(e,t,n=1){const i=_e(t),r=_e(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return Y(()=>{var a;if(s(i)){const u=Gt(e.evaluate()),l=Gt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return p(re,null,[p("b",null,[p("i",null,[u,$(" \u2192 "),l])])])}return p(re,null,[Gt(e.evaluate())])})}const St={dirt:120,sand:60,gravel:40,wood:30,stone:24,coal:20,copper:15,iron:12,silver:10,gold:8,emerald:6,platinum:5,diamond:4,berylium:3,unobtainium:2,ultimatum:1},Lt=Object.keys(St),Ve={dirt:{cost:1e3,name:"Pickaxe",type:"passive",state:"dirt"},sand:{cost:1e4,name:"Dowsing Rod",type:"dowsing",state:{resources:[],maxConnections:1,powered:!1}},gravel:{cost:1e5,name:"Ore Processor",type:"passive",state:"gravel"},wood:{cost:1e6,name:"Quarry",type:"quarry",state:{resources:[],maxConnections:1,powered:!1,progress:0}},stone:{cost:1e7,name:"Energizer",type:"passive",state:"stone"},coal:{cost:1e8,name:"Tool Empowerer",type:"empowerer",state:{tools:[],maxConnections:1,powered:!1}},copper:{cost:1e9,name:"Book",type:"passive",state:"copper"},iron:{cost:1e10,name:"Portal Generator",type:"portalGenerator",state:{tier:void 0,influences:[]}},silver:{cost:1e12,name:"Robotics",type:"passive",state:"silver"},gold:{cost:1e15,name:"Booster",type:"booster",state:{portals:[],maxConnections:1,powered:!1,level:1}},emerald:{cost:1e19,name:"AI",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"ML",type:"passive",state:"diamond"},berylium:{cost:1e37,name:"Automator",type:"automator",state:{portals:[],maxConnections:1,powered:!1}},unobtainium:{cost:1e45,name:"National Grid",type:"passive",state:"unobtainium"},ultimatum:{cost:1e54,name:"Investments",type:"investments",state:{portals:[],maxConnections:1,powered:!1}}},Dt={dirt:"BOGO Coupon",sand:"Metal Detector",gravel:"Neural Nets",wood:"Mining Laser",stone:"Replicator",coal:"Planar Intelligence",copper:"Efficient Code",iron:"Trade Agreements",silver:"Machine Synergizer",gold:"XP Market",emerald:"Efficient Portals",platinum:"Time Dilation",diamond:"Paypal",berylium:"Tiered Mining",unobtainium:"OC'ed Portals",ultimatum:"Rebates"},vd={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 40% stronger":"Material level is 20% stronger"},silver:{description:e=>e?"Quadruples each plane's resource gain":"Doubles each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase (diminishing)":"+1% plane's resource gain per repeatable purchase (diminishing)"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"All upgrades apply twice":"Non-multiplicative upgrades apply twice"},coalRelic:{description:e=>e?"Every treasure boosts planar speed by +20%":"Every treasure boosts planar speed by +10%"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give quadruple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Powered machines)^2 boost quarry speed":"Powered machines boost quarry speed"},goldRelic:{description:e=>e?"Each treasure gives +50% XP gain":"Each treasure gives +25% XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs 20x less energy":"Creating portals costs 10x less energy"},platinumRelic:{description:e=>e?"Quadruple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"log(energy)^0.5 boosts planes' resource gain":"log(energy)^0.25 boosts planes' resource gain"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},ct={increaseResources:{display:"+resource",description:e=>{const t=e.data;return t.length===0?"Increase resource odds - Drag a resource to me!":t.length===1?`Increase ${t[0]}'s odds`:`Increase ${t.length} resources' odds`},cost:2,initialData:[]},decreaseResources:{display:"-resource",description:e=>{const t=e.data;return t.length===0?"Decrease resource odds - Drag a resource to me!":t.length===1?`Decrease ${t[0]}'s odds`:`Decrease ${t.length} resources' odds`},cost:2,initialData:[]},increaseLength:{display:"+length",description:"Increase length",cost:100,initialData:void 0},increaseCaches:{display:"+caches",description:"Increase caches odds",cost:10,initialData:void 0},increaseGens:{display:"+gens",description:"Increase generators odds",cost:10,initialData:void 0},increaseInfluences:{display:"+influences",description:"Increase influences odds",cost:10,initialData:void 0},increaseEnergyMults:{display:"+energy mults",description:"Increase energy mults odds",cost:10,initialData:void 0},increaseResourceMults:{display:"+resource mults",description:"Increase resource mults odds",cost:10,initialData:void 0},increaseDiff:{display:"+difficulty",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-difficulty",description:"Decrease difficulty/rewards odds",cost:10,initialData:void 0},increaseRewards:{display:"+rewards",description:"Increase rewards level",cost:1e4,initialData:void 0},relic:{display:"+relic",description:"Max length/difficulty, add tier-unique relic",cost:1e6,initialData:void 0}},si=g.variable(0).add(8).times(2).pow10();function Qn(e,t){const n=lt(!1);return{modal:Y(()=>p(Rt,{modelValue:n.value,"onUpdate:modelValue":r=>n.value=r},{header:()=>p("h2",null,[e]),body:t})),showModal:n}}function hd(){return Qn("Getting Started",Y(()=>p("div",null,[p("p",null,[$(`Welcome to Planar Pioneers! Your job is to gather resources and eventually explore and conquer increasingly difficult "planes", which are like alien worlds. To start you'll use the mine (\u{1FAA8}) machine to gather resources.`)]),p("br",null,null),p("p",null,[$(`You'll gain energy every second based on how much of each resource you have. You can check the exact calculation and various other information by clicking the "modifiers" button near the top of the screen.`)]),p("br",null,null),p("p",null,[$("Select the machine by clicking it to make the mine active. You can also drag them around to organize your various machines and other objects. While selected machines will have various actions you can take, such as viewing the help for that machine. There's also an action to power the machine, allowing it to be active even while not selected, at the cost of energy per second (cost increases based on the total number of machines being powered).")])])))}function bd(){return Qn("Forging",Y(()=>p("div",null,[p("p",null,[$("You've repaired the forge (\u{1F6E0}\uFE0F)! This is the next main line of progression. Here you'll be able to craft a total of 16 machines and passive bonuses to create - one for each resource!")]),p("br",null,null),p("p",null,[$("Drag a resource onto the forge to select that resource tier. You can then use an action on the forge to create that item, at the cost of energy based on the resource tier. You can only have 1 of each item.")])])))}function yd(){return Qn("Dowsing",Y(()=>p("div",null,[p("p",null,[$("You've created the dowsing rod (\u{1F962})! This machine let's you bias the odds of specified resources from mining. It will double the odds of each specified resource, so keep in mind rare resources will still be fairly rare.")]),p("br",null,null),p("p",null,[$("Specify resources to boost by dragging them to the dowsing rod. You can only select a single resource to start, but that can be increased using an action.")])])))}function wd(){return Qn("Quarry",Y(()=>p("div",null,[p("p",null,[$("You've created the Quarry (\u26CF\uFE0F)! This machine let's you gather specified resources. Unlike the mine, this machine will always output the same resources. However, rarer resources will take longer to gather.")]),p("br",null,null),p("p",null,[$("Specify resources to gather by dragging them to the quarry. You can only select a single resource to start, but that can be increased using an action.")])])))}function _d(){return Qn("Tool Empowerer",Y(()=>p("div",null,[p("p",null,[$("You've created the Tool Empowerer (\u{1F50C})! This machine let's you increase the effect of specified passives. Experimenting with which passives to empower can really help you progress!")]),p("br",null,null),p("p",null,[$("Specify passives to empower by dragging them to the empowerer. You can only select a single passive to start, but that can be increased using an action.")])])))}const Nd=J({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(M(),A("div",{style:Be({width:e.width,height:e.height})},null,4))}});function On(e){return et(t=>{var i;const n=e.call(t,t);return n.partialDisplay=r=>p("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[mi(n.resource,n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=r=>p("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",mi(n.resource,n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),E(n,"visibility"),oe(n,"visibility",Me.Visible),E(n,"cost"),E(n,"requiresPay"),oe(n,"requiresPay",!0),E(n,"cumulativeCost"),oe(n,"cumulativeCost",!0),E(n,"maxBulkAmount"),oe(n,"maxBulkAmount",1),E(n,"directSum"),oe(n,"pay",function(r){const a=n.cost instanceof g?Qt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost);n.resource.value=o.sub(n.resource.value,a).max(0)}),n.canMaximize=N(()=>{var l;if(!(n.cost instanceof g))return!1;const r=s(n.maxBulkAmount);if(o.lte(r,1))return!1;const a=s(n.cumulativeCost),u=(l=s(n.directSum))!=null?l:a?10:0;return o.lte(r,u)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof g?n.requirementMet=Ar(n.cost,n.resource,(i=n.cumulativeCost)!=null?i:!0,n.directSum,n.maxBulkAmount):n.requirementMet=N(()=>o.gte(n.resource.value,s(n.cost))),n})}function Ki(e){return et(()=>({requirementMet:N(()=>Ye(e.visibility)),visibility:Me.None,requiresPay:!1}))}function Cd(e,t){return et(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:Y(()=>Ct(t)),display:t==null?void 0:Y(()=>p(re,null,[$("Req: "),Ct(t)])),visibility:t==null?Me.None:Me.Visible,requiresPay:!1}))}function Ni(e){if(At(e))return e.every(Ni);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Yr(e){if(At(e))return e.map(Yr).reduce(o.min);const t=s(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&s(e.canMaximize)!==!0?1:t}function Ci(e,t=1){var n,i;if(At(e)&&(e=e.filter(r=>Ye(r.visibility)),e.length===1&&(e=e[0])),At(e)){e=e.filter(u=>"partialDisplay"in u);const r=e.filter(u=>s(u.requiresPay)),a=e.filter(u=>!s(u.requiresPay));return p(re,null,[r.length>0?p("div",null,[$("Costs:")," ",ur(r.map(u=>u.partialDisplay(t)),p(re,null,[$(", ")]))]):null,a.length>0?p("div",null,[$("Requires:")," ",ur(a.map(u=>u.partialDisplay(t)),p(re,null,[$(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:p(re,null,null)}function Zr(e,t=1){var n;At(e)?e.filter(i=>s(i.requiresPay)).forEach(i=>{var r;return(r=i.pay)==null?void 0:r.call(i,t)}):s(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var kd=J({props:{visibility:{type:q(Number,Boolean),required:!0},display:q(Object,String,Function),earned:{type:q(Boolean),required:!0},requirements:q(Object,Array),image:q(String),style:q(String,Object,Array),classes:q(Object),mark:q(Boolean,String),small:q(Boolean),id:{type:String,required:!0}},components:{Node:Kn,MarkNode:Jn},setup(e){const{display:t,requirements:n,earned:i}=Te(e),r=ht("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.requirement?a.requirement:Y(()=>{var d;return Ci((d=Ee(n))!=null?d:[])}),"h3"),l=pe(a.effectDisplay||"","b"),c=Ee(i)?pe(a.optionsDisplay||"","span"):"";r.value=pe(Y(()=>p("span",null,[p(u,null,null),a.effectDisplay!=null?p("div",null,[p(l,null,null)]):null,a.optionsDisplay!=null?p("div",{class:"equal-spaced"},[p(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:Me,isVisible:Ye,isHidden:vn}}});function Md(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("div",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:Ne({feature:!0,achievement:!0,locked:!e.unref(e.earned),done:e.unref(e.earned),small:e.unref(e.small),...e.unref(e.classes)})},[e.comp?(M(),ne(Ke(e.comp),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var Sd=ve(kd,[["render",Md],["__scopeId","data-v-5673325a"]]);const Id=hi(),xd=Symbol("Achievement");let In=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function $d(e,...t){const n=lt(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var c,d,h;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=rn("achievement-"),a.type=xd,a[yt]=Sd;for(const f of t)(d=f.preConstruct)==null||d.call(f,a);a.earned=n,a.complete=function(){var b,v;if(n.value)return;n.value=!0;const f=a;if((b=f.onComplete)==null||b.call(f),f.display!=null&&s(f.showPopups)===!0){const y=s(f.display);let _;xt(y)?_=pe(y):y.requirement!=null?_=pe(y.requirement):_=Ci((v=f.requirements)!=null?v:[]),Id.info(p("div",null,[p("h3",null,[$("Treasure earned!")]),p("div",null,[p(_,null,null)])]))}},Object.assign(a,i),E(a,"visibility"),oe(a,"visibility",Me.Visible);const u=a.visibility;a.visibility=la(()=>{const f=s(a.display);switch(ce.msDisplay){default:case In.All:return s(u);case In.Configurable:return s(a.earned)&&!(f!=null&&typeof f=="object"&&"optionsDisplay"in f)?Me.None:s(u);case In.Incomplete:return s(a.earned)?Me.None:s(u);case In.None:return Me.None}}),E(a,"display"),E(a,"mark"),E(a,"small"),E(a,"image"),E(a,"style"),E(a,"classes"),E(a,"showPopups"),oe(a,"showPopups",!0);for(const f of t)(h=f.postConstruct)==null||h.call(f,a);const l=t.reduce((f,b)=>{var v;return Object.assign(f,(v=b.getGatheredProps)==null?void 0:v.call(b,a))},{});if(a[pt]=function(){const{visibility:f,display:b,requirements:v,earned:y,image:_,style:I,classes:P,mark:S,small:T,id:B}=this;return{visibility:f,display:b,requirements:v,earned:y,image:_,style:s(I),classes:P,mark:S,small:T,id:B,...l}},a.requirements){const f=a,b=[Ki(f),Cd(()=>!f.earned.value),...At(a.requirements)?a.requirements:[a.requirements]];It(()=>{ce.active===Q.id&&Ni(b)&&f.complete()})}return a})}Qe.on("loadSettings",e=>{oe(e,"msDisplay",In.All)});const Ed=Object.values(In).map(e=>({label:at(e),value:e}));hs(Y(()=>p(Xi,{title:Y(()=>p("span",{class:"option-title"},[$("Show achievements"),p("desc",null,[$("Select which achievements to display based on criterias.")])])),options:Ed,"onUpdate:modelValue":e=>ce.msDisplay=e,modelValue:ce.msDisplay},null)));const Dd=J({props:{progress:{type:q(String,Object,Number),required:!0},width:{type:q(Number),required:!0},height:{type:q(Number),required:!0},direction:{type:q(String),required:!0},display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),borderStyle:q(Object,String,Array),textStyle:q(Object,String,Array),baseStyle:q(Object,String,Array),fillStyle:q(Object,String,Array),mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Jn,Node:Kn},setup(e){const{progress:t,width:n,height:i,direction:r,display:a}=Te(e),u=N(()=>{let d=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(d,0),1))*100}),l=N(()=>{const d={width:Ee(n)+.5+"px",height:Ee(i)+.5+"px"};switch(s(r)){case W.Up:d.clipPath=`inset(${u.value}% 0% 0% 0%)`,d.width=Ee(n)+1+"px";break;case W.Down:d.clipPath=`inset(0% 0% ${u.value}% 0%)`,d.width=Ee(n)+1+"px";break;case W.Right:d.clipPath=`inset(0% ${u.value}% 0% 0%)`;break;case W.Left:d.clipPath=`inset(0% 0% 0% ${u.value} + '%)`;break;case W.Default:d.clipPath="inset(0% 50% 0% 0%)";break}return d}),c=Pn(a);return{normalizedProgress:u,barStyle:l,component:c,unref:s,Visibility:Me,isVisible:Ye,isHidden:vn}}});function Pd(e,t,n,i,r,a){var c,d,h,f,b,v,y;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("div",{key:0,style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px",visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),class:Ne({bar:!0,...e.unref(e.classes)})},[C("div",{class:"overlayTextContainer border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(d=e.unref(e.borderStyle))!=null?d:{}])},[e.component?(M(),A("span",{key:0,class:"overlayText",style:Be(e.unref(e.textStyle))},[(M(),ne(Ke(e.component)))],4)):j("",!0)],4),C("div",{class:"border",style:Be([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(h=e.unref(e.style))!=null?h:{},(f=e.unref(e.baseStyle))!=null?f:{},(b=e.unref(e.borderStyle))!=null?b:{}])},[C("div",{class:"fill",style:Be([e.barStyle,(v=e.unref(e.style))!=null?v:{},(y=e.unref(e.fillStyle))!=null?y:{}])},null,4)],4),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],6)):j("",!0)}var Td=ve(Dd,[["render",Pd],["__scopeId","data-v-6bd06b56"]]);const Ad=Symbol("Bar");function Rd(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return et(i=>{var u,l;const r=e.call(i,i);r.id=rn("bar-"),r.type=Ad,r[yt]=Td;for(const c of t)(u=c.preConstruct)==null||u.call(c,r);Object.assign(r,n),E(r,"visibility"),oe(r,"visibility",Me.Visible),E(r,"width"),E(r,"height"),E(r,"direction"),E(r,"style"),E(r,"classes"),E(r,"borderStyle"),E(r,"baseStyle"),E(r,"textStyle"),E(r,"fillStyle"),E(r,"progress"),E(r,"display"),E(r,"mark");for(const c of t)(l=c.postConstruct)==null||l.call(c,r);const a=t.reduce((c,d)=>{var h;return Object.assign(c,(h=d.getGatheredProps)==null?void 0:h.call(d,r))},{});return r[pt]=function(){const{progress:c,width:d,height:h,direction:f,display:b,visibility:v,style:y,classes:_,borderStyle:I,textStyle:P,baseStyle:S,fillStyle:T,mark:B,id:le}=this;return{progress:c,width:d,height:h,direction:f,display:b,visibility:v,style:s(y),classes:_,borderStyle:I,textStyle:P,baseStyle:S,fillStyle:T,mark:B,id:le,...a}},r})}function Fd(e,...t){return et(n=>{var r,a;const i=e.call(n,n);for(const u of t)(r=u.preConstruct)==null||r.call(u,i);i.formula=i.formula(g.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=N(()=>{let u=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(u=u.min(1)),u})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=N(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=N(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var l;const u=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,u),i.spend(u),(l=i.onConvert)==null||l.call(i,u)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),E(i,"currentGain"),E(i,"actualGain"),E(i,"currentAt"),E(i,"nextAt"),E(i,"buyMax"),oe(i,"buyMax",!0);for(const u of t)(a=u.postConstruct)==null||a.call(u,i);return i})}function Od(e){return Fd(e)}function qd(e,t,n=1,i=o.dInf){const r=_e(n),a=_e(i);e.on("preUpdate",u=>{const l=s(r);o.neq(l,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(l,u).times(o.ceil(s(t.actualGain)))).min(s(a)).max(t.gainResource.value))})}const Vd={postConstruct(e){e.amount===void 0&&console.error(`Decorated feature ${e.id} does not contain the required 'amount' property"`),E(e,"bonusAmount"),e.totalAmount===void 0&&(e.totalAmount=N(()=>{var t;return o.add(s((t=e.amount)!=null?t:0),s(e.bonusAmount))}))}},Xr=Symbol("Repeatable");function pr(e,...t){const n=lt(0),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var b,v,y;const a=e.call(r,r);a.id=rn("repeatable-"),a.type=Xr,a[yt]=Wr;for(const _ of t)(b=_.preConstruct)==null||b.call(_,a);a.amount=n,a.amount[Ht]=(v=a.initialAmount)!=null?v:0,Object.assign(a,i);const u={requirementMet:N(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:Me.None,canMaximize:!0},l=Ki(a);At(a.requirements)?(a.requirements.unshift(l),a.requirements.push(u)):a.requirements=[l,a.requirements,u],a.maxed=N(()=>o.gte(a.amount.value,s(a.limit))),E(a,"classes");const c=a.classes;a.classes=N(()=>{const _=s(c)||{};return a.maxed.value&&(_.bought=!0),_}),a.amountToIncrease=N(()=>o.clampMin(Yr(a.requirements),1)),a.canClick=N(()=>Ni(a.requirements));const d=a.onClick;a.onClick=function(_){var S;const I=a;if(!s(I.canClick))return;const P=(S=s(a.amountToIncrease))!=null?S:1;Zr(a.requirements,P),I.amount.value=o.add(I.amount.value,P),d==null||d(_)},E(a,"display");const h=a.display;a.display=Y(()=>{var I,P,S;const _=s(h);if(xt(_)){const T=pe(_);return p(T,null,null)}if(_!=null){const T=a,B=pe((I=_.title)!=null?I:"","h3"),le=pe((P=_.description)!=null?P:""),ae=pe((S=_.effectDisplay)!=null?S:"");return p("span",null,[_.title==null?null:p("div",null,[p(B,null,null)]),_.description==null?null:p(le,null,null),_.showAmount===!1?null:p("div",null,[p("br",null,null),p(re,null,[$("Amount: "),dt(T.amount.value)]),o.isFinite(s(T.limit))?p(re,null,[$(" / "),dt(s(T.limit))]):void 0]),_.effectDisplay==null?null:p("div",null,[p("br",null,null),$("Currently: "),p(ae,null,null)]),T.maxed.value?null:p("div",null,[p("br",null,null),Ci(T.requirements,s(a.amountToIncrease))])])}return""}),E(a,"visibility"),oe(a,"visibility",Me.Visible),E(a,"limit"),oe(a,"limit",o.dInf),E(a,"style"),E(a,"mark"),E(a,"small");for(const _ of t)(y=_.postConstruct)==null||y.call(_,a);const f=t.reduce((_,I)=>{var P;return Object.assign(_,(P=I.getGatheredProps)==null?void 0:P.call(I,a))},{});return a[pt]=function(){const{display:_,visibility:I,style:P,classes:S,onClick:T,canClick:B,small:le,mark:ae,id:te}=this;return{display:_,visibility:I,style:s(P),classes:S,onClick:T,canClick:B,small:le,mark:ae,id:te,...f}},a})}const Bd=Symbol("Reset");function Ld(e){return et(t=>{const n=e.call(t,t);return n.id=rn("reset-"),n.type=Bd,n.reset=function(){var r;const i=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof o)&&!(a instanceof g)){if(Zn in a&&a[Zn]===!0)return;if(Ht in a){const u=a;u.value=u[Ht]}else!(a instanceof o)&&!Fe(a)&&Object.values(a).forEach(u=>i(u))}};s(n.thingsToReset).forEach(i),Qe.emit("reset",n),(r=n.onReset)==null||r.call(n)},E(n,"thingsToReset"),n})}const oi={};Qe.on("removeLayer",e=>{var t;(t=oi[e.id])==null||t.call(oi),oi[e.id]=void 0});function Ri(e,t){return E(t,"display"),E(t,"classes"),E(t,"style"),E(t,"direction"),oe(t,"direction",W.Up),E(t,"xoffset"),E(t,"yoffset"),t.pinnable&&(t.pinned=lt(!1,!1)),Ut(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Rr(t.pinned)):e.pinned=t.pinned);const n=e[yt];e[yt]=Re;const i=e[pt].bind(e);e[pt]=function(){const{display:a,classes:u,style:l,direction:c,xoffset:d,yoffset:h,pinned:f}=this;return{element:{[yt]:n,[pt]:i},display:a,classes:u,style:s(l),direction:c,xoffset:d,yoffset:h,pinned:f}}.bind(t)}),t}var jd=J({props:{display:{type:q(String,Object,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),requirements:{type:Object,required:!0},canPurchase:{type:q(Boolean),required:!0},bought:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:Kn,MarkNode:Jn},setup(e){const{display:t,requirements:n,bought:i}=Te(e),r=ht("");return It(()=>{const a=Ee(t);if(a==null){r.value="";return}if(xt(a)){r.value=pe(a);return}const u=pe(a.title||"","h3"),l=pe(a.description,"div"),c=pe(a.effectDisplay||"");r.value=pe(Y(()=>p("span",null,[a.title!=null?p("div",null,[p(u,null,null)]):null,p(l,null,null),a.effectDisplay!=null?p("div",null,[$("Currently: "),p(c,null,null)]):null,i.value?null:p(re,null,[p("br",null,null),Ci(n.value)])])))}),{component:r,unref:s,Visibility:Me,isVisible:Ye,isHidden:vn}}});const zd=["disabled"];function Gd(e,t,n,i,r,a){var c;const u=kt("MarkNode"),l=kt("Node");return e.isVisible(e.visibility)?(M(),A("button",{key:0,style:Be([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...d)=>e.purchase&&e.purchase(...d)),class:Ne({feature:!0,upgrade:!0,can:e.unref(e.canPurchase),locked:!e.unref(e.canPurchase),bought:e.unref(e.bought),...e.unref(e.classes)}),disabled:!e.unref(e.canPurchase)},[e.unref(e.component)?(M(),ne(Ke(e.unref(e.component)),{key:0})):j("",!0),p(u,{mark:e.unref(e.mark)},null,8,["mark"]),p(l,{id:e.id},null,8,["id"])],14,zd)):j("",!0)}var Ud=ve(jd,[["render",Gd],["__scopeId","data-v-9be6bac0"]]);const Qi=Symbol("Upgrade");function fr(e,...t){const n=lt(!1,!1),i=t.reduce((r,a)=>{var u;return Object.assign(r,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(r=>{var c,d;const a=e.call(r,r);a.id=rn("upgrade-"),a.type=Qi,a[yt]=Ud;for(const h of t)(c=h.preConstruct)==null||c.call(h,a);a.bought=n,Object.assign(a,i),a.canPurchase=N(()=>!n.value&&Ni(a.requirements)),a.purchase=function(){var f;const h=a;!s(h.canPurchase)||(Zr(a.requirements),n.value=!0,(f=h.onPurchase)==null||f.call(h))};const u=Ki(a);At(a.requirements)?a.requirements.unshift(u):a.requirements=[u,a.requirements],E(a,"visibility"),oe(a,"visibility",Me.Visible),E(a,"classes"),E(a,"style"),E(a,"display"),E(a,"mark");for(const h of t)(d=h.postConstruct)==null||d.call(h,a);const l=t.reduce((h,f)=>{var b;return Object.assign(h,(b=f.getGatheredProps)==null?void 0:b.call(f,a))},{});return a[pt]=function(){const{display:h,visibility:f,style:b,classes:v,requirements:y,canPurchase:_,bought:I,mark:P,id:S,purchase:T}=this;return{display:h,visibility:f,style:s(b),classes:v,requirements:y,canPurchase:_,bought:I,mark:P,id:S,purchase:T,...l}},a})}function Wd(e,t,n=[]){n=n.length===0?Hn(e,Qi):n;const i=Un(t)?N(t):t;e.on("update",()=>{s(i)&&n.forEach(r=>r.purchase())})}function Hd(e,t,n,i){return function(){e>>>=0,t>>>=0,n>>>=0,i>>>=0;let r=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,i=i+1|0,r=r+i|0,n=n+r|0,(r>>>0)/4294967296}}const Yd={1:["b","c","d","f","g","h","i","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"],2:["a","e","o","u"],3:["br","cr","dr","fr","gr","pr","str","tr","bl","cl","fl","gl","pl","sl","sc","sk","sm","sn","sp","st","sw","ch","sh","th","wh"],4:["ae","ai","ao","au","a","ay","ea","ei","eo","eu","e","ey","ua","ue","ui","uo","u","uy","ia","ie","iu","io","iy","oa","oe","ou","oi","o","oy"],5:["turn","ter","nus","rus","tania","hiri","hines","gawa","nides","carro","rilia","stea","lia","lea","ria","nov","phus","mia","nerth","wei","ruta","tov","zuno","vis","lara","nia","liv","tera","gantu","yama","tune","ter","nus","cury","bos","pra","thea","nope","tis","clite"],6:["una","ion","iea","iri","illes","ides","agua","olla","inda","eshan","oria","ilia","erth","arth","orth","oth","illon","ichi","ov","arvis","ara","ars","yke","yria","onoe","ippe","osie","one","ore","ade","adus","urn","ypso","ora","iuq","orix","apus","ion","eon","eron","ao","omia"]},gr=[[1,2,5],[2,3,6],[3,4,5],[4,3,6],[3,4,2,5],[2,1,3,6],[3,4,2,5],[4,3,1,6],[3,4,1,4,5],[4,1,4,3,6]];function Fi(e){const t=gr[Math.floor(e()*gr.length)];let n="";for(let i=0;in-n*t*Math.max(Math.min(a,4-a,1),0);return[i(5),i(3),i(1)]}const vr=hi();function Jr(e,t,n,i){return Hi(e,function(){const r=Hd(0,n>>0,n>>32,1);for(let V=0;V<12;V++)r();const a=Fi(r),u=qn([.64,.75,.55],r),l=qn([.18,.2,.25],r),c=Sn(0,Fi(r)),d=lt(0),h=Lt.indexOf(t);let f=r();const b=i.reduce((V,L)=>(V[L.type]=L.data,V),{});"increaseDiff"in b&&(f=f/2+.5),"decreaseDiff"in b&&(f=f/2),"relic"in b&&(f=1);const v=f+h+1,y=m.toolNodes.value.sandRelic!=null?ee("sandRelic")?2:1:0,_=lt(y),I=N(()=>("increaseRewards"in b?v+1:v)+_.value);let P="relic"in b?h+2:Math.ceil(r()*(h+2));"increaseLength"in b&&P++;const S=[],T=_t(()=>S),B=N(()=>T.apply(0)),le=[],ae={};function te({feature:V,canClick:L,modifier:$e,cost:nt,previewModifier:_n,showETA:ze,previewCost:Et}){L=_e(L),ze=_e(ze);const Vt=cr(V);le.push({shouldShowPreview:N(()=>s(L)&&Vt.value),modifier:_t(()=>{const Bt=S.slice();return Bt.splice(Bt.indexOf($e),1,_n),Bt}),cost:Et!=null?Et:nt}),S.push($e);const Mt=Ai(c,B,()=>Se(nt)),it=Ri(V,{display:ze==null?Mt:()=>s(ze)?Mt.value:"",direction:W.Down});return{isHovering:Vt,eta:Mt,tooltip:it}}const K=[],Ie=z(0);let he=g.variable(Ie).times(0),U=0,be=!0;const je=N(()=>o.add(v,r()-.5).pow_base(2).times(10).times(he.evaluate())),ft=[];for(let V=0;V=P-1?0:4};switch(li(L,r)){case"upgrades":const D=[];for(let R=0;R<4;R++){const H=li({add:1,mult:V===0&&R===0?0:1},r),Ge=je.value,Ze=Mn(r);let qe="",Ae,fe;switch(H){case"add":{const ue=o.add(Ge,10).pow(r()/4+1);qe=`Gain ${xe(ue)} ${c.displayName}/s`,he=he.add(ue),Ae=rt=>zt(()=>({addend:ue,description:Ze,enabled:rt==null?ye.bought:()=>rt()&&ye.bought.value})),fe=zt(()=>({addend:ue}));break}case"mult":{const ue=r()*5+1;qe=`Multiply previous ${c.displayName} gain by x${xe(ue)}.`;const rt=U;he=he.add(o.sub(ue,1).times(rt)),Ae=Xe=>ke(()=>({multiplier:ue,description:Ze,enabled:Xe==null?ye.bought:()=>Xe()&&ye.bought.value})),fe=ke(()=>({multiplier:ue}));break}}U=he.evaluate(),Ie.value++;const Pe=be,ye=fr(()=>({requirements:On(()=>({resource:kn(c),cost:Ge,requiresPay:()=>m.toolNodes.value.unobtainiumRelic==null})),display:{title:Ze,description:qe},visibility:Pe}));te({feature:ye,canClick:()=>ye.canPurchase.value,modifier:Ae(),cost:Ge,previewCost:N(()=>m.toolNodes.value.unobtainiumRelic==null?Ge:0),showETA:()=>!ye.bought.value,previewModifier:fe}),S.push(Ae(()=>H==="add"?m.toolNodes.value.stoneRelic!=null:ee("stoneRelic"))),D.push(ye)}K.push(D);break;case"repeatables":const F=[];for(let R=0;R<3;R++){const H=li({add:1.5,mult:3},r),Ge=Ie.value,Ze=je.value,qe=Mn(r);let Ae="",fe,Pe,ye,ue;const rt=g.variable(N(()=>se.amount.value)).times(2);switch(H){case"add":{const Ue=o.add(Ze,10).times(r()+.5);Ae=`Gain ${xe(Ue)} ${c.displayName}/s`,ue=rt.add(1).times(Ze),he=he.add(N(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).times(Ue))),fe=N(()=>xe(o.times(Ue,s(se.totalAmount)))+"/s"),Pe=zt(()=>({addend:()=>o.times(Ue,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=zt(()=>({addend:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).times(Ue)}));break}case"mult":{const Ue=r()*.75+1.25;Ae=`Multiply previous ${c.displayName} gain by x${xe(Ue)}.`,ue=rt.add(1).pow_base(Ue).times(Ze);const st=U;he=he.add(N(()=>o.sub(Ie.value,Ge).times(2).add(1).pow(2).clampMax(100).pow_base(Ue).sub(1).times(st))),fe=N(()=>"x"+xe(o.pow(Ue,s(se.totalAmount)))),Pe=ke(()=>({multiplier:()=>o.pow(Ue,s(se.totalAmount)),description:qe,enabled:()=>o.gt(s(se.totalAmount),0)})),ye=ke(()=>({multiplier:()=>o.add(s(se.totalAmount),se.amountToIncrease.value).pow_base(Ue)}));break}}U=he.evaluate(),Ie.value++;const Xe=be,se=pr(()=>({requirements:On(()=>({resource:kn(c),cost:ue,maxBulkAmount:()=>m.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>m.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:qe,description:`${Ae}

Amount: ${dt(se.amount.value)}${o.gt(s(se.bonusAmount),0)?` [+${dt(s(se.bonusAmount))}]`:""}`,effectDisplay:s(fe),showAmount:!1}),visibility:Xe,limit:100,bonusAmount:()=>o.gt(se.amount.value,0)?ee("dirtRelic")?2:m.toolNodes.value.dirtRelic!=null?1:0:0}),Vd);te({feature:se,canClick:()=>s(se.canClick),modifier:Pe,cost:ue,previewModifier:ye,previewCost:N(()=>m.toolNodes.value.unobtainiumRelic==null?Qt(ue,se.amountToIncrease.value):0),showETA:()=>!se.maxed.value}),F.push(se)}K.push(F);break;case"conversion":{const R=Sn(0,Fi(r)),G=qn([.64,.75,.55],r),H=je.value,Ge=r()/2+.25,Ze=r()/2+.25,qe=Ie.value,Ae=U;he=he.add(N(()=>o.sub(Ie.value,qe).add(1).times(2).pow10().times(Ae)));const fe=Od(()=>({baseResource:kn(c),gainResource:R,formula:Ei=>Ei.div(H).pow(Ge).times(N(()=>m.toolNodes.value.ironRelic!=null?ee("ironRelic")?4:2:1)),spend(){c.value=0}}));U=he.evaluate(),Ie.value+=2;const Pe=be,ye=Mn(r),ue=g.variable(R).pow(Ze).add(1),rt=ke(()=>({multiplier:()=>ue.evaluate(),description:ye,enabled:()=>o.gt(R.value,0)})),Xe=ke(()=>({multiplier:()=>ue.evaluate(o.add(R.value,fe.actualGain.value))})),se=cd(()=>({display:{title:ye,description:Y(()=>p("span",null,[$("Reset "),c.displayName,$(" for")," ",mi(R,o.clampMin(fe.actualGain.value,1))," ",R.displayName,p("br",null,null),p("div",null,[$("Next:")," ",mi(c,o.lt(fe.actualGain.value,1)?fe.currentAt.value:fe.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(fe.actualGain.value,1),prestigeResource:R,onClick:fe.convert,visibility:Pe})),{isHovering:Ue}=te({feature:se,canClick:()=>s(se.canClick),modifier:rt,cost:H,previewCost:c,previewModifier:Xe}),st=N(()=>Ue.value&&se.canClick.value);K.push([se]);const Fn=un(g.variable(R),st,fe.actualGain),Je=un(ue,st,fe.actualGain);ae[V*2]=Y(()=>p(re,null,[Ye(se.visibility)?p("div",{style:"margin: 10px"},[$("You have")," ",p("h2",{style:{color:G,textShadow:`0px 0px 10px ${G}`}},[Fn()])," ",R.displayName,$(","),p("br",null,null),$("providing a "),Je(),$("x multiplier to previous")," ",c.displayName,$(" gain")]):null,Ti(se)])),qd(this,fe,()=>tt.value.lengthQt(fe,Pe.value,!0,10)),ue=N(()=>Qt(fe,o.add(Pe.value,1),!0,10)),rt=N(()=>o.pow(Ae,Pe.value)),Xe=ke(()=>({multiplier:rt,description:Ge,enabled:()=>Ye(st.visibility)})),se=U;he=he.add(N(()=>o.sub(Ie.value,H).add(1).times(3).pow(Ae).times(se))),U=he.evaluate(),Ie.value+=3;const Ue=qn([.64,.75,.55],r),st=Rd(()=>({direction:W.Right,width:300,height:20,progress:()=>o.sub(R.value,ye.value).div(o.sub(ue.value,ye.value)).toNumber(),visibility:G,xp:R,display:Y(()=>p("span",null,[xe(R.value),$("/"),xe(ue.value)])),fillStyle:`background-color: ${Ue}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",Fn=>{if(tt.value.lengthJe.state.id===e)&&Ye(st.visibility)){let Je=o.times($t.value,Fn);m.toolNodes.value.goldRelic!=null&&(Je=o.times(ee("goldRelic")?.5:.25,tt.value.length).add(1).times(Je)),R.value=o.add(Je,R.value)}}),S.push(Xe),K.push([st]),ae[V*2]=Y(()=>p(re,null,[Ye(st.visibility)?p("div",{style:"margin: 10px"},[$("You have "),p("h3",null,[Ge]),$(" Lv. "),dt(Pe.value),$(","),p("br",null,null),$("providing a "),xe(rt.value),$("x multiplier to previous")," ",c.displayName,$(" gain"),p("br",null,null)]):null,Ti(st)]));break}case"dimensions":{const R=Mn(r),G=Sn(0,R+" energy"),H=qn([.64,.75,.55],r),Ge=Ie.value,Ze=U;he=he.add(N(()=>o.sub(Ie.value,Ge).add(1).pow_base(32).add(1).log2().add(1).times(Ze)));const qe=N(()=>o.add(G.value,1).log2().add(1)),Ae=ke(()=>({multiplier:qe,description:R,enabled:()=>o.gt(G.value,0)}));S.push(Ae);const fe=be,Pe=[];for(let ye=0;ye<4;ye++){const ue=o.add(v,r()-.5).pow_base(2).times(10).recip(),rt=je.value,Xe=g.variable(N(()=>Je.amount.value)),se=Xe.pow_base(o.pow10(ye+1)).times(rt),Ue=["First","Second","Third","Fourth"][ye]+" "+R+" Dimension",st=Sn(0,Ue),Fn=Xe.sub(1).pow_base(2).times(ue).times(N(()=>o.add(Je.amount.value,st.value))),Je=pr(()=>({display:{title:Ue,description:Y(()=>p("div",null,[p("div",null,[$("Amount:")," ",xe(o.add(st.value,Je.amount.value))," ",$("["),dt(Je.amount.value),$("]")])])),effectDisplay:Y(()=>p("span",null,[Qr()," ",ye===0?G.displayName:["First","Second","Third","Fourth"][ye-1]+" "+R+" Dimension",$("/s")])),showAmount:!1},style:{width:"400px"},effect:Fn,dimensions:st,limit:100,energy:ye===0?G:void 0,requirements:On(()=>({resource:kn(c),cost:se,maxBulkAmount:()=>ee("diamondRelic")!=null?o.dInf:1,requiresPay:()=>!ee("unobtainiumRelic")})),visibility:fe}));Pe.push(Je);const Ei=cr(Je),tr=N(()=>s(Je.canClick)&&Ei.value),Kr=new g({inputs:[Xe],evaluate(nr){return o.sub(nr,1).pow_base(2).times(ue).times(o.add(nr,st.value))}}),Qr=un(Kr,tr);le.push({shouldShowPreview:tr,cost:N(()=>ee("unobtainiumRelic")?0:Qt(se,Je.amountToIncrease.value))});const ea=Ai(c,B,()=>Se(se));Ri(Je,{display:ea,direction:W.Down}),U=he.evaluate(),Ie.value++}this.on("preUpdate",ye=>{if(tt.value.lengthue.state.id===e)&&Ye(fe)){let ue=o.times($t.value,ye);m.toolNodes.value.platinumRelic!=null&&(ue=o.times(ee("platinumRelic")?4:2,ue));const rt=Pe[0].effect.evaluate();G.value=o.times(rt,ue).add(G.value);for(let Xe=1;Xe<4;Xe++){const se=Pe[Xe].effect.evaluate();Pe[Xe-1].dimensions.value=o.times(se,ue).add(Pe[Xe-1].dimensions.value)}}}),K.push(Pe),ae[V*2]=Y(()=>p(re,null,[Ye(fe)?p("div",{style:"margin: 10px"},[$("You have")," ",p("h2",{style:{color:H,textShadow:`0px 0px 10px ${H}`}},[xe(G.value)])," ",G.displayName,$(","),p("br",null,null),$("providing a "),xe(qe.value),$("x multiplier to previous")," ",c.displayName,$(" gain")]):null,ks(...Pe)]));break}case"prestige":{const R=Mn(r),G=be,H=r()/10+1.1,Ge=je.value;he=he.pow(H);const Ze=Kc(()=>({exponent:H,description:R,enabled:fe.bought}));U=he.evaluate(),Ie.value+=20;const qe=K.filter((ye,ue)=>ue%2===0),Ae=Ld(()=>({thingsToReset:qe,onReset(){c.value=0}})),fe=fr(()=>({display:{title:R,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${xe(H)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{ee("unobtainiumRelic")||Ae.reset()},visibility:G,requirements:On(()=>({resource:kn(c),cost:Ge,requiresPay:!1}))})),Pe=ke(()=>({multiplier:0}));te({feature:fe,canClick:()=>s(fe.canPurchase),modifier:Ze,cost:Ge,previewCost:N(()=>ee("unobtainiumRelic")?0:c.value),previewModifier:Pe,showETA:()=>!s(fe.bought)}),K.push([fe]);break}}const nt={cache:"increaseCaches"in b?10:1,generation:"increaseGens"in b?10:1,resourceMulti:"increaseResourceMults"in b?10:1,energyMulti:"increaseEnergyMults"in b?2.5:.25,influences:Object.keys(m.influenceNodes.value).length+ft.length===Object.keys(ct).length?0:"increaseInfluences"in b?20:2,relic:0};let _n=li(nt,r);V===P-1&&"relic"in b&&(_n="relic");let ze="",Et,Vt,Mt,it,Bt,Zt;switch(_n){case"cache":it=Oi(r,i),ze=`Gain ${xe(o.div(I.value,12))}x your current ${it} (no modifiers).`,Vt=()=>{var R,G,H;return m.grantResource(it,o.times((H=(G=(R=m.resourceNodes.value[it])==null?void 0:R.state)==null?void 0:G.amount)!=null?H:0,o.div(I.value,12)))};break;case"generation":it=Oi(r,i);const D=o.div(I.value,40).times(St[it]);ze=`Gain ${xe(D)} ${it}/s while plane is active.`,Et=R=>m.grantResource(it,o.times(R,D)),Mt=N(()=>m.resourceNodes.value[it]);break;case"resourceMulti":Bt=it=Oi(r,i),Zt=o.div(I.value,10).pow_base(2),ze=`Gain ${xe(Zt)}x ${it} while plane is active.`;break;case"energyMulti":Bt="energy",Zt=o.div(I.value,8).add(1),ze=`Gain ${xe(Zt)}x energy while plane is active.`;break;case"influences":const F=Object.keys(ct)[Math.floor(r()*Object.keys(ct).length)];ft.push(F),ze=`Gain a portal influence (${ct[F].display})`,Vt=()=>{if(F in m.influenceNodes.value){vr.warning(`You already have a ${ct[F].display} influence, skipping treasure`);return}const R={id:Dn(m.board),position:{...m.board.types.portal.nodes.value.find(G=>G.state.id===e).position},type:"influence",state:{type:F,data:ct[F].initialData}};m.board.placeInAvailableSpace(R),m.board.nodes.value.push(R)};break;case"relic":ze=t==="ultimatum"?"Win the game!":`Gain the ${t}-tier planar relic (${Dt[t]})`,Vt=()=>{if(t==="ultimatum"){er.value=!0;return}if(`${t}Relic`in m.toolNodes.value)vr.warning(`You already have a ${Dt[t]} relic, skipping treasure`);else{const R={id:Dn(m.board),position:{...m.board.types.portal.nodes.value.find(G=>G.state.id===e).position},type:"passive",state:`${t}Relic`};m.board.placeInAvailableSpace(R),m.board.nodes.value.push(R)}}}const $i=be,Nn=je.value,Cn=$d(()=>({requirements:On(()=>({resource:kn(c),cost:Nn})),visibility:$i,display:{requirement:`${xe(Nn)} ${c.displayName}`,effectDisplay:ze},style:"width: 100%",classes:{final:V===P-1},update:Et,onComplete:Vt,link:Mt,effectedResource:Bt,resourceMulti:Zt})),x=Ai(c,B,Nn);Ri(Cn,{display:()=>Cn.earned.value?"":x.value,direction:W.Down}),K.push([Cn]),be=N(()=>Cn.earned.value)}const Ot=Hn(K,Qi),gt=Hn(K,Xr);S.push(ke(()=>({multiplier:()=>ee("silver")?4:2,description:()=>(ee("silver")?"Empowered ":"")+Ve.silver.name,enabled:()=>m.toolNodes.value.silver!=null})),ke(()=>({multiplier:()=>o.add(1,(ee("diamond")?2:1)*Ot.filter(V=>V.bought.value).length/10),description:()=>(ee("diamond")?"Empowered ":"")+Ve.diamond.name,enabled:()=>m.toolNodes.value.diamond!=null})),ke(()=>({multiplier:()=>o.div(d.value,6e3).times(ee("emerald")?2:1).add(1),description:()=>(ee("emerald")?"Empowered ":"")+Ve.emerald.name,enabled:()=>m.toolNodes.value.emerald!=null})),ke(()=>({multiplier:()=>o.div(gt.reduce((V,L)=>V.add(s(L.totalAmount)),o.dZero),100).times(ee("gravelRelic")?2:1).add(1).pow(.75),description:()=>(ee("gravelRelic")?"Empowered ":"")+Dt.gravel,enabled:()=>m.toolNodes.value.gravelRelic!=null})),ke(()=>({multiplier:()=>o.add(m.energy.value,1).log10().add(1).pow(ee("beryliumRelic")?.5:.25),description:()=>(ee("beryliumRelic")?"Empowered ":"")+Dt.berylium,enabled:()=>m.toolNodes.value.beryliumRelic!=null})));const yn=_t(()=>[ke(()=>({multiplier:()=>{var V,L,$e;return o.add(($e=(L=(V=m.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.level)!=null?$e:0,1)},description:"Booster",enabled:()=>{var V,L,$e;return($e=(L=(V=m.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:L.portals.includes(e))!=null?$e:!1}})),ke(()=>({multiplier:()=>o.times(ee("coalRelic")?.2:.1,tt.value.length).add(1),description:()=>(ee("coalRelic")?"Empowered ":"")+Dt.coal,enabled:()=>m.toolNodes.value.coalRelic!=null}))]),$t=N(()=>yn.apply(1)),[Mi,ti]=jn(()=>[{title:`${at(c.displayName)} Gain`,modifier:T,base:0,unit:"/s"},{title:`${at(c.displayName)} Time Speed`,modifier:yn,base:1,visible:()=>o.gt($t.value,1)}]),wn=z(!1),ni=Y(()=>p(Rt,{modelValue:wn.value,"onUpdate:modelValue":V=>wn.value=V},{header:()=>p("h2",null,[$("Modifiers")]),body:()=>ot(Mi)}));this.on("preUpdate",V=>{if(!m.activePortals.value.some($e=>$e.state.id===e))return;const L=o.times($t.value,V);d.value=o.add(d.value,L),tt.value.length{var nt;(nt=$e.update)==null||nt.call($e,L)})}),Wd(this,()=>tt.value.lengthtt.value.length{const V=le.find(L=>L.shouldShowPreview.value);return V?o.neg(Se(V.cost)):0}),qt=N(()=>{const V=le.find(L=>L.shouldShowPreview.value);return V&&V.modifier?o.sub(V.modifier.apply(0),B.value):0}),Rn=un(g.variable(0).add(c),()=>o.neq(An.value,0),An),ii=un(g.variable(0).add(B),()=>o.neq(qt.value,0),qt),ri=N(()=>{const V=[];return tt.value.forEach(L=>{L.link&&V.push(L.link)}),V}),Si=N(()=>{const V={};return tt.value.forEach(L=>{L.effectedResource!=null&&L.resourceMulti!=null&&(V[L.effectedResource]!=null?V[L.effectedResource]=o.times(V[L.effectedResource],L.resourceMulti):V[L.effectedResource]=L.resourceMulti)}),V}),tt=N(()=>{const V=[];for(let L=1;Lo.lt(tt.value.length,P)&&K.some(V=>V.some(L=>"earned"in L&&s(L.earned)||"bought"in L&&s(L.bought)?!1:("canClick"in L&&s(L.canClick)||"canPurchase"in L&&s(L.canPurchase),!0)))),xi=N(()=>{const V=K.findIndex(($e,nt)=>nt>0&&nt%2===0&&!K[nt-1][0].earned.value);let L;return V===-1?L=K:L=K.slice(0,V),L.map(($e,nt)=>nt in ae?ot(ae[nt]):Ti(...$e))});return{tier:lt(t),seed:lt(n),influences:lt(i),name:a,color:u,resource:c,background:l,style:{background:l,"--background":l},features:K,resourceTabCollapsed:ti,links:ri,resourceMultis:Si,earnedTreasures:tt,showNotif:Ii,timeActive:d,bonusRewardsLevel:_,display:Y(()=>p(re,null,[p(gi,{class:"nav-container",style:"z-index: 5"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",null,[a])]),p("span",{class:"nav-segment"},[p("h3",null,[t,$("-tier")])]),i.length===0?null:p("span",{class:"nav-segment"},[p(Re,{display:i.map(V=>{const L=ct[V.type].description;return typeof L=="function"?L(V):L}).join("
"),direction:W.Down,style:"width: 300px"},{default:()=>[p("h3",null,[i.length,$(" influences")])]})]),p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>wn.value=!0},[$("modifiers")])])]}),p(gi,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[ot(Rn)])," ",c.displayName]),p("span",{class:"nav-segment"},[$("("),p("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[o.gt(B.value,0)?"+":"",ot(ii)]),$("/s)")]),o.neq($t.value,1)?p("span",{class:"nav-segment"},[$("Speed: "),xe($t.value),$("x")]):null]}),p(Nd,{height:"60px"},null),xi.value,ot(ni)])),minimizedDisplay:Y(()=>p("div",null,[p("span",null,[a]),p("span",{style:"font-size: large; vertical-align: sub;"},[" ",tt.value.length,$("/"),P,$(" treasures")])]))}})}function Oi(e,t){t=t.filter(l=>l.type==="increaseResources"||l.type==="decreaseResources");const n=Object.keys(St).reduce((l,c)=>{let d=St[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?d*=1e3:d/=1e3}),l+d},0),i=Object.keys(St),r=Math.floor(e()*n);let a=0,u;for(let l=0;ll+c),i=Object.keys(e);let r=0,a=null;const u=t()*n;for(let l=0;le===m.board.selectedNode.value?{text:"Mining"}:Object.keys(m.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[Ft,Xn("mine")],progress:e=>Ce(e)?new o(e.state.progress).toNumber():0,progressDisplay:nn.Outline,progressColor:"var(--accent2)",classes:e=>({running:Ce(e)}),draggable:!0},Qd={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===m.board.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:Math.PI/4,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 100 energy"},onClick(e){o.gte(m.energy.value,100)&&(e.type="factory",m.energy.value=o.sub(m.energy.value,100),m.helpModals.factory.showModal.value=!0)},confirmationLabel:()=>o.gte(m.energy.value,1e3)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},ep={shape:Le.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===m.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${Ve[e.state].name}`};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="resource"){const i=((n=m.board.draggingNode.value)==null?void 0:n.state).type,r=e.state===i?"Disconnect":m.toolNodes.value[i]==null?Ve[i].name:"Already crafted",a=e.state===i||m.toolNodes.value[i]==null?"var(--accent2)":"var(--danger)";return{text:r,color:a}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(e){e.state=void 0,m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${Ve[e.state].name} - ${He(Ve[e.state].cost)} energy`}),onClick(e){const t=Ve[e.state];if(o.gte(m.energy.value,t.cost)&&m.toolNodes.value[e.state]==null){m.energy.value=o.sub(m.energy.value,t.cost);const n={id:Dn(m.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};if(m.board.placeInAvailableSpace(n),m.board.nodes.value.push(n),e.state==="iron"){const i={id:Dn(m.board),position:{...e.position},type:"trashCan"};m.board.placeInAvailableSpace(i),m.board.nodes.value.push(i)}m.board.selectedAction.value=null,m.board.selectedNode.value=null,e.state=void 0,t.type in m.helpModals&&(m.helpModals[t.type].showModal.value=!0)}},fillColor:e=>o.gte(m.energy.value,Ve[e.state].cost)&&m.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(m.energy.value,Ve[e.state].cost)?m.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}},Xn("factory")],progress:e=>e.state==null||m.toolNodes.value[e.state]!=null?0:o.div(o.sqrt(m.energy.value),o.sqrt(Ve[e.state].cost)).clampMax(1).toNumber(),progressDisplay:nn.Fill,progressColor:e=>e.state!=null&&o.gte(m.energy.value,Ve[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){var i;if(t.type!=="resource")return!1;const n=((i=m.board.draggingNode.value)==null?void 0:i.state).type;return m.toolNodes.value[n]==null},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,m.board.selectedNode.value=e},draggable:!0},tp=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],np={shape:Le.Circle,size:50,title:e=>at(e.state.type),subtitle:e=>He(e.state.amount),otherSubtitle:e=>tp[Lt.indexOf(e.state.type)],progress:e=>nd(e.state.type),onClick(){},progressDisplay:nn.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":m.dowsing.value!=null&&Ce(m.dowsing.value)&&m.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=m.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0},ip={shape:Le.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?Dt[t.slice(0,-5)]:Ve[t].name},label:e=>e===m.board.selectedNode.value?{text:vd[e.state].description(ee(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":ee(e.state)}),draggable:!0},rp={shape:Le.Diamond,size:50,title:"\u{1F962}",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Dowsing - Drag a resource to me!":`Dowsing (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(2).pow_base(100),16),Ft,Xn("dowsing")],classes:e=>({running:Ce(e)}),canAccept:Gr,onDrop:Ur,draggable:!0},ap={shape:Le.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Quarry - Drag a resource to me!":`Quarrying (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:zr(e,t=>`Gather ${bt(o.div(m.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(2).pow_base(1e4),16),Ft,Xn("quarry")],progress:e=>Ce(e)?o.eq(m.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(m.quarryProgressRequired.value).toNumber():0,progressDisplay:nn.Outline,progressColor:"var(--accent2)",canAccept:Gr,onDrop:Ur,classes:e=>({running:Ce(e)}),draggable:!0},sp={shape:Le.Diamond,size:50,title:"\u{1F50C}",label:e=>e===m.board.selectedNode.value?{text:e.state.tools.length===0?"Empowerer - Drag a tool to me!":`Empowering (${e.state.tools.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:Qc(e,t=>t.includes("Relic")?`Double ${Dt[t.slice(0,-5)]}'s effect`:`Double ${Ve[t].name}'s effect`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(3).pow_base(1e3),24),Ft,Xn("empowerer")],canAccept:ed,onDrop:td,classes:e=>({running:Ce(e)}),draggable:!0},op={shape:Le.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===m.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${at(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type;if(e.state.influences.includes(n))return{text:"Disconnect",color:"var(--accent2)"};const r=ct[n].cost;let a;return o.lt(r,1e3)?a=He(r):a=Li(r,0),{text:`Add influence (${a}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${ge[t.state.id].name}`};return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(e){e.state={...e.state,tier:void 0,influences:[]},m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{const{tier:t,influences:n}=e.state;return t!=null||n.length>0}},{id:"makePortal",icon:"done",tooltip:e=>({text:`Spawn ${e.state.tier}-tier portal - ${He(m.computedPortalCost.value)} energy`}),fillColor:()=>o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--danger)",confirmationLabel:()=>o.gte(m.energy.value,m.computedPortalCost.value)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(e){if(o.lt(m.energy.value,m.computedPortalCost.value))return;let t=0;for(;`portal-${t}`in ge;)t++;m.energy.value=o.sub(m.energy.value,m.computedPortalCost.value);const{tier:n,influences:i}=e.state;Yi(Jr(`portal-${t}`,n,Math.floor(Math.random()*4294967296),i.map(a=>m.influenceNodes.value[a].state)),Q);const r={id:Dn(m.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};m.board.placeInAvailableSpace(r),m.board.nodes.value.push(r),m.board.selectedAction.value=null,m.board.selectedNode.value=null,e.state={tier:void 0,influences:[]}},visibility:e=>e.state.tier!=null}],canAccept(e,t){return t.type==="resource"||t.type==="influence"||t.type==="portal"},onDrop(e,t){if(t.type==="resource"){const n=t.state.type,i=e.state.tier;e.state={...e.state,tier:n===i?void 0:n}}else if(t.type==="influence"){const n=t.state.type,i=e.state.influences;i.includes(n)?e.state={...e.state,influences:i.filter(r=>r!==n)}:e.state={...e.state,influences:[...i,n]}}else if(t.type==="portal"){const n=ge[t.state.id];e.state={...e.state,tier:n.tier.value,influences:n.influences.value.map(i=>i.type)}}m.board.selectedNode.value=e},progress:e=>e.state.tier==null?0:o.div(o.sqrt(m.energy.value),o.sqrt(m.computedPortalCost.value)).clampMax(1).toNumber(),progressDisplay:nn.Fill,progressColor:e=>e.state.tier!=null&&o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},lp={shape:Le.Diamond,size:50,title:"\u{1F300}",label:e=>e===m.board.selectedNode.value?{text:`Portal to ${ge[e.state.id].name}`,color:ge[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[Ft],classes:e=>({running:Ce(e),showNotif:ge[e.state.id].showNotif.value,"affected-node":m.booster.value!=null&&Ce(m.booster.value)&&m.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>ge[e.state.id].background,draggable:!0},up={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?Le.Diamond:Le.Circle,size:50,title:e=>ct[e.state.type].display,otherSubtitle:e=>{const t=ct[e.state.type].cost;return o.lt(t,1e3)?`${He(t)}x cost`:`${Li(t,0)}x cost`},label:e=>{if(e===m.board.selectedNode.value){const n=e.state,i=ct[n.type].description;return{text:typeof i=="function"?i(n):i}}const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type,{type:i,data:r}=e.state;let a;if(Array.isArray(r)&&r.includes(n))a="Disconnect";else if(i==="increaseResources")a=`Increase ${at(n)} odds`;else if(i==="decreaseResources")a=`Decrease ${at(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[an],canAccept:(e,t)=>t.type!=="resource"?!1:Array.isArray(e.state.data),onDrop:(e,t)=>{if(t.type!=="resource")return;const n=t.state.type,i=e.state.data;i!=null&&(i.includes(n)?e.state={...e.state,data:i.filter(r=>r!==n)}:e.state={...e.state,data:[...i,n]},m.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},cp={shape:Le.Diamond,size:50,title:"\u231B",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${He(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Boost ${ge[t].name}'s speed`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${He(si.evaluate(e.state.level))} energy`}},fillColor(e){return o.gte(m.energy.value,si.evaluate(e.state.level))?"var(--bought)":"var(--locked)"},confirmationLabel(e){return o.gte(m.energy.value,si.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=si.evaluate(e.state.level);o.gte(m.energy.value,t)&&(m.energy.value=o.sub(m.energy.value,t),e.state={...e.state,level:o.add(e.state.level,1)},m.board.selectedAction.value=null)}},Ft],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},dp={shape:Le.Diamond,size:50,title:"\u{1F916}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Upgrader - Drag a portal to me!":`Auto-Upgrading (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Auto-buy ${ge[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(4).pow_base(1e6)),Ft],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},pp={shape:Le.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Automator - Drag a portal to me!":`Automatating (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Auto-buy ${ge[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(4).pow_base(1e6)),Ft],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},fp={shape:Le.Diamond,size:50,title:"\u{1F4B1}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Investments - Drag a portal to me!":`Investing (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:yi(e,t=>`Passively generate ${ge[t].name}'s conversions`),actionDistance:Math.PI/4,actions:[an,bn(e=>e.add(3).pow_base(1e8)),Ft],canAccept:wi,onDrop:_i,classes:e=>({running:Ce(e)}),draggable:!0},gp={shape:Le.Diamond,size:50,title:"\u{1F5D1}\uFE0F",label:e=>{var t;if(e===m.board.selectedNode.value)return{text:"Trash Can - Drag a portal to me!"};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="portal"){const n=m.board.draggingNode.value.state.id;return{text:`Delete ${ge[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;Zi(ge[n]),delete Q.layers[n],m.board.state.value.nodes=m.board.state.value.nodes.filter(i=>i!==t),m.booster.value&&(m.booster.value.state={...m.booster.value.state,portals:m.booster.value.state.portals.filter(i=>i!==n)}),m.upgrader.value&&(m.upgrader.value.state={...m.upgrader.value.state,portals:m.upgrader.value.state.portals.filter(i=>i!==n)}),m.automator.value&&(m.automator.value.state={...m.automator.value.state,portals:m.automator.value.state.portals.filter(i=>i!==n)}),m.investments.value&&(m.investments.value.state={...m.investments.value.state,portals:m.investments.value.state.portals.filter(i=>i!==n)})},draggable:!0},hr=hi(),mp={mine:Kd,brokenFactory:Qd,factory:ep,resource:np,passive:ip,dowsing:rp,quarry:ap,empowerer:sp,portalGenerator:op,portal:lp,influence:up,booster:cp,upgrader:dp,automator:pp,investments:fp,trashCan:gp},m=Hi("main",function(){const e=Sn(0,"energy"),t=N(()=>v.types.resource.nodes.value.reduce((x,D)=>(x[D.state.type]=D,x),{})),n=N(()=>({...v.types.passive.nodes.value.reduce((x,D)=>(x[D.state]=D,x),{}),sand:v.types.dowsing.nodes.value[0],wood:v.types.quarry.nodes.value[0],coal:v.types.empowerer.nodes.value[0],iron:v.types.portalGenerator.nodes.value[0],gold:v.types.booster.nodes.value[0],platinum:v.types.upgrader.nodes.value[0],berylium:v.types.automator.nodes.value[0],ultimatum:v.types.investments.nodes.value[0]})),i=N(()=>Object.keys(Dt).filter(x=>`${x}Relic`in n.value).length),r=N(()=>({...v.types.influence.nodes.value.reduce((x,D)=>(x[D.state.type]=D,x),{})})),a=N(()=>({...v.types.portal.nodes.value.reduce((x,D)=>(x[D.state.id]=D,x),{})})),u=N(()=>Lt.reduce((x,D)=>{var R,G,H;const F=(H=(G=(R=t.value[D])==null?void 0:R.state)==null?void 0:G.amount)!=null?H:0;return x[D]=o.floor(qi.invert(F)),x},{})),l=fn({}),c=fn({});Ut(()=>{Lt.forEach(x=>{vt(()=>u.value[x],(D,F)=>{const R=o.sub(D,F);o.gt(R,1)&&ce.active===Q.id&&hr.info(p("div",null,[p("h3",null,[o.eq(D,1)?`${at(x)} discovered`:`${at(x)} is now Level ${dt(D)}`,$("!")]),o.gt(R,1)?p("div",null,[$("Gained "),dt(R),$(" levels")]):null]))})})});const d=N(()=>K.filter(x=>{var D,F;return(F=(D=x.value)==null?void 0:D.state)==null?void 0:F.powered}).length+v.types.portal.nodes.value.filter(x=>x.state.powered).length),h=N(()=>{let x=d.value;return n.value.copperRelic!=null&&(x--,ee("copperRelic")&&x--),x}),f=N(()=>{const x=h.value;return o.lt(x,0)?0:o.eq(x,0)?10:o.add(x,1).pow_base(100).div(10).times(.99)}),b=N(()=>{if(P.value==null)return 0;let D=P.value.state.resources.reduce((F,R)=>o.div(100,qt[R].computedModifier.value).add(F),o.dZero);return n.value.silverRelic!=null&&(D=o.div(D,o.add(d.value,1)),ee("silverRelic")&&(D=o.div(D,o.add(d.value,1)))),D}),v=jc(x=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:mp,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const D=[];if(D.push(...Object.keys(l).map(F=>({startNode:y.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),_.value!=null&&_.value.state!=null&&D.push({startNode:_.value,endNode:t.value[_.value.state],stroke:"var(--foreground)",strokeWidth:4}),I.value!=null&&I.value.state.resources.forEach(F=>{D.push({startNode:I.value,endNode:t.value[F],stroke:Ce(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),P.value!=null&&P.value.state.resources.forEach(F=>{D.push({startNode:P.value,endNode:t.value[F],stroke:"var(--foreground)",strokeWidth:4})}),D.push(...Object.keys(c).map(F=>({startNode:P.value,endNode:t.value[F],stroke:"var(--accent3)",strokeWidth:5}))),S.value!=null&&S.value.state.tools.forEach(F=>{D.push({startNode:S.value,endNode:n.value[F],stroke:Ce(S.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),T.value!=null){const F=T.value.state;F.tier!=null&&D.push({startNode:T.value,endNode:t.value[F.tier],stroke:"var(--foreground)",strokeWidth:4}),F.influences.forEach(R=>{D.push({startNode:T.value,endNode:r.value[R],stroke:"var(--foreground)",strokeWidth:4})}),x.types.portal.nodes.value.forEach(R=>{const G=ge[R.state.id];return G.links.value.forEach(H=>{H.value!=null&&D.push({startNode:R,endNode:H.value,stroke:Ce(R)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(G.resourceMultis.value).forEach(H=>{H!=="energy"&&H in t.value&&D.push({startNode:R,endNode:t.value[H],stroke:Ce(R)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),D})}return B.value!=null&&B.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{D.push({startNode:B.value,endNode:a.value[F],stroke:Ce(B.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),le.value!=null&&le.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{D.push({startNode:le.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{D.push({startNode:ae.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),te.value!=null&&te.value.state.portals.filter(F=>a.value[F]!=null).forEach(F=>{D.push({startNode:te.value,endNode:a.value[F],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(r.value).forEach(F=>{const R=F.state;(R.type==="increaseResources"||R.type==="decreaseResources")&&R.data.forEach(G=>{D.push({startNode:F,endNode:t.value[G],stroke:"var(--foreground)",strokeWidth:4})})}),D}})),y=N(()=>v.types.mine.nodes.value[0]),_=N(()=>v.types.factory.nodes.value[0]),I=N(()=>n.value.sand),P=N(()=>n.value.wood),S=N(()=>n.value.coal),T=N(()=>n.value.iron),B=N(()=>n.value.gold),le=N(()=>n.value.platinum),ae=N(()=>n.value.berylium),te=N(()=>n.value.ultimatum),K=[y,I,P,S,B,le,ae,te];function Ie(x,D){let F=t.value[x];if(D=o.times(D,Rn[x].computedModifier.value),F==null)F={id:Dn(v),position:{...y.value.position},type:"resource",state:{type:x,amount:D}},v.placeInAvailableSpace(F),v.nodes.value.push(F);else{const R=F.state;F.state={...R,amount:o.add(R.amount,D)}}}const he=N(()=>Object.keys(St).reduce((x,D)=>x+new o(qt[D].computedModifier.value).toNumber(),0)),U=N(()=>{const x={};return v.types.portal.nodes.value.forEach(D=>{if(!Ce(D))return;const R=ge[D.state.id].resourceMultis.value;Object.keys(R).forEach(G=>{x[G]!=null?x[G]=o.times(x[G],R[G]):x[G]=R[G]})}),x}),be=_t(()=>Lt.map(x=>zt(()=>({description:()=>at(x),addend:()=>u.value[x],enabled:()=>o.gt(u.value[x],0)})))),je=N(()=>be.apply(0)),ft=_t(()=>[zt(()=>({addend:je,description:"Resource Levels"})),ke(()=>({multiplier:()=>o.pow(An.value,je.value),description:()=>`${Gt(An.value,3)}x per Resource Level`})),ke(()=>({multiplier:()=>ee("stone")?4:2,description:()=>(ee("stone")?"Empowered ":"")+Ve.stone.name,enabled:()=>n.value.stone!=null})),ke(()=>({multiplier:()=>{var x;return(x=U.value.energy)!=null?x:1},description:"Planar Treasures",enabled:()=>{var x;return o.neq((x=U.value.energy)!=null?x:1,1)}})),zt(()=>({addend:()=>o.pow(100,h.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(h.value,0)}))]),Ot=N(()=>ft.apply(0)),gt=_t(()=>[zt(()=>({addend:()=>ee("unobtainium")?2:1,description:()=>(ee("unobtainium")?"Empowered ":"")+Ve.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),yn=N(()=>gt.apply(0)),$t=_t(()=>[ke(()=>({multiplier:()=>ee("dirt")?4:2,description:()=>(ee("dirt")?"Empowered ":"")+Ve.dirt.name,enabled:()=>n.value.dirt!=null})),ke(()=>({multiplier:()=>o.pow(i.value,ee("woodRelic")?2:1),description:()=>(ee("woodRelic")?"Empowered ":"")+Dt.wood,enabled:()=>n.value.woodRelic!=null}))]),Mi=N(()=>$t.apply(1)),ti=_t(()=>[ke(()=>({multiplier:()=>ee("gravel")?4:2,description:()=>(ee("gravel")?"Empowered ":"")+Ve.gravel.name,enabled:()=>n.value.gravel!=null}))]),wn=N(()=>ti.apply(1)),ni=_t(()=>[zt(()=>({addend:()=>ee("copper")?.004:.002,description:()=>(ee("copper")?"Empowered ":"")+Ve.copper.name,enabled:()=>n.value.copper!=null}))]),An=N(()=>ni.apply(1.01)),qt=Object.keys(St).reduce((x,D)=>{const F=_t(()=>[ke(()=>({multiplier:2,description:"Dowsing",enabled:()=>I.value!=null&&Ce(I.value)&&I.value.state.resources.includes(D)}))]),R=N(()=>F.apply(St[D])),G={title:`${at(D)} Drop Rate`,modifier:F,base:St[D]};return x[D]={modifier:F,computedModifier:R,section:G},x},{}),Rn=Object.keys(St).reduce((x,D)=>{const F=_t(()=>[ke(()=>({multiplier:()=>{var H;return(H=U.value[D])!=null?H:1},description:"Planar Treasures",enabled:()=>{var H;return o.neq((H=U.value[D])!=null?H:1,1)}}))]),R=N(()=>F.apply(1)),G={title:`${at(D)} Gain`,modifier:F};return x[D]={modifier:F,computedModifier:R,section:G},x},{}),ii=N(()=>{var D,F,R;const x=Lt.indexOf((R=(F=(D=T.value)==null?void 0:D.state)==null?void 0:F.tier)!=null?R:"dirt");return o.add(x,1).times(x).div(2).add(9).pow10()}),ri=_t(()=>[...Object.keys(ct).map(x=>ke(()=>({multiplier:ct[x].cost,description:ct[x].display,enabled:()=>{var D,F,R;return(R=(F=(D=T.value)==null?void 0:D.state)==null?void 0:F.influences.includes(x))!=null?R:!1},smallerIsBetter:!0}))),ke(()=>({multiplier:()=>ee("emeraldRelic")?.05:.1,description:()=>(ee("emeraldRelic")?"Empowered ":"")+Dt.emerald,enabled:()=>n.value.emeraldRelic!=null,smallerIsBetter:!0}))]),Si=N(()=>ri.apply(ii.value)),[tt,Ii]=jn(()=>[{title:"Resource Levels",modifier:be,base:0},{title:"Energy Gain",modifier:ft,base:0,unit:"/s"},{title:"Portal Cost",modifier:ri,base:ii,unit:" energy",baseText:()=>{var x,D,F;return`${at((F=(D=(x=T.value)==null?void 0:x.state)==null?void 0:D.tier)!=null?F:"dirt")}-tier Base Cost`},visible:()=>T.value!=null,smallerIsBetter:!0},{title:"Bonus Connections",modifier:gt,base:0,visible:()=>o.gt(yn.value,0)}]),[xi,V]=jn(()=>[{title:"Mining Speed",modifier:$t,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:ti,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:ni,base:1.01,visible:()=>n.value.copper!=null}]),[L,$e]=jn(()=>Object.values(qt).map(x=>x.section)),[nt,_n]=jn(()=>Object.values(Rn).map(x=>x.section)),ze=Jc({general:()=>({display:"General",glowColor(){return ze.activeTab.value===this.tab?"white":""},tab:tt,energyTabCollapsed:Ii}),mining:()=>({display:"Mine",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(n.value).length>0,tab:xi,miningTabCollapsed:V}),resources:()=>({display:"Ore Rates",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>I.value!=null,tab:L,resourcesCollapsed:$e}),resourcesGain:()=>({display:"Ore Gain",glowColor(){return ze.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(Rn).some(x=>o.neq(x.computedModifier.value,1)),tab:nt,resourceGainCollapsed:_n})}),Et=z(!1),Vt=Y(()=>p(Rt,{modelValue:Et.value,"onUpdate:modelValue":x=>Et.value=x},{header:()=>p("h2",null,[$("Modifiers")]),body:()=>ot(ze)})),Mt={mine:hd(),factory:bd(),dowsing:yd(),quarry:wd(),empowerer:_d()};Mt.mine.showModal[Ht]=!0,Mt.mine.showModal.value=!0,this.on("preUpdate",x=>{if(Object.keys(l).forEach(D=>{l[D]-=x,l[D]<=0&&delete l[D]}),Object.keys(c).forEach(D=>{c[D]-=x,c[D]<=0&&delete c[D]}),Ce(y.value)){const D=o.add(y.value.state.progress,o.times(Mi.value,x)),F=D.floor();y.value.state={...y.value.state,progress:o.sub(D,F)};const R=F.div(he.value).floor();R.gt(0)&&Lt.forEach(H=>{Ie(H,o.times(new o(qt[H].computedModifier.value).toNumber(),R).times(wn.value)),l[H]=.3});const G=o.sub(F,R).toNumber();for(let H=0;H0){let R=o.add(D,x);const G=o.div(D,b.value).floor();R=o.sub(R,o.times(G,b.value)),P.value.state={...P.value.state,progress:R},o.gt(G,0)&&F.forEach(H=>{Ie(H,G),c[H]=.3})}}e.value=o.add(e.value,o.times(Ot.value,x)),o.lt(e.value,0)&&(e.value=0,K.forEach(D=>{var F;((F=D.value)==null?void 0:F.state).powered=!1}),Object.values(a.value).forEach(D=>{D.state.powered=!1}),y.value.state={...y.value.state,powered:!1},hr.warning(p("div",null,[p("h3",null,[$("Ran out of energy!")]),p("div",null,[$("All machines have been turned off.")])])))});const it=N(()=>{var x,D;return v.selectedAction.value===v.types.brokenFactory.actions[0]?-100:v.selectedAction.value===v.types.factory.actions[1]?o.neg(Ve[v.selectedNode.value.state].cost):((x=v.selectedAction.value)==null?void 0:x.id)==="moreConnections"?o.neg(v.selectedAction.value.formula.evaluate(((D=v.selectedNode.value)==null?void 0:D.state).maxConnections)):0}),Bt=un(g.variable(0).add(e),()=>o.neq(it.value,0),it),Zt=N(()=>{var x;return v.selectedAction.value===Ft?((x=v.selectedNode.value)==null?void 0:x.state).powered?o.eq(d.value,1)?10:o.pow(100,d.value).div(10).times(.99):o.neg(f.value):0}),$i=un(g.variable(0).add(Ot),()=>o.neq(Zt.value,0),Zt),Nn=N(()=>v.types.portal.nodes.value.filter(x=>Ce(x))),Cn=N(()=>Nn.value.sort((x,D)=>{var G,H;const F=(G=ge[x.state.id])!=null&&G.minimized.value?1:0,R=(H=ge[D.state.id])!=null&&H.minimized.value?1:0;return F-R}).map(x=>x.state.id));return vt(Cn,x=>{Ut(()=>{Q.tabs=["main",...x]})}),vt(yn,(x,D)=>{o.lt(x,D)&&(ln(x,I,"resources"),ln(x,P,"resources"),ln(x,S,"tools"),ln(x,B,"portals"),ln(x,le,"portals"),ln(x,ae,"portals"),ln(x,te,"portals"))}),{name:"World",board:v,energy:e,modifierTabs:ze,resourceNodes:t,toolNodes:n,influenceNodes:r,grantResource:Ie,activePortals:Nn,nextPowerCost:f,computedBonusConnectionsModifier:yn,quarryProgressRequired:b,dropRates:qt,dowsing:I,empowerer:S,booster:B,upgrader:le,automator:ae,investments:te,resourceLevels:u,planarMultis:U,computedPortalCost:Si,helpModals:Mt,display:Y(()=>p(re,null,[p(gi,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[ot(Bt)])," ",$("energy")]),p("span",{class:"nav-segment"},[$("("),p("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(Ot.value,0)?"+":"",ot($i)]),$("/s)")]),o.gt(d.value,0)?p("span",{class:"nav-segment"},[p("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[dt(d.value)])," ",$("machines powered")]):null,p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>Et.value=!0},[$("modifiers")])]),Q.devSpeed===0?p("span",{class:"nav-segment"},[$("Game Paused")]):Q.devSpeed!=null&&Q.devSpeed!==1?p("span",{class:"nav-segment"},[$("Dev Speed: "),xe(Q.devSpeed),$("x")]):null]}),ot(v),ot(Vt),Object.values(Mt).map(({modal:x})=>x())]))}}),vp=e=>{var n,i,r,a,u;const t=[m];return(u=(a=(r=(i=(n=e.layers)==null?void 0:n.main)==null?void 0:i.board)==null?void 0:r.state)==null?void 0:a.nodes)==null||u.filter(l=>(l==null?void 0:l.type)==="portal").map(l=>{var c,d;return(d=(c=l==null?void 0:l.state)==null?void 0:c.id)!=null?d:""}).forEach(l=>{var d,h,f,b;const c=(d=e.layers)==null?void 0:d[l];t.push(Jr(l,(h=c.tier)!=null?h:"dirt",(f=c.seed)!=null?f:Math.floor(Math.random()*4294967296),(b=c.influences)!=null?b:[]))}),t},er=z(!1);function hp(e,t){}var bp=Object.freeze(Object.defineProperty({__proto__:null,main:m,getInitialLayers:vp,hasWon:er,fixOldSave:hp},Symbol.toStringTag,{value:"Module"}));const ei=e=>(gn("data-v-4a50ce42"),e=e(),mn(),e),yp={class:"game-over-modal-header"},wp=["src","alt"],_p={class:"game-over-modal-title"},Np=ei(()=>C("h2",null,"Congratulations!",-1)),Cp={key:0},kp=ei(()=>C("br",null,null,-1)),Mp=ei(()=>C("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),Sp=ei(()=>C("br",null,null,-1)),Ip=["href"],xp=ei(()=>C("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),$p=J({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:u}=we,l=N(()=>bi(Q.timePlayed)),c=N(()=>er.value&&!Q.keepGoing),d=tn(Q,"autosave");function h(){Q.keepGoing=!0}function f(){cn(xn())}return(b,v)=>(M(),ne(Rt,{"model-value":s(c)},{header:Z(()=>[C("div",yp,[s(n)?(M(),A("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,wp)):j("",!0),C("div",_p,[Np,C("h4",null,"You've beaten "+de(s(t))+" v"+de(s(a))+": "+de(s(u)),1)])])]),body:Z(({shown:y})=>[y?(M(),A("div",Cp,[C("div",null,"It took you "+de(s(l))+" to beat the game.",1),kp,Mp,Sp,C("div",null,[C("a",{href:s(r),class:"game-over-modal-discord-link"},[xp,$(" "+de(s(i)),1)],8,Ip)]),p(jt,{title:"Autosave",modelValue:s(d),"onUpdate:modelValue":v[0]||(v[0]=_=>Fe(d)?d.value=_:null)},null,8,["modelValue"])])):j("",!0)]),footer:Z(()=>[C("div",{class:"game-over-footer"},[C("button",{onClick:h,class:"button"},"Keep Going"),C("button",{onClick:f,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Ep=ve($p,[["__scopeId","data-v-4a50ce42"]]);const ki=e=>(gn("data-v-2776d67d"),e=e(),mn(),e),Dp=ki(()=>C("div",{class:"nan-modal-header"},[C("h2",null,"NaN value detected!")],-1)),Pp={key:0},Tp=ki(()=>C("br",null,null,-1)),Ap=["href"],Rp=ki(()=>C("span",{class:"material-icons nan-modal-discord"},"discord",-1)),Fp=ki(()=>C("br",null,null,-1)),Op={class:"nan-footer"},qp=J({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=we,i=z(!0),r=z(!0),a=tn(We,"hasNaN"),u=z(null);vt(a,b=>{b?(i.value=Q.autosave,r.value=Q.devSpeed===0):(Q.autosave=i.value,Q.devSpeed=r.value?0:null)});const l=N(()=>{var b;return(b=We.NaNPath)==null?void 0:b.join(".")}),c=N(()=>We.NaNPersistent!=null?We.NaNPersistent.value:null);function d(){We.NaNPersistent!=null&&(We.NaNPersistent.value=new o(0),We.hasNaN=!1)}function h(){We.NaNPersistent&&(We.NaNPersistent.value=new o(1),We.hasNaN=!1)}function f(){We.NaNPersistent&&(We.NaNPersistent.value=new o(NaN),We.hasNaN=!1)}return(b,v)=>(M(),A(re,null,[p(Rt,Wt({modelValue:s(a),"onUpdate:modelValue":v[4]||(v[4]=y=>Fe(a)?a.value=y:null)},b.$attrs),{header:Z(()=>[Dp]),body:Z(()=>[C("div",null,[$(' Attempted to assign "'+de(s(l))+'" to NaN',1),s(c)?(M(),A("span",Pp,de(" ")+"(previously "+de(s(xe)(s(c)))+")",1)):j("",!0),$(". Auto-saving has been "+de(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Tp,C("div",null,[C("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Rp,$(" "+de(s(t)||"The Paper Pilot Community"),1)],8,Ap)]),Fp,p(jt,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":v[0]||(v[0]=y=>i.value=y)},null,8,["modelValue"]),s(we).enablePausing?(M(),ne(jt,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":v[1]||(v[1]=y=>r.value=y)},null,8,["modelValue"])):j("",!0)]),footer:Z(()=>[C("div",Op,[C("button",{onClick:v[2]||(v[2]=y=>{var _;return(_=u.value)==null?void 0:_.open()}),class:"button"},"Open Saves Manager"),C("button",{onClick:d,class:"button"},"Set to 0"),C("button",{onClick:h,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(M(),A("button",{key:0,onClick:v[3]||(v[3]=y=>a.value=!1),class:"button"}," Set to previous ")):j("",!0),C("button",{onClick:f,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),p(Vr,{ref_key:"savesManager",ref:u},null,512)],64))}});var Vp=ve(qp,[["__scopeId","data-v-2776d67d"]]);const Bp={key:0,class:"tpsDisplay"},Lp=J({__name:"TPS",setup(e){const t=N(()=>o.div(We.lastTenTicks.length,We.lastTenTicks.reduce((n,i)=>n+i,0)));return(n,i)=>s(t).isNan()?j("",!0):(M(),A("div",Bp,"TPS: "+de(s(dt)(s(t))),1))}});var jp=ve(Lp,[["__scopeId","data-v-89b89152"]]);var zp=J({__name:"App",setup(e){const t=we.useHeader,n=N(()=>Nt[ce.theme].variables),i=tn(ce,"showTPS"),r=N(()=>pe(Y(()=>p(re,null,[ys.map(ot)]))));return(a,u)=>(M(),A(re,null,[C("div",{id:"modal-root",style:Be(s(n))},null,4),C("div",{class:Ne(["app",{useHeader:s(t)}]),style:Be(s(n))},[s(t)?(M(),ne(Br,{key:0})):j("",!0),p(uc),s(s(i))?(M(),ne(jp,{key:1})):j("",!0),p(Ep),p(Vp),(M(),ne(Ke(s(r))))],6)],64))}});var Gp=ve(zp,[["__scopeId","data-v-41d15e5e"]]);function Up(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e;let l,c,d,h;const f=async(v=!0)=>{await d,v&&(l==null||l.addEventListener("controlling",y=>{y.isUpdate&&window.location.reload()})),await(h==null?void 0:h())};async function b(){if("serviceWorker"in navigator){const{Workbox:v,messageSW:y}=await Gn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await y(c.waiting,{type:"SKIP_WAITING"})},l=new v("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",_=>{_.isUpdate||i==null||i()});{const _=()=>{n==null||n()};l.addEventListener("waiting",_),l.addEventListener("externalwaiting",_)}l.register({immediate:t}).then(_=>{c=_,a?a("./sw.js",_):r==null||r(_)}).catch(_=>{u==null||u(_)})}}return d=b(),f}function Wp(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:u}=e,l=z(!1),c=z(!1);return{updateServiceWorker:Up({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:u}),offlineReady:c,needRefresh:l}}document.title=we.title;window.projInfo=we;if(we.id==="")throw new Error("Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json");requestAnimationFrame(async()=>{console.log(`%cMade in Profectus%c +Learn more at www.moddingtree.com`,"font-weight: bold; font-size: 24px; color: #A3BE8C; background: #2E3440; padding: 4px 8px; border-radius: 8px;","padding: 4px;"),await fs();const{globalBus:e}=await Gn(()=>Promise.resolve().then(function(){return ds}),void 0),{startGameLoop:t}=await Gn(()=>import("./gameLoop.708e7c33.js"),["assets/gameLoop.708e7c33.js","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/nanoevents.1080beb7.js","assets/lz-string.dccec454.js","assets/vue-next-select.ded54c4a.js","assets/vue-next-select.9e6f4164.css","assets/vuedraggable.1879de79.js","assets/sortablejs.a0f68e5e.js","assets/vue-textarea-autosize.35804eaf.js","assets/vue-panzoom.8ce6f9b1.js","assets/panzoom.30c56ba6.js","assets/wheel.f2ae740f.js","assets/ngraph.events.083734c6.js","assets/vue-toastification.9c2dad53.js","assets/vue-toastification.4b5f8ac8.css"]),n=window.vue=ua(Gp);e.emit("setupVue",n),n.mount("#app"),Ut(()=>{const i=hi(),{updateServiceWorker:r}=Wp({onNeedRefresh(){i.info("New content available, click here to update.",{timeout:!1,closeOnClick:!1,draggable:!1,icon:{iconClass:"material-icons",iconChildren:"refresh",iconTag:"i"},rtl:!1,onClick(){r()}})},onOfflineReady(){i.info("App ready to work offline")},onRegisterError:console.warn,onRegistered(a){a&&setInterval(()=>a.update(),60*60*1e3)}})}),t()});export{o as D,Gn as _,We as a,we as b,bp as c,Qe as g,gs as l,Q as p,ce as s}; diff --git a/index.html b/index.html index 7a8314e..0246513 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ Profectus - + diff --git a/sw.js b/sw.js index feedc6b..520174a 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const o=e=>i(e,r),u={module:{uri:r},exports:a,require:o};s[r]=Promise.all(n.map((e=>u[e]||o(e)))).then((e=>(l(...e),a)))}}define(["./workbox-7369c0e1"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@vue.6b211d3c.js",revision:null},{url:"assets/amator.1e5a40c8.js",revision:null},{url:"assets/bezier-easing.a990b400.js",revision:null},{url:"assets/gameLoop.b6c8f87a.js",revision:null},{url:"assets/index.6cff6927.css",revision:null},{url:"assets/index.8dbb25be.js",revision:null},{url:"assets/lz-string.dccec454.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/ngraph.events.083734c6.js",revision:null},{url:"assets/panzoom.30c56ba6.js",revision:null},{url:"assets/sortablejs.a0f68e5e.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.ded54c4a.js",revision:null},{url:"assets/vue-panzoom.8ce6f9b1.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.9c2dad53.js",revision:null},{url:"assets/vue.c16a309b.js",revision:null},{url:"assets/vuedraggable.1879de79.js",revision:null},{url:"assets/wheel.f2ae740f.js",revision:null},{url:"assets/workbox-window.4a8794bb.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"79d039f3d7967ad1e968adedcaad0432"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"e1e419fec40e2d042566c11fe4bce322"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const a=e=>i(e,r),u={module:{uri:r},exports:o,require:a};s[r]=Promise.all(n.map((e=>u[e]||a(e)))).then((e=>(l(...e),o)))}}define(["./workbox-7369c0e1"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@vue.6b211d3c.js",revision:null},{url:"assets/amator.1e5a40c8.js",revision:null},{url:"assets/bezier-easing.a990b400.js",revision:null},{url:"assets/gameLoop.708e7c33.js",revision:null},{url:"assets/index.15c6e2b7.js",revision:null},{url:"assets/index.6cff6927.css",revision:null},{url:"assets/lz-string.dccec454.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/ngraph.events.083734c6.js",revision:null},{url:"assets/panzoom.30c56ba6.js",revision:null},{url:"assets/sortablejs.a0f68e5e.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.ded54c4a.js",revision:null},{url:"assets/vue-panzoom.8ce6f9b1.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.9c2dad53.js",revision:null},{url:"assets/vue.c16a309b.js",revision:null},{url:"assets/vuedraggable.1879de79.js",revision:null},{url:"assets/wheel.f2ae740f.js",revision:null},{url:"assets/workbox-window.4a8794bb.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"0791393d55efe74c1c4f98953a855fd1"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"e1e419fec40e2d042566c11fe4bce322"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));