mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-26 10:06:17 +00:00
18 lines
215 KiB
JavaScript
18 lines
215 KiB
JavaScript
/* empty css */import"./vue.c16a309b.js";import{_ as C,C as s,l as De,q as mn,t as B,b2 as pt,ab as J,aF as M,a1 as P,a2 as _,aL as Pt,G as pe,aD as _r,w as gt,b3 as _t,a9 as p,O as ne,ap as pa,az as pi,as as jt,aH as ni,A as $e,$ as ee,b7 as W,b9 as Ri,ar as zt,bv as xn,a8 as $,bt as ga,bc as $n,T as ma,u as qi,j as va,bw as Tt,aM as Ct,a0 as L,aO as We,J as ae,I as Re,aI as hn,aG as bn,z as nn,bo as ha,bs as ba,aK as En,bd as sr,am as si,H as ya,bx as wa,bf as _a}from"./@vue.6b211d3c.js";import{c as Nr}from"./nanoevents.1080beb7.js";import{L as Qt}from"./lz-string.dccec454.js";import{Y as Na}from"./vue-next-select.ded54c4a.js";import{D as Ca}from"./vuedraggable.1879de79.js";import{p as ka}from"./vue-textarea-autosize.35804eaf.js";import{P as Ma}from"./vue-panzoom.8ce6f9b1.js";import{s as Sa,u as gi}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 Ia=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 l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).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)}};Ia();const xa="modulepreload",or={},$a="./",zn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(i=>{if(i=`${$a}${i}`,i in or)return;or[i]=!0;const r=i.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${a}`))return;const l=document.createElement("link");if(l.rel=r?"stylesheet":xa,r||(l.as="script",l.crossOrigin=""),l.href=i,document.head.appendChild(l),r)return new Promise((u,c)=>{l.addEventListener("load",u),l.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())},Ea="./projInfo-schema.json",Pa="Planar Pioneers",Ta="A game about controlling and exploiting planes!",Da="planar-pioneers",Aa="thepaperpilot",Fa="",Oa="",Ra="0.0",qa="Initial Commit",Va=!1,Ba=!1,La=2,ja=!0,za=null,Ua="",Ga=["main"],Wa=3600,Ha=0,Za=!0,Ya="base64";var fe={$schema:Ea,title:Pa,description:Ta,id:Da,author:Aa,discordName:Fa,discordLink:Oa,versionNumber:Ra,versionTitle:qa,allowGoBack:Va,defaultShowSmall:Ba,defaultDecimalsShown:La,useHeader:ja,banner:za,logo:Ua,initialTabs:Ga,maxTickLength:Wa,offlineLimit:Ha,enablePausing:Za,exportEncoding:Ya};class Xa{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 Ja(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 Ja{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Ii=17,Ka=9e15,Qa=Math.log10(9e15),es=1/9e15,ts=308,ns=-324,lr=5,is=(1<<10)-1,rs=function(){const e=[];for(let n=ns+1;n<=ts;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),on=[2,Math.E,3,4,5,6,7,8,9,10],as=[[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]],ss=[[-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)},te=function(t,n,i){return o.fromComponents_noNormalize(t,n,i)};const Jt=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)))},xi=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},os=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},Cr=.5671432904097838,ur=function(e,t=1e-10){let n,i;if(!Number.isFinite(e)||e===0)return e;if(e===1)return Cr;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)<t*Math.abs(i))return i;n=i}throw Error(`Iteration failed to converge: ${e.toString()}`)};function cr(e,t=1e-10){let n,i,r,a;if(!Number.isFinite(e.mag)||e.eq(o.dZero))return e;if(e.eq(o.dOne))return o.fromNumber(Cr);n=o.ln(e);for(let l=0;l<100;++l){if(i=n.neg().exp(),r=n.sub(e.mul(i)),a=n.sub(r.div(n.add(1).sub(n.add(2).mul(r).div(o.mul(2,n).add(2))))),o.abs(a.sub(n)).lt(o.abs(a).mul(t)))return a;n=a}throw Error(`Iteration failed to converge: ${e.toString()}`)}const y=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof y?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"&&this.fromString(e)}get m(){if(this.sign===0)return 0;if(this.layer===0){const e=Math.floor(Math.log10(this.mag));let t;return this.mag===5e-324?t=5:t=this.mag/rs(e),this.sign*t}else if(this.layer===1){const e=this.mag-Math.floor(this.mag);return this.sign*Math.pow(10,e)}else return this.sign}set m(e){this.layer<=2?this.fromMantissaExponent(e,this.e):(this.sign=Math.sign(e),this.sign===0&&(this.layer=0,this.exponent=0))}get e(){return this.sign===0?0:this.layer===0?Math.floor(Math.log10(this.mag)):this.layer===1?Math.floor(this.mag):this.layer===2?Math.floor(Math.sign(this.mag)*Math.pow(10,Math.abs(this.mag))):this.mag*Number.POSITIVE_INFINITY}set e(e){this.fromMantissaExponent(this.m,e)}get s(){return this.sign}set s(e){e===0?(this.sign=0,this.layer=0,this.mag=0):this.sign=e}get mantissa(){return this.m}set mantissa(e){this.m=e}get exponent(){return this.e}set exponent(e){this.e=e}static fromComponents(e,t,n){return new y().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new y().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new y().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new y().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new y().fromDecimal(e)}static fromNumber(e){return new y().fromNumber(e)}static fromString(e){return new y().fromString(e)}static fromValue(e){return new y().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof y)return e;if(typeof e=="string"){const t=y.fromStringCache.get(e);return t!==void 0?t:y.fromString(e)}else return typeof e=="number"?y.fromNumber(e):y.dZero}static abs(e){return k(e).abs()}static neg(e){return k(e).neg()}static negate(e){return k(e).neg()}static negated(e){return k(e).neg()}static sign(e){return k(e).sign}static sgn(e){return k(e).sign}static round(e){return k(e).round()}static floor(e){return k(e).floor()}static ceil(e){return k(e).ceil()}static trunc(e){return k(e).trunc()}static add(e,t){return k(e).add(t)}static plus(e,t){return k(e).add(t)}static sub(e,t){return k(e).sub(t)}static subtract(e,t){return k(e).sub(t)}static minus(e,t){return k(e).sub(t)}static mul(e,t){return k(e).mul(t)}static multiply(e,t){return k(e).mul(t)}static times(e,t){return k(e).mul(t)}static div(e,t){return k(e).div(t)}static divide(e,t){return k(e).div(t)}static recip(e){return k(e).recip()}static reciprocal(e){return k(e).recip()}static reciprocate(e){return k(e).reciprocate()}static cmp(e,t){return k(e).cmp(t)}static cmpabs(e,t){return k(e).cmpabs(t)}static compare(e,t){return k(e).cmp(t)}static isNaN(e){return e=k(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=k(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return k(e).eq(t)}static equals(e,t){return k(e).eq(t)}static neq(e,t){return k(e).neq(t)}static notEquals(e,t){return k(e).notEquals(t)}static lt(e,t){return k(e).lt(t)}static lte(e,t){return k(e).lte(t)}static gt(e,t){return k(e).gt(t)}static gte(e,t){return k(e).gte(t)}static max(e,t){return k(e).max(t)}static min(e,t){return k(e).min(t)}static minabs(e,t){return k(e).minabs(t)}static maxabs(e,t){return k(e).maxabs(t)}static clamp(e,t,n){return k(e).clamp(t,n)}static clampMin(e,t){return k(e).clampMin(t)}static clampMax(e,t){return k(e).clampMax(t)}static cmp_tolerance(e,t,n){return k(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return k(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return k(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return k(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return k(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return k(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return k(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return k(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return k(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return k(e).gte_tolerance(t,n)}static pLog10(e){return k(e).pLog10()}static absLog10(e){return k(e).absLog10()}static log10(e){return k(e).log10()}static log(e,t){return k(e).log(t)}static log2(e){return k(e).log2()}static ln(e){return k(e).ln()}static logarithm(e,t){return k(e).logarithm(t)}static pow(e,t){return k(e).pow(t)}static pow10(e){return k(e).pow10()}static pow_base(e,t){return k(e).pow_base(t)}static root(e,t){return k(e).root(t)}static factorial(e,t){return k(e).factorial()}static gamma(e,t){return k(e).gamma()}static lngamma(e,t){return k(e).lngamma()}static exp(e){return k(e).exp()}static sqr(e){return k(e).sqr()}static sqrt(e){return k(e).sqrt()}static cube(e){return k(e).cube()}static cbrt(e){return k(e).cbrt()}static tetrate(e,t=2,n=te(1,0,1)){return k(e).tetrate(t,n)}static iteratedexp(e,t=2,n=te(1,0,1)){return k(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return k(e).iteratedlog(t,n)}static layeradd10(e,t){return k(e).layeradd10(t)}static layeradd(e,t,n=10){return k(e).layeradd(t,n)}static slog(e,t=10){return k(e).slog(t)}static lambertw(e){return k(e).lambertw()}static ssqrt(e){return k(e).ssqrt()}static pentate(e,t=2,n=te(1,0,1)){return k(e).pentate(t,n)}static sin(e){return k(e).sin()}static cos(e){return k(e).cos()}static tan(e){return k(e).tan()}static asin(e){return k(e).asin()}static acos(e){return k(e).acos()}static atan(e){return k(e).atan()}static sinh(e){return k(e).sinh()}static cosh(e){return k(e).cosh()}static tanh(e){return k(e).tanh()}static asinh(e){return k(e).asinh()}static acosh(e){return k(e).acosh()}static atanh(e){return k(e).atanh()}static affordGeometricSeries(e,t,n,i){return this.affordGeometricSeries_core(k(e),k(t),k(n),i)}static sumGeometricSeries(e,t,n,i){return this.sumGeometricSeries_core(e,k(t),k(n),i)}static affordArithmeticSeries(e,t,n,i){return this.affordArithmeticSeries_core(k(e),k(t),k(n),k(i))}static sumArithmeticSeries(e,t,n,i){return this.sumArithmeticSeries_core(k(e),k(t),k(n),k(i))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(k(e),k(t),k(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return te(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return te(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 y.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(y.sub(1,n.pow(e))).div(y.sub(1,n))}static affordArithmeticSeries_core(e,t,n,i){const a=t.add(i.mul(n)).sub(n.div(2)),l=a.pow(2);return a.neg().add(l.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<es)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=Ka)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<Qa&&this.layer>0;)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=y.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const i=e.split("^^^");if(i.length===2){const b=parseFloat(i[0]),h=parseFloat(i[1]),I=i[1].split(";");let F=1;if(I.length===2&&(F=parseFloat(I[1]),isFinite(F)||(F=1)),isFinite(b)&&isFinite(h)){const S=y.pentate(b,h,F);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const r=e.split("^^");if(r.length===2){const b=parseFloat(r[0]),h=parseFloat(r[1]),I=r[1].split(";");let F=1;if(I.length===2&&(F=parseFloat(I[1]),isFinite(F)||(F=1)),isFinite(b)&&isFinite(h)){const S=y.tetrate(b,h,F);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const b=parseFloat(a[0]),h=parseFloat(a[1]);if(isFinite(b)&&isFinite(h)){const I=y.pow(b,h);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}e=e.trim().toLowerCase();let l,u,c=e.split("pt");if(c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let b=parseFloat(c[1]);if(isFinite(b)||(b=1),isFinite(l)&&isFinite(u)){const h=y.tetrate(l,u,b);return this.sign=h.sign,this.layer=h.layer,this.mag=h.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(c=e.split("p"),c.length===2){l=10,u=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let b=parseFloat(c[1]);if(isFinite(b)||(b=1),isFinite(l)&&isFinite(u)){const h=y.tetrate(l,u,b);return this.sign=h.sign,this.layer=h.layer,this.mag=h.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}const d=e.split("e"),m=d.length-1;if(m===0){const b=parseFloat(e);if(isFinite(b))return this.fromNumber(b),y.fromStringCache.size>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else if(m===1){const b=parseFloat(e);if(isFinite(b)&&b!==0)return this.fromNumber(b),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}const f=e.split("e^");if(f.length===2){this.sign=1,f[0].charAt(0)=="-"&&(this.sign=-1);let b="";for(let h=0;h<f[1].length;++h){const I=f[1].charCodeAt(h);if(I>=43&&I<=57||I===101)b+=f[1].charAt(h);else return this.layer=parseFloat(b),this.mag=parseFloat(f[1].substr(h+1)),this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}}if(m<1)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;const v=parseFloat(d[0]);if(v===0)return this.sign=0,this.layer=0,this.mag=0,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this;let w=parseFloat(d[d.length-1]);if(m>=2){const b=parseFloat(d[d.length-2]);isFinite(b)&&(w*=Math.sign(b),w+=xi(b))}if(!isFinite(v))this.sign=d[0]==="-"?-1:1,this.layer=m,this.mag=w;else if(m===1)this.sign=Math.sign(v),this.layer=1,this.mag=w+Math.log10(Math.abs(v));else if(this.sign=Math.sign(v),this.layer=m,m===2){const b=y.mul(X(1,2,w),k(v));return this.sign=b.sign,this.layer=b.layer,this.mag=b.mag,y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}else this.mag=w;return this.normalize(),y.fromStringCache.maxSize>=1&&y.fromStringCache.set(t,y.fromDecimal(this)),this}fromValue(e){return e instanceof y?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:Jt(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Jt(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<=lr?(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):Jt(this.m,e)+"e"+Jt(this.e,e):this.layer===1?Jt(this.m,e)+"e"+Jt(this.e,e):this.layer<=lr?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Jt(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Jt(this.mag,e)}abs(){return te(this.sign===0?0:1,this.layer,this.mag)}neg(){return te(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?y.dZero:this.layer===0?X(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?y.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 te(0,0,0);let n,i;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(y.cmpabs(this,t)>0?(n=this,i=t):(n=t,i=this),n.layer===0&&i.layer===0)return y.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))>Ii)return n;{const l=Math.pow(10,Math.log10(n.mag)-i.mag),u=i.sign+n.sign*l;return X(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}if(r===1&&a===0){if(Math.abs(n.mag-Math.log10(i.mag))>Ii)return n;{const l=Math.pow(10,n.mag-Math.log10(i.mag)),u=i.sign+n.sign*l;return X(Math.sign(u),1,Math.log10(i.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-i.mag)>Ii)return n;{const l=Math.pow(10,n.mag-i.mag),u=i.sign+n.sign*l;return X(Math.sign(u),1,i.mag+Math.log10(Math.abs(u)))}}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 te(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return te(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 y.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?y.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.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=k(e),n=this.mag>0?this.layer:-this.layer,i=t.mag>0?t.layer:-t.layer;return n>i?1:n<i?-1:this.mag>t.mag?1:this.mag<t.mag?-1:0}compare(e){return this.cmp(e)}isNan(){return isNaN(this.sign)||isNaN(this.layer)||isNaN(this.mag)}isFinite(){return isFinite(this.sign)&&isFinite(this.layer)&&isFinite(this.mag)}eq(e){const t=k(e);return this.sign===t.sign&&this.layer===t.layer&&this.mag===t.mag}equals(e){return this.eq(e)}neq(e){return!this.eq(e)}notEquals(e){return this.neq(e)}lt(e){return this.cmp(e)===-1}lte(e){return!this.gt(e)}gt(e){return this.cmp(e)===1}gte(e){return!this.lt(e)}max(e){const t=k(e);return this.lt(t)?t:this}min(e){const t=k(e);return this.gt(t)?t:this}maxabs(e){const t=k(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=k(e);return this.cmpabs(t)>0?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=xi(r)),this.layer<n.layer&&(i=xi(i)),Math.abs(i-r)<=t*Math.max(Math.abs(i),Math.abs(r))}equals_tolerance(e,t){return this.eq_tolerance(e,t)}neq_tolerance(e,t){return!this.eq_tolerance(e,t)}notEquals_tolerance(e,t){return this.neq_tolerance(e,t)}lt_tolerance(e,t){const n=k(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=k(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=k(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(y.dZero)?y.dZero:this.log10()}absLog10(){return this.sign===0?y.dNaN:this.layer>0?X(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):X(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?y.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?y.dNaN:this.layer===0&&e.layer===0?X(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):y.div(this.log10(),e.log10())}log2(){return this.sign<=0?y.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?y.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)?te(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(i.sign===0)return te(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:y.dNaN:r}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return y.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 y.dOne;e=te(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):y.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?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(te(1,0,24)))return y.fromNumber(os(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,l=t+a;if(l===t||(t=l,i=i*n,r=360*i,a=1/r,l=t-a,l===t))return y.exp(t);t=l,i=i*n,r=1260*i;let u=1/r;return t=t+u,i=i*n,r=1680*i,u=1/r,t=t-u,y.exp(t)}else return this.layer===1?y.exp(y.mul(this,y.ln(this).sub(1))):y.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?y.dOne:this.layer===0&&this.mag<=709.7?y.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 y.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return X(1,2,Math.log10(this.mag)-.3010299956639812);{const e=y.div(te(this.sign,this.layer-1,this.mag),te(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=te(1,0,1)){if(e===1)return y.pow(this,t);if(e===0)return new y(t);if(this.eq(y.dOne))return y.dOne;if(this.eq(-1))return y.pow(this,t);if(e===Number.POSITIVE_INFINITY){const r=this.toNumber();if(r<=1.444667861009766&&r>=.06598803584531254){if(r>1.444667861009099)return y.fromNumber(Math.E);const a=y.ln(this).neg();return a.lambertw().div(a)}else return r>1.444667861009766?y.fromNumber(Number.POSITIVE_INFINITY):y.dNaN}if(this.eq(y.dZero)){let r=Math.abs((e+1)%2);return r>1&&(r=2-r),y.fromNumber(r)}if(e<0)return y.iteratedlog(t,this,-e);t=k(t);const n=e;e=Math.trunc(e);const i=n-e;if(this.gt(y.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let r=0;r<e;++r){const a=t;if(t=this.pow(t),a.eq(t))return t}if(i!=0){const r=this.pow(t);return t.mul(1-i).add(r.mul(i))}return t}i!==0&&(t.eq(y.dOne)?this.gt(10)?t=this.pow(i):(t=y.fromNumber(y.tetrate_critical(this.toNumber(),i)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return te(t.sign,t.layer+(e-r-1),t.mag);if(r>1e4)return t}return t}iteratedexp(e=2,t=te(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return y.tetrate(e,-t,this);e=k(e);let n=y.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;a<t;++a){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(a>1e4)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 l=1;l<t;++l){const c=new y(e).tetrate(a).gt(this);if(l>1&&r!=c&&(i=!0),r=c,i?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return y.fromNumber(a)}slog_internal(e=10){if(e=k(e),e.lte(y.dZero)||e.eq(y.dOne))return y.dNaN;if(e.lt(y.dOne))return this.eq(y.dOne)?y.dZero:this.eq(y.dZero)?y.dNegOne:y.dNaN;if(this.mag<0||this.eq(y.dZero))return y.dNegOne;let t=0,n=y.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(y.dZero))n=y.pow(e,n),t-=1;else{if(n.lte(y.dOne))return y.fromNumber(t+y.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=y.log(n,e)}return y.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:y.critical_section(e,t,ss)}static tetrate_critical(e,t){return y.critical_section(e,t,as)}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 l=0;l<on.length;++l)if(on[l]==e){i=n[l][Math.floor(t)],r=n[l][Math.ceil(t)];break}else if(on[l]<e&&on[l+1]>e){const u=(e-on[l])/(on[l+1]-on[l]);i=n[l][Math.floor(t)]*(1-u)+n[l+1][Math.floor(t)]*u,r=n[l][Math.ceil(t)]*(1-u)+n[l+1][Math.ceil(t)]*u;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=y.fromValue_noAlloc(e).toNumber();const t=y.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?y.tetrate(t,i):Number.isFinite(i)?i>=-1?y.log(y.tetrate(t,i+1),t):y.log(y.log(y.tetrate(t,i+2),t),t):y.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return y.fromNumber(ur(this.toNumber()));if(this.layer===0)return y.fromNumber(ur(this.sign*this.mag));if(this.layer===1)return cr(this);if(this.layer===2)return cr(this);if(this.layer>=3)return te(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return te(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=te(1,0,1)){t=k(t);const n=e;e=Math.trunc(e);const i=n-e;i!==0&&(t.eq(y.dOne)?(++e,t=y.fromNumber(i)):this.eq(10)?t=t.layeradd10(i):t=t.layeradd(i,this));for(let r=0;r<e;++r){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(r>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.sin(this.sign*this.mag)):te(0,0,0)}cos(){return this.mag<0?y.dOne:this.layer===0?y.fromNumber(Math.cos(this.sign*this.mag)):te(0,0,0)}tan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.tan(this.sign*this.mag)):te(0,0,0)}asin(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.asin(this.sign*this.mag)):te(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?y.fromNumber(Math.acos(this.toNumber())):this.layer===0?y.fromNumber(Math.acos(this.sign*this.mag)):te(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?y.fromNumber(Math.atan(this.sign*this.mag)):y.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 y.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return y.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?te(Number.NaN,Number.NaN,Number.NaN):y.ln(this.add(1).div(y.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(y.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=y;o.fromStringCache=new Xa(is);o.dZero=te(0,0,0);o.dOne=te(1,0,1);o.dNegOne=te(-1,0,1);o.dTwo=te(1,0,2);o.dTen=te(1,0,10);o.dNaN=te(Number.NaN,Number.NaN,Number.NaN);o.dInf=te(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=te(-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;te=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const ls=new o(1);function qn(e,t,n=!0){let i=o.log10(e).floor(),r=o.div(e,o.pow(10,i));r.toStringWithDecimalPlaces(t)==="10"&&(r=ls,i=i.add(1));const a=i.gte(1e9)?mt(i,Math.max(Math.max(t,3),fe.defaultDecimalsShown)):i.gte(1e4)?oi(i,0):i.toStringWithDecimalPlaces(0);return n?r.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function oi(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 kr(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()),fe.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const us=new o("eeee1000"),cs=new o("e100000"),dr=new o("e1000"),Mr=new o(1e9),ds=new o(1e6),fs=new o(1e3),ps=new o(.98),gs=new o(.001),Sr=new o(0);function mt(e,t,n){if(t==null&&(t=fe.defaultDecimalsShown),n=n!=null?n:fe.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+mt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(us)){const i=e.slog();return i.gte(ds)?"F"+mt(i.floor()):o.pow(10,i.sub(i.floor())).toStringWithDecimalPlaces(3)+"F"+oi(i.floor(),0)}else{if(e.gte(cs))return qn(e,0,!1);if(e.gte(dr))return qn(e,0);if(e.gte(Mr))return qn(e,t);if(e.gte(fs))return oi(e,0);if(e.gte(gs)||!n)return kr(e,t);if(e.eq(Sr))return 0 .toFixed(t)}return e=xr(e),e.lt(dr)?qn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):mt(e,t)+"\u207B\xB9"}function Je(e){return e=new o(e),e.sign<0?"-"+Je(e.neg()):e.gte(Mr)||e.lte(ps)&&!e.eq(Sr)?mt(e):mt(e,0)}function Ir(e){return o.lt(e,0)?"-"+Ir(o.neg(e)):o.gt(e,2**51)?mt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?mt(e)+"s":e<3600?Je(Math.floor(e/60))+"m "+mt(e%60)+"s":e<86400?Je(Math.floor(e/3600))+"h "+Je(Math.floor(e/60)%60)+"m "+Je(e%60)+"s":e<31536e3?Je(Math.floor(e/84600)%365)+"d "+Je(Math.floor(e/3600)%24)+"h "+Je(Math.floor(e/60)%60)+"m":Je(Math.floor(e/31536e3))+"y "+Je(Math.floor(e/84600)%365)+"d "+Je(Math.floor(e/3600)%24)+"h")}function ms(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 vs(e,t){return mt(e,t,!0)}function xr(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 hs=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:qn,commaFormat:oi,regularFormat:kr,format:mt,formatWhole:Je,formatTime:Ir,toPlaces:ms,formatSmall:vs,invertOOM:xr},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:bs,commaFormat:ys,regularFormat:ws,format:me,formatWhole:vt,formatTime:mi,toPlaces:_s,formatSmall:en,invertOOM:Ns}=hs;window.Decimal=o;window.exponentialFormat=bs;window.commaFormat=ys;window.regularFormat=ws;window.format=me;window.formatWhole=vt;window.formatTime=mi;window.toPlaces=_s;window.formatSmall=en;window.invertOOM=Ns;function tt(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 G=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(G||{});const Gn=Symbol("DoNotCache");function x(e,t){const n=e[t];Un(n)&&n.length===0&&!n[Gn]?e[t]=C(n.bind(e)):Un(n)&&(e[t]=n.bind(e),e[t][Gn]=!0)}function ve(e){return Un(e)&&!e[Gn]&&(e=C(e)),e}const ht=Symbol("Component"),ot=Symbol("GatherProps");let Cs=0;function an(e="feature-"){return e+Cs++}var ye=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(ye||{});function Le(e){const t=s(e);return t!==2&&t!==!1}function yn(e){return s(e)===1}function K(e){return e[Gn]=!0,e}function ie(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Wn(e,...t){const n=[],i=r=>{Object.keys(r).forEach(a=>{const l=r[a];l!=null&&typeof l=="object"&&(t.includes(l.type)?n.push(l):!(l instanceof o)&&!De(l)&&i(l))})};return i(e),n}const ln={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 Vi=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Vi||{}),wt={classic:ln,paper:{...ln,variables:{...ln.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:{...ln,variables:{...ln.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:{...ln,variables:{...ln.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const He=Nr();"fonts"in document&&(document.fonts.onloadingdone=()=>He.emit("fontsLoaded"));var ks=Object.freeze(Object.defineProperty({__proto__:null,globalBus:He},Symbol.toStringTag,{value:"Module"}));const Ms=mn({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Q=window.player=Ms;function $r(e){return JSON.stringify(e,(t,n)=>s(n))}function Er(e={}){return Object.assign({id:`${fe.id}-0`,name:"Default Save",tabs:fe.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:fe.id,modVersion:fe.versionNumber,layers:{}},e)}function dt(e){const t=Qt.compressToUTF16($r(e!=null?e:Q));return localStorage.setItem((e!=null?e:Q).id,t),t}async function Ss(){$s();try{let e=localStorage.getItem(re.active);if(e==null){await dn(In());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Qt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==fe.id){await dn(In());return}t.id=re.active,await dn(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
|
|
`,e),await dn(In())}}function In(){const e=ai(),t=Er({id:e});return dt(t),re.saves.push(e),t}function ai(){let e,t=0;do e=`${fe.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const Is=B(!1);async function dn(e){console.info("Loading save",e),Is.value=!0;const{layers:t,removeLayer:n,addLayer:i}=await zn(()=>Promise.resolve().then(function(){return Js}),void 0),{fixOldSave:r,getInitialLayers:a}=await zn(()=>Promise.resolve().then(function(){return wf}),void 0);for(const l in t){const u=t[l];u&&n(u)}a(e).forEach(l=>i(l,e)),e=Er(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,fe.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==fe.versionNumber&&(r(e.modVersion,e),e.modVersion=fe.versionNumber),Object.assign(Q,e),re.active=Q.id,He.emit("onLoad")}setInterval(()=>{Q.autosave&&dt()},1e3);window.onbeforeunload=()=>{Q.autosave&&dt()};window.save=dt;const xs=window.hardReset=async()=>{await dn(In())};window.deleteLowerSaves=()=>{const e=Object.values(re.saves).indexOf(Q.id)+1;Object.values(re.saves).slice(e).forEach(t=>localStorage.removeItem(t)),re.saves=re.saves.slice(0,e)};const Hn=mn({active:"",saves:[],showTPS:!0,theme:Vi.Nordic,unthrottled:!1,alignUnits:!1});pt(Hn,e=>{const t=Qt.compressToUTF16(JSON.stringify(e));localStorage.setItem(fe.id,t)},{deep:!0});var re=window.settings=Hn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Vi.Nordic,alignUnits:!1};He.emit("loadSettings",e),Object.assign(Hn,e),xs()};function $s(){try{let e=localStorage.getItem(fe.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Qt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Hn,t)}He.emit("loadSettings",Hn)}catch{}}const Pr=mn([]);function Es(e){Pr.push(e)}const Ps=mn([]),Ts=mn([]),Ds={class:"table"},As=J({__name:"Column",setup(e){const t=C(()=>wt[re.theme].mergeAdjacent);return(n,i)=>(M(),P("div",Ds,[_("div",{class:pe(["col",{mergeAdjacent:s(t)}])},[Pt(n.$slots,"default")],2)]))}}),Fs={class:"table"},Os=J({__name:"Row",setup(e){const t=C(()=>wt[re.theme].mergeAdjacent);return(n,i)=>(M(),P("div",Fs,[_("div",{class:pe(["row",{mergeAdjacent:s(t)}])},[Pt(n.$slots,"default")],2)]))}});function Tr(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!pa(e)}function se(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}</${t}>`),J({template:e})):J({render:()=>({})}):e}function nt(e){if(St(e))return typeof e=="function"?e():se(e);const t=e[ht];return p(t,e[ot](),null)}function $i(...e){let t;return p(Os,null,Tr(t=e.map(nt))?t:{default:()=>[t]})}function Rs(...e){let t;return p(As,null,Tr(t=e.map(nt))?t:{default:()=>[t]})}function Nt(e){if(St(e))return typeof e=="function"?e():typeof e=="string"?p(ne,null,[e]):p(e,null,null);const t=e[ht];return p(t,e[ot](),null)}function fr(e,t){return e.reduce((n,i)=>p(ne,null,[n,t,i]))}function St(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Gn]===!0}function Dr(e,t){const n=B(null),i=B(void 0);function r(u){n.value||(n.value=setInterval(l,250)),i.value=u}function a(){n.value&&(clearInterval(n.value),n.value=null)}function l(){t&&t.value?t.value():e&&e.value&&e.value(i.value)}return _r(a),{start:r,stop:a,handleHolding:l}}function Ar(e,t="div"){const n=gt();return _t(()=>{n.value=se(Me(e),t)}),n}function Pn(e,t="div"){const n=gt(null);return _t(()=>{const i=Me(e);n.value=i==""||i==null?null:se(i,t)}),n}function Me(e){return s(s(e))}function R(...e){return e.includes(Object)||e.push(Object),e}function pr(e){const t=B(!1),n=e[ot].bind(e);return e[ot]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}var ue=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};const qs=J({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var m;const n=B({}),i=new ResizeObserver(u),r=B(null);pi(()=>{const f=r.value;f!=null&&i.observe(f)});let a=!0,l=B((m=r.value)==null?void 0:m.getBoundingClientRect());function u(){a&&(a=!1,jt(()=>{var f;l.value=(f=r.value)==null?void 0:f.getBoundingClientRect(),Object.values(n.value).filter(v=>v).forEach(v=>v.rect=v.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}He.on("fontsLoaded",u);const c={attributes:!1,childList:!0,subtree:!1};ni(Bi,(f,v)=>{const w=new MutationObserver(()=>d(f));w.observe(v,c),n.value[f]={element:v,observer:w,rect:v.getBoundingClientRect()},u()}),ni(Li,f=>{var v;(v=n.value[f])==null||v.observer.disconnect(),n.value[f]=void 0,u()}),ni(ji,n),ni(zi,l);function d(f){const v=n.value[f];v!=null&&(v.rect=v.element.getBoundingClientRect(),t("updateNodes",n.value))}return(f,v)=>(M(),P(ne,null,[Pt(f.$slots,"default",{},void 0,!0),_("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Fr=ue(qs,[["__scopeId","data-v-2b1dc1bc"]]);const Vs=["onPointerdown"],Bs={class:"modal-wrapper"},Ls={class:"modal-container"},js={class:"modal-header"},zs={class:"modal-body"},Us={class:"modal-footer"},Gs=_("div",{class:"modal-default-flex-grow"},null,-1),Ut=J({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const r=$e(e),a=C(()=>s(r.modelValue)||u.value);function l(){n("update:modelValue",!1)}const u=B(!1),c=B(null),d=C(()=>{var m,f;return(f=(m=c.value)==null?void 0:m.nodes)!=null?f:null});return t({isOpen:a,nodes:d}),(m,f)=>(M(),ee(ma,{to:"#modal-root"},[p($n,{name:"modal",onBeforeEnter:f[0]||(f[0]=v=>u.value=!0),onAfterLeave:f[1]||(f[1]=v=>u.value=!1)},{default:W(()=>[Ri(_("div",zt({class:"modal-mask",onPointerdown:xn(l,["self"])},m.$attrs),[_("div",Bs,[_("div",Ls,[_("div",js,[Pt(m.$slots,"header",{shown:s(a)},()=>[$(" default header ")])]),_("div",zs,[p(Fr,{ref_key:"contextRef",ref:c},{default:W(()=>[Pt(m.$slots,"body",{shown:s(a)},()=>[$(" default body ")])]),_:3},512)]),_("div",Us,[Pt(m.$slots,"footer",{shown:s(a)},()=>[_("div",{class:"modal-default-footer"},[Gs,_("button",{class:"button modal-default-button",onClick:l}," Close ")])])])])])],16,Vs),[[ga,e.modelValue]])]),_:3})]))}}),Kt=Symbol("ProxyState");function Ze(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,l){if(l===Kt)return r();const u=r()[l];return u!=null&&typeof u=="object"&&Et in u?u[Et]:u},set(a,l,u){return r()[l]=u,!0},has(a,l){return l===Kt?!0:Reflect.has(r(),l)},ownKeys(){return Reflect.ownKeys(r())},getOwnPropertyDescriptor(a,l){return i||(Object.assign(n,e.call(n,n)),i=!0),Object.getOwnPropertyDescriptor(a,l)}})}var Be=window.state=qi({lastTenTicks:[],hasNaN:!1,NaNPath:[]});const tn=Symbol("PersistentState"),rn=Symbol("DefaultValue"),li=Symbol("StackTrace"),ui=Symbol("Deleted"),Et=Symbol("NonPersistent"),fn=Symbol("SaveDataPath"),Oi=Symbol("SkipPersistence");function Ws(){var e,t;return(t=(e=new Error().stack)==null?void 0:e.split(`
|
|
`).slice(3,5).map(n=>n.trim()).join(`
|
|
`))!=null?t:""}function gr(e,t){var n;if(o.isNaN(t))throw Be.hasNaN||(Q.autosave=!1,Be.hasNaN=!0,Be.NaNPath=e[fn],Be.NaNPersistent=e),console.error("Attempted to save NaN value to",(n=e[fn])==null?void 0:n.join("."),e),new Error("Attempted to set NaN value. See above for details");e[tn].value=t}function ft(e,t=!0){const n=De(e)?e:B(e);De(e)&&(e=e.value);const i=C({get(){return n.value},set(a){t?gr(r,a):r[tn].value=a}});i[rn]=e;const r={get value(){return n.value},set value(a){t?gr(r,a):r[tn].value=a},__v_isRef:!0,[tn]:n,[rn]:e,[li]:Ws(),[ui]:!1,[Et]:i,[fn]:void 0};return st.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",r,`
|
|
Created at:
|
|
`+r[li]):gn[st[st.length-1]].add(r),r}function Hs(e){return e!=null&&typeof e=="object"&&tn in e}function Nn(e){return!(Kt in e)&&Et in e?e[Et]:new Proxy(e,{get(t,n){if(n!==tn)return n===Oi?!0:t[n]},set(t,n,i){return t[n]=i,!0},has(t,n){return n===tn?!1:n==Oi?!0:Reflect.has(t,n)}})}function Or(e){st.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):gn[st[st.length-1]].delete(e),e[ui]=!0}He.on("addLayer",(e,t)=>{const n=[],i=(r,a=[])=>{let l=!1;return Object.keys(r).forEach(u=>{let c=r[u];if(c!=null&&typeof c=="object"){if(c[Oi]===!0)return;if(Kt in c&&(c=c[Kt]),Hs(c)){if(l=!0,c[ui]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
|
|
Created at:
|
|
`+c[li]);return}gn[e.id].delete(c);const d=[e.id,...a,u];c[fn]!=null&&JSON.stringify(d)!==JSON.stringify(c[fn])&&console.error(`Persistent ref is being saved to \`${d.join(".")}\` when it's already present at \`${c[fn].join(".")}\`. This can cause unexpected behavior when loading saves between updates.`,c),c[fn]=d;const m=a.reduce((v,w)=>(w in v||(v[w]={}),v[w]),t),f=m[u];m[u]=c[tn],va(m)?f!=null?m[u]=f:m[u]=c[rn]:f!=null?m[u].value=f:m[u].value=c[rn]}else!(c instanceof o)&&!De(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),i(c,[...a,u])&&(Tt(c)&&!Tt(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.",Kt in r?r[Kt]:r,u):l=!0))}}),l};i(e[Kt]),gn[e.id].forEach(r=>{r[ui]||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[li])}),gn[e.id].clear()});const Bi=Symbol("RegisterNode"),Li=Symbol("UnregisterNode"),ji=Symbol("Nodes"),zi=Symbol("Bounds"),be=qi({});window.layers=be;const gn={},st=[];function Ui(e,t){return Ze(()=>{const n={},i=n.emitter=Nr();if(n.on=i.on.bind(i),n.emit=i.emit.bind(i),n.nodes=B({}),n.id=e,st.push(e),gn[e]=new Set,n.minimized=ft(!1,!1),Object.assign(n,t.call(n,n)),st[st.length-1]==null||st[st.length-1]!==e)throw`Adding layers stack in invalid state. This should not happen
|
|
Stack: ${st}
|
|
Trying to pop ${n.id}`;st.pop(),x(n,"color"),x(n,"display"),x(n,"classes"),x(n,"style"),x(n,"name"),ie(n,"name",n.id),x(n,"minWidth"),ie(n,"minWidth",600),x(n,"minimizable"),ie(n,"minimizable",!0),x(n,"minimizedDisplay");const r=n.style;return n.style=C(()=>{var l,u;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(l=s(r))!=null?l:"",(u=n.minimized)!=null&&u.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Gi(e,t){if(console.info("Adding layer",e.id),be[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,be[e.id]);return}ie(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),be[e.id]=e,He.emit("addLayer",e,t.layers[e.id])}function Zs(e){return be[e]}function Rr(e){console.info("Removing layer",e.id),He.emit("removeLayer",e),be[e.id]=void 0}function Ys(e){Rr(e),Gi(e,Q)}function Xs(e){const t=B(!1);return{openModal:()=>t.value=!0,modal:K(()=>p(Ut,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>p("h2",null,[s(e.name)]),body:s(e.display)}))}}He.on("update",function(t){Object.values(be).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(be).forEach(n=>{n==null||n.emit("update",t)}),Object.values(be).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Js=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Bi,UnregisterNodeInjectionKey:Li,NodesInjectionKey:ji,BoundsInjectionKey:zi,layers:be,persistentRefs:gn,addingLayers:st,createLayer:Ui,addLayer:Gi,getLayer:Zs,removeLayer:Rr,reloadLayer:Ys,setupLayerModal:Xs},Symbol.toStringTag,{value:"Module"}));const Ks=J({components:{Context:Fr},props:{index:{type:Number,required:!0},display:{type:R(Object,String,Function),required:!0},minimizedDisplay:R(Object,String,Function),minimized:{type:Object,required:!0},name:{type:R(String),required:!0},color:R(String),minimizable:R(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:i,minimizedDisplay:r}=$e(e),a=Ar(t),l=Pn(r),u=C(()=>fe.allowGoBack&&n.value>0&&!Me(i));function c(){Q.tabs.splice(s(e.index),1/0)}function d(m){e.nodes.value=m}return{component:a,minimizedComponent:l,showGoBack:u,updateNodes:d,unref:s,goBack:c}}}),Qs={key:1};function eo(e,t,n,i,r,a){const l=Ct("Context");return M(),P("div",{class:"layer-container",style:Re({"--layer-color":e.unref(e.color)})},[e.showGoBack?(M(),P("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...u)=>e.goBack&&e.goBack(...u))},"\u274C")):L("",!0),e.unref(e.minimized)?(M(),P("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=u=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(M(),ee(We(e.minimizedComponent),{key:0})):(M(),P("div",Qs,ae(e.unref(e.name)),1))])):(M(),P("div",{key:2,class:pe(["layer-tab",{showGoBack:e.showGoBack}])},[p(l,{onUpdateNodes:e.updateNodes},{default:W(()=>[(M(),ee(We(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(M(),P("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=u=>e.$emit("setMinimized",!0))}," \u25BC ")):L("",!0)],4)}var to=ue(Ks,[["render",eo],["__scopeId","data-v-72dd78b1"]]);const qr=e=>(hn("data-v-4b4bda40"),e=e(),bn(),e),no=qr(()=>_("h2",null,"Changelog",-1)),io=qr(()=>_("details",{open:""},[_("summary",null,[$("v0.0 Initial Commit - "),_("time",null,"2021-09-04")]),$(" This is the first release :D "),_("ul",null,[_("li",{class:"feature"},"Did everything"),_("li",{class:"fix"},"Had some fun"),_("li",{class:"breaking"},"Removed everything"),_("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),ro=J({__name:"Changelog",setup(e,{expose:t}){const n=B(!1);return t({open(){n.value=!0}}),(i,r)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a)},{header:W(()=>[no]),body:W(()=>[io]),_:1},8,["modelValue"]))}});var ao=ue(ro,[["__scopeId","data-v-4b4bda40"]]),so=J({props:{element:Object,display:{type:R(Object,String,Function),required:!0},style:R(Object,String,Array),classes:R(Object),direction:R(String),xoffset:R(String),yoffset:R(String),pinned:Object},setup(e){const{element:t,display:n,pinned:i}=$e(e),r=B(!1),a=C(()=>(Me(i)||r.value)&&l.value),l=Pn(n),u=gt(se(K(()=>{const m=Me(t);return m==null?"":Nt(m)})));function c(m){const f=i;m.shiftKey&&f&&(f.value=!f.value,m.stopPropagation(),m.preventDefault())}const d=C(()=>Me(i)&&wt[re.theme].showPin);return{Direction:G,isHovered:r,isShown:a,comp:l,elementComp:u,unref:s,togglePinned:c,showPin:d}}});const oo={key:0,class:"material-icons pinned"};function lo(e,t,n,i,r,a){return M(),P("div",{class:pe(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=l=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=l=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...l)=>e.togglePinned&&e.togglePinned(...l))},[Pt(e.$slots,"default",{},void 0,!0),e.elementComp?(M(),ee(We(e.elementComp),{key:0})):L("",!0),p($n,{name:"fade"},{default:W(()=>{var l;return[e.isShown?(M(),P("div",{key:0,class:pe(["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:Re([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(l=e.unref(e.style))!=null?l:{}])},[e.showPin?(M(),P("span",oo,"push_pin")):L("",!0),e.comp?(M(),ee(We(e.comp),{key:1})):L("",!0)],6)):L("",!0)]}),_:1})],34)}var Pe=ue(so,[["render",lo],["__scopeId","data-v-6102fa3a"]]);const wn=e=>(hn("data-v-4f97aa40"),e=e(),bn(),e),uo={class:"info-modal-header"},co=["src","alt"],fo={class:"info-modal-title"},po={key:0},go={key:0},mo={key:0},vo=wn(()=>_("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),ho=wn(()=>_("br",null,null,-1)),bo=wn(()=>_("br",null,null,-1)),yo=["href"],wo=wn(()=>_("span",{class:"material-icons info-modal-discord"},"discord",-1)),_o=wn(()=>_("div",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[_("span",{class:"material-icons info-modal-discord"},"discord"),$(" The Paper Pilot Community ")])],-1)),No=wn(()=>_("div",null,[_("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[_("span",{class:"material-icons info-modal-discord"},"discord"),$(" The Modding Tree ")])],-1)),Co=wn(()=>_("br",null,null,-1));var ko=J({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:i,logo:r,author:a,discordName:l,discordLink:u,versionNumber:c,versionTitle:d}=fe,m=$e(n),f=B(!1),v=C(()=>mi(Q.timePlayed)),w=C(()=>se(K(()=>p(ne,null,[Ps.map(nt)]))));t({open(){f.value=!0}});function b(){var h;(h=s(m.changelog))==null||h.open()}return(h,I)=>(M(),ee(Ut,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=F=>f.value=F)},{header:W(()=>[_("div",uo,[s(r)?(M(),P("img",{key:0,class:"info-modal-logo",src:s(r),alt:s(i)},null,8,co)):L("",!0),_("div",fo,[_("h2",null,ae(s(i)),1),_("h4",null,[$(" v"+ae(s(c)),1),s(d)?(M(),P("span",po,": "+ae(s(d)),1)):L("",!0)])])])]),body:W(({shown:F})=>[F?(M(),P("div",go,[s(a)?(M(),P("div",mo,"By "+ae(s(a)),1)):L("",!0),vo,ho,_("div",{class:"link",onClick:b},"Changelog"),bo,_("div",null,[s(u)?(M(),P("a",{key:0,href:s(u),class:"info-modal-discord-link",target:"_blank"},[wo,$(" "+ae(s(l)),1)],8,yo)):L("",!0)]),_o,No,Co,_("div",null,"Time Played: "+ae(s(v)),1),(M(),ee(We(s(w))))])):L("",!0)]),_:1},8,["modelValue"]))}});var Mo=ue(ko,[["__scopeId","data-v-4f97aa40"]]);const So={class:"field"},Io={key:0,class:"field-title"},Wi=J({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var l;const n=e,i=Pn(nn(n,"title"),"span"),r=B((l=n.options.find(u=>u.value===n.modelValue))!=null?l:null);pt(nn(n,"modelValue"),u=>{var c;Me(r)!==u&&(r.value=(c=n.options.find(d=>d.value===u))!=null?c:null)});function a(u){t("update:modelValue",u.value)}return(u,c)=>(M(),P("div",So,[s(i)?(M(),P("span",Io,[(M(),ee(We(s(i))))])):L("",!0),p(s(Na),{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 xo={class:"field"},$o=J({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=C(()=>{var a;return se((a=s(n.title))!=null?a:"<span></span>","span")}),r=C({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,l)=>(M(),P("label",xo,[Ri(_("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":l[0]||(l[0]=u=>De(r)?r.value=u:null)},null,512),[[ha,s(r)]]),(M(),ee(We(s(i))))]))}});var Bt=ue($o,[["__scopeId","data-v-11046116"]]);const Eo=["onClick"],Po=J({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=B(!1),i=B(null);function r(){t("click"),i.value&&clearTimeout(i.value),n.value=!1,jt(()=>{n.value=!0,i.value=setTimeout(()=>n.value=!1,500)})}return(a,l)=>(M(),P("button",{onClick:xn(r,["stop"]),class:pe(["feedback",{activated:n.value,left:e.left}])},[Pt(a.$slots,"default",{},void 0,!0)],10,Eo))}});var Vr=ue(Po,[["__scopeId","data-v-01a1b95c"]]);const To={class:"header"},Do=_("h2",null,"Settings",-1),Ao={class:"option-tabs"},Fo={key:0},Oo={key:1};var Ro=J({__name:"Options",setup(e,{expose:t}){const n=B(!1),i=B("behaviour");function r(H){return H==i.value}function a(H){i.value=H}t({isTab:r,setTab:a,save:dt,open(){n.value=!0}});const l=Object.keys(wt).map(H=>({label:tt(H),value:H})),u=C(()=>se(K(()=>p(ne,null,[Pr.map(nt)])))),{showTPS:c,theme:d,unthrottled:m,alignUnits:f}=$e(re),{autosave:v,offlineProd:w}=$e(Q),b=C({get(){return Q.devSpeed===0},set(H){Q.devSpeed=H?0:null}}),h=K(()=>p("span",{class:"option-title"},[$("Unthrottled"),p("desc",null,[$("Allow the game to run as fast as possible. Not battery friendly.")])])),I=K(()=>p("span",{class:"option-title"},[$("Offline Production"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[$("*")]}),p("desc",null,[$("Simulate production that occurs while the game is closed.")])])),F=K(()=>p("span",{class:"option-title"},[$("Autosave"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[$("*")]}),p("desc",null,[$("Automatically save the game every second or when the game is closed.")])])),S=K(()=>p("span",{class:"option-title"},[$("Pause game"),p(Pe,{display:"Save-specific",direction:G.Right},{default:()=>[$("*")]}),p("desc",null,[$("Stop everything from moving.")])])),E=K(()=>p("span",{class:"option-title"},[$("Theme"),p("desc",null,[$("How the game looks.")])])),V=K(()=>p("span",{class:"option-title"},[$("Show TPS"),p("desc",null,[$("Show TPS meter at the bottom-left corner of the page.")])])),ce=K(()=>p("span",{class:"option-title"},[$("Align modifier units"),p("desc",null,[$("Align numbers to the beginning of the unit in modifier view.")])]));return(H,z)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":z[10]||(z[10]=U=>n.value=U)},{header:W(()=>[_("div",To,[Do,_("div",Ao,[_("button",{class:pe({selected:r("behaviour")}),onClick:z[0]||(z[0]=U=>a("behaviour"))},"Behaviour",2),_("button",{class:pe({selected:r("appearance")}),onClick:z[1]||(z[1]=U=>a("appearance"))},"Appearance",2)])])]),body:W(()=>[r("behaviour")?(M(),P("div",Fo,[p(Bt,{title:s(h),modelValue:s(m),"onUpdate:modelValue":z[2]||(z[2]=U=>De(m)?m.value=U:null)},null,8,["title","modelValue"]),s(fe).enablePausing?(M(),ee(Bt,{key:0,title:s(S),modelValue:s(b),"onUpdate:modelValue":z[3]||(z[3]=U=>De(b)?b.value=U:null)},null,8,["title","modelValue"])):L("",!0),p(Bt,{title:s(I),modelValue:s(w),"onUpdate:modelValue":z[4]||(z[4]=U=>De(w)?w.value=U:null)},null,8,["title","modelValue"]),p(Bt,{title:s(F),modelValue:s(v),"onUpdate:modelValue":z[5]||(z[5]=U=>De(v)?v.value=U:null)},null,8,["title","modelValue"]),s(v)?L("",!0):(M(),ee(Vr,{key:1,class:"button save-button",onClick:z[6]||(z[6]=U=>s(dt)())},{default:W(()=>[$("Manually save")]),_:1}))])):L("",!0),r("appearance")?(M(),P("div",Oo,[p(Wi,{title:s(E),options:s(l),modelValue:s(d),"onUpdate:modelValue":z[7]||(z[7]=U=>De(d)?d.value=U:null)},null,8,["title","options","modelValue"]),(M(),ee(We(s(u)))),p(Bt,{title:s(V),modelValue:s(c),"onUpdate:modelValue":z[8]||(z[8]=U=>De(c)?c.value=U:null)},null,8,["title","modelValue"]),p(Bt,{title:s(ce),modelValue:s(f),"onUpdate:modelValue":z[9]||(z[9]=U=>De(f)?f.value=U:null)},null,8,["title","modelValue"])])):L("",!0)]),_:1},8,["modelValue"]))}});const qo=["onSubmit"],Vo={class:"field"},Bo={key:0,class:"field-title"},Lo=["placeholder"],jo=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(nn(n,"title"),"span"),r=gt(null);pi(()=>{var c;(c=r.value)==null||c.focus()});const a=C({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function l(){t("submit")}function u(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,d)=>(M(),P("form",{onSubmit:xn(l,["prevent"])},[_("div",Vo,[s(i)?(M(),P("span",Bo,[(M(),ee(We(s(i))))])):L("",!0),e.textArea?(M(),ee(s(ka),{key:1,modelValue:s(a),"onUpdate:modelValue":d[0]||(d[0]=m=>De(a)?a.value=m:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:r},null,8,["modelValue","placeholder","maxHeight"])):Ri((M(),P("input",{key:2,type:"text","onUpdate:modelValue":d[1]||(d[1]=m=>De(a)?a.value=m:null),placeholder:e.placeholder,class:pe({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:r},null,42,Lo)),[[ba,s(a)]])])],40,qo))}});var Br=ue(jo,[["__scopeId","data-v-90bd4994"]]);const zo={key:0},Uo=["onClick","disabled"],Go={key:0},Wo=["onClick"],Ho=J({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const i=$e(e),r=B(!1);pt(r,u=>{t("confirmingChanged",u)});function a(){if(s(i.skipConfirm)){t("click");return}r.value&&t("click"),r.value=!r.value}function l(){r.value=!1}return(u,c)=>(M(),P("span",{class:pe(["container",{confirming:r.value}])},[r.value?(M(),P("span",zo,"Are you sure?")):L("",!0),_("button",{onClick:xn(a,["stop"]),class:"button danger",disabled:e.disabled},[r.value?(M(),P("span",Go,"Yes")):Pt(u.$slots,"default",{key:1},void 0,!0)],8,Uo),r.value?(M(),P("button",{key:1,class:"button",onClick:xn(l,["stop"])},"No",8,Wo)):L("",!0)],2))}});var Zo=ue(Ho,[["__scopeId","data-v-2f8ef34c"]]);const Gt=e=>(hn("data-v-32313015"),e=e(),bn(),e),Yo=Gt(()=>_("div",{class:"handle material-icons"},"drag_handle",-1)),Xo={key:0,class:"actions"},Jo=Gt(()=>_("span",{class:"material-icons"},"content_paste",-1)),Ko=Gt(()=>_("span",{class:"material-icons"},"content_copy",-1)),Qo=Gt(()=>_("span",{class:"material-icons"},"edit",-1)),el=Gt(()=>_("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),tl={key:1,class:"actions"},nl=Gt(()=>_("span",{class:"material-icons"},"check",-1)),il=Gt(()=>_("span",{class:"material-icons"},"close",-1)),rl={key:2,class:"details"},al={class:"save-version"},sl=Gt(()=>_("br",null,null,-1)),ol={key:0},ll={key:3,class:"details"},ul={key:4,class:"details error"},cl=Gt(()=>_("br",null,null,-1)),dl=J({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:i}=$e(n),r=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=B(!1),l=B(!1),u=B("");pt(a,()=>{var f;return u.value=(f=i.value.name)!=null?f:""});const c=C(()=>i.value!=null&&i.value.id===Q.id),d=C(()=>{var f;return c.value?Q.time:(f=i.value!=null&&i.value.time)!=null?f:0});function m(){t("editName",u.value),a.value=!1}return(f,v)=>(M(),P("div",{class:pe(["save",{active:s(c)}])},[Yo,a.value?(M(),P("div",tl,[_("button",{onClick:m,class:"button"},[p(Pe,{display:"Save",direction:s(G).Left,class:"info"},{default:W(()=>[nl]),_:1},8,["direction"])]),_("button",{onClick:v[5]||(v[5]=w=>a.value=!a.value),class:"button"},[p(Pe,{display:"Cancel",direction:s(G).Left,class:"info"},{default:W(()=>[il]),_:1},8,["direction"])])])):(M(),P("div",Xo,[s(i).error==null&&!l.value?(M(),ee(Vr,{key:0,onClick:v[0]||(v[0]=w=>t("export")),class:"button",left:""},{default:W(()=>[p(Pe,{display:"Export",direction:s(G).Left,class:"info"},{default:W(()=>[Jo]),_:1},8,["direction"])]),_:1})):L("",!0),s(i).error==null&&!l.value?(M(),P("button",{key:1,onClick:v[1]||(v[1]=w=>t("duplicate")),class:"button"},[p(Pe,{display:"Duplicate",direction:s(G).Left,class:"info"},{default:W(()=>[Ko]),_:1},8,["direction"])])):L("",!0),s(i).error==null&&!l.value?(M(),P("button",{key:2,onClick:v[2]||(v[2]=w=>a.value=!a.value),class:"button"},[p(Pe,{display:"Edit Name",direction:s(G).Left,class:"info"},{default:W(()=>[Qo]),_:1},8,["direction"])])):L("",!0),p(Zo,{disabled:s(c),onClick:v[3]||(v[3]=w=>t("delete")),onConfirmingChanged:v[4]||(v[4]=w=>l.value=w)},{default:W(()=>[p(Pe,{display:"Delete",direction:s(G).Left,class:"info"},{default:W(()=>[el]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(i).error==null&&!a.value?(M(),P("div",rl,[_("button",{class:"button open",onClick:v[6]||(v[6]=w=>t("open"))},[_("h3",null,ae(s(i).name),1)]),_("span",al,"v"+ae(s(i).modVersion),1),sl,s(d)?(M(),P("div",ol,"Last played "+ae(s(r).format(s(d))),1)):L("",!0)])):s(i).error==null&&a.value?(M(),P("div",ll,[p(Br,{modelValue:u.value,"onUpdate:modelValue":v[7]||(v[7]=w=>u.value=w),class:"editname",onSubmit:m},null,8,["modelValue"])])):(M(),P("div",ul,[$(" Error: Failed to load save with id "+ae(s(i).id),1),cl,$(ae(s(i).error),1)]))],2))}});var fl=ue(dl,[["__scopeId","data-v-32313015"]]);const Hi=e=>(hn("data-v-2a4275be"),e=e(),bn(),e),pl=Hi(()=>_("h2",null,"Saves Manager",-1)),gl={class:"modal-footer"},ml={class:"field"},vl=Hi(()=>_("span",{class:"field-title"},"Create Save",-1)),hl={class:"field-buttons"},bl={class:"footer"},yl=Hi(()=>_("div",{style:{"flex-grow":"1"}},null,-1)),wl=J({__name:"SavesManager",setup(e,{expose:t}){const n=B(!1),i=B(null);t({open(){n.value=!0}});const r=B(!1),a=B(""),l=B(null);pt(a,S=>{S?jt(()=>{try{if(S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Qt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S),r.value=!0;return}const E=JSON.parse(S);if(typeof E!="object"){r.value=!0;return}const V=ai();E.id=V,dt(E),a.value="",r.value=!1,re.saves.push(V)}catch{r.value=!0}}):r.value=!1});let u={},c=B(Object.keys(u).reduce((S,E)=>(S.push({label:E.split("/").slice(-1)[0].slice(0,-4),value:u[E]}),S),[]));const d=qi({});function m(S){if(d[S]==null){let E=localStorage.getItem(S);if(E==null)d[S]={error:"Save doesn't exist in localStorage",id:S};else if(E==="dW5kZWZpbmVk")d[S]={error:"Save is undefined",id:S};else try{if(E[0]!=="{")if(E[0]==="e")E=decodeURIComponent(escape(atob(E)));else if(E[0]==="\u1BE1")E=Qt.decompressFromUTF16(E);else return console.warn("Unable to determine preset encoding",E),r.value=!0,d[S]={error:"Unable to determine preset encoding",id:S},d[S];d[S]={...JSON.parse(E),id:S}}catch(V){d[S]={error:V,id:S},console.warn(`SavesManager: Failed to load info about save with id ${S}:
|
|
${V}
|
|
${E}`)}}return d[S]}pt(n,S=>{S&&Object.keys(d).forEach(E=>delete d[E])});const f=C(()=>re.saves.reduce((S,E)=>(S[E]=m(E),S),{}));function v(S){let E;switch(Q.id===S?E=$r(Q):E=JSON.stringify(f.value[S]),fe.exportEncoding){default:console.warn(`Unknown save encoding: ${fe.exportEncoding}. Defaulting to lz`);case"lz":E=Qt.compressToUTF16(E);break;case"base64":E=btoa(unescape(encodeURIComponent(E)));break;case"plain":break}const V=document.createElement("textarea");V.value=E,document.body.appendChild(V),V.select(),V.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(V)}function w(S){Q.id===S&&dt();const E={...f.value[S],id:ai()};dt(E),re.saves.push(E.id)}function b(S){re.saves=re.saves.filter(E=>E!==S),localStorage.removeItem(S),d[S]=void 0}function h(S){f.value[Q.id].time=Q.time,dt(),d[Q.id]=void 0,dn(f.value[S]),d[S]=void 0}function I(S){if(l.value=S,jt(()=>{l.value=null}),S[0]!=="{")if(S[0]==="e")S=decodeURIComponent(escape(atob(S)));else if(S[0]==="\u1BE1")S=Qt.decompressFromUTF16(S);else{console.warn("Unable to determine preset encoding",S);return}const E=JSON.parse(S);E.id=ai(),dt(E),re.saves.push(E.id),h(E.id)}function F(S,E){const V=f.value[S];V!=null&&(V.name=E,Q.id===S?(Q.name=E,dt()):(dt(V),d[S]=void 0))}return(S,E)=>(M(),ee(Ut,{modelValue:n.value,"onUpdate:modelValue":E[4]||(E[4]=V=>n.value=V),ref_key:"modal",ref:i},{header:W(()=>[pl]),body:W(({shown:V})=>[V?(M(),ee(s(Ca),{key:0,list:s(re).saves,handle:".handle",itemKey:ce=>ce},{item:W(({element:ce})=>[p(fl,{save:s(f)[ce],onOpen:H=>h(ce),onExport:H=>v(ce),onEditName:H=>F(ce,H),onDuplicate:H=>w(ce),onDelete:H=>b(ce)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):L("",!0)]),footer:W(()=>[_("div",gl,[p(Br,{modelValue:a.value,"onUpdate:modelValue":E[0]||(E[0]=V=>a.value=V),title:"Import Save",placeholder:"Paste your save here!",class:pe({importingFailed:r.value})},null,8,["modelValue","class"]),_("div",ml,[vl,_("div",hl,[_("button",{class:"button",onClick:E[1]||(E[1]=V=>h(s(In)().id))},"New Game"),Object.keys(s(c)).length>0?(M(),ee(Wi,{key:0,options:s(c),modelValue:l.value,"onUpdate:modelValue":E[2]||(E[2]=V=>I(V)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):L("",!0)])]),_("div",bl,[yl,_("button",{class:"button modal-default-button",onClick:E[3]||(E[3]=V=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Lr=ue(wl,[["__scopeId","data-v-2a4275be"]]);const bt=e=>(hn("data-v-318a1c31"),e=e(),bn(),e),_l=["src","alt"],Nl={key:1,class:"title"},Cl=bt(()=>_("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),kl={class:"discord"},Ml={class:"discord-links"},Sl={key:0},Il=["href"],xl=bt(()=>_("li",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),$l=bt(()=>_("li",null,[_("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),El={href:"https://forums.moddingtree.com/",target:"_blank"},Pl=bt(()=>_("span",{class:"material-icons"},"forum",-1)),Tl=bt(()=>_("span",{class:"material-icons"},"info",-1)),Dl=bt(()=>_("span",{class:"material-icons"},"library_books",-1)),Al=bt(()=>_("span",{class:"material-icons"},"settings",-1)),Fl=bt(()=>_("span",{class:"material-icons"},"library_books",-1)),Ol=bt(()=>_("span",{class:"material-icons"},"settings",-1)),Rl=bt(()=>_("span",{class:"material-icons"},"info",-1)),ql={href:"https://forums.moddingtree.com/",target:"_blank"},Vl=bt(()=>_("span",{class:"material-icons"},"forum",-1)),Bl={class:"discord"},Ll={class:"discord-links"},jl={key:0},zl=["href"],Ul=bt(()=>_("li",null,[_("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),Gl=bt(()=>_("li",null,[_("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Wl=J({__name:"Nav",setup(e){const t=B(null),n=B(null),i=B(null),r=B(null),{useHeader:a,banner:l,title:u,discordName:c,discordLink:d,versionNumber:m}=fe;function f(){window.open(d,"mywindow")}return(v,w)=>(M(),P(ne,null,[s(a)?(M(),P("div",zt({key:0,class:"nav"},v.$attrs),[s(l)?(M(),P("img",{key:0,src:s(l),class:"banner",alt:s(u)},null,8,_l)):(M(),P("div",Nl,ae(s(u)),1)),_("div",{onClick:w[0]||(w[0]=b=>{var h;return(h=r.value)==null?void 0:h.open()}),class:"version-container"},[p(Pe,{display:"Changelog",direction:s(G).Down,class:"version"},{default:W(()=>[_("span",null,"v"+ae(s(m)),1)]),_:1},8,["direction"])]),Cl,_("div",kl,[_("span",{onClick:f,class:"material-icons"},"discord"),_("ul",Ml,[s(d)?(M(),P("li",Sl,[_("a",{href:s(d),target:"_blank"},ae(s(c)),9,Il)])):L("",!0),xl,$l])]),_("div",null,[_("a",El,[p(Pe,{display:"Forums",direction:s(G).Down,yoffset:"5px"},{default:W(()=>[Pl]),_:1},8,["direction"])])]),_("div",{onClick:w[1]||(w[1]=b=>{var h;return(h=t.value)==null?void 0:h.open()})},[p(Pe,{display:"Info",direction:s(G).Down,class:"info"},{default:W(()=>[Tl]),_:1},8,["direction"])]),_("div",{onClick:w[2]||(w[2]=b=>{var h;return(h=n.value)==null?void 0:h.open()})},[p(Pe,{display:"Saves",direction:s(G).Down,xoffset:"-20px"},{default:W(()=>[Dl]),_:1},8,["direction"])]),_("div",{onClick:w[3]||(w[3]=b=>{var h;return(h=i.value)==null?void 0:h.open()})},[p(Pe,{display:"Settings",direction:s(G).Down,xoffset:"-66px"},{default:W(()=>[Al]),_:1},8,["direction"])])],16)):(M(),P("div",zt({key:1,class:"overlay-nav"},v.$attrs),[_("div",{onClick:w[4]||(w[4]=b=>{var h;return(h=r.value)==null?void 0:h.open()}),class:"version-container"},[p(Pe,{display:"Changelog",direction:s(G).Right,xoffset:"25%",class:"version"},{default:W(()=>[_("span",null,"v"+ae(s(m)),1)]),_:1},8,["direction"])]),_("div",{onClick:w[5]||(w[5]=b=>{var h;return(h=n.value)==null?void 0:h.open()})},[p(Pe,{display:"Saves",direction:s(G).Right},{default:W(()=>[Fl]),_:1},8,["direction"])]),_("div",{onClick:w[6]||(w[6]=b=>{var h;return(h=i.value)==null?void 0:h.open()})},[p(Pe,{display:"Settings",direction:s(G).Right},{default:W(()=>[Ol]),_:1},8,["direction"])]),_("div",{onClick:w[7]||(w[7]=b=>{var h;return(h=t.value)==null?void 0:h.open()})},[p(Pe,{display:"Info",direction:s(G).Right},{default:W(()=>[Rl]),_:1},8,["direction"])]),_("div",null,[_("a",ql,[p(Pe,{display:"Forums",direction:s(G).Right,xoffset:"7px"},{default:W(()=>[Vl]),_:1},8,["direction"])])]),_("div",Bl,[_("span",{onClick:f,class:"material-icons"},"discord"),_("ul",Ll,[s(d)?(M(),P("li",jl,[_("a",{href:s(d),target:"_blank"},ae(s(c)),9,zl)])):L("",!0),Ul,Gl])])],16)),p(Mo,{ref_key:"info",ref:t,changelog:r.value},null,8,["changelog"]),p(Lr,{ref_key:"savesManager",ref:n},null,512),p(Ro,{ref_key:"options",ref:i},null,512),p(ao,{ref_key:"changelog",ref:r},null,512)],64))}});var jr=ue(Wl,[["__scopeId","data-v-318a1c31"]]);const Hl={class:"inner-tab"},Zl=J({__name:"Game",setup(e){const t=nn(Q,"tabs"),n=C(()=>Object.keys(be)),i=fe.useHeader;function r(a){const{display:l,minimized:u,name:c,color:d,minimizable:m,nodes:f,minimizedDisplay:v}=a;return{display:l,minimized:u,name:c,color:d,minimizable:m,nodes:f,minimizedDisplay:v}}return(a,l)=>(M(),P("div",{class:pe(["tabs-container",{useHeader:s(i)}])},[(M(!0),P(ne,null,En(s(t),(u,c)=>{var d,m;return M(),P("div",{key:c,class:pe(["tab",s((d=s(be)[u])==null?void 0:d.classes)]),style:Re(s((m=s(be)[u])==null?void 0:m.style))},[c===0&&!s(i)?(M(),ee(jr,{key:0})):L("",!0),_("div",Hl,[s(n).includes(u)?(M(),ee(to,zt({key:0},r(s(be)[u]),{index:c,onSetMinimized:f=>s(be)[u].minimized.value=f}),null,16,["index","onSetMinimized"])):(M(),ee(We(u),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var Yl=ue(Zl,[["__scopeId","data-v-dcd207b4"]]);const Xl=J({__name:"Sticky",setup(e){const t=B("0"),n=new ResizeObserver(r),i=gt(null);function r(){let a=i.value;if(a==null)return;let l=0;for(;a.previousSibling;){const u=a.previousSibling;u.dataset&&"vSticky"in u.dataset&&(l+=u.offsetHeight),a=u}t.value=l+"px"}return jt(r),document.fonts.ready.then(r),pi(()=>{var l;const a=(l=i.value)==null?void 0:l.parentElement;a&&n.observe(a)}),(a,l)=>(M(),P("div",{class:"sticky",style:Re({top:t.value}),ref_key:"element",ref:i,"data-v-sticky":""},[Pt(a.$slots,"default",{},void 0,!0)],4))}});var ci=ue(Xl,[["__scopeId","data-v-cccac690"]]);const Jl=["x1","y1","x2","y2"],Kl=J({__name:"BoardLink",props:{link:null},setup(e){const n=$e(e),i=C(()=>{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=C(()=>{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,l)=>(M(),P("line",zt({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,Jl))}});var Ql=ue(Kl,[["__scopeId","data-v-57c4970a"]]);const eu={key:0},tu=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],nu=["fill","stroke-width","stroke"],iu=["fill"],ru=J({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const i=$e(e),r=C(()=>de(i.nodeType.value.size,s(i.node))),a=C(()=>{var m;return(m=de(i.nodeType.value.outlineColor,s(i.node)))!=null?m:wt[re.theme].variables["--outline"]}),l=C(()=>{var m;return(m=de(i.nodeType.value.titleColor,s(i.node)))!=null?m:wt[re.theme].variables["--foreground"]}),u=C(()=>de(i.nodeType.value.actionDistance,s(i.node)));function c(m,f){t("clickAction",f.id),m.preventDefault(),m.stopPropagation()}function d(m,f){var v;((v=s(i.selectedAction))==null?void 0:v.id)===f.id&&(m.preventDefault(),m.stopPropagation())}return(m,f)=>(M(),ee($n,{name:"actions",appear:""},{default:W(()=>[e.isSelected&&e.actions?(M(),P("g",eu,[(M(!0),P(ne,null,En(e.actions,(v,w)=>{var b,h;return M(),P("g",{key:v.id,class:pe(["action",{selected:((b=e.selectedAction)==null?void 0:b.id)===v.id}]),transform:`translate(
|
|
${(-s(r)-30)*Math.sin(((e.actions.length-1)/2-w)*s(u))},
|
|
${(s(r)+30)*Math.cos(((e.actions.length-1)/2-w)*s(u))}
|
|
)`,onMousedown:I=>c(I,v),onTouchstart:I=>c(I,v),onMouseup:I=>d(I,v),onTouchend:xn(I=>d(I,v),["stop"])},[_("circle",{fill:s(de)(v.fillColor,e.node),r:"20","stroke-width":((h=e.selectedAction)==null?void 0:h.id)===v.id?4:0,stroke:s(a)},null,8,nu),_("text",{fill:s(l),class:"material-icons"},ae(s(de)(v.icon,e.node)),9,iu)],42,tu)}),128))])):L("",!0)]),_:1}))}});var au=ue(ru,[["__scopeId","data-v-9efb2a56"]]);const su=["transform"],ou={key:0},lu=["r","fill","stroke"],uu=["r","fill","stroke"],cu=["r","fill"],du=["r","stroke-dasharray","stroke-dashoffset","stroke"],fu={key:1,transform:"rotate(45, 0, 0)"},pu=["width","height","transform","fill","stroke"],gu=["width","height","transform","fill","stroke"],mu=["width","height","transform","fill"],vu=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],hu=["fill","y"],bu=["fill"],yu={key:0},wu=["fill","y"],_u=["fill","y"],Nu=J({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},selectedNode:null,selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,i=Math.sqrt(2),r=$e(n),a=C(()=>s(r.selectedNode)===s(r.node)),l=C(()=>de(r.nodeType.value.draggable,s(r.node)));pt(l,Y=>{const Ce=s(r.node);s(r.dragging)===Ce&&!Y&&t("endDragging",Ce)});const u=C(()=>{var Ce;const Y=s(r.node);return(Ce=de(r.nodeType.value.actions,Y))==null?void 0:Ce.filter(Qe=>Le(de(Qe.visibility,Y)))}),c=C(()=>{var Ce;const Y=s(r.node);if(de(r.nodeType.value.draggable,Y)&&((Ce=s(r.dragging))==null?void 0:Ce.id)===Y.id&&s(r.dragged)!=null){const{x:Qe,y:kt}=s(r.dragged);return{x:Y.position.x+Math.round(Qe/25)*25,y:Y.position.y+Math.round(kt/25)*25}}return Y.position}),d=C(()=>de(r.nodeType.value.shape,s(r.node))),m=C(()=>de(r.nodeType.value.title,s(r.node))),f=C(()=>de(r.nodeType.value.subtitle,s(r.node))),v=C(()=>{var Y;return(Y=a.value?s(r.selectedAction)&&de(s(r.selectedAction).tooltip,s(r.node)):null)!=null?Y:de(r.nodeType.value.label,s(r.node))}),w=C(()=>{var Y,Ce;return de((Ce=(Y=s(r.selectedAction))==null?void 0:Y.confirmationLabel)!=null?Ce:{text:"Tap again to confirm"},s(r.node))}),b=C(()=>de(r.nodeType.value.size,s(r.node))),h=C(()=>{var Y;return(Y=de(r.nodeType.value.progress,s(r.node)))!=null?Y:0}),I=C(()=>wt[re.theme].variables["--background"]),F=C(()=>{var Y;return(Y=de(r.nodeType.value.outlineColor,s(r.node)))!=null?Y:wt[re.theme].variables["--outline"]}),S=C(()=>{var Y;return(Y=de(r.nodeType.value.fillColor,s(r.node)))!=null?Y:wt[re.theme].variables["--raised-background"]}),E=C(()=>de(r.nodeType.value.progressColor,s(r.node))),V=C(()=>{var Y;return(Y=de(r.nodeType.value.titleColor,s(r.node)))!=null?Y:wt[re.theme].variables["--foreground"]}),ce=C(()=>de(r.nodeType.value.progressDisplay,s(r.node))),H=C(()=>r.dragging.value!=null&&s(r.hasDragged)&&de(r.nodeType.value.canAccept,s(r.node),r.dragging.value)),z=C(()=>de(r.nodeType.value.style,s(r.node))),U=C(()=>de(r.nodeType.value.classes,s(r.node)));function qe(Y){t("mouseDown",Y,r.node.value,l.value)}function Ke(Y){var Ce,Qe,kt;(Ce=r.hasDragged)!=null&&Ce.value||(t("endDragging",r.node.value),(kt=(Qe=r.nodeType.value).onClick)==null||kt.call(Qe,r.node.value),Y.stopPropagation())}return(Y,Ce)=>{var Qe,kt,Ht;return M(),P("g",{class:pe(["boardnode",{[e.node.type]:!0,isSelected:s(a),isDraggable:s(l),...s(U)}]),style:Re([{opacity:((Qe=e.dragging)==null?void 0:Qe.id)===e.node.id&&e.hasDragged?.5:1},(kt=s(z))!=null?kt:[]]),transform:`translate(${s(c).x},${s(c).y})${s(a)?" scale(1.2)":""}`},[p(au,{actions:(Ht=s(u))!=null?Ht:[],"is-selected":s(a),node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:Ce[0]||(Ce[0]=Ue=>t("clickAction",Ue))},null,8,["actions","is-selected","node","node-type","selected-action"]),_("g",{class:"node-container",onMousedown:qe,onTouchstartPassive:qe,onMouseup:Ke,onTouchendPassive:Ke},[s(d)===s(ze).Circle?(M(),P("g",ou,[s(H)?(M(),P("circle",{key:0,class:"receiver",r:s(b)+8,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,lu)):L("",!0),_("circle",{class:"body",r:s(b),fill:s(S),stroke:s(F),"stroke-width":4},null,8,uu),s(ce)===s(vn).Fill?(M(),P("circle",{key:1,class:"progress progressFill",r:Math.max(s(b)*s(h)-2,0),fill:s(E)},null,8,cu)):(M(),P("circle",{key:2,r:s(b)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(b)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(b)+4.5)*2*Math.PI-s(h)*(s(b)+4.5)*2*Math.PI,stroke:s(E)},null,8,du))])):s(d)===s(ze).Diamond?(M(),P("g",fu,[s(H)?(M(),P("rect",{key:0,class:"receiver",width:s(b)*s(i)+16,height:s(b)*s(i)+16,transform:`translate(${-(s(b)*s(i)+16)/2}, ${-(s(b)*s(i)+16)/2})`,fill:s(I),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,pu)):L("",!0),_("rect",{class:"body",width:s(b)*s(i),height:s(b)*s(i),transform:`translate(${-s(b)*s(i)/2}, ${-s(b)*s(i)/2})`,fill:s(S),stroke:s(F),"stroke-width":4},null,8,gu),s(ce)===s(vn).Fill?(M(),P("rect",{key:1,class:"progress progressFill",width:Math.max(s(b)*s(i)*s(h)-2,0),height:Math.max(s(b)*s(i)*s(h)-2,0),transform:`translate(${-Math.max(s(b)*s(i)*s(h)-2,0)/2}, ${-Math.max(s(b)*s(i)*s(h)-2,0)/2})`,fill:s(E)},null,8,mu)):(M(),P("rect",{key:2,class:"progress progressDiamond",width:s(b)*s(i)+9,height:s(b)*s(i)+9,transform:`translate(${-(s(b)*s(i)+9)/2}, ${-(s(b)*s(i)+9)/2})`,fill:"transparent","stroke-dasharray":(s(b)*s(i)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(b)*s(i)+9)*4-s(h)*(s(b)*s(i)+9)*4,stroke:s(E)},null,8,vu))])):L("",!0),_("text",{fill:s(V),class:"node-title",y:s(f)?10:0},ae(s(m)),9,hu),s(f)?(M(),P("text",{key:2,fill:s(V),class:"node-subtitle",y:"-15"},ae(s(f)),9,bu)):L("",!0)],32),p($n,{name:"fade",appear:""},{default:W(()=>{var Ue;return[s(v)?(M(),P("g",yu,[_("text",{fill:(Ue=s(v).color)!=null?Ue:s(V),class:pe(["node-title",{pulsing:s(v).pulsing}]),y:-s(b)-20},ae(s(v).text),11,wu)])):L("",!0)]}),_:1}),p($n,{name:"fade",appear:""},{default:W(()=>{var Ue;return[s(a)&&e.selectedAction?(M(),P("text",{key:0,fill:(Ue=s(w).color)!=null?Ue:s(V),class:pe(["node-title",{pulsing:s(w).pulsing}]),y:s(b)+75},ae(s(w).text),11,_u)):L("",!0)]}),_:1})],14,su)}}});var Cu=ue(Nu,[["__scopeId","data-v-4654be02"]]);const ku={class:"stage",width:"100%",height:"100%"},Mu={class:"g1"},Su=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=$e(e),i=B({x:0,y:0}),r=B({x:0,y:0}),a=B(!1),l=B(null),u=C(()=>{const w=n.nodes.value.slice();if(n.draggingNode.value){const b=w.splice(w.indexOf(n.draggingNode.value),1)[0];w.push(b)}return w});_t(()=>{const w=n.draggingNode.value;if(w==null)return null;const b={x:w.position.x+r.value.x,y:w.position.y+r.value.y};let h=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce((I,F)=>{if(F.id===w.id)return I;const S=n.types.value[F.type];if(!de(S.canAccept,F,w))return I;const V=Math.pow(b.x-F.position.x,2)+Math.pow(b.y-F.position.y,2);let ce=de(S.size,F);return V>h||V>ce*ce?I:(h=V,F)},null))});function c(w){w.setTransformOrigin(null),w.moveTo(l.value.$el.clientWidth/2,l.value.$el.clientHeight/2)}function d(w,b=null,h=!1){if(n.draggingNode.value==null){w.preventDefault(),w.stopPropagation();let I,F;if("touches"in w)if(w.touches.length===1)I=w.touches[0].clientX,F=w.touches[0].clientY;else return;else I=w.clientX,F=w.clientY;i.value={x:I,y:F},r.value={x:0,y:0},a.value=!1,h&&n.setDraggingNode.value(b)}b!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function m(w){const{x:b,y:h,scale:I}=l.value.panZoomInstance.getTransform();let F,S;if("touches"in w)if(w.touches.length===1)F=w.touches[0].clientX,S=w.touches[0].clientY;else{f(n.draggingNode.value),n.mousePosition.value=null;return}else F=w.clientX,S=w.clientY;n.mousePosition.value={x:(F-b)/I,y:(S-h)/I},r.value={x:r.value.x+(F-i.value.x)/I,y:r.value.y+(S-i.value.y)/I},i.value={x:F,y:S},(Math.abs(r.value.x)>10||Math.abs(r.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(w.preventDefault(),w.stopPropagation())}function f(w,b=!1){var h,I;if(n.draggingNode.value!=null&&n.draggingNode.value===w){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 F=n.nodes.value;F.push(F.splice(F.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((I=(h=n.types.value[n.receivingNode.value.type]).onDrop)==null||I.call(h,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!b&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function v(w,b){n.state.value.selectedAction===b?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:b}}return(w,b)=>{const h=Ct("panZoom");return s(Le)(e.visibility)?(M(),ee(h,{key:0,style:Re([{width:e.width,height:e.height},e.style]),class:pe(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:l,onInit:c,onMousemove:m,onTouchmove:m,onMousedown:b[0]||(b[0]=I=>d(I)),onTouchstart:b[1]||(b[1]=I=>d(I)),onMouseup:b[2]||(b[2]=()=>f(s(e.draggingNode))),onTouchendPassive:b[3]||(b[3]=()=>f(s(e.draggingNode))),onMouseleave:b[4]||(b[4]=()=>f(s(e.draggingNode),!0))},{default:W(()=>[(M(),P("svg",ku,[_("g",Mu,[p(sr,{name:"link",appear:""},{default:W(()=>[(M(!0),P(ne,null,En(s(e.links)||[],I=>(M(),P("g",{key:`${I.startNode.id}-${I.endNode.id}`},[p(Ql,{link:I},null,8,["link"])]))),128))]),_:1}),p(sr,{name:"grow",duration:500,appear:""},{default:W(()=>[(M(!0),P(ne,null,En(s(u),I=>{var F;return M(),P("g",{key:I.id,style:{"transition-duration":"0s"}},[p(Cu,{node:I,nodeType:e.types[I.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===I?r.value:void 0,hasDragged:a.value,receivingNode:((F=s(e.receivingNode))==null?void 0:F.id)===I.id,selectedNode:s(e.selectedNode),selectedAction:s(e.selectedAction),onMouseDown:d,onEndDragging:f,onClickAction:S=>v(I,S)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","selectedNode","selectedAction","onClickAction"])])}),128))]),_:1})])]))]),_:1},8,["style","class","options"])):L("",!0)}}});He.on("setupVue",e=>Ma.install(e));const zr=Symbol("Board");var vn=(e=>(e.Outline="Outline",e.Fill="Fill",e))(vn||{}),ze=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(ze||{});function Iu(e){const t=ft({nodes:[],selectedNode:null,selectedAction:null},!1);return Ze(n=>{const i=e.call(n,n);i.id=an("board-"),i.type=zr,i[ht]=Su,i.state?(Or(t),x(i,"state")):(t[rn]={nodes:i.startNodes().map((u,c)=>(u.id=c,u)),selectedNode:null,selectedAction:null},i.state=t),i.nodes=C(()=>s(l.state).nodes),i.selectedNode=C({get(){return l.nodes.value.find(u=>u.id===s(l.state).selectedNode)||null},set(u){var c,d;De(l.state)?l.state.value={...l.state.value,selectedNode:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedNode=(d=u==null?void 0:u.id)!=null?d:null}}),i.selectedAction=C({get(){const u=l.selectedNode.value;if(u==null)return null;const c=l.types[u.type];return c.actions==null?null:c.actions.find(d=>d.id===s(l.state).selectedAction)||null},set(u){var c,d;De(l.state)?l.state.value={...l.state.value,selectedAction:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedAction=(d=u==null?void 0:u.id)!=null?d:null}}),i.mousePosition=B(null),i.links?x(i,"links"):i.links=C(()=>l.selectedAction.value==null?null:l.selectedAction.value.links&&l.selectedNode.value?de(l.selectedAction.value.links,l.selectedNode.value):null),i.draggingNode=B(null),i.receivingNode=B(null),x(i,"visibility"),ie(i,"visibility",ye.Visible),x(i,"width"),ie(i,"width","100%"),x(i,"height"),ie(i,"height","100%"),x(i,"classes"),x(i,"style");for(const u in i.types){const c=i.types[u];if(x(c,"title"),x(c,"subtitle"),x(c,"label"),x(c,"size"),ie(c,"size",50),x(c,"style"),x(c,"classes"),x(c,"draggable"),ie(c,"draggable",!1),x(c,"shape"),ie(c,"shape","Circle"),x(c,"canAccept"),ie(c,"canAccept",!1),x(c,"progress"),x(c,"progressDisplay"),ie(c,"progressDisplay","Fill"),x(c,"progressColor"),ie(c,"progressColor","none"),x(c,"fillColor"),x(c,"outlineColor"),x(c,"titleColor"),x(c,"actionDistance"),ie(c,"actionDistance",Math.PI/6),c.nodes=C(()=>s(l.state).nodes.filter(d=>d.type===u)),ie(c,"onClick",function(d){s(l.state).selectedNode=d.id}),c.actions)for(const d of c.actions)x(d,"visibility"),ie(d,"visibility",ye.Visible),x(d,"icon"),x(d,"fillColor"),x(d,"tooltip"),x(d,"confirmationLabel"),ie(d,"confirmationLabel",{text:"Tap again to confirm"}),x(d,"links")}function r(u){i.draggingNode.value=u}function a(u){i.receivingNode.value=u}i.placeInAvailableSpace=function(u,c=100,d=G.Right){const m=l.nodes.value.slice().filter(f=>f===u||(d===G.Down||d===G.Up)&&Math.abs(f.position.x-u.position.x)>c||(d===G.Left||d===G.Right)&&Math.abs(f.position.y-u.position.y)>c?!1:!(d===G.Right&&f.position.x<u.position.x-c||d===G.Left&&f.position.x>u.position.x+c||d===G.Up&&f.position.y>u.position.y+c||d===G.Down&&f.position.y<u.position.y-c)).sort(d===G.Right?(f,v)=>f.position.x-v.position.x:d===G.Left?(f,v)=>v.position.x-f.position.x:d===G.Up?(f,v)=>v.position.y-f.position.y:(f,v)=>f.position.y-v.position.y);for(let f=0;f<m.length;f++){const v=m[f],w=d===G.Right||d===G.Left?Math.abs(u.position.x-v.position.x):Math.abs(u.position.y-v.position.y);if(w<c)d===G.Right?u.position.x=v.position.x+c:d===G.Left?u.position.x=v.position.x-c:d===G.Up?u.position.y=v.position.y-c:d===G.Down&&(u.position.y=v.position.y+c);else if(f>0&&w>c)break}},i[ot]=function(){const{nodes:u,types:c,state:d,visibility:m,width:f,height:v,style:w,classes:b,links:h,selectedAction:I,selectedNode:F,mousePosition:S,draggingNode:E,receivingNode:V}=this;return{nodes:u,types:c,state:d,visibility:m,width:f,height:v,style:s(w),classes:b,links:h,selectedAction:I,selectedNode:F,mousePosition:S,draggingNode:E,receivingNode:V,setDraggingNode:r,setReceivingNode:a}};const l=i;return l})}function de(e,t,...n){return Un(e)?e(t,...n):s(e)}function Zn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const Vn={};He.on("addLayer",e=>{const t=Wn(e,zr);Vn[e.id]=e.on("postUpdate",n=>{t.forEach(i=>{Object.values(i.types).forEach(r=>r.nodes.value.forEach(a=>{var l;return(l=r.update)==null?void 0:l.call(r,a,n)}))})})});He.on("removeLayer",e=>{var t;(t=Vn[e.id])==null||t.call(Vn),Vn[e.id]=void 0});function Mn(e,t="points",n=0,i=void 0){const r=De(e)?e:ft(e);if(r.displayName=t,r.precision=n,r.small=i,!De(e)){const a=r[Et];a.displayName=t,a.precision=n,a.small=i}return r}new o("10^^8");new o("1e100");function di(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?vt(e.small?n:o.floor(n)):me(n,e.precision,e.small)}He.on("setupVue",e=>e.use(Sa));function xu(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 $u=J({props:{visibility:{type:R(Number,Boolean),required:!0},display:{type:R(Object,String,Function),required:!0},style:R(String,Object,Array),classes:R(Object),glowColor:R(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:i,floating:r}=$e(e),a=Ar(n),l=C(()=>{const c=Me(i);return c==null||c===""?{}:s(r)?xu(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function u(){t("selectTab")}return{selectTab:u,component:a,glowColorStyle:l,unref:s,Visibility:ye,isVisible:Le,isHidden:yn}}});function Eu(e,t,n,i,r,a){var l;return e.isVisible(e.visibility)?(M(),P("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:pe(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(l=e.unref(e.style))!=null?l:{}])},[(M(),ee(We(e.component)))],6)):L("",!0)}var Ur=ue($u,[["render",Eu],["__scopeId","data-v-21427abb"]]);const Pu=J({props:{visibility:{type:R(Number,Boolean),required:!0},activeTab:{type:R(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:R(Object),required:!0},style:R(String,Object,Array),classes:R(Object),buttonContainerStyle:R(String,Object,Array),buttonContainerClasses:R(Object)},components:{Sticky:ci,TabButton:Ur},setup(e){const{activeTab:t}=$e(e),n=C(()=>wt[re.theme].floatingTabs),i=gt("");_t(()=>{const u=Me(t);if(u==null){i.value="";return}if(St(u)){i.value=se(u);return}i.value=se(s(u.display))});const r=C(()=>{const u=Me(t);return St(u)||!u?void 0:s(u.classes)}),a=C(()=>{const u=Me(t);return St(u)||!u?void 0:s(u.style)});function l(u){const{display:c,style:d,classes:m,glowColor:f,visibility:v}=u;return{display:c,style:s(d),classes:m,glowColor:f,visibility:v}}return{floating:n,tabClasses:r,tabStyle:a,Visibility:ye,component:i,gatherButtonProps:l,unref:s,isVisible:Le,isHidden:yn}}});function Tu(e,t,n,i,r,a){var c,d;const l=Ct("TabButton"),u=Ct("Sticky");return e.isVisible(e.visibility)?(M(),P("div",{key:0,class:pe(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(d=e.tabStyle)!=null?d:[]])},[p(u,{class:pe(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Re(e.unref(e.buttonContainerStyle))},{default:W(()=>[_("div",{class:pe(["tab-buttons",{floating:e.floating}])},[(M(!0),P(ne,null,En(e.unref(e.tabs),(m,f)=>(M(),ee(l,zt({onSelectTab:v=>e.selected.value=f,floating:e.floating,key:f,active:e.unref(m.tab)===e.unref(e.activeTab)},e.gatherButtonProps(m)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(M(),ee(We(e.unref(e.component)),{key:0})):L("",!0)],6)):L("",!0)}var Du=ue(Pu,[["render",Tu],["__scopeId","data-v-58dbf83a"]]);const Au=Symbol("TabButton"),Fu=Symbol("TabFamily");function Ou(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=ft(Object.keys(e)[0],!1);return Ze(i=>{var l;const r=(l=t==null?void 0:t.call(i,i))!=null?l:{};r.id=an("tabFamily-"),r.type=Fu,r[ht]=Du,r.tabs=Object.keys(e).reduce((u,c)=>{const d=e[c]();return d.type=Au,d[ht]=Ur,x(d,"visibility"),ie(d,"visibility",ye.Visible),x(d,"tab"),x(d,"display"),x(d,"classes"),x(d,"style"),x(d,"glowColor"),u[c]=d,u},{}),r.selected=n,r.activeTab=C(()=>{const u=s(a.tabs);if(n.value in u&&Le(u[n.value].visibility))return s(u[n.value].tab);const c=Object.values(u).find(d=>Le(d.visibility));return c?s(c.tab):null}),x(r,"visibility"),ie(r,"visibility",ye.Visible),x(r,"classes"),x(r,"style"),x(r,"buttonContainerClasses"),x(r,"buttonContainerStyle"),r[ot]=function(){const{visibility:u,activeTab:c,selected:d,tabs:m,style:f,classes:v,buttonContainerClasses:w,buttonContainerStyle:b}=this;return{visibility:u,activeTab:c,selected:d,tabs:m,style:s(f),classes:v,buttonContainerClasses:w,buttonContainerStyle:b}};const a=r;return a})}const Gr=o.ln(10);function Bn(e){return e}function Ru(e,t){if(A(t))return t.invert(o.neg(e));throw new Error("Could not invert due to no input being a variable")}function qu(e,t){if(A(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 Vu(e){return g.neg(e)}function Bu(e,t,n){if(A(t))return t.invert(o.sub(e,we(n)));if(A(n))return n.invert(o.sub(e,we(t)));throw new Error("Could not invert due to no input being a variable")}function Lu(e,t,n){var i,r;if(A(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(A(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 ju(e,t,n){if(A(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(A(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 zu(e,t,n){if(A(t))return t.invert(o.add(e,we(n)));if(A(n))return n.invert(o.sub(we(t),e));throw new Error("Could not invert due to no input being a variable")}function Uu(e,t,n){var i,r;if(A(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(A(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 Gu(e,t,n){if(A(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(A(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 Wu(e,t,n){if(A(t))return t.invert(o.div(e,we(n)));if(A(n))return n.invert(o.div(e,we(t)));throw new Error("Could not invert due to no input being a variable")}function Hu(e,t,n){if(A(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(A(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 Zu(e,t,n){if(A(t))return g.div(e,n);if(A(n))return g.div(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Yu(e,t,n){if(A(t))return t.invert(o.mul(e,we(n)));if(A(n))return n.invert(o.div(we(t),e));throw new Error("Could not invert due to no input being a variable")}function Xu(e,t,n){if(A(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(A(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 Ju(e,t,n){if(A(t))return g.mul(e,n);if(A(n))return g.mul(e,t);throw new Error("Could not apply substitution due to no input being a variable")}function Ku(e,t){if(A(t))return t.invert(o.recip(e));throw new Error("Could not invert due to no input being a variable")}function Qu(e,t){if(A(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 ec(e,t){if(A(t))return t.invert(o.pow10(e));throw new Error("Could not invert due to no input being a variable")}function tc(e){return o.ln(e).sub(1).times(e).div(Gr)}function nc(e,t){if(A(t)){const n=Gr.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 ic(e,t){if(A(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:tc,invert:nc})}throw new Error("Could not integrate due to no input being a variable")}function rc(e,t,n){if(A(t))return t.invert(o.pow(we(n),e));if(A(n))return n.invert(o.root(we(t),e));throw new Error("Could not invert due to no input being a variable")}function ac(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function sc(e,t,n){if(A(t)){const i=o.ln(we(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 oc(e,t,n){if(A(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:ac,invert:sc})}throw new Error("Could not integrate due to no input being a variable")}function lc(e,t){if(A(t))return t.invert(o.pow(2,e));throw new Error("Could not invert due to no input being a variable")}function uc(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function cc(e,t){if(A(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 dc(e,t){if(A(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:uc,invert:cc})}throw new Error("Could not integrate due to no input being a variable")}function fc(e,t){if(A(t))return t.invert(o.exp(e));throw new Error("Could not invert due to no input being a variable")}function pc(e){return o.ln(e).sub(1).times(e)}function gc(e,t){if(A(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 mc(e,t){if(A(t)){if(!t.isIntegrable())throw new Error("Could not integrate due to variable not being integrable");return new g({inputs:[t.getIntegralFormula(e)],evaluate:pc,invert:gc})}throw new Error("Could not integrate due to no input being a variable")}function vc(e,t,n){if(A(t))return t.invert(o.root(e,we(n)));if(A(n))return n.invert(o.ln(e).div(o.ln(we(t))));throw new Error("Could not invert due to no input being a variable")}function hc(e,t,n){if(A(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(A(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 bc(e,t){if(A(t))return t.invert(o.root(e,10));throw new Error("Could not invert due to no input being a variable")}function yc(e,t){if(A(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 wc(e,t,n){if(A(t))return t.invert(o.ln(e).div(we(n)));if(A(n))return n.invert(o.root(we(t),e));throw new Error("Could not invert due to no input being a variable")}function _c(e,t,n){if(A(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(A(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 Nc(e,t,n){if(A(t))return t.invert(o.root(e,o.recip(we(n))));if(A(n))return n.invert(o.ln(we(t)).div(o.ln(e)));throw new Error("Could not invert due to no input being a variable")}function Cc(e,t,n){if(A(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 kc(e,t){if(A(t))return t.invert(o.ln(e));throw new Error("Could not invert due to no input being a variable")}function Mc(e,t){if(A(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 Sc(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const i=o.minabs(t,1e308).toNumber();return o.tetrate(e,i,n)}function Ic(e,t,n,i){if(A(t))return t.invert(o.ssqrt(e));throw new Error("Could not invert due to no input being a variable")}function xc(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 $c(e,t,n,i){if(A(t))return t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,we(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Ec(e,t=10,n=2){const i=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,i)}function Pc(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function Tc(e,t,n){if(A(t))return t.invert(o.tetrate(e,o.minabs(1e308,we(n)).toNumber()));throw new Error("Could not invert due to no input being a variable")}function Dc(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.layeradd(e,i,n)}function Ac(e,t,n,i){if(A(t))return t.invert(o.layeradd(e,o.minabs(1e308,we(n)).negate().toNumber()));throw new Error("Could not invert due to no input being a variable")}function Fc(e,t){if(A(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 Oc(e,t){if(A(t))return t.invert(o.tetrate(e,2));throw new Error("Could not invert due to no input being a variable")}function Rc(e,t,n){const i=o.minabs(t,1e308).toNumber();return o.pentate(e,i,n)}function qc(e,t){if(A(t))return t.invert(o.asin(e));throw new Error("Could not invert due to no input being a variable")}function Vc(e,t){if(A(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 Bc(e,t){if(A(t))return t.invert(o.acos(e));throw new Error("Could not invert due to no input being a variable")}function Lc(e,t){if(A(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 jc(e,t){if(A(t))return t.invert(o.atan(e));throw new Error("Could not invert due to no input being a variable")}function zc(e,t){if(A(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 Uc(e,t){if(A(t))return t.invert(o.sin(e));throw new Error("Could not invert due to no input being a variable")}function Gc(e,t){if(A(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 Wc(e,t){if(A(t))return t.invert(o.cos(e));throw new Error("Could not invert due to no input being a variable")}function Hc(e,t){if(A(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 Zc(e,t){if(A(t))return t.invert(o.tan(e));throw new Error("Could not invert due to no input being a variable")}function Yc(e,t){if(A(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 Xc(e,t){if(A(t))return t.invert(o.asinh(e));throw new Error("Could not invert due to no input being a variable")}function Jc(e,t){if(A(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 Kc(e,t){if(A(t))return t.invert(o.acosh(e));throw new Error("Could not invert due to no input being a variable")}function Qc(e,t){if(A(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 ed(e,t){if(A(t))return t.invert(o.atanh(e));throw new Error("Could not invert due to no input being a variable")}function td(e,t){if(A(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 nd(e,t){if(A(t))return t.invert(o.sinh(e));throw new Error("Could not invert due to no input being a variable")}function id(e,t){if(A(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 rd(e,t){if(A(t))return t.invert(o.cosh(e));throw new Error("Could not invert due to no input being a variable")}function ad(e,t){if(A(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 sd(e,t){if(A(t))return t.invert(o.tanh(e));throw new Error("Could not invert due to no input being a variable")}function od(e,t){if(A(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 A(e){return e instanceof Se&&e.hasVariable()}function we(e,t){return e instanceof Se?e.evaluate(t):s(e)}function ld(){return g.pow(this,2).div(2)}function ud(){return this}const Ae=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"&&Et in n?n[Et]:n)),"variable"in e?(typeof e.variable=="object"&&Et in e.variable&&(e.variable=e.variable[Et]),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:ld,internalIntegrateInner:ud,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 v,w;const{inputs:t,evaluate:n,invert:i,integrate:r,integrateInner:a,applySubstitution:l}=e,u=t.reduce((b,h)=>b+(h instanceof Ae?h.internalVariables:0),0),c=t.find(b=>b instanceof Ae&&b.hasVariable()),d=u===1?c==null?void 0:c.innermostVariable:void 0,m=(v=c==null?void 0:c.isInvertible())!=null?v:!1,f=(w=c==null?void 0:c.isIntegrable())!=null?w:!1;return{inputs:t,internalEvaluate:n,internalInvert:m?i:void 0,internalIntegrate:f?r:void 0,internalIntegrateInner:a,applySubstitution:l,innermostVariable:d,internalVariables:u}}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=>we(r,e))))!=null?n:this.hasVariable()?e:null)!=null?i:we(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Ae&&e.inputs[n]instanceof Ae?t.equals(e.inputs[n]):!(t instanceof Ae)&&!(e.inputs[n]instanceof Ae)&&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=B(0),r=n(g.variable(i)),a=ve(t);function l(c){return o.lt(c,s(a))?c:(i.value=o.sub(c,s(a)),o.add(r.evaluate(),s(a)))}function u(c,d){if(A(d)&&r.isInvertible())return o.gt(c,s(a))&&(c=o.add(r.invert(o.sub(c,s(a))),s(a))),d.invert(c);throw new Error("Could not invert due to no input being a variable")}return new g({inputs:[e],evaluate:l,invert:r.isInvertible()&&r.hasVariable()?u:void 0})}static if(e,t,n,i){const r=B(0),a=g.variable(r),l=n(a),u=i==null?void 0:i(a),c=ve(t);function d(f){return s(c)?(r.value=f,l.evaluate()):u?(r.value=f,u.evaluate()):f}function m(f,v){if(!A(v)||!l.isInvertible()||u!=null&&!u.isInvertible())throw new Error("Could not invert due to no input being a variable");return s(c)?v.invert(l.invert(f)):u?v.invert(u.invert(f)):v.invert(f)}return new g({inputs:[e],evaluate:d,invert:l.isInvertible()&&l.hasVariable()?m: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:Ru,applySubstitution:Vu,integrate:qu})}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:Bu,integrate:Lu,integrateInner:ju,applySubstitution:Bn})}static sub(e,t){return new g({inputs:[e,t],evaluate:o.sub,invert:zu,integrate:Uu,integrateInner:Gu,applySubstitution:Bn})}static mul(e,t){return new g({inputs:[e,t],evaluate:o.mul,invert:Wu,integrate:Hu,applySubstitution:Zu})}static div(e,t){return new g({inputs:[e,t],evaluate:o.div,invert:Yu,integrate:Xu,applySubstitution:Ju})}static recip(e){return new g({inputs:[e],evaluate:o.recip,invert:Ku,integrate:Qu})}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:ec,integrate:ic})}static log(e,t){return new g({inputs:[e,t],evaluate:o.log,invert:rc,integrate:oc})}static log2(e){return new g({inputs:[e],evaluate:o.log2,invert:lc,integrate:dc})}static ln(e){return new g({inputs:[e],evaluate:o.ln,invert:fc,integrate:mc})}static pow(e,t){return new g({inputs:[e,t],evaluate:o.pow,invert:vc,integrate:hc})}static pow10(e){return new g({inputs:[e],evaluate:o.pow10,invert:bc,integrate:yc})}static pow_base(e,t){return new g({inputs:[e,t],evaluate:o.pow_base,invert:wc,integrate:_c})}static root(e,t){return new g({inputs:[e,t],evaluate:o.root,invert:Nc,integrate:Cc})}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:kc,integrate:Mc})}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:Sc,invert:Ic})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:xc,invert:$c})}static iteratedlog(e,t=10,n=1){return new g({inputs:[e,t,n],evaluate:Ec})}static slog(e,t=10){return new g({inputs:[e,t],evaluate:Pc,invert:Tc})}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:Dc,invert:Ac})}static lambertw(e){return new g({inputs:[e],evaluate:o.lambertw,invert:Fc})}static ssqrt(e){return new g({inputs:[e],evaluate:o.ssqrt,invert:Oc})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new g({inputs:[e,t,n],evaluate:Rc})}static sin(e){return new g({inputs:[e],evaluate:o.sin,invert:Uc,integrate:Vc})}static cos(e){return new g({inputs:[e],evaluate:o.cos,invert:Wc,integrate:Lc})}static tan(e){return new g({inputs:[e],evaluate:o.tan,invert:Zc,integrate:zc})}static asin(e){return new g({inputs:[e],evaluate:o.asin,invert:qc,integrate:Gc})}static acos(e){return new g({inputs:[e],evaluate:o.acos,invert:Bc,integrate:Hc})}static atan(e){return new g({inputs:[e],evaluate:o.atan,invert:jc,integrate:Yc})}static sinh(e){return new g({inputs:[e],evaluate:o.sinh,invert:nd,integrate:Jc})}static cosh(e){return new g({inputs:[e],evaluate:o.cosh,invert:rd,integrate:Qc})}static tanh(e){return new g({inputs:[e],evaluate:o.tanh,invert:sd,integrate:td})}static asinh(e){return new g({inputs:[e],evaluate:o.asinh,invert:Xc,integrate:id})}static acosh(e){return new g({inputs:[e],evaluate:o.acosh,invert:Kc,integrate:ad})}static atanh(e){return new g({inputs:[e],evaluate:o.atanh,invert:ed,integrate:od})}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 Se=Ae;Se.negate=Ae.neg;Se.negated=Ae.neg;Se.sgn=Ae.sign;Se.plus=Ae.add;Se.subtract=Ae.sub;Se.minus=Ae.sub;Se.multiply=Ae.mul;Se.times=Ae.mul;Se.divide=Ae.div;Se.divideBy=Ae.div;Se.dividedBy=Ae.div;Se.reciprocal=Ae.recip;Se.reciprocate=Ae.recip;Se.max=Tn(o.max);Se.min=Tn(o.min);Se.minabs=Tn(o.minabs);Se.maxabs=Tn(o.maxabs);Se.clampMin=Tn(o.clampMin);Se.clampMax=Tn(o.clampMax);Se.logarithm=Ae.log;class g extends Se{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 Wr(e,t,n=!0,i,r=o.dInf){const a=ve(n),l=ve(i),u=ve(r);return C(()=>{var v,w,b,h;const c=s(u);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const d=s(a),m=(v=s(l))!=null?v:d?10:0;let f=0;if(o.gt(c,m)){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((w=s(e.innermostVariable))!=null?w:0)}else f=o.floor(e.invert(t.value))}if(f=o.clampMax(f,c),m>0){f=o.sub(f,m).clampMin(0);let I;for(d?I=Lt(e,f,!0,0):I=e.evaluate(o.add((b=s(e.innermostVariable))!=null?b:0,f));o.lt(f,c)&&o.lt(f,Number.MAX_SAFE_INTEGER);){const F=e.evaluate(f.add((h=s(e.innermostVariable))!=null?h:0));if(o.add(I,F).lte(t.value))f=f.add(1),I=o.add(I,F);else break}}return f})}function Lt(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 l=a;i!=null||(i=n?10:0),a=a.sub(i).clampMin(r);let u=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(u=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),l.gt(1e308))return o.add(u,o.sub(l,a).times(e.evaluate(a)))}else if(u=e.evaluate(a),a=a.add(1),l.gt(1e308))return o.sub(l,a).add(1).times(u)}for(let d=a.toNumber();d<l.toNumber();d++)u=o.add(u,e.evaluate(d));return u}function pn(e){return Ze(t=>{const{addend:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=ve(n),u=ve(i),c=r==null?void 0:ve(r);return{apply:d=>o.add(d,s(l)),invert:d=>o.sub(d,s(l)),getFormula:d=>g.add(d,l),enabled:c,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(u)!=null?p("span",{class:"modifier-description"},[Nt(s(u))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),0):o.lt(s(l),0))?"color: var(--danger)":""},[o.gte(s(l),0)?"+":"",en(s(l))])]))}})}function Oe(e){return Ze(t=>{const{multiplier:n,description:i,enabled:r,smallerIsBetter:a}=e.call(t,t),l=ve(n),u=ve(i),c=r==null?void 0:ve(r);return{apply:d=>o.times(d,s(l)),invert:d=>o.div(d,s(l)),getFormula:d=>g.times(d,l),enabled:c,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(u)!=null?p("span",{class:"modifier-description"},[Nt(s(u))]):null,p("span",{class:"modifier-amount",style:(a===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[$("\xD7"),en(s(l))])]))}})}function Ei(e){return Ze(t=>{const{exponent:n,description:i,enabled:r,supportLowNumbers:a,smallerIsBetter:l}=e.call(t,t),u=ve(n),c=ve(i),d=r==null?void 0:ve(r);return{apply:m=>{let f=m;return a&&(f=o.add(f,1)),f=o.pow(f,s(u)),a&&(f=o.sub(f,1)),f},invert:m=>{let f=m;return a&&(f=o.add(f,1)),f=o.root(f,s(u)),a&&(f=o.sub(f,1)),f},getFormula:m=>a?g.add(m,1).pow(u).sub(1):g.pow(m,u),enabled:d,description:i==null?void 0:K(()=>p("div",{class:"modifier-container"},[s(c)!=null?p("span",{class:"modifier-description"},[Nt(s(c)),a?" (+1 effective)":null]):null,p("span",{class:"modifier-amount",style:(l===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[$("^"),en(s(u))])]))}})}function $t(e){return Ze(()=>{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)?C(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?K(()=>p(ne,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(Nt)])):void 0}})}const jn=g.variable(0).add(1),vi={id:"deselect",icon:"close",tooltip:e=>({text:"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:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),N.board.selectedAction.value=null,N.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},Wt={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${vt(N.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},N.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function Dn(e,t=1/0){const n=e(g.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(i){return{text:`Increase Connections - ${vt(n.evaluate(i.state.maxConnections))} energy`}},confirmationLabel:i=>o.gte(N.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(N.energy.value,r)&&(N.energy.value=o.sub(N.energy.value,r)),i.state={...i.state,maxConnections:o.add(i.state.maxConnections,1)},N.board.selectedAction.value=null},visibility:i=>o.add(i.state.maxConnections,N.computedBonusConnectionsModifier.value).lt(t)}}function Hr(e,t){var n,i;if(((n=N.board.draggingNode.value)==null?void 0:n.type)==="resource"){const r=((i=N.board.draggingNode.value)==null?void 0:i.state).type,{maxConnections:a,resources:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,N.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function cd(e,t){var n,i;if(((n=N.board.draggingNode.value)==null?void 0:n.type)==="passive"){const r=(i=N.board.draggingNode.value)==null?void 0:i.state,{maxConnections:a,tools:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,N.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Zi(e,t){var n,i;if(((n=N.board.draggingNode.value)==null?void 0:n.type)==="portal"){const r=((i=N.board.draggingNode.value)==null?void 0:i.state).id,{maxConnections:a,portals:l}=e.state;return l.includes(r)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,N.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(r),color:"var(--accent2)"}}return null}function Zr(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,N.computedBonusConnectionsModifier.value).lte(r.length)}function Yr(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]},N.board.selectedNode.value=e}function dd(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,N.computedBonusConnectionsModifier.value).lte(r.length)}function fd(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]},N.board.selectedNode.value=e}function Yi(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,N.computedBonusConnectionsModifier.value).lte(r.length)}function Xi(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]},N.board.selectedNode.value=e}function he(e){return e===N.board.selectedNode.value||e.state.powered}function ct(e){return N.empowerer.value!=null&&he(N.empowerer.value)&&N.empowerer.value.state.tools.includes(e)}function pd(e){var a,l,u;const t=(u=(l=(a=N.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:l.amount)!=null?u:0,n=N.resourceLevels.value[e],i=Lt(jn,n,!0),r=Lt(jn,o.add(n,1),!0);return o.sub(t,i).max(0).div(o.sub(r,i)).toNumber()}function Cn(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())})}}const gd={key:0},md={key:0,class:"mark star"},vd=["src"],hd=J({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(M(),P("div",gd,[e.mark===!0?(M(),P("div",md)):(M(),P("img",{key:1,class:"mark",src:e.mark},null,8,vd))])):L("",!0)}});var Yn=ue(hd,[["__scopeId","data-v-2207999f"]]);const bd=J({__name:"Node",props:{id:null},setup(e){const n=$e(e),i=si(Bi,()=>{}),r=si(Li,()=>{}),a=gt(null),l=C(()=>a.value&&a.value.parentElement);return pt([l,n.id],([u,c],[d,m])=>{d&&r(s(m)),u&&i(c,u)}),_r(()=>r(s(n.id))),(u,c)=>(M(),P("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Xn=ue(bd,[["__scopeId","data-v-a48cb382"]]),yd=J({props:{display:{type:R(Object,String,Function),required:!0},visibility:{type:R(Number,Boolean),required:!0},style:R(Object,String,Array),classes:R(Object),onClick:Function,onHold:Function,canClick:{type:R(Boolean),required:!0},small:Boolean,mark:R(Boolean,String),id:{type:String,required:!0}},components:{Node:Xn,MarkNode:Yn},setup(e){const{display:t,onClick:n,onHold:i}=$e(e),r=gt("");_t(()=>{var m;const u=Me(t);if(u==null){r.value="";return}if(St(u)){r.value=se(u);return}const c=se((m=u.title)!=null?m:"","h3"),d=se(u.description,"div");r.value=se(K(()=>p("span",null,[u.title!=null?p("div",null,[p(c,null,null)]):null,p(d,null,null)])))});const{start:a,stop:l}=Dr(n,i);return{start:a,stop:l,comp:r,Visibility:ye,isVisible:Le,isHidden:yn,unref:s}}});function wd(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),P("button",{key:0,style:Re([{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:pe({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(),ee(We(e.unref(e.comp)),{key:0})):L("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],38)):L("",!0)}var Xr=ue(yd,[["render",wd],["__scopeId","data-v-211328c0"]]);const Jr=Symbol("Clickable");function _d(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return Ze(i=>{var l,u,c;const r=(l=e==null?void 0:e.call(i,i))!=null?l:{};r.id=an("clickable-"),r.type=Jr,r[ht]=Xr;for(const d of t)(u=d.preConstruct)==null||u.call(d,r);if(Object.assign(r,n),x(r,"visibility"),ie(r,"visibility",ye.Visible),x(r,"canClick"),ie(r,"canClick",!0),x(r,"classes"),x(r,"style"),x(r,"mark"),x(r,"display"),r.onClick){const d=r.onClick.bind(r);r.onClick=function(m){s(r.canClick)!==!1&&d(m)}}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,m)=>{var f;return Object.assign(d,(f=m.getGatheredProps)==null?void 0:f.call(m,r))},{});return r[ot]=function(){const{display:d,visibility:m,style:f,classes:v,onClick:w,onHold:b,canClick:h,small:I,mark:F,id:S}=this;return{display:d,visibility:m,style:s(f),classes:v,onClick:w,onHold:b,canClick:h,small:I,mark:F,id:S,...a}},r})}function Nd(e,t,n=[]){n=n.length===0?Wn(e,Jr):n;const i=typeof t=="function"?C(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 Cd=["x1","y1","x2","y2"],kd=J({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=$e(e),i=C(()=>{const a=n.startNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetStart&&(u.x+=n.link.value.offsetStart.x,u.y+=n.link.value.offsetStart.y),u}),r=C(()=>{const a=n.endNode.value.rect,l=n.boundingRect.value,u=l?{x:a.x+a.width/2-l.x,y:a.y+a.height/2-l.y}:{x:0,y:0};return n.link.value.offsetEnd&&(u.x+=n.link.value.offsetEnd.x,u.y+=n.link.value.offsetEnd.y),u});return(a,l)=>(M(),P("line",zt({"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,Cd))}});const Md=J({__name:"Links",props:{links:null},setup(e){var c;const n=nn(e,"links"),i=B(null),r=si(ji,B({})),a=si(zi,B(void 0)),l=B((c=i.value)==null?void 0:c.getBoundingClientRect());pt(a,()=>{var d;return l.value=(d=i.value)==null?void 0:d.getBoundingClientRect()}),pi(()=>{var d;return l.value=(d=i.value)==null?void 0:d.getBoundingClientRect()});const u=C(()=>{var m,f;const d=r.value;return(f=(m=n.value)==null?void 0:m.filter(v=>{var w,b;return((w=d[v.startNode.id])==null?void 0:w.rect)&&((b=d[v.startNode.id])==null?void 0:b.rect)}))!=null?f:[]});return(d,m)=>(M(),P(ne,null,[s(u)?(M(),P("svg",ya(zt({key:0},d.$attrs)),[(M(!0),P(ne,null,En(s(u),(f,v)=>(M(),ee(kd,{key:v,link:f,boundingRect:l.value,startNode:s(r)[f.startNode.id],endNode:s(r)[f.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):L("",!0),_("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var Sd=ue(Md,[["__scopeId","data-v-063f6d6b"]]);J({props:{nodes:{type:R(Array),required:!0},leftSideNodes:R(Array),rightSideNodes:R(Array),branches:R(Array)},components:{Links:Sd},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:i}=$e(e),r=gt();_t(()=>{const u=Me(t);r.value=se(K(()=>p(ne,null,[u.map(c=>p("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(Nt)]))])))});const a=gt();_t(()=>{const u=Me(n);a.value=u?se(K(()=>p("span",{class:"left-side-nodes small"},[u.map(Nt)]))):""});const l=gt();return _t(()=>{const u=Me(i);l.value=u?se(K(()=>p("span",{class:"side-nodes small"},[u.map(Nt)]))):""}),{unref:s,nodesComp:r,leftNodesComp:a,rightNodesComp:l}}});J({props:{display:R(Object,String,Function),visibility:{type:R(Number,Boolean),required:!0},style:R(String,Object,Array),classes:R(Object),onClick:Function,onHold:Function,color:R(String),glowColor:R(String),canClick:{type:R(Boolean),required:!0},mark:R(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Yn,Node:Xn},setup(e){const{onClick:t,onHold:n,display:i}=$e(e),r=Pn(i),{start:a,stop:l}=Dr(t,n);return{start:a,stop:l,comp:r,unref:s,Visibility:ye,isCoercableComponent:St,isVisible:Le,isHidden:yn}}});function Ln(e){const t=[],n={};let i=!1;function r(){return i||(t.push(...e()),n.base=t.map(u=>ve(u.base)),n.baseText=t.map(u=>ve(u.baseText)),n.visible=t.map(u=>ve(u.visible)),n.title=t.map(u=>ve(u.title)),n.subtitle=t.map(u=>ve(u.subtitle)),i=!0),t}const a=ft({},!1);return[K(()=>{const u=r();let c=!0;const d=u.map((m,f)=>{var F,S,E;if(s(n.visible[f])===!1)return null;const v=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]),w=s(a.value[f])?null:p(ne,null,[p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[Nt((F=s(n.baseText[f]))!=null?F:"Base")]),p("span",{class:"modifier-amount"},[me((S=s(n.base[f]))!=null?S:1),m.unit])]),m.modifier.description==null?null:Nt(s(m.modifier.description))]),b=!c;c=!1;const h=(E=s(n.base[f]))!=null?E:1,I=m.modifier.apply(h);return p(ne,null,[b?p("br",null,null):null,p("div",{style:{"--unit":re.alignUnits&&m.unit!=null?"'"+m.unit+"'":""}},[v,p("br",null,null),w,p("hr",null,null),p("div",{class:"modifier-container"},[p("span",{class:"modifier-description"},[$("Total")]),p("span",{class:"modifier-amount",style:(m.smallerIsBetter===!0?o.gt(I,h!=null?h:1):o.lt(I,h!=null?h:1))?"color: var(--danger)":""},[en(I),m.unit])])])])});return p(ne,null,[d])}),a]}function Pi(e,t,n){const i=ve(t),r=ve(n);return C(()=>{const a=s(i),l=s(r);return o.gte(e.value,l)?"Now":o.lte(a,0)?"Never":mi(o.sub(l,e.value).div(a))})}function cn(e,t,n=1){const i=ve(t),r=ve(n);if(!e.hasVariable())throw new Error("Cannot create formula preview if the formula does not have a variable");return K(()=>{var a;if(s(i)){const l=en(e.evaluate()),u=en(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(r))));return p(ne,null,[p("b",null,[p("i",null,[l,$(" \u2192 "),u])])])}return p(ne,null,[en(e.evaluate())])})}const Mt={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},un=Object.keys(Mt),Te={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:"Artificial Intelligence",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"Machine Learning",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}}},fi={dirt:"Replicator",sand:"Metal Detector",gravel:"Neural Networks",wood:"Mining Laser",stone:"BOGO Coupon",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:"Overclocked Portals",ultimatum:"Rebates"},Id={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 20% stronger":"Material level is 10% 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?"Upgrades apply thrice":"Upgrades apply twice"},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":"+1% plane's resource gain per repeatable purchase"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},coalRelic:{description:e=>e?"(Treasures)^2 boost planar speed":"Treasures boost planar speed"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give triple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Power machines)^2 boost ore dropped":"Power machines boost ore dropped"},goldRelic:{description:e=>e?"Each treasure quadruples XP gain":"Each treasure doubles XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs a third the energy":"Creating portals costs half the energy"},platinumRelic:{description:e=>e?"Triple 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?"ln(energy) boosts planar speed":"log(energy) boosts planar speed"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},Vt={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:"+diff",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-diff",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}},Ti=g.variable(0).add(8).times(2).pow10();const xd=J({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(M(),P("div",{style:Re({width:e.width,height:e.height})},null,4))}});function On(e){return Ze(t=>{var i;const n=e.call(t,t);return n.partialDisplay=r=>p("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[di(n.resource,n.cost instanceof g?Lt(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: ",di(n.resource,n.cost instanceof g?Lt(n.cost,r!=null?r:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),x(n,"visibility"),ie(n,"visibility",ye.Visible),x(n,"cost"),x(n,"requiresPay"),ie(n,"requiresPay",!0),x(n,"cumulativeCost"),ie(n,"cumulativeCost",!0),x(n,"maxBulkAmount"),ie(n,"maxBulkAmount",1),x(n,"directSum"),ie(n,"pay",function(r){const a=n.cost instanceof g?Lt(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=C(()=>{var u;if(!(n.cost instanceof g))return!1;const r=s(n.maxBulkAmount);if(o.lte(r,1))return!1;const a=s(n.cumulativeCost),l=(u=s(n.directSum))!=null?u:a?10:0;return o.lte(r,l)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof g?n.requirementMet=Wr(n.cost,n.resource,(i=n.cumulativeCost)!=null?i:!0,n.directSum,n.maxBulkAmount):n.requirementMet=C(()=>o.gte(n.resource.value,s(n.cost))),n})}function Ji(e){return Ze(()=>({requirementMet:C(()=>Le(e.visibility)),visibility:ye.None,requiresPay:!1}))}function $d(e,t){return Ze(()=>({requirementMet:ve(e),partialDisplay:t==null?void 0:K(()=>Nt(t)),display:t==null?void 0:K(()=>p(ne,null,[$("Req: "),Nt(t)])),visibility:t==null?ye.None:ye.Visible,requiresPay:!1}))}function hi(e){if(Tt(e))return e.every(hi);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function Kr(e){if(Tt(e))return e.map(Kr).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 bi(e,t=1){var n,i;if(Tt(e)&&(e=e.filter(r=>Le(r.visibility)),e.length===1&&(e=e[0])),Tt(e)){e=e.filter(l=>"partialDisplay"in l);const r=e.filter(l=>s(l.requiresPay)),a=e.filter(l=>!s(l.requiresPay));return p(ne,null,[r.length>0?p("div",null,[$("Costs:")," ",fr(r.map(l=>l.partialDisplay(t)),p(ne,null,[$(", ")]))]):null,a.length>0?p("div",null,[$("Requires:")," ",fr(a.map(l=>l.partialDisplay(t)),p(ne,null,[$(", ")]))]):null])}return(i=(n=e.display)==null?void 0:n.call(e))!=null?i:p(ne,null,null)}function Qr(e,t=1){var n;Tt(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 Ed=J({props:{visibility:{type:R(Number,Boolean),required:!0},display:R(Object,String,Function),earned:{type:R(Boolean),required:!0},requirements:R(Object,Array),image:R(String),style:R(String,Object,Array),classes:R(Object),mark:R(Boolean,String),small:R(Boolean),id:{type:String,required:!0}},components:{Node:Xn,MarkNode:Yn},setup(e){const{display:t,requirements:n,earned:i}=$e(e),r=gt("");return _t(()=>{const a=Me(t);if(a==null){r.value="";return}if(St(a)){r.value=se(a);return}const l=se(a.requirement?a.requirement:K(()=>{var d;return bi((d=Me(n))!=null?d:[])}),"h3"),u=se(a.effectDisplay||"","b"),c=Me(i)?se(a.optionsDisplay||"","span"):"";r.value=se(K(()=>p("span",null,[p(l,null,null),a.effectDisplay!=null?p("div",null,[p(u,null,null)]):null,a.optionsDisplay!=null?p("div",{class:"equal-spaced"},[p(c,null,null)]):null])))}),{comp:r,unref:s,Visibility:ye,isVisible:Le,isHidden:yn}}});function Pd(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),P("div",{key:0,style:Re([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:pe({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(),ee(We(e.comp),{key:0})):L("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],6)):L("",!0)}var Td=ue(Ed,[["render",Pd],["__scopeId","data-v-5673325a"]]);const Dd=gi(),Ad=Symbol("Achievement");let Sn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function Fd(e,...t){const n=ft(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return Ze(r=>{var c,d,m;const a=(c=e==null?void 0:e.call(r,r))!=null?c:{};a.id=an("achievement-"),a.type=Ad,a[ht]=Td;for(const f of t)(d=f.preConstruct)==null||d.call(f,a);a.earned=n,a.complete=function(){var v,w;n.value=!0;const f=a;if((v=f.onComplete)==null||v.call(f),f.display!=null&&s(f.showPopups)===!0){const b=s(f.display);let h;St(b)?h=se(b):b.requirement!=null?h=se(b.requirement):h=bi((w=f.requirements)!=null?w:[]),Dd.info(p("div",null,[p("h3",null,[$("Achievement earned!")]),p("div",null,[p(h,null,null)])]))}},Object.assign(a,i),x(a,"visibility"),ie(a,"visibility",ye.Visible);const l=a.visibility;a.visibility=wa(()=>{const f=s(a.display);switch(re.msDisplay){default:case Sn.All:return s(l);case Sn.Configurable:return s(a.earned)&&!(f!=null&&typeof f=="object"&&"optionsDisplay"in f)?ye.None:s(l);case Sn.Incomplete:return s(a.earned)?ye.None:s(l);case Sn.None:return ye.None}}),x(a,"display"),x(a,"mark"),x(a,"small"),x(a,"image"),x(a,"style"),x(a,"classes"),x(a,"showPopups"),ie(a,"showPopups",!0);for(const f of t)(m=f.postConstruct)==null||m.call(f,a);const u=t.reduce((f,v)=>{var w;return Object.assign(f,(w=v.getGatheredProps)==null?void 0:w.call(v,a))},{});if(a[ot]=function(){const{visibility:f,display:v,requirements:w,earned:b,image:h,style:I,classes:F,mark:S,small:E,id:V}=this;return{visibility:f,display:v,requirements:w,earned:b,image:h,style:s(I),classes:F,mark:S,small:E,id:V,...u}},a.requirements){const f=a,v=[Ji(f),$d(()=>!f.earned.value),...Tt(a.requirements)?a.requirements:[a.requirements]];_t(()=>{re.active===Q.id&&hi(v)&&f.complete()})}return a})}He.on("loadSettings",e=>{ie(e,"msDisplay",Sn.All)});const Od=Object.values(Sn).map(e=>({label:tt(e),value:e}));Es(K(()=>p(Wi,{title:K(()=>p("span",{class:"option-title"},[$("Show achievements"),p("desc",null,[$("Select which achievements to display based on criterias.")])])),options:Od,"onUpdate:modelValue":e=>re.msDisplay=e,modelValue:re.msDisplay},null)));const Rd=J({props:{progress:{type:R(String,Object,Number),required:!0},width:{type:R(Number),required:!0},height:{type:R(Number),required:!0},direction:{type:R(String),required:!0},display:R(Object,String,Function),visibility:{type:R(Number,Boolean),required:!0},style:R(Object,String,Array),classes:R(Object),borderStyle:R(Object,String,Array),textStyle:R(Object,String,Array),baseStyle:R(Object,String,Array),fillStyle:R(Object,String,Array),mark:R(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Yn,Node:Xn},setup(e){const{progress:t,width:n,height:i,direction:r,display:a}=$e(e),l=C(()=>{let d=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(d,0),1))*100}),u=C(()=>{const d={width:Me(n)+.5+"px",height:Me(i)+.5+"px"};switch(s(r)){case G.Up:d.clipPath=`inset(${l.value}% 0% 0% 0%)`,d.width=Me(n)+1+"px";break;case G.Down:d.clipPath=`inset(0% 0% ${l.value}% 0%)`,d.width=Me(n)+1+"px";break;case G.Right:d.clipPath=`inset(0% ${l.value}% 0% 0%)`;break;case G.Left:d.clipPath=`inset(0% 0% 0% ${l.value} + '%)`;break;case G.Default:d.clipPath="inset(0% 50% 0% 0%)";break}return d}),c=Pn(a);return{normalizedProgress:l,barStyle:u,component:c,unref:s,Visibility:ye,isVisible:Le,isHidden:yn}}});function qd(e,t,n,i,r,a){var c,d,m,f,v,w,b;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),P("div",{key:0,style:Re([{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:pe({bar:!0,...e.unref(e.classes)})},[_("div",{class:"overlayTextContainer border",style:Re([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(d=e.unref(e.borderStyle))!=null?d:{}])},[e.component?(M(),P("span",{key:0,class:"overlayText",style:Re(e.unref(e.textStyle))},[(M(),ee(We(e.component)))],4)):L("",!0)],4),_("div",{class:"border",style:Re([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(m=e.unref(e.style))!=null?m:{},(f=e.unref(e.baseStyle))!=null?f:{},(v=e.unref(e.borderStyle))!=null?v:{}])},[_("div",{class:"fill",style:Re([e.barStyle,(w=e.unref(e.style))!=null?w:{},(b=e.unref(e.fillStyle))!=null?b:{}])},null,4)],4),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],6)):L("",!0)}var Vd=ue(Rd,[["render",qd],["__scopeId","data-v-6bd06b56"]]);const Bd=Symbol("Bar");function Ld(e,...t){const n=t.reduce((i,r)=>{var a;return Object.assign(i,(a=r.getPersistentData)==null?void 0:a.call(r))},{});return Ze(i=>{var l,u;const r=e.call(i,i);r.id=an("bar-"),r.type=Bd,r[ht]=Vd;for(const c of t)(l=c.preConstruct)==null||l.call(c,r);Object.assign(r,n),x(r,"visibility"),ie(r,"visibility",ye.Visible),x(r,"width"),x(r,"height"),x(r,"direction"),x(r,"style"),x(r,"classes"),x(r,"borderStyle"),x(r,"baseStyle"),x(r,"textStyle"),x(r,"fillStyle"),x(r,"progress"),x(r,"display"),x(r,"mark");for(const c of t)(u=c.postConstruct)==null||u.call(c,r);const a=t.reduce((c,d)=>{var m;return Object.assign(c,(m=d.getGatheredProps)==null?void 0:m.call(d,r))},{});return r[ot]=function(){const{progress:c,width:d,height:m,direction:f,display:v,visibility:w,style:b,classes:h,borderStyle:I,textStyle:F,baseStyle:S,fillStyle:E,mark:V,id:ce}=this;return{progress:c,width:d,height:m,direction:f,display:v,visibility:w,style:s(b),classes:h,borderStyle:I,textStyle:F,baseStyle:S,fillStyle:E,mark:V,id:ce,...a}},r})}function jd(e,...t){return Ze(n=>{var r,a;const i=e.call(n,n);for(const l of t)(r=l.preConstruct)==null||r.call(l,i);i.formula=i.formula(g.variable(i.baseResource)),i.currentGain==null&&(i.currentGain=C(()=>{let l=o.floor(i.formula.evaluate(i.baseResource.value)).max(0);return s(i.buyMax)===!1&&(l=l.min(1)),l})),i.actualGain==null&&(i.actualGain=i.currentGain),i.currentAt==null&&(i.currentAt=C(()=>i.formula.invert(o.floor(s(i.currentGain))))),i.nextAt==null&&(i.nextAt=C(()=>i.formula.invert(o.floor(s(i.currentGain)).add(1)))),i.convert==null&&(i.convert=function(){var u;const l=s(i.currentGain);i.gainResource.value=o.add(i.gainResource.value,l),i.spend(l),(u=i.onConvert)==null||u.call(i,l)}),i.spend==null&&(i.spend=function(){i.baseResource.value=0}),x(i,"currentGain"),x(i,"actualGain"),x(i,"currentAt"),x(i,"nextAt"),x(i,"buyMax"),ie(i,"buyMax",!0);for(const l of t)(a=l.postConstruct)==null||a.call(l,i);return i})}function zd(e){return jd(e)}const ea=Symbol("Repeatable");function mr(e,...t){const n=ft(0),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return Ze(r=>{var v,w,b;const a=e.call(r,r);a.id=an("repeatable-"),a.type=ea,a[ht]=Xr;for(const h of t)(v=h.preConstruct)==null||v.call(h,a);a.amount=n,a.amount[rn]=(w=a.initialAmount)!=null?w:0,Object.assign(a,i);const l={requirementMet:C(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:ye.None},u=Ji(a);Tt(a.requirements)?(a.requirements.unshift(u),a.requirements.push(l)):a.requirements=[u,a.requirements,l],a.maxed=C(()=>o.gte(a.amount.value,s(a.limit))),x(a,"classes");const c=a.classes;a.classes=C(()=>{const h=s(c)||{};return a.maxed.value&&(h.bought=!0),h}),a.amountToIncrease=C(()=>o.clampMin(Kr(a.requirements),1)),a.canClick=C(()=>hi(a.requirements));const d=a.onClick;a.onClick=function(h){const I=a;!s(I.canClick)||(Qr(a.requirements,s(a.amountToIncrease)),I.amount.value=o.add(I.amount.value,1),d==null||d(h))},x(a,"display");const m=a.display;a.display=K(()=>{var I,F,S;const h=s(m);if(St(h)){const E=se(h);return p(E,null,null)}if(h!=null){const E=a,V=se((I=h.title)!=null?I:"","h3"),ce=se((F=h.description)!=null?F:""),H=se((S=h.effectDisplay)!=null?S:"");return p("span",null,[h.title==null?null:p("div",null,[p(V,null,null)]),h.description==null?null:p(ce,null,null),h.showAmount===!1?null:p("div",null,[p("br",null,null),p(ne,null,[$("Amount: "),vt(E.amount.value)]),o.isFinite(s(E.limit))?p(ne,null,[$(" / "),vt(s(E.limit))]):void 0]),h.effectDisplay==null?null:p("div",null,[p("br",null,null),$("Currently: "),p(H,null,null)]),E.maxed.value?null:p("div",null,[p("br",null,null),bi(E.requirements,s(a.amountToIncrease))])])}return""}),x(a,"visibility"),ie(a,"visibility",ye.Visible),x(a,"limit"),ie(a,"limit",o.dInf),x(a,"style"),x(a,"mark"),x(a,"small");for(const h of t)(b=h.postConstruct)==null||b.call(h,a);const f=t.reduce((h,I)=>{var F;return Object.assign(h,(F=I.getGatheredProps)==null?void 0:F.call(I,a))},{});return a[ot]=function(){const{display:h,visibility:I,style:F,classes:S,onClick:E,canClick:V,small:ce,mark:H,id:z}=this;return{display:h,visibility:I,style:s(F),classes:S,onClick:E,canClick:V,small:ce,mark:H,id:z,...f}},a})}const Ud=Symbol("Reset");function Gd(e){return Ze(t=>{const n=e.call(t,t);return n.id=an("reset-"),n.type=Ud,n.reset=function(){var r;const i=a=>{if(a!=null&&typeof a=="object")if(rn in a){const l=a;l.value=l[rn]}else!(a instanceof o)&&!De(a)&&Object.values(a).forEach(l=>i(l))};s(n.thingsToReset).forEach(i),He.emit("reset",n),(r=n.onReset)==null||r.call(n)},x(n,"thingsToReset"),n})}const ii={};He.on("removeLayer",e=>{var t;(t=ii[e.id])==null||t.call(ii),ii[e.id]=void 0});function Di(e,t){return x(t,"display"),x(t,"classes"),x(t,"style"),x(t,"direction"),ie(t,"direction",G.Up),x(t,"xoffset"),x(t,"yoffset"),t.pinnable&&(t.pinned=ft(!1,!1)),jt(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Or(t.pinned)):e.pinned=t.pinned);const n=e[ht];e[ht]=Pe;const i=e[ot].bind(e);e[ot]=function(){const{display:a,classes:l,style:u,direction:c,xoffset:d,yoffset:m,pinned:f}=this;return{element:{[ht]:n,[ot]:i},display:a,classes:l,style:s(u),direction:c,xoffset:d,yoffset:m,pinned:f}}.bind(t)}),t}var Wd=J({props:{display:{type:R(String,Object,Function),required:!0},visibility:{type:R(Number,Boolean),required:!0},style:R(String,Object,Array),classes:R(Object),requirements:{type:Object,required:!0},canPurchase:{type:R(Boolean),required:!0},bought:{type:R(Boolean),required:!0},mark:R(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:Xn,MarkNode:Yn},setup(e){const{display:t,requirements:n,bought:i}=$e(e),r=gt("");return _t(()=>{const a=Me(t);if(a==null){r.value="";return}if(St(a)){r.value=se(a);return}const l=se(a.title||"","h3"),u=se(a.description,"div"),c=se(a.effectDisplay||"");r.value=se(K(()=>p("span",null,[a.title!=null?p("div",null,[p(l,null,null)]):null,p(u,null,null),a.effectDisplay!=null?p("div",null,[$("Currently: "),p(c,null,null)]):null,i.value?null:p(ne,null,[p("br",null,null),bi(n.value)])])))}),{component:r,unref:s,Visibility:ye,isVisible:Le,isHidden:yn}}});const Hd=["disabled"];function Zd(e,t,n,i,r,a){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(M(),P("button",{key:0,style:Re([{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:pe({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(),ee(We(e.unref(e.component)),{key:0})):L("",!0),p(l,{mark:e.unref(e.mark)},null,8,["mark"]),p(u,{id:e.id},null,8,["id"])],14,Hd)):L("",!0)}var Yd=ue(Wd,[["render",Zd],["__scopeId","data-v-9be6bac0"]]);const Ki=Symbol("Upgrade");function vr(e,...t){const n=ft(!1,!1),i=t.reduce((r,a)=>{var l;return Object.assign(r,(l=a.getPersistentData)==null?void 0:l.call(a))},{});return Ze(r=>{var c,d;const a=e.call(r,r);a.id=an("upgrade-"),a.type=Ki,a[ht]=Yd;for(const m of t)(c=m.preConstruct)==null||c.call(m,a);a.bought=n,Object.assign(a,i),a.canPurchase=C(()=>!n.value&&hi(a.requirements)),a.purchase=function(){var f;const m=a;!s(m.canPurchase)||(Qr(a.requirements),n.value=!0,(f=m.onPurchase)==null||f.call(m))};const l=Ji(a);Tt(a.requirements)?a.requirements.unshift(l):a.requirements=[l,a.requirements],x(a,"visibility"),ie(a,"visibility",ye.Visible),x(a,"classes"),x(a,"style"),x(a,"display"),x(a,"mark");for(const m of t)(d=m.postConstruct)==null||d.call(m,a);const u=t.reduce((m,f)=>{var v;return Object.assign(m,(v=f.getGatheredProps)==null?void 0:v.call(f,a))},{});return a[ot]=function(){const{display:m,visibility:f,style:v,classes:w,requirements:b,canPurchase:h,bought:I,mark:F,id:S,purchase:E}=this;return{display:m,visibility:f,style:s(v),classes:w,requirements:b,canPurchase:h,bought:I,mark:F,id:S,purchase:E,...u}},a})}function Xd(e,t,n=[]){n=n.length===0?Wn(e,Ki):n;const i=Un(t)?C(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 Kd={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"]},hr=[[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=hr[Math.floor(e()*hr.length)];let n="";for(let i=0;i<t.length;i++){const r=Kd[t[i]];n+=r[Math.floor(e()*r.length)]}return tt(n)}const Qd={1:["a","e","i","o","u"],2:["ph","th","ch","sh","br","cr","dr","fr","gr","pr","tr","str","sc","sk","sm","sn","sp","st","sw"],3:["ae","ai","ao","au","ay","ea","ei","eo","eu","ey","ua","ue","ui","uo","uy","ia","ie","iu","io","iy","oa","oe","ou","oi","oy"],4:["morp","flux","syn","void","rift","dyn","nov","chron","lum","par","ter","psy","phan","man","grav","pyr","cry","hydr","elec","kin","nan","omni"],5:["ance","ation","esis","ergy","tide","al","ism","ity","mancy","urgy","pathy","port","shift","burst","pulse","wave","field","storm","force","blade"]},br=[[1,2,1,4,5],[1,4,5],[2,1,4,5],[1,2,3,4,5],[3,4,5]];function kn(e){const t=br[Math.floor(e()*br.length)];let n="";for(let i=0;i<t.length;i++){const r=Qd[t[i]];n+=r[Math.floor(e()*r.length)]}return tt(n)}function Rn(e,t){const[n,i,r]=ef(...e),[a,l,u]=tf(Math.floor(t()*360),i,r);return`rgb(${a*255}, ${l*255}, ${u*255})`}function ef(e,t,n){const i=Math.max(e,t,n),r=i-Math.min(e,t,n),a=r&&(i==e?(t-n)/r:i==t?2+(n-e)/r:4+(e-t)/r);return[60*(a<0?a+6:a),i&&r/i,i]}function tf(e,t,n){const i=(r,a=(r+e/60)%6)=>n-n*t*Math.max(Math.min(a,4-a,1),0);return[i(5),i(3),i(1)]}const yr=gi();function ta(e,t,n,i){return Ui(e,function(){const r=Jd(0,n>>0,n>>32,1);for(let q=0;q<12;q++)r();const a=Ai(r),l=Rn([.64,.75,.55],r),u=Rn([.18,.2,.25],r),c=Mn(0,Ai(r)),d=ft(0),m=un.indexOf(t);let f=r();const v=i.reduce((q,j)=>(q[j.type]=j.data,q),{});"increaseDiff"in v&&(f=f/2+.5),"decreaseDiff"in v&&(f=f/2),"relic"in v&&(f=1);const w=f+m+1,b="increaseRewards"in v?w+1:w;let h="relic"in v?m+2:Math.ceil(r()*(m+2));"increaseLength"in v&&h++;const I=[],F=$t(()=>[...I,Oe(()=>({multiplier:()=>N.isEmpowered("silver")?4:2,description:()=>(N.isEmpowered("silver")?"Empowered ":"")+Te.silver.name,enabled:()=>N.toolNodes.value.silver!=null})),Oe(()=>({multiplier:()=>(N.isEmpowered("diamond")?2:1)*Qe.filter(q=>q.bought.value).length/10,description:()=>(N.isEmpowered("diamond")?"Empowered ":"")+Te.diamond.name,enabled:()=>N.toolNodes.value.diamond!=null})),Oe(()=>({multiplier:()=>o.div(d.value,6e3).times(N.isEmpowered("emerald")?2:1).add(1),description:()=>(N.isEmpowered("emerald")?"Empowered ":"")+Te.emerald.name,enabled:()=>N.toolNodes.value.emerald!=null}))]),S=C(()=>F.apply(0)),E=[],V={};function ce({feature:q,canClick:j,modifier:_e,cost:Ye,previewModifier:sn,showETA:it,previewCost:Dt}){j=ve(j),it=ve(it);const T=pr(q);E.push({shouldShowPreview:C(()=>s(j)&&T.value),modifier:$t(()=>{const Z=I.slice();return Z.splice(Z.indexOf(_e),1,sn),Z}),cost:Dt!=null?Dt:Ye}),I.push(_e);const D=Pi(c,S,()=>we(Ye)),O=Di(q,{display:it==null?D:()=>s(it)?D.value:"",direction:G.Down});return{isHovering:T,eta:D,tooltip:O}}const H=[],z=B(0);let U=g.variable(z).times(0);const qe={};let Ke=!0;const Y=C(()=>o.add(w,r()-.5).pow_base(2).times(10).times(U.evaluate())),Ce=[];for(let q=0;q<h;q++){const j={upgrades:32,repeatables:q<=1?0:16,conversion:q<=3?0:8,xp:q<=5?0:4,dimensions:q<=7?0:2,prestige:q<=7||q>=h-1?0:1};switch(ri(j,r)){case"upgrades":const At=[];for(let Ie=0;Ie<4;Ie++){const ut=ri({add:1,mult:q===0&&Ie===0?0:1,pow:q===0?0:.5},r),Xe=Y.value,et=kn(r);let at="",Ee,Ne;const xe=z.value;switch(ut){case"add":{const le=o.add(Xe,10).pow(r()/4+.875);at=`Gain ${me(le)} ${c.displayName}/s`,U=U.add(le),Ee=pn(()=>({addend:le,description:et,enabled:Ve.bought})),Ne=pn(()=>({addend:le}));break}case"mult":{const le=r()*5+1;at=`Multiply previous ${c.displayName} gain by x${me(le)}.`,U=U.add(o.sub(le,1).times(qe[xe-1])),Ee=Oe(()=>({multiplier:le,description:et,enabled:Ve.bought})),Ne=Oe(()=>({multiplier:le}));break}case"pow":{const le=r()/10+1.05;at=`Raise previous ${c.displayName} gain to the ^${me(le)}`,U=U.add(o.pow(qe[xe-1],le)).sub(qe[xe-1]),Ee=Ei(()=>({exponent:le,description:et,enabled:Ve.bought})),Ne=Ei(()=>({exponent:le}))}}qe[z.value]=U.evaluate(),z.value++;const je=Ke,Ve=vr(()=>({requirements:On(()=>({resource:Nn(c),cost:Xe})),display:{title:et,description:at},visibility:je}));ce({feature:Ve,canClick:()=>Ve.canPurchase.value,modifier:Ee,cost:Xe,showETA:()=>!Ve.bought.value,previewModifier:Ne}),At.push(Ve)}H.push(At);break;case"repeatables":const Ft=[];for(let Ie=0;Ie<3;Ie++){const ut=ri({add:1.5,mult:3},r),Xe=z.value,et=Y.value,at=kn(r);let Ee="",Ne,xe,je,Ve;const le=g.variable(C(()=>Ge.amount.value)).times(2);switch(ut){case"add":{const ke=o.add(et,10).times(r()+.5);Ee=`Gain ${me(ke)} ${c.displayName}/s`,Ve=le.add(1).times(et),U=U.add(C(()=>o.sub(z.value,Xe).add(1).times(5).times(ke))),Ne=C(()=>me(o.times(ke,Ge.amount.value))+"/s"),xe=pn(()=>({addend:()=>o.times(ke,Ge.amount.value),description:at,enabled:()=>o.gt(Ge.amount.value,0)})),je=pn(()=>({addend:()=>o.add(Ge.amount.value,1).times(ke)}));break}case"mult":{const ke=r()*.75+1.25;Ee=`Multiply previous ${c.displayName} gain by x${me(ke)}.`,Ve=le.pow_base(ke).times(et),U=U.add(C(()=>o.sub(z.value,Xe).add(1).times(5).pow_base(ke).sub(1).times(qe[Xe-1]))),Ne=C(()=>"x"+me(o.pow(ke,Ge.amount.value))),xe=Oe(()=>({multiplier:()=>o.pow(ke,Ge.amount.value),description:at,enabled:()=>o.gt(Ge.amount.value,0)})),je=Oe(()=>({multiplier:()=>o.add(Ge.amount.value,1).pow_base(ke)}));break}}qe[z.value]=U.evaluate(),z.value++;const qt=Ke,Ge=mr(()=>({requirements:On(()=>({resource:Nn(c),cost:Ve})),display:()=>({title:at,description:Ee,effectDisplay:s(Ne)}),visibility:qt}));ce({feature:Ge,canClick:()=>s(Ge.canClick),modifier:xe,cost:Ve,previewModifier:je}),Ft.push(Ge)}H.push(Ft);break;case"conversion":const Fe=Mn(0,Ai(r)),Ot=Rn([.64,.75,.55],r),Fn=Y.value,na=r()/2+.25,er=r()/2+.25,tr=z.value;U=U.add(C(()=>o.sub(z.value,tr).add(1).pow_base(5).pow(er).times(qe[tr-1])));const Rt=zd(()=>({baseResource:Nn(c),gainResource:Fe,formula:Ie=>Ie.div(Fn).pow(na),spend(){c.value=0}}));qe[z.value]=U.evaluate(),z.value+=2;const ia=Ke,nr=kn(r),Mi=g.variable(Fe).pow(er).add(1),ra=Oe(()=>({multiplier:()=>Mi.evaluate(),description:nr,enabled:()=>o.gt(Fe.value,0)})),aa=Oe(()=>({multiplier:()=>Mi.evaluate(o.add(Fe.value,Rt.actualGain.value))})),_n=_d(()=>({display:{title:nr,description:K(()=>p("span",null,[$("Reset "),c.displayName,$(" for")," ",di(Fe,o.clampMin(Rt.actualGain.value,1))," ",Fe.displayName,p("br",null,null),p("div",null,[$("Next:")," ",di(c,o.lt(Rt.actualGain.value,1)?Rt.currentAt.value:Rt.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(Rt.actualGain.value,1),prestigeResource:Fe,onClick:Rt.convert,visibility:ia})),{isHovering:sa}=ce({feature:_n,canClick:()=>s(_n.canClick),modifier:ra,cost:Fn,previewCost:c,previewModifier:aa}),ir=C(()=>sa.value&&_n.canClick.value);H.push([_n]);const oa=cn(g.variable(Fe),ir,Rt.actualGain),la=cn(Mi,ir,Rt.actualGain);V[q*2]=K(()=>p(ne,null,[Le(_n.visibility)?p("div",{style:"margin: 10px"},[$("You have")," ",p("h2",{style:{color:Ot,textShadow:`0px 0px 10px ${Ot}`}},[oa()])," ",Fe.displayName,$(","),p("br",null,null),$("providing a "),la(),$("x multiplier to previous")," ",c.displayName,$(" gain")]):null,$i(_n)]));break;case"xp":{const Ie=Mn(0),rt=Ke,ut=z.value,Xe=kn(r),et=o.add(w,r()-.5).pow_base(2).times(10),at=r()/4+1.125,Ee=r()/2+1.25,Ne=g.variable(0).pow(at).times(et),xe=Wr(Ne,Ie,!0,10,o.dInf),je=C(()=>Lt(Ne,xe.value,!0,10)),Ve=C(()=>Lt(Ne,o.add(xe.value,1),!0,10)),le=C(()=>o.pow(Ee,xe.value)),qt=Oe(()=>({multiplier:le,description:Xe,enabled:()=>Le(ke.visibility)}));U=U.add(C(()=>o.sub(z.value,ut).add(1).sqrt().times(3).pow(Ee).times(qe[ut-1]))),qe[z.value]=U.evaluate(),z.value+=2;const Ge=Rn([.18,.2,.25],r),ke=Ld(()=>({direction:G.Right,width:300,height:20,progress:()=>o.sub(Ie.value,je.value).div(o.sub(Ve.value,je.value)).toNumber(),visibility:rt,xp:Ie,display:K(()=>p("span",null,[me(Ie.value),$("/"),me(Ve.value)])),fillStyle:`background-color: ${Ge}`}));this.on("preUpdate",Si=>{if(lt.value.length<h&&N.activePortals.value.some(yt=>yt.state.id===e)&&Le(ke.visibility)){const yt=o.times(Ue.value,Si);Ie.value=o.add(yt,Ie.value)}}),I.push(qt),H.push([ke]),V[q*2]=K(()=>p(ne,null,[Le(ke.visibility)?p("div",{style:"margin: 10px"},[$("You have "),p("h3",null,[Xe]),$(" Lv. "),vt(xe.value),$(","),p("br",null,null),$("providing a "),me(le.value),$("x multiplier to previous")," ",c.displayName,$(" gain"),p("br",null,null)]):null,$i(ke)]));break}case"dimensions":{const Ie=kn(r),rt=Mn(0,Ie+" energy"),ut=Rn([.64,.75,.55],r),Xe=z.value;U=U.add(C(()=>o.sub(z.value,Xe).add(1).pow_base(32).add(1).log2().add(1).times(qe[Xe-1])));const et=C(()=>o.add(rt.value,1).log2().add(1)),at=Oe(()=>({multiplier:et,description:Ie,enabled:()=>o.gt(rt.value,0)}));I.push(at);const Ee=Ke,Ne=[];for(let xe=0;xe<4;xe++){const je=o.add(w,r()-.5).pow_base(2).times(10).recip(),Ve=Y.value,le=g.variable(C(()=>yt.amount.value)),qt=le.pow_base(o.pow10(xe+1)).times(Ve),Ge=["First","Second","Third","Fourth"][xe]+" "+Ie+" Dimension",ke=Mn(0,Ge),Si=le.sub(1).pow_base(2).times(je).times(C(()=>o.add(yt.amount.value,ke.value))),yt=mr(()=>({display:{title:Ge,description:K(()=>p("div",null,[p("div",null,[$("Amount:")," ",me(o.add(ke.value,yt.amount.value))," ",$("["),vt(yt.amount.value),$("]")])])),effectDisplay:K(()=>p("span",null,[da()," ",xe===0?rt.displayName:Ne[Ne.length-1].display.title,$("/s")])),showAmount:!1},style:{width:"400px"},effect:Si,dimensions:ke,energy:xe===0?rt:void 0,requirements:On(()=>({resource:Nn(c),cost:qt})),visibility:Ee}));Ne.push(yt);const ua=pr(yt),rr=C(()=>s(yt.canClick)&&ua.value),ca=new g({inputs:[le],evaluate(ar){return o.sub(ar,1).pow_base(2).times(je).times(o.add(ar,ke.value))}}),da=cn(ca,rr);E.push({shouldShowPreview:rr,cost:qt});const fa=Pi(c,S,()=>we(qt));Di(yt,{display:fa,direction:G.Down}),qe[z.value]=U.evaluate(),z.value++}this.on("preUpdate",xe=>{if(lt.value.length<h&&N.activePortals.value.some(je=>je.state.id===e)&&Le(Ee)){const je=o.times(Ue.value,xe),Ve=Ne[0].effect.evaluate();rt.value=o.times(Ve,je).add(rt.value);for(let le=1;le<4;le++){const qt=Ne[le].effect.evaluate();Ne[le-1].dimensions.value=o.times(qt,je).add(Ne[le-1].dimensions.value)}}}),H.push(Ne),V[q*2]=K(()=>p(ne,null,[Le(Ee)?p("div",{style:"margin: 10px"},[$("You have")," ",p("h2",{style:{color:ut,textShadow:`0px 0px 10px ${ut}`}},[me(rt.value)])," ",rt.displayName,$(","),p("br",null,null),$("providing a "),me(et.value),$("x multiplier to previous")," ",c.displayName,$(" gain")]):null,Rs(...Ne)]));break}case"prestige":{const Ie=kn(r),rt=Ke,ut=r()/2+1.25,Xe=Y.value;U=U.pow(ut);const et=Ei(()=>({exponent:ut,description:Ie,enabled:Ee.bought}));qe[z.value]=U.evaluate(),z.value++;const at=Gd(()=>({thingsToReset:H.filter((xe,je)=>je%2===0),onReset(){c.value=0}})),Ee=vr(()=>({display:{title:Ie,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${me(ut)}`},style:{width:"200px",minHeight:"100px"},onPurchase:at.reset,visibility:rt,requirements:On(()=>({resource:Nn(c),cost:Xe}))})),Ne=Oe(()=>({multiplier:0}));ce({feature:Ee,canClick:()=>s(Ee.canPurchase),modifier:et,cost:Xe,previewCost:c,previewModifier:Ne,showETA:()=>!s(Ee.bought)}),H.push([Ee]);break}}const Ye={cache:"increaseCaches"in v?10:1,generation:"increaseGens"in v?10:1,resourceMulti:"increaseResourceMults"in v?10:1,energyMulti:"increaseEnergyMults"in v?2.5:.25,influences:Object.keys(N.influenceNodes.value).length+Ce.length===Object.keys(Vt).length?0:"increaseInfluences"in v?20:2,relic:0};let sn=ri(Ye,r);q===h-1&&"relic"in v&&(sn="relic");let it="",Dt,T,D,O,Z,oe;switch(sn){case"cache":O=Fi(r,i),it=`Gain ${me(b)}x your current ${O}.`,T=()=>{var Fe,Ot,Fn;return N.grantResource(O,o.times((Fn=(Ot=(Fe=N.resourceNodes.value[O])==null?void 0:Fe.state)==null?void 0:Ot.amount)!=null?Fn:0,b))};break;case"generation":O=Fi(r,i);const At=o.div(b,120).times(Mt[O]);it=`Gain ${me(At)} ${O}/s while plane is active.`,Dt=Fe=>N.grantResource(O,o.times(Fe,At)),D=C(()=>N.resourceNodes.value[O]);break;case"resourceMulti":Z=O=Fi(r,i),oe=o.div(b,17).pow_base(2),it=`Gain ${me(oe)}x ${O} while plane is active.`;break;case"energyMulti":Z="energy",oe=o.div(b,17).add(1),it=`Gain ${me(oe)}x energy while plane is active.`;break;case"influences":const Ft=Object.keys(Vt)[Math.floor(r()*Object.keys(Vt).length)];Ce.push(Ft),it=`Gain a new portal influence (${Vt[Ft].display})`,T=()=>{if(Ft in N.influenceNodes.value){yr.warning(`Error: ignoring duplicate portal influence (${Vt[Ft].display})`);return}const Fe={id:Zn(N.board),position:{...N.board.types.portal.nodes.value.find(Ot=>Ot.state.id===e).position},type:"influence",state:{type:Ft,data:Vt[Ft].initialData}};N.board.placeInAvailableSpace(Fe),N.board.nodes.value.push(Fe)};break;case"relic":it=t==="ultimatum"?"Win the game!":`Gain the ${t}-tier planar relic (${fi[t]})`,T=()=>{if(t==="ultimatum"){Qi.value=!0;return}if(`${t}Relic`in N.toolNodes.value)yr.warning(`Error: ignoring duplicate relic (${fi[t]})`);else{const Fe={id:Zn(N.board),position:{...N.board.types.portal.nodes.value.find(Ot=>Ot.state.id===e).position},type:"passive",state:`${t}Relic`};N.board.placeInAvailableSpace(Fe),N.board.nodes.value.push(Fe)}}}const ge=Ke,Yt=Y.value,xt=Fd(()=>({requirements:On(()=>({resource:Nn(c),cost:Yt})),visibility:ge,display:{requirement:`${me(Yt)} ${c.displayName}`,effectDisplay:it},style:"width: 100%",classes:{final:q===h-1},update:Dt,onComplete:T,link:D,effectedResource:Z,resourceMulti:oe})),Xt=Pi(c,S,Yt);Di(xt,{display:()=>xt.earned.value?"":Xt.value,direction:G.Down}),H.push([xt]),Ke=xt.earned}const Qe=Wn(H,Ki),kt=Wn(H,ea),Ht=$t(()=>[Oe(()=>({multiplier:()=>{var q,j,_e;return o.add((_e=(j=(q=N.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:j.level)!=null?_e:0,1)},description:"Booster",enabled:()=>{var q,j,_e;return(_e=(j=(q=N.board.types.booster.nodes.value[0])==null?void 0:q.state)==null?void 0:j.portals.includes(e))!=null?_e:!1}}))]),Ue=C(()=>Ht.apply(1)),[Kn,Qn]=Ln(()=>[{title:`${tt(c.displayName)} Gain`,modifier:F,base:0,unit:"/s"},{title:`${tt(c.displayName)} Time Speed`,modifier:Ht,base:1,visible:()=>o.gt(Ue.value,1)}]),It=B(!1),An=K(()=>p(Ut,{modelValue:It.value,"onUpdate:modelValue":q=>It.value=q},{header:()=>p("h2",null,[$("Modifiers")]),body:()=>nt(Kn)}));this.on("preUpdate",q=>{if(!N.activePortals.value.some(_e=>_e.state.id===e))return;const j=o.times(Ue.value,q);d.value=o.add(d.value,j),lt.value.length<h&&(c.value=o.times(S.value,j).add(c.value)),lt.value.forEach(_e=>{var Ye;(Ye=_e.update)==null||Ye.call(_e,j)})}),Xd(this,()=>lt.value.length<h&&N.upgrader.value!=null&&he(N.upgrader.value)&&N.upgrader.value.state.portals.includes(e),Qe),Nd(this,()=>lt.value.length<h&&N.automator.value!=null&&he(N.automator.value)&&N.automator.value.state.portals.includes(e),kt);const ei=C(()=>{const q=E.find(j=>j.shouldShowPreview.value);return q?o.neg(we(q.cost)):0}),ti=C(()=>{const q=E.find(j=>j.shouldShowPreview.value);return q&&q.modifier?o.sub(q.modifier.apply(0),S.value):0}),wi=cn(g.variable(0).add(c),()=>o.neq(ei.value,0),ei),_i=cn(g.variable(0).add(S),()=>o.neq(ti.value,0),ti),Ni=C(()=>{const q=[];return lt.value.forEach(j=>{j.link&&q.push(j.link)}),q}),Ci=C(()=>{const q={};return lt.value.forEach(j=>{j.effectedResource!=null&&j.resourceMulti!=null&&(q[j.effectedResource]!=null?q[j.effectedResource]=o.times(q[j.effectedResource],j.resourceMulti):q[j.effectedResource]=j.resourceMulti)}),q}),lt=C(()=>{const q=[];for(let j=1;j<H.length;j+=2){const _e=H[j][0];_e.earned.value&&q.push(_e)}return q}),ki=C(()=>o.lt(lt.value.length,h)&&H.some(q=>q.some(j=>"earned"in j&&s(j.earned)||"bought"in j&&s(j.bought)?!1:("canClick"in j&&s(j.canClick)||"canPurchase"in j&&s(j.canPurchase),!0)))),Zt=C(()=>{const q=H.findIndex((_e,Ye)=>Ye>0&&Ye%2===0&&!H[Ye-1][0].earned.value);let j;return q===-1?j=H:j=H.slice(0,q),j.map((_e,Ye)=>Ye in V?nt(V[Ye]):$i(..._e))});return{tier:ft(t),seed:ft(n),influences:ft(i),name:a,color:l,resource:c,background:u,style:{background:u,"--background":u},features:H,resourceTabCollapsed:Qn,links:Ni,resourceMultis:Ci,earnedTreasures:lt,showNotif:ki,timeActive:d,display:K(()=>p(ne,null,[p(ci,{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(Pe,{display:i.map(q=>{const j=Vt[q.type].description;return typeof j=="function"?j(q):j}).join("<br/>"),direction:G.Down,style:"width: 300px"},{default:()=>[p("h3",null,[i.length,$(" influences")])]})]),p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>It.value=!0},[$("modifiers")])])]}),p(ci,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[nt(wi)])," ",c.displayName]),p("span",{class:"nav-segment"},[$("("),p("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[o.gt(S.value,0)?"+":"",nt(_i)]),$("/s)")]),o.neq(Ue.value,1)?p("span",{class:"nav-segment"},[$("Speed: "),me(Ue.value),$("x")]):null]}),p(xd,{height:"60px"},null),Zt.value,nt(An)])),minimizedDisplay:K(()=>p("div",null,[p("span",null,[a]),p("span",{style:"font-size: large; vertical-align: sub;"},[" ",lt.value.length,$("/"),h,$(" treasures")])]))}})}function Fi(e,t){t=t.filter(u=>u.type==="increaseResources"||u.type==="decreaseResources");const n=Object.keys(Mt).reduce((u,c)=>{let d=Mt[c];return t.filter(m=>m.data===c).forEach(m=>{m.type==="increaseResources"?d*=1e3:d/=1e3}),u+d},0),i=Object.keys(Mt),r=Math.floor(e()*n);let a=0,l;for(let u=0;u<i.length;u++){const c=i[u];if(a+=Mt[c],r<a){l=c;break}}return l}function ri(e,t){const n=Object.values(e).reduce((u,c)=>u+c),i=Object.keys(e);let r=0,a=null;const l=t()*n;for(let u=0;u<i.length;u++){const c=i[u];if(r+=e[c],l<r){a=c;break}}if(a==null)throw new Error("Failed to pick random. This should not happen");return a}const nf={shape:ze.Diamond,size:50,title:"\u{1FAA8}",label:e=>e===N.board.selectedNode.value?{text:"Mining"}:Object.keys(N.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[Wt],progress:e=>he(e)?new o(e.state.progress).toNumber():0,progressDisplay:vn.Outline,progressColor:"var(--accent2)",classes:e=>({running:he(e)}),draggable:!0},rf={shape:ze.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===N.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(N.energy.value,100)&&(e.type="factory",N.energy.value=o.sub(N.energy.value,100))},confirmationLabel:()=>o.gte(N.energy.value,1e3)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},af={shape:ze.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===N.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${Te[e.state].name}`};if(((t=N.board.draggingNode.value)==null?void 0:t.type)==="resource"){const i=((n=N.board.draggingNode.value)==null?void 0:n.state).type,r=e.state===i?"Disconnect":Te[i].name,a=e.state===i||o.gte(N.energy.value,Te[i].cost)&&N.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,N.board.selectedAction.value=null,N.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${Te[e.state].name} - ${Je(Te[e.state].cost)} energy`}),onClick(e){const t=Te[e.state];if(o.gte(N.energy.value,t.cost)&&N.toolNodes.value[e.state]==null){N.energy.value=o.sub(N.energy.value,t.cost);const n={id:Zn(N.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};N.board.placeInAvailableSpace(n),N.board.nodes.value.push(n),N.board.selectedAction.value=null,N.board.selectedNode.value=null,e.state=void 0}},fillColor:e=>o.gte(N.energy.value,Te[e.state].cost)&&N.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(N.energy.value,Te[e.state].cost)?N.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}}],progress:e=>e.state==null||N.toolNodes.value[e.state]!=null?0:o.div(N.energy.value,Te[e.state].cost).clampMax(1).toNumber(),progressDisplay:vn.Fill,progressColor:e=>e.state!=null&&o.gte(N.energy.value,Te[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){return t.type==="resource"},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,N.board.selectedNode.value=e},draggable:!0},sf={shape:ze.Circle,size:50,title:e=>tt(e.state.type),subtitle:e=>Je(e.state.amount),progress:e=>pd(e.state.type),onClick(){},progressDisplay:vn.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":N.dowsing.value!=null&&he(N.dowsing.value)&&N.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=N.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0},of={shape:ze.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?fi[t.slice(0,-5)]:Te[t].name},label:e=>e===N.board.selectedNode.value?{text:Id[e.state].description(ct(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":ct(e.state)}),draggable:!0},lf={shape:ze.Diamond,size:50,title:"\u{1F962}",label:e=>e===N.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,N.computedBonusConnectionsModifier.value)})`}:Hr(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[vi,Dn(e=>e.add(2).pow_base(100),16),Wt],classes:e=>({running:he(e)}),canAccept:Zr,onDrop:Yr,draggable:!0},uf={shape:ze.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===N.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,N.computedBonusConnectionsModifier.value)})`}:Hr(e,t=>`Gather ${mt(o.div(N.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[vi,Dn(e=>e.add(2).pow_base(1e4),16),Wt],progress:e=>he(e)?o.eq(N.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(N.quarryProgressRequired.value).toNumber():0,progressDisplay:vn.Outline,progressColor:"var(--accent2)",canAccept:Zr,onDrop:Yr,classes:e=>({running:he(e)}),draggable:!0},cf={shape:ze.Diamond,size:50,title:"\u{1F50C}",label:e=>e===N.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,N.computedBonusConnectionsModifier.value)})`}:cd(e,t=>t.includes("Relic")?`Double ${fi[t.slice(0,-5)]}'s effect`:`Double ${Te[t].name}'s effect`),actionDistance:Math.PI/4,actions:[vi,Dn(e=>e.add(3).pow_base(1e3),16),Wt],canAccept:dd,onDrop:fd,classes:e=>({running:he(e)}),draggable:!0},df={shape:ze.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===N.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=N.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${tt(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type,{influences:i}=e.state;return i.includes(n)?{text:"Disconnect",color:"var(--accent2)"}:{text:"Add influence",color:"var(--accent2)"}}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:[]},N.board.selectedAction.value=null,N.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`}),onClick(e){let t=0;for(;`portal-${t}`in be;)t++;const{tier:n,influences:i}=e.state;Gi(ta(`portal-${t}`,n,Math.floor(Math.random()*4294967296),i.map(a=>N.influenceNodes.value[a].state)),Q);const r={id:Zn(N.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};N.board.placeInAvailableSpace(r),N.board.nodes.value.push(r),N.board.selectedAction.value=null,N.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"},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]}}N.board.selectedNode.value=e},draggable:!0},ff={shape:ze.Diamond,size:50,title:"\u{1F300}",label:e=>e===N.board.selectedNode.value?{text:`Portal to ${be[e.state.id].name}`,color:be[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[Wt],classes:e=>({running:he(e),showNotif:be[e.state.id].showNotif.value,"affected-node":N.booster.value!=null&&he(N.booster.value)&&N.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>be[e.state.id].background,draggable:!0},pf={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?ze.Diamond:ze.Circle,size:50,title:e=>Vt[e.state.type].display,label:e=>{if(e===N.board.selectedNode.value){const n=e.state,i=Vt[n.type].description;return{text:typeof i=="function"?i(n):i}}const t=N.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 ${tt(n)} odds`;else if(i==="decreaseResources")a=`Decrease ${tt(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[vi],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]},N.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},gf={shape:ze.Diamond,size:50,title:"\u231B",label:e=>e===N.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${Je(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,N.computedBonusConnectionsModifier.value)})`}:Zi(e,t=>`Boost ${be[t].name}'s speed`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(e){e.state={...e.state,portals:[]},N.board.selectedAction.value=null,N.board.selectedNode.value=null},visibility:e=>{var t,n;return(n=(t=e.state)==null?void 0:t.portals.length)!=null?n:0>0}},Dn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${Je(Ti.evaluate(e.state.level))} energy`}},confirmationLabel(e){return o.gte(N.energy.value,Ti.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=Ti.evaluate(e.state.level);o.gte(N.energy.value,t)&&(N.energy.value=o.sub(N.energy.value,t)),e.state={...e.state,level:o.add(e.state.level,1)},N.board.selectedAction.value=null}},Wt],canAccept:Yi,onDrop:Xi,classes:e=>({running:he(e)}),draggable:!0},mf={shape:ze.Diamond,size:50,title:"\u{1F916}",label:e=>e===N.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,N.computedBonusConnectionsModifier.value)})`}:Zi(e,t=>`Auto-buy ${be[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(e){e.state={...e.state,portals:[]},N.board.selectedAction.value=null,N.board.selectedNode.value=null},visibility:e=>{var t,n;return(n=(t=e.state)==null?void 0:t.portals.length)!=null?n:0>0}},Dn(e=>e.add(4).pow_base(1e6)),Wt],canAccept:Yi,onDrop:Xi,classes:e=>({running:he(e)}),draggable:!0},vf={shape:ze.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===N.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,N.computedBonusConnectionsModifier.value)})`}:Zi(e,t=>`Auto-buy ${be[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect portals"},onClick(e){e.state={...e.state,portals:[]},N.board.selectedAction.value=null,N.board.selectedNode.value=null},visibility:e=>{var t,n;return(n=(t=e.state)==null?void 0:t.portals.length)!=null?n:0>0}},Dn(e=>e.add(4).pow_base(1e6)),Wt],canAccept:Yi,onDrop:Xi,classes:e=>({running:he(e)}),draggable:!0},wr=gi(),hf={mine:nf,brokenFactory:rf,factory:af,resource:sf,passive:of,dowsing:lf,quarry:uf,empowerer:cf,portalGenerator:df,portal:ff,influence:pf,booster:gf,upgrader:mf,automator:vf},N=Ui("main",function(){const e=Mn(0,"energy"),t=C(()=>f.types.resource.nodes.value.reduce((T,D)=>(T[D.state.type]=D,T),{})),n=C(()=>({...f.types.passive.nodes.value.reduce((T,D)=>(T[D.state]=D,T),{}),sand:f.types.dowsing.nodes.value[0],wood:f.types.quarry.nodes.value[0],coal:f.types.empowerer.nodes.value[0],iron:f.types.portalGenerator.nodes.value[0],gold:f.types.booster.nodes.value[0],platinum:f.types.upgrader.nodes.value[0],berylium:f.types.automator.nodes.value[0]})),i=C(()=>({...f.types.influence.nodes.value.reduce((T,D)=>(T[D.state.type]=D,T),{})})),r=C(()=>({...f.types.portal.nodes.value.reduce((T,D)=>(T[D.state.id]=D,T),{})})),a=C(()=>un.reduce((T,D)=>{var ge,Yt,xt;const O=(xt=(Yt=(ge=t.value[D])==null?void 0:ge.state)==null?void 0:Yt.amount)!=null?xt:0;let Z=o.floor(jn.invertIntegral(O)).sub(10).clampMin(0),oe=Lt(jn,Z,!0,0);for(;;){const Xt=jn.evaluate(Z);if(o.add(oe,Xt).lte(O))Z=Z.add(1),oe=o.add(oe,Xt);else break}return T[D]=Z,T},{})),l=mn({}),u=mn({});jt(()=>{un.forEach(T=>{pt(()=>a.value[T],(D,O)=>{o.gt(D,O)&&re.active===Q.id&&o.lte(D,100)&&wr.info(p("div",null,[p("h3",null,[o.eq(D,1)?`${tt(T)} discovered`:`${tt(T)} is now Level ${vt(D)}`,$("!")]),p("div",null,[$("Energy gain is now 1.01x higher.")])]))})})});const c=C(()=>ce.filter(T=>{var D,O;return(O=(D=T.value)==null?void 0:D.state)==null?void 0:O.powered}).length+f.types.portal.nodes.value.filter(T=>T.state.powered).length),d=C(()=>o.eq(c.value,0)?10:o.add(c.value,1).pow_base(100).div(10).times(.99)),m=C(()=>h.value==null?0:h.value.state.resources.reduce((D,O)=>o.div(100,It[O].computedModifier.value).add(D),o.dZero)),f=Iu(T=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:hf,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const D=[];if(D.push(...Object.keys(l).map(O=>({startNode:v.value,endNode:t.value[O],stroke:"var(--accent3)",strokeWidth:5}))),w.value!=null&&w.value.state!=null&&D.push({startNode:w.value,endNode:t.value[w.value.state],stroke:"var(--foreground)",strokeWidth:4}),b.value!=null&&b.value.state.resources.forEach(O=>{D.push({startNode:b.value,endNode:t.value[O],stroke:he(b.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),h.value!=null&&h.value.state.resources.forEach(O=>{D.push({startNode:h.value,endNode:t.value[O],stroke:"var(--foreground)",strokeWidth:4})}),D.push(...Object.keys(u).map(O=>({startNode:h.value,endNode:t.value[O],stroke:"var(--accent3)",strokeWidth:5}))),I.value!=null&&I.value.state.tools.forEach(O=>{D.push({startNode:I.value,endNode:n.value[O],stroke:he(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),F.value!=null){const O=F.value.state;O.tier!=null&&D.push({startNode:F.value,endNode:t.value[O.tier],stroke:"var(--foreground)",strokeWidth:4}),O.influences.forEach(Z=>{D.push({startNode:F.value,endNode:i.value[Z],stroke:"var(--foreground)",strokeWidth:4})}),T.types.portal.nodes.value.forEach(Z=>{const oe=be[Z.state.id];return oe.links.value.forEach(ge=>{ge.value!=null&&D.push({startNode:Z,endNode:ge.value,stroke:he(Z)?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),Object.keys(oe.resourceMultis.value).forEach(ge=>{ge!=="energy"&&ge in t.value&&D.push({startNode:Z,endNode:t.value[ge],stroke:he(Z)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),D})}return S.value!=null&&S.value.state.portals.forEach(O=>{D.push({startNode:S.value,endNode:r.value[O],stroke:he(S.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),E.value!=null&&E.value.state.portals.forEach(O=>{D.push({startNode:E.value,endNode:r.value[O],stroke:"var(--foreground)",strokeWidth:4})}),V.value!=null&&V.value.state.portals.forEach(O=>{D.push({startNode:V.value,endNode:r.value[O],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(i.value).forEach(O=>{const Z=O.state;(Z.type==="increaseResources"||Z.type==="decreaseResources")&&Z.data.forEach(oe=>{D.push({startNode:O,endNode:t.value[oe],stroke:"var(--foreground)",strokeWidth:4})})}),D}})),v=C(()=>f.types.mine.nodes.value[0]),w=C(()=>f.types.factory.nodes.value[0]),b=C(()=>n.value.sand),h=C(()=>n.value.wood),I=C(()=>n.value.coal),F=C(()=>n.value.iron),S=C(()=>n.value.gold),E=C(()=>n.value.platinum),V=C(()=>n.value.berylium),ce=[v,b,h,I,S,E,V];function H(T,D){let O=t.value[T];if(D=o.times(D,An[T].computedModifier.value),O==null)O={id:Zn(f),position:{...v.value.position},type:"resource",state:{type:T,amount:D}},f.placeInAvailableSpace(O),f.nodes.value.push(O);else{const Z=O.state;O.state={...Z,amount:o.add(Z.amount,D)}}}const z=C(()=>Object.keys(Mt).reduce((T,D)=>T+new o(It[D].computedModifier.value).toNumber(),0)),U=C(()=>{const T={};return f.types.portal.nodes.value.forEach(D=>{if(!he(D))return;const Z=be[D.state.id].resourceMultis.value;Object.keys(Z).forEach(oe=>{T[oe]!=null?T[oe]=o.times(T[oe],Z[oe]):T[oe]=Z[oe]})}),T}),qe=$t(()=>[...un.map(T=>Oe(()=>({description:()=>`${tt(T)} (Lv. ${vt(a.value[T])}) (${me(Qn.value)}x per level)`,multiplier:()=>o.pow(Qn.value,a.value[T]),enabled:()=>{var D,O;return T in t.value&&o.gt((O=(D=t.value[T].state)==null?void 0:D.amount)!=null?O:0,0)}}))),Oe(()=>({multiplier:()=>ct("stone")?4:2,description:()=>(ct("stone")?"Empowered ":"")+Te.stone.name,enabled:()=>n.value.stone!=null})),Oe(()=>({multiplier:()=>{var T;return(T=U.value.energy)!=null?T:1},description:"Planar Treasures",enabled:()=>{var T;return o.neq((T=U.value.energy)!=null?T:1,1)}})),pn(()=>({addend:()=>o.pow(100,c.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(c.value,0)}))]),Ke=C(()=>qe.apply(1)),Y=$t(()=>[pn(()=>({addend:()=>ct("unobtainium")?2:1,description:()=>(ct("unobtainium")?"Empowered ":"")+Te.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),Ce=C(()=>Y.apply(0)),Qe=$t(()=>[Oe(()=>({multiplier:()=>ct("dirt")?4:2,description:()=>(ct("dirt")?"Empowered ":"")+Te.dirt.name,enabled:()=>n.value.dirt!=null}))]),kt=C(()=>Qe.apply(1)),Ht=$t(()=>[Oe(()=>({multiplier:()=>ct("gravel")?4:2,description:()=>(ct("gravel")?"Empowered ":"")+Te.gravel.name,enabled:()=>n.value.gravel!=null}))]),Ue=C(()=>Ht.apply(1)),Kn=$t(()=>[pn(()=>({addend:()=>ct("copper")?.002:.001,description:()=>(ct("copper")?"Empowered ":"")+Te.copper.name,enabled:()=>n.value.copper!=null}))]),Qn=C(()=>Kn.apply(1.01)),It=Object.keys(Mt).reduce((T,D)=>{const O=$t(()=>[Oe(()=>({multiplier:2,description:"Dowsing",enabled:()=>b.value!=null&&he(b.value)&&b.value.state.resources.includes(D)}))]),Z=C(()=>O.apply(Mt[D])),oe={title:`${tt(D)} Drop Rate`,modifier:O,base:Mt[D]};return T[D]={modifier:O,computedModifier:Z,section:oe},T},{}),An=Object.keys(Mt).reduce((T,D)=>{const O=$t(()=>[Oe(()=>({multiplier:()=>{var ge;return(ge=U.value[D])!=null?ge:1},description:"Planar Treasures",enabled:()=>{var ge;return o.neq((ge=U.value[D])!=null?ge:1,1)}}))]),Z=C(()=>O.apply(1)),oe={title:`${tt(D)} Gain`,modifier:O};return T[D]={modifier:O,computedModifier:Z,section:oe},T},{}),[ei,ti]=Ln(()=>[{title:"Energy Gain",modifier:qe,base:1,unit:"/s"},{title:"Bonus Connections",modifier:Y,base:0}]),[wi,_i]=Ln(()=>[{title:"Mining Speed",modifier:Qe,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:Ht,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:Kn,base:1.01,visible:()=>n.value.copper!=null}]),[Ni,Ci]=Ln(()=>Object.values(It).map(T=>T.section)),[lt,ki]=Ln(()=>Object.values(An).map(T=>T.section)),Zt=Ou({general:()=>({display:"General",glowColor(){return Zt.activeTab.value===this.tab?"white":""},tab:ei,energyTabCollapsed:ti}),mining:()=>({display:"Mine",glowColor(){return Zt.activeTab.value===this.tab?"white":""},visibility:()=>Object.keys(n.value).length>0,tab:wi,miningTabCollapsed:_i}),resources:()=>({display:"Mine Rates",glowColor(){return Zt.activeTab.value===this.tab?"white":""},visibility:()=>b.value!=null,tab:Ni,resourcesCollapsed:Ci}),resourcesGain:()=>({display:"Resource Gain",glowColor(){return Zt.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(An).some(T=>o.neq(T.computedModifier.value,1)),tab:lt,resourceGainCollapsed:ki})}),q=B(!1),j=K(()=>p(Ut,{modelValue:q.value,"onUpdate:modelValue":T=>q.value=T},{header:()=>p("h2",null,[$("Modifiers")]),body:()=>nt(Zt)}));this.on("preUpdate",T=>{if(Object.keys(l).forEach(D=>{l[D]-=T,l[D]<=0&&delete l[D]}),Object.keys(u).forEach(D=>{u[D]-=T,u[D]<=0&&delete u[D]}),he(v.value)){const D=o.add(v.value.state.progress,o.times(kt.value,T)),O=D.floor();v.value.state={...v.value.state,progress:o.sub(D,O)};const Z=O.div(z.value).floor();Z.gt(0)&&un.forEach(ge=>{H(ge,o.times(new o(It[ge].computedModifier.value).toNumber(),Z).times(Ue.value)),l[ge]=.3});const oe=o.sub(O,Z).toNumber();for(let ge=0;ge<oe;ge++){const Yt=Math.floor(Math.random()*z.value);let xt=0;for(let Xt=0;Xt<un.length;Xt++){const At=un[Xt];if(xt+=new o(It[At].computedModifier.value).toNumber(),Yt<xt){H(At,Ue.value),l[At]=.3;break}}}}if(h.value!=null&&he(h.value)){const{progress:D,resources:O}=h.value.state;if(O.length>0){let Z=o.add(D,T);const oe=o.div(D,m.value).floor();Z=o.sub(Z,o.times(oe,m.value)),h.value.state={...h.value.state,progress:Z},o.gt(oe,0)&&O.forEach(ge=>{H(ge,oe),u[ge]=.3})}}e.value=o.add(e.value,o.times(Ke.value,T)),o.lt(e.value,0)&&(e.value=0,v.value.state={...v.value.state,powered:!1},wr.warning(p("div",null,[p("h3",null,[$("Ran out of energy!")]),p("div",null,[$("All machines have been turned off.")])])))});const _e=C(()=>{var T,D;return f.selectedAction.value===f.types.brokenFactory.actions[0]?-100:f.selectedAction.value===f.types.factory.actions[1]?o.neg(Te[f.selectedNode.value.state].cost):((T=f.selectedAction.value)==null?void 0:T.id)==="moreConnections"?o.neg(f.selectedAction.value.formula.evaluate(((D=f.selectedNode.value)==null?void 0:D.state).maxConnections)):0}),Ye=cn(g.variable(0).add(e),()=>o.neq(_e.value,0),_e),sn=C(()=>{var T;return f.selectedAction.value===Wt?((T=f.selectedNode.value)==null?void 0:T.state).powered?o.eq(c.value,1)?10:o.pow(100,c.value).div(10).times(.99):o.neg(d.value):0}),it=cn(g.variable(0).add(Ke),()=>o.neq(sn.value,0),sn),Dt=C(()=>f.types.portal.nodes.value.filter(T=>he(T)));return pt(Dt,T=>{jt(()=>{Q.tabs=["main",...T.map(D=>D.state.id)]})}),pt(Ce,(T,D)=>{o.lt(T,D)&&(Cn(T,b,"resources"),Cn(T,h,"resources"),Cn(T,I,"tools"),Cn(T,S,"portals"),Cn(T,E,"portals"),Cn(T,V,"portals"))}),{name:"World",board:f,energy:e,modifierTabs:Zt,resourceNodes:t,toolNodes:n,influenceNodes:i,grantResource:H,activePortals:Dt,isEmpowered:ct,nextPowerCost:d,computedBonusConnectionsModifier:Ce,quarryProgressRequired:m,dropRates:It,dowsing:b,empowerer:I,booster:S,upgrader:E,automator:V,resourceLevels:a,planarMultis:U,display:K(()=>p(ne,null,[p(ci,{class:"nav-container"},{default:()=>[p("span",{class:"nav-segment"},[p("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[nt(Ye)])," ",$("energy")]),p("span",{class:"nav-segment"},[$("("),p("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(Ke.value,0)?"+":"",nt(it)]),$("/s)")]),o.gt(c.value,0)?p("span",{class:"nav-segment"},[p("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[vt(c.value)])," ",$("machines powered")]):null,p("span",{class:"nav-segment"},[p("button",{class:"button",style:"display: inline",onClick:()=>q.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: "),me(Q.devSpeed),$("x")]):null]}),nt(f),nt(j)]))}}),bf=e=>{var i,r,a,l,u;const t=[N];let n=0;for(;`portal-${n}`in((i=e.layers)!=null?i:{});){const c=(r=e.layers)==null?void 0:r[`portal-${n}`];t.push(ta(`portal-${n}`,(a=c.tier)!=null?a:"dirt",(l=c.seed)!=null?l:Math.floor(Math.random()*4294967296),(u=c.influences)!=null?u:[])),n++}return t},Qi=B(!1);function yf(e,t){}var wf=Object.freeze(Object.defineProperty({__proto__:null,main:N,getInitialLayers:bf,hasWon:Qi,fixOldSave:yf},Symbol.toStringTag,{value:"Module"}));const Jn=e=>(hn("data-v-4a50ce42"),e=e(),bn(),e),_f={class:"game-over-modal-header"},Nf=["src","alt"],Cf={class:"game-over-modal-title"},kf=Jn(()=>_("h2",null,"Congratulations!",-1)),Mf={key:0},Sf=Jn(()=>_("br",null,null,-1)),If=Jn(()=>_("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),xf=Jn(()=>_("br",null,null,-1)),$f=["href"],Ef=Jn(()=>_("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),Pf=J({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:i,discordLink:r,versionNumber:a,versionTitle:l}=fe,u=C(()=>mi(Q.timePlayed)),c=C(()=>Qi.value&&!Q.keepGoing),d=nn(Q,"autosave");function m(){Q.keepGoing=!0}function f(){dn(In())}return(v,w)=>(M(),ee(Ut,{"model-value":s(c)},{header:W(()=>[_("div",_f,[s(n)?(M(),P("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,Nf)):L("",!0),_("div",Cf,[kf,_("h4",null,"You've beaten "+ae(s(t))+" v"+ae(s(a))+": "+ae(s(l)),1)])])]),body:W(({shown:b})=>[b?(M(),P("div",Mf,[_("div",null,"It took you "+ae(s(u))+" to beat the game.",1),Sf,If,xf,_("div",null,[_("a",{href:s(r),class:"game-over-modal-discord-link"},[Ef,$(" "+ae(s(i)),1)],8,$f)]),p(Bt,{title:"Autosave",modelValue:s(d),"onUpdate:modelValue":w[0]||(w[0]=h=>De(d)?d.value=h:null)},null,8,["modelValue"])])):L("",!0)]),footer:W(()=>[_("div",{class:"game-over-footer"},[_("button",{onClick:m,class:"button"},"Keep Going"),_("button",{onClick:f,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Tf=ue(Pf,[["__scopeId","data-v-4a50ce42"]]);const yi=e=>(hn("data-v-2776d67d"),e=e(),bn(),e),Df=yi(()=>_("div",{class:"nan-modal-header"},[_("h2",null,"NaN value detected!")],-1)),Af={key:0},Ff=yi(()=>_("br",null,null,-1)),Of=["href"],Rf=yi(()=>_("span",{class:"material-icons nan-modal-discord"},"discord",-1)),qf=yi(()=>_("br",null,null,-1)),Vf={class:"nan-footer"},Bf=J({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=fe,i=B(!0),r=B(!0),a=nn(Be,"hasNaN"),l=B(null);pt(a,v=>{v?(i.value=Q.autosave,r.value=Q.devSpeed===0):(Q.autosave=i.value,Q.devSpeed=r.value?0:null)});const u=C(()=>{var v;return(v=Be.NaNPath)==null?void 0:v.join(".")}),c=C(()=>Be.NaNPersistent!=null?Be.NaNPersistent.value:null);function d(){Be.NaNPersistent!=null&&(Be.NaNPersistent.value=new o(0),Be.hasNaN=!1)}function m(){Be.NaNPersistent&&(Be.NaNPersistent.value=new o(1),Be.hasNaN=!1)}function f(){Be.NaNPersistent&&(Be.NaNPersistent.value=new o(NaN),Be.hasNaN=!1)}return(v,w)=>(M(),P(ne,null,[p(Ut,zt({modelValue:s(a),"onUpdate:modelValue":w[4]||(w[4]=b=>De(a)?a.value=b:null)},v.$attrs),{header:W(()=>[Df]),body:W(()=>[_("div",null,[$(' Attempted to assign "'+ae(s(u))+'" to NaN',1),s(c)?(M(),P("span",Af,ae(" ")+"(previously "+ae(s(me)(s(c)))+")",1)):L("",!0),$(". Auto-saving has been "+ae(i.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),Ff,_("div",null,[_("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[Rf,$(" "+ae(s(t)||"The Paper Pilot Community"),1)],8,Of)]),qf,p(Bt,{title:"Autosave",modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=b=>i.value=b)},null,8,["modelValue"]),s(fe).enablePausing?(M(),ee(Bt,{key:0,title:"Pause game",modelValue:r.value,"onUpdate:modelValue":w[1]||(w[1]=b=>r.value=b)},null,8,["modelValue"])):L("",!0)]),footer:W(()=>[_("div",Vf,[_("button",{onClick:w[2]||(w[2]=b=>{var h;return(h=l.value)==null?void 0:h.open()}),class:"button"},"Open Saves Manager"),_("button",{onClick:d,class:"button"},"Set to 0"),_("button",{onClick:m,class:"button"},"Set to 1"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(M(),P("button",{key:0,onClick:w[3]||(w[3]=b=>a.value=!1),class:"button"}," Set to previous ")):L("",!0),_("button",{onClick:f,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),p(Lr,{ref_key:"savesManager",ref:l},null,512)],64))}});var Lf=ue(Bf,[["__scopeId","data-v-2776d67d"]]);const jf={key:0,class:"tpsDisplay"},zf={key:0,class:"low"},Uf=J({__name:"TPS",setup(e){const t=C(()=>o.div(Be.lastTenTicks.length,Be.lastTenTicks.reduce((a,l)=>a+l,0))),n=B([]);_t(()=>{n.value.push(Math.round(t.value.toNumber())),n.value.length>10&&(n.value=n.value.slice(1))});const i=C(()=>n.value.reduce((a,l)=>o.max(a,l),0)),r=C(()=>o.sub(t.value,i.value).gt(1));return(a,l)=>s(t).isNan()?L("",!0):(M(),P("div",jf,[$(" TPS: "+ae(s(vt)(s(t)))+" ",1),p($n,{name:"fade"},{default:W(()=>[s(r)?(M(),P("span",zf,ae(s(vt)(s(i))),1)):L("",!0)]),_:1})]))}});var Gf=ue(Uf,[["__scopeId","data-v-46a3ed5b"]]);var Wf=J({__name:"App",setup(e){const t=fe.useHeader,n=C(()=>wt[re.theme].variables),i=nn(re,"showTPS"),r=C(()=>se(K(()=>p(ne,null,[Ts.map(nt)]))));return(a,l)=>(M(),P(ne,null,[_("div",{id:"modal-root",style:Re(s(n))},null,4),_("div",{class:pe(["app",{useHeader:s(t)}]),style:Re(s(n))},[s(t)?(M(),ee(jr,{key:0})):L("",!0),p(Yl),s(s(i))?(M(),ee(Gf,{key:1})):L("",!0),p(Tf),p(Lf),(M(),ee(We(s(r))))],6)],64))}});var Hf=ue(Wf,[["__scopeId","data-v-41d15e5e"]]);function Zf(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e;let u,c,d,m;const f=async(w=!0)=>{await d,w&&(u==null||u.addEventListener("controlling",b=>{b.isUpdate&&window.location.reload()})),await(m==null?void 0:m())};async function v(){if("serviceWorker"in navigator){const{Workbox:w,messageSW:b}=await zn(()=>import("./workbox-window.4a8794bb.js"),[]);m=async()=>{c&&c.waiting&&await b(c.waiting,{type:"SKIP_WAITING"})},u=new w("./sw.js",{scope:"./",type:"classic"}),u.addEventListener("activated",h=>{h.isUpdate||i==null||i()});{const h=()=>{n==null||n()};u.addEventListener("waiting",h),u.addEventListener("externalwaiting",h)}u.register({immediate:t}).then(h=>{c=h,a?a("./sw.js",h):r==null||r(h)}).catch(h=>{l==null||l(h)})}}return d=v(),f}function Yf(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:i,onRegistered:r,onRegisteredSW:a,onRegisterError:l}=e,u=B(!1),c=B(!1);return{updateServiceWorker:Zf({immediate:t,onNeedRefresh(){u.value=!0,n==null||n()},onOfflineReady(){c.value=!0,i==null||i()},onRegistered:r,onRegisteredSW:a,onRegisterError:l}),offlineReady:c,needRefresh:u}}document.title=fe.title;window.projInfo=fe;if(fe.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 Ss();const{globalBus:e}=await zn(()=>Promise.resolve().then(function(){return ks}),void 0),{startGameLoop:t}=await zn(()=>import("./gameLoop.87edf988.js"),["assets/gameLoop.87edf988.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=_a(Hf);e.emit("setupVue",n),n.mount("#app"),jt(()=>{const i=gi(),{updateServiceWorker:r}=Yf({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,zn as _,Be as a,fe as b,wf as c,He as g,Is as l,Q as p,re as s};
|