mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 08:31:31 +00:00
21 lines
242 KiB
JavaScript
21 lines
242 KiB
JavaScript
/* empty css */import"./vue.c16a309b.js";import{q as ln,C as a,ab as X,t as G,aF as S,a1 as T,aL as qt,bv as Pn,G as Ne,as as Xt,_ as y,az as Qn,a2 as N,J as ee,O as ne,aK as Dt,a0 as B,I as Le,a8 as w,a9 as d,b7 as H,aI as cn,aG as dn,l as Ve,u as Lr,b2 as wt,aD as Mi,w as _t,b3 as Pt,ap as ca,aH as sr,A as Ae,$ as re,b9 as jr,ar as Vt,bt as da,bc as Wn,T as pa,j as fa,bw as Bt,ay as ga,aM as Ct,aO as Ke,z as Jt,bo as ma,bs as va,bd as ui,am as dr,H as ha,bx as ba,bf as ya}from"./@vue.6b211d3c.js";import{L as Yt}from"./lz-string.dccec454.js";import{c as Ii}from"./nanoevents.1080beb7.js";import{Y as wa}from"./vue-next-select.ded54c4a.js";import{D as _a}from"./vuedraggable.1879de79.js";import{p as Na}from"./vue-textarea-autosize.35804eaf.js";import{P as Ca}from"./vue-panzoom.8ce6f9b1.js";import{s as ka,u as hr}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 Sa=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerpolicy&&(s.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?s.credentials="include":i.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}};Sa();const Ma="modulepreload",ci={},Ia="./",Hn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${Ia}${r}`,r in ci)return;ci[r]=!0;const i=r.endsWith(".css"),s=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${s}`))return;const l=document.createElement("link");if(l.rel=i?"stylesheet":Ma,i||(l.as="script",l.crossOrigin=""),l.href=r,document.head.appendChild(l),i)return new Promise((u,c)=>{l.addEventListener("load",u),l.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())},xa="./projInfo-schema.json",$a="Planar Pioneers",Da="A game about controlling and exploiting planes!",Ta="planar-pioneers",Pa="thepaperpilot",Aa="",Ra="",Ea="0.0",Fa="Initial Commit",Oa=!1,qa=!1,Va=2,Ba=!0,La=null,ja="",za=["main"],Ga=3600,Ua=0,Wa=!0,Ha="base64";var ve={$schema:xa,title:$a,description:Da,id:Ta,author:Pa,discordName:Aa,discordLink:Ra,versionNumber:Ea,versionTitle:Fa,allowGoBack:Oa,defaultShowSmall:qa,defaultDecimalsShown:Va,useHeader:Ba,banner:La,logo:ja,initialTabs:za,maxTickLength:Ga,offlineLimit:Ua,enablePausing:Wa,exportEncoding:Ha};const Ya=ln({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Y=window.player=Ya;function zr(e){return JSON.stringify(e,(t,n)=>a(n))}var be=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const Za=["onClick"],Xa=X({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=G(!1),r=G(null);function i(){t("click"),r.value&&clearTimeout(r.value),n.value=!1,Xt(()=>{n.value=!0,r.value=setTimeout(()=>n.value=!1,500)})}return(s,l)=>(S(),T("button",{onClick:Pn(i,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[qt(s.$slots,"default",{},void 0,!0)],10,Za))}});var Gr=be(Xa,[["__scopeId","data-v-01a1b95c"]]);const br=e=>(cn("data-v-ac351c02"),e=e(),dn(),e),Ja={class:"error"},Ka={class:"error-title"},Qa={class:"error-details",style:{"margin-top":"-10px"}},es={key:0},ts={class:"instructions"},ns=["href"],rs=br(()=>N("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),is=br(()=>N("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),as=br(()=>N("br",null,null,-1)),ss={key:0,style:{"margin-top":"20px"}},os=br(()=>N("h3",null,"Other errors",-1)),ls=[os],us={class:"error-details"},cs={key:0,style:{"margin-top":"10px"}},ds={key:1,style:{"margin-top":"10px"}},ps=X({__name:"Error",props:{errors:null},setup(e){const t=e,n=y(()=>t.errors[0]),r=y(()=>t.errors.map(l=>l.stack==null?[]:l.stack.split(`
|
|
`))),i=y(()=>t.errors.map(l=>l.cause==null?[]:(typeof l.cause=="string"?l.cause:JSON.stringify(l.cause)).split(`
|
|
`)));function s(){let l=zr(Y);switch(ve.exportEncoding){default:console.warn(`Unknown save encoding: ${ve.exportEncoding}. Defaulting to lz`);case"lz":l=Yt.compressToUTF16(l);break;case"base64":l=btoa(unescape(encodeURIComponent(l)));break;case"plain":break}console.log(l);const u=document.createElement("textarea");u.value=l,document.body.appendChild(u),u.select(),u.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(u)}return Qn(()=>{Y.autosave=!1,Y.devSpeed=0}),(l,u)=>(S(),T("div",Ja,[N("h1",Ka,ee(a(n).name)+": "+ee(a(n).message),1),N("div",Qa,[a(n).cause?(S(),T("div",es,[(S(!0),T(ne,null,Dt(a(i)[0],c=>(S(),T("div",{key:c},ee(c),1))),128))])):B("",!0),a(n).stack?(S(),T("div",{key:1,style:Le(a(n).cause?"margin-top: 10px":"")},[(S(!0),T(ne,null,Dt(a(r)[0],c=>(S(),T("div",{key:c},ee(c),1))),128))],4)):B("",!0)]),N("div",ts,[w(" Check the console for more details, and consider sharing it with the developers on "),N("a",{href:a(ve).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,ns),w("! "),d(Gr,{onClick:s,class:"button",style:{display:"inline-flex"}},{default:H(()=>[rs,is]),_:1}),as,e.errors.length>1?(S(),T("div",ss,ls)):B("",!0),(S(!0),T(ne,null,Dt(e.errors.slice(1),(c,p)=>(S(),T("div",{key:p,style:{"margin-top":"20px"}},[N("details",us,[N("summary",null,ee(c.name)+": "+ee(c.message),1),c.cause?(S(),T("div",cs,[(S(!0),T(ne,null,Dt(a(i)[p+1],h=>(S(),T("div",{key:h},ee(h),1))),128))])):B("",!0),c.stack?(S(),T("div",ds,[(S(!0),T(ne,null,Dt(a(r)[p+1],h=>(S(),T("div",{key:h},ee(h),1))),128))])):B("",!0)])]))),128))])]))}});var xi=be(ps,[["__scopeId","data-v-ac351c02"]]);class fs{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 r=new gs(t,n);for(this.first===void 0?(this.first=r,this.last=r):(r.next=this.first,this.first.prev=r,this.first=r),this.map.set(t,r);this.map.size>this.maxSize;){const i=this.last;this.map.delete(i.key),this.last=i.prev,this.last.next=void 0}}}class gs{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Pr=17,ms=9e15,vs=Math.log10(9e15),hs=1/9e15,bs=308,ys=-324,di=5,ws=(1<<10)-1,_s=function(){const e=[];for(let n=ys+1;n<=bs;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),gn=[2,Math.E,3,4,5,6,7,8,9,10],Ns=[[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]],Cs=[[-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 M=function(t){return o.fromValue_noAlloc(t)},Q=function(e,t,n){return o.fromComponents(e,t,n)},se=function(t,n,r){return o.fromComponents_noNormalize(t,n,r)};const rn=function(t,n){const r=n+1,i=Math.ceil(Math.log10(Math.abs(t))),s=Math.round(t*Math.pow(10,r-i))*Math.pow(10,i-r);return parseFloat(s.toFixed(Math.max(r-i,0)))},Ar=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},ks=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 r=e*e;let i=e;return n=n+1/(12*i),i=i*r,n=n+1/(360*i),i=i*r,n=n+1/(1260*i),i=i*r,n=n+1/(1680*i),i=i*r,n=n+1/(1188*i),i=i*r,n=n+691/(360360*i),i=i*r,n=n+7/(1092*i),i=i*r,n=n+3617/(122400*i),Math.exp(n)/t},$i=.5671432904097838,pi=function(e,t=1e-10){let n,r;if(!Number.isFinite(e)||e===0)return e;if(e===1)return $i;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let i=0;i<100;++i){if(r=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(r-n)<t*Math.abs(r))return r;n=r}throw Error(`Iteration failed to converge: ${e.toString()}`)};function fi(e,t=1e-10){let n,r,i,s;if(!Number.isFinite(e.mag)||e.eq(o.dZero))return e;if(e.eq(o.dOne))return o.fromNumber($i);n=o.ln(e);for(let l=0;l<100;++l){if(r=n.neg().exp(),i=n.sub(e.mul(r)),s=n.sub(i.div(n.add(1).sub(n.add(2).mul(i).div(o.mul(2,n).add(2))))),o.abs(s.sub(n)).lt(o.abs(s).mul(t)))return s;n=s}throw Error(`Iteration failed to converge: ${e.toString()}`)}const _=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof _?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/_s(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 _().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new _().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new _().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new _().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new _().fromDecimal(e)}static fromNumber(e){return new _().fromNumber(e)}static fromString(e){return new _().fromString(e)}static fromValue(e){return new _().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof _)return e;if(typeof e=="string"){const t=_.fromStringCache.get(e);return t!==void 0?t:_.fromString(e)}else return typeof e=="number"?_.fromNumber(e):_.dZero}static abs(e){return M(e).abs()}static neg(e){return M(e).neg()}static negate(e){return M(e).neg()}static negated(e){return M(e).neg()}static sign(e){return M(e).sign}static sgn(e){return M(e).sign}static round(e){return M(e).round()}static floor(e){return M(e).floor()}static ceil(e){return M(e).ceil()}static trunc(e){return M(e).trunc()}static add(e,t){return M(e).add(t)}static plus(e,t){return M(e).add(t)}static sub(e,t){return M(e).sub(t)}static subtract(e,t){return M(e).sub(t)}static minus(e,t){return M(e).sub(t)}static mul(e,t){return M(e).mul(t)}static multiply(e,t){return M(e).mul(t)}static times(e,t){return M(e).mul(t)}static div(e,t){return M(e).div(t)}static divide(e,t){return M(e).div(t)}static recip(e){return M(e).recip()}static reciprocal(e){return M(e).recip()}static reciprocate(e){return M(e).reciprocate()}static cmp(e,t){return M(e).cmp(t)}static cmpabs(e,t){return M(e).cmpabs(t)}static compare(e,t){return M(e).cmp(t)}static isNaN(e){return e=M(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=M(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return M(e).eq(t)}static equals(e,t){return M(e).eq(t)}static neq(e,t){return M(e).neq(t)}static notEquals(e,t){return M(e).notEquals(t)}static lt(e,t){return M(e).lt(t)}static lte(e,t){return M(e).lte(t)}static gt(e,t){return M(e).gt(t)}static gte(e,t){return M(e).gte(t)}static max(e,t){return M(e).max(t)}static min(e,t){return M(e).min(t)}static minabs(e,t){return M(e).minabs(t)}static maxabs(e,t){return M(e).maxabs(t)}static clamp(e,t,n){return M(e).clamp(t,n)}static clampMin(e,t){return M(e).clampMin(t)}static clampMax(e,t){return M(e).clampMax(t)}static cmp_tolerance(e,t,n){return M(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return M(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return M(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return M(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return M(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return M(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return M(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return M(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return M(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return M(e).gte_tolerance(t,n)}static pLog10(e){return M(e).pLog10()}static absLog10(e){return M(e).absLog10()}static log10(e){return M(e).log10()}static log(e,t){return M(e).log(t)}static log2(e){return M(e).log2()}static ln(e){return M(e).ln()}static logarithm(e,t){return M(e).logarithm(t)}static pow(e,t){return M(e).pow(t)}static pow10(e){return M(e).pow10()}static pow_base(e,t){return M(e).pow_base(t)}static root(e,t){return M(e).root(t)}static factorial(e,t){return M(e).factorial()}static gamma(e,t){return M(e).gamma()}static lngamma(e,t){return M(e).lngamma()}static exp(e){return M(e).exp()}static sqr(e){return M(e).sqr()}static sqrt(e){return M(e).sqrt()}static cube(e){return M(e).cube()}static cbrt(e){return M(e).cbrt()}static tetrate(e,t=2,n=se(1,0,1)){return M(e).tetrate(t,n)}static iteratedexp(e,t=2,n=se(1,0,1)){return M(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return M(e).iteratedlog(t,n)}static layeradd10(e,t){return M(e).layeradd10(t)}static layeradd(e,t,n=10){return M(e).layeradd(t,n)}static slog(e,t=10){return M(e).slog(t)}static lambertw(e){return M(e).lambertw()}static ssqrt(e){return M(e).ssqrt()}static pentate(e,t=2,n=se(1,0,1)){return M(e).pentate(t,n)}static sin(e){return M(e).sin()}static cos(e){return M(e).cos()}static tan(e){return M(e).tan()}static asin(e){return M(e).asin()}static acos(e){return M(e).acos()}static atan(e){return M(e).atan()}static sinh(e){return M(e).sinh()}static cosh(e){return M(e).cosh()}static tanh(e){return M(e).tanh()}static asinh(e){return M(e).asinh()}static acosh(e){return M(e).acosh()}static atanh(e){return M(e).atanh()}static affordGeometricSeries(e,t,n,r){return this.affordGeometricSeries_core(M(e),M(t),M(n),r)}static sumGeometricSeries(e,t,n,r){return this.sumGeometricSeries_core(e,M(t),M(n),r)}static affordArithmeticSeries(e,t,n,r){return this.affordArithmeticSeries_core(M(e),M(t),M(n),M(r))}static sumArithmeticSeries(e,t,n,r){return this.sumArithmeticSeries_core(M(e),M(t),M(n),M(r))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(M(e),M(t),M(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return se(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return se(t,0,1);const n=Math.floor(Math.random()*(e+1));let r=n===0?Math.random()*616-308:Math.random()*16;Math.random()>.9&&(r=Math.trunc(r));let i=Math.pow(10,r);return Math.random()>.9&&(i=Math.trunc(i)),Q(t,n,i)}static affordGeometricSeries_core(e,t,n,r){const i=t.mul(n.pow(r));return _.floor(e.div(i).mul(n.sub(1)).add(1).log10().div(n.log10()))}static sumGeometricSeries_core(e,t,n,r){return t.mul(n.pow(r)).mul(_.sub(1,n.pow(e))).div(_.sub(1,n))}static affordArithmeticSeries_core(e,t,n,r){const s=t.add(r.mul(n)).sub(n.div(2)),l=s.pow(2);return s.neg().add(l.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,r){const i=t.add(r.mul(n));return e.div(2).mul(i.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<hs)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=ms)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<vs&&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=_.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const r=e.split("^^^");if(r.length===2){const k=parseFloat(r[0]),C=parseFloat(r[1]),$=r[1].split(";");let x=1;if($.length===2&&(x=parseFloat($[1]),isFinite(x)||(x=1)),isFinite(k)&&isFinite(C)){const I=_.pentate(k,C,x);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}const i=e.split("^^");if(i.length===2){const k=parseFloat(i[0]),C=parseFloat(i[1]),$=i[1].split(";");let x=1;if($.length===2&&(x=parseFloat($[1]),isFinite(x)||(x=1)),isFinite(k)&&isFinite(C)){const I=_.tetrate(k,C,x);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}const s=e.split("^");if(s.length===2){const k=parseFloat(s[0]),C=parseFloat(s[1]);if(isFinite(k)&&isFinite(C)){const $=_.pow(k,C);return this.sign=$.sign,this.layer=$.layer,this.mag=$.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.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 k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(l)&&isFinite(u)){const C=_.tetrate(l,u,k);return this.sign=C.sign,this.layer=C.layer,this.mag=C.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.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 k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(l)&&isFinite(u)){const C=_.tetrate(l,u,k);return this.sign=C.sign,this.layer=C.layer,this.mag=C.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}const p=e.split("e"),h=p.length-1;if(h===0){const k=parseFloat(e);if(isFinite(k))return this.fromNumber(k),_.fromStringCache.size>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}else if(h===1){const k=parseFloat(e);if(isFinite(k)&&k!==0)return this.fromNumber(k),_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}const g=e.split("e^");if(g.length===2){this.sign=1,g[0].charAt(0)=="-"&&(this.sign=-1);let k="";for(let C=0;C<g[1].length;++C){const $=g[1].charCodeAt(C);if($>=43&&$<=57||$===101)k+=g[1].charAt(C);else return this.layer=parseFloat(k),this.mag=parseFloat(g[1].substr(C+1)),this.normalize(),_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}if(h<1)return this.sign=0,this.layer=0,this.mag=0,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this;const b=parseFloat(p[0]);if(b===0)return this.sign=0,this.layer=0,this.mag=0,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this;let m=parseFloat(p[p.length-1]);if(h>=2){const k=parseFloat(p[p.length-2]);isFinite(k)&&(m*=Math.sign(k),m+=Ar(k))}if(!isFinite(b))this.sign=p[0]==="-"?-1:1,this.layer=h,this.mag=m;else if(h===1)this.sign=Math.sign(b),this.layer=1,this.mag=m+Math.log10(Math.abs(b));else if(this.sign=Math.sign(b),this.layer=h,h===2){const k=_.mul(Q(1,2,m),M(b));return this.sign=k.sign,this.layer=k.layer,this.mag=k.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}else this.mag=m;return this.normalize(),_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}fromValue(e){return e instanceof _?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:rn(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:rn(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<=di?(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):rn(this.m,e)+"e"+rn(this.e,e):this.layer===1?rn(this.m,e)+"e"+rn(this.e,e):this.layer<=di?(this.sign===-1?"-":"")+"e".repeat(this.layer)+rn(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+rn(this.mag,e)}abs(){return se(this.sign===0?0:1,this.layer,this.mag)}neg(){return se(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?_.dZero:this.layer===0?Q(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?_.dZero:this.layer===0?Q(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?_.dZero:this.layer===0?Q(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?_.dZero:this.layer===0?Q(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=M(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 se(0,0,0);let n,r;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(_.cmpabs(this,t)>0?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return _.fromNumber(n.sign*n.mag+r.sign*r.mag);const i=n.layer*Math.sign(n.mag),s=r.layer*Math.sign(r.mag);if(i-s>=2)return n;if(i===0&&s===-1){if(Math.abs(r.mag-Math.log10(n.mag))>Pr)return n;{const l=Math.pow(10,Math.log10(n.mag)-r.mag),u=r.sign+n.sign*l;return Q(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}if(i===1&&s===0){if(Math.abs(n.mag-Math.log10(r.mag))>Pr)return n;{const l=Math.pow(10,n.mag-Math.log10(r.mag)),u=r.sign+n.sign*l;return Q(Math.sign(u),1,Math.log10(r.mag)+Math.log10(Math.abs(u)))}}if(Math.abs(n.mag-r.mag)>Pr)return n;{const l=Math.pow(10,n.mag-r.mag),u=r.sign+n.sign*l;return Q(Math.sign(u),1,r.mag+Math.log10(Math.abs(u)))}}plus(e){return this.add(e)}sub(e){return this.add(M(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=M(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return se(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return se(this.sign*t.sign,0,1);let n,r;if(this.layer>t.layer||this.layer==t.layer&&Math.abs(this.mag)>Math.abs(t.mag)?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return _.fromNumber(n.sign*r.sign*n.mag*r.mag);if(n.layer>=3||n.layer-r.layer>=2)return Q(n.sign*r.sign,n.layer,n.mag);if(n.layer===1&&r.layer===0)return Q(n.sign*r.sign,1,n.mag+Math.log10(r.mag));if(n.layer===1&&r.layer===1)return Q(n.sign*r.sign,1,n.mag+r.mag);if(n.layer===2&&r.layer===1){const i=Q(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(Q(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return Q(n.sign*r.sign,i.layer+1,i.sign*i.mag)}if(n.layer===2&&r.layer===2){const i=Q(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(Q(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return Q(n.sign*r.sign,i.layer+1,i.sign*i.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=M(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?_.dNaN:this.layer===0?Q(this.sign,0,1/this.mag):Q(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=M(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=M(e),n=this.mag>0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:n<r?-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=M(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=M(e);return this.lt(t)?t:this}min(e){const t=M(e);return this.gt(t)?t:this}maxabs(e){const t=M(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=M(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=M(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=M(e);if(t==null&&(t=1e-7),this.sign!==n.sign||Math.abs(this.layer-n.layer)>1)return!1;let r=this.mag,i=n.mag;return this.layer>n.layer&&(i=Ar(i)),this.layer<n.layer&&(r=Ar(r)),Math.abs(r-i)<=t*Math.max(Math.abs(r),Math.abs(i))}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=M(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=M(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=M(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=M(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(_.dZero)?_.dZero:this.log10()}absLog10(){return this.sign===0?_.dNaN:this.layer>0?Q(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):Q(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?_.dNaN:this.layer>0?Q(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):Q(this.sign,0,Math.log10(this.mag))}log(e){return e=M(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?_.dNaN:this.layer===0&&e.layer===0?Q(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):_.div(this.log10(),e.log10())}log2(){return this.sign<=0?_.dNaN:this.layer===0?Q(this.sign,0,Math.log2(this.mag)):this.layer===1?Q(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?Q(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):Q(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?_.dNaN:this.layer===0?Q(this.sign,0,Math.log(this.mag)):this.layer===1?Q(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?Q(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):Q(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=M(e),n=this,r=t;if(n.sign===0)return r.eq(0)?se(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(r.sign===0)return se(1,0,1);if(r.sign===1&&r.layer===0&&r.mag===1)return n;const i=n.absLog10().mul(r).pow10();return this.sign===-1?Math.abs(r.toNumber()%2)%2===1?i.neg():Math.abs(r.toNumber()%2)%2===0?i:_.dNaN:i}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return _.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 Q(1,0,t);if(e.sign===0)return _.dOne;e=se(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?Q(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?Q(-e.sign,e.layer+1,-e.mag):_.dOne}pow_base(e){return M(e).pow(this)}root(e){const t=M(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?_.exp(_.mul(this,_.ln(this).sub(1))):_.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(se(1,0,24)))return _.fromNumber(ks(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 r=e,i=12*r,s=1/i,l=t+s;if(l===t||(t=l,r=r*n,i=360*r,s=1/i,l=t-s,l===t))return _.exp(t);t=l,r=r*n,i=1260*r;let u=1/i;return t=t+u,r=r*n,i=1680*r,u=1/i,t=t-u,_.exp(t)}else return this.layer===1?_.exp(_.mul(this,_.ln(this).sub(1))):_.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?_.dOne:this.layer===0&&this.mag<=709.7?_.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?Q(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?Q(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):Q(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return _.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return Q(1,2,Math.log10(this.mag)-.3010299956639812);{const e=_.div(se(this.sign,this.layer-1,this.mag),se(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=se(1,0,1)){if(e===1)return _.pow(this,t);if(e===0)return new _(t);if(this.eq(_.dOne))return _.dOne;if(this.eq(-1))return _.pow(this,t);if(e===Number.POSITIVE_INFINITY){const i=this.toNumber();if(i<=1.444667861009766&&i>=.06598803584531254){if(i>1.444667861009099)return _.fromNumber(Math.E);const s=_.ln(this).neg();return s.lambertw().div(s)}else return i>1.444667861009766?_.fromNumber(Number.POSITIVE_INFINITY):_.dNaN}if(this.eq(_.dZero)){let i=Math.abs((e+1)%2);return i>1&&(i=2-i),_.fromNumber(i)}if(e<0)return _.iteratedlog(t,this,-e);t=M(t);const n=e;e=Math.trunc(e);const r=n-e;if(this.gt(_.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let i=0;i<e;++i){const s=t;if(t=this.pow(t),s.eq(t))return t}if(r!=0){const i=this.pow(t);return t.mul(1-r).add(i.mul(r))}return t}r!==0&&(t.eq(_.dOne)?this.gt(10)?t=this.pow(r):(t=_.fromNumber(_.tetrate_critical(this.toNumber(),r)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i<e;++i){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return se(t.sign,t.layer+(e-i-1),t.mag);if(i>1e4)return t}return t}iteratedexp(e=2,t=se(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return _.tetrate(e,-t,this);e=M(e);let n=_.fromDecimal(this);const r=t;t=Math.trunc(t);const i=r-t;if(n.layer-e.layer>3){const s=Math.min(t,n.layer-e.layer-3);t-=s,n.layer-=s}for(let s=0;s<t;++s){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(s>1e4)return n}return i>0&&i<1&&(e.eq(10)?n=n.layeradd10(-i):n=n.layeradd(-i,e)),n}slog(e=10,t=100){let n=.001,r=!1,i=!1,s=this.slog_internal(e).toNumber();for(let l=1;l<t;++l){const c=new _(e).tetrate(s).gt(this);if(l>1&&i!=c&&(r=!0),i=c,r?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),s+=n,n===0)break}return _.fromNumber(s)}slog_internal(e=10){if(e=M(e),e.lte(_.dZero)||e.eq(_.dOne))return _.dNaN;if(e.lt(_.dOne))return this.eq(_.dOne)?_.dZero:this.eq(_.dZero)?_.dNegOne:_.dNaN;if(this.mag<0||this.eq(_.dZero))return _.dNegOne;let t=0,n=_.fromDecimal(this);if(n.layer-e.layer>3){const r=n.layer-e.layer-3;t+=r,n.layer-=r}for(let r=0;r<100;++r)if(n.lt(_.dZero))n=_.pow(e,n),t-=1;else{if(n.lte(_.dOne))return _.fromNumber(t+_.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=_.log(n,e)}return _.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:_.critical_section(e,t,Cs)}static tetrate_critical(e,t){return _.critical_section(e,t,Ns)}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 r=0,i=0;for(let l=0;l<gn.length;++l)if(gn[l]==e){r=n[l][Math.floor(t)],i=n[l][Math.ceil(t)];break}else if(gn[l]<e&&gn[l+1]>e){const u=(e-gn[l])/(gn[l+1]-gn[l]);r=n[l][Math.floor(t)]*(1-u)+n[l+1][Math.floor(t)]*u,i=n[l][Math.ceil(t)]*(1-u)+n[l+1][Math.ceil(t)]*u;break}const s=t-Math.floor(t);return r<=0||i<=0?r*(1-s)+i*s:Math.pow(e,Math.log(r)/Math.log(e)*(1-s)+Math.log(i)/Math.log(e)*s)}layeradd10(e){e=_.fromValue_noAlloc(e).toNumber();const t=_.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 r=0;r<100;++r){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 r=this.slog(t).toNumber()+e;return r>=0?_.tetrate(t,r):Number.isFinite(r)?r>=-1?_.log(_.tetrate(t,r+1),t):_.log(_.log(_.tetrate(t,r+2),t),t):_.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return _.fromNumber(pi(this.toNumber()));if(this.layer===0)return _.fromNumber(pi(this.sign*this.mag));if(this.layer===1)return fi(this);if(this.layer===2)return fi(this);if(this.layer>=3)return se(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return se(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=se(1,0,1)){t=M(t);const n=e;e=Math.trunc(e);const r=n-e;r!==0&&(t.eq(_.dOne)?(++e,t=_.fromNumber(r)):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i<e;++i){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(i>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?_.fromNumber(Math.sin(this.sign*this.mag)):se(0,0,0)}cos(){return this.mag<0?_.dOne:this.layer===0?_.fromNumber(Math.cos(this.sign*this.mag)):se(0,0,0)}tan(){return this.mag<0?this:this.layer===0?_.fromNumber(Math.tan(this.sign*this.mag)):se(0,0,0)}asin(){return this.mag<0?this:this.layer===0?_.fromNumber(Math.asin(this.sign*this.mag)):se(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?_.fromNumber(Math.acos(this.toNumber())):this.layer===0?_.fromNumber(Math.acos(this.sign*this.mag)):se(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?_.fromNumber(Math.atan(this.sign*this.mag)):_.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 _.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return _.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?se(Number.NaN,Number.NaN,Number.NaN):_.ln(this.add(1).div(_.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(_.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=_;o.fromStringCache=new fs(ws);o.dZero=se(0,0,0);o.dOne=se(1,0,1);o.dNegOne=se(-1,0,1);o.dTwo=se(1,0,2);o.dTen=se(1,0,10);o.dNaN=se(Number.NaN,Number.NaN,Number.NaN);o.dInf=se(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);o.dNegInf=se(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);o.dNumberMax=Q(1,0,Number.MAX_VALUE);o.dNumberMin=Q(1,0,Number.MIN_VALUE);M=o.fromValue_noAlloc;Q=o.fromComponents;se=o.fromComponents_noNormalize;o.fromMantissaExponent;o.fromMantissaExponent_noNormalize;const Ss=new o(1);function jn(e,t,n=!0){let r=o.log10(e).floor(),i=o.div(e,o.pow(10,r));i.toStringWithDecimalPlaces(t)==="10"&&(i=Ss,r=r.add(1));const s=r.gte(1e9)?Nt(r,Math.max(Math.max(t,3),ve.defaultDecimalsShown)):r.gte(1e4)?pr(r,0):r.toStringWithDecimalPlaces(0);return n?i.toStringWithDecimalPlaces(t)+"e"+s:"e"+s}function pr(e,t){if(e==null)return"NaN";if(e=new o(e),e.mag<.001)return 0 .toFixed(t);const r=e.toStringWithDecimalPlaces(t).split(".");return r[0]=r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1,"),r.length==1?r[0]:r[0]+"."+r[1]}function Di(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()),ve.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Ms=new o("eeee1000"),Is=new o("e100000"),gi=new o("e1000"),Ti=new o(1e9),xs=new o(1e6),$s=new o(1e3),Ds=new o(.98),Ts=new o(.001),Pi=new o(0);function Nt(e,t,n){if(t==null&&(t=ve.defaultDecimalsShown),n=n!=null?n:ve.defaultShowSmall,e=new o(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+Nt(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Ms)){const r=e.slog();return r.gte(xs)?"F"+Nt(r.floor()):o.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+pr(r.floor(),0)}else{if(e.gte(Is))return jn(e,0,!1);if(e.gte(gi))return jn(e,0);if(e.gte(Ti))return jn(e,t);if(e.gte($s))return pr(e,0);if(e.gte(Ts)||!n)return Di(e,t);if(e.eq(Pi))return 0 .toFixed(t)}return e=Ri(e),e.lt(gi)?jn(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):Nt(e,t)+"\u207B\xB9"}function Ye(e){return e=new o(e),e.sign<0?"-"+Ye(e.neg()):e.gte(Ti)||e.lte(Ds)&&!e.eq(Pi)?Nt(e):Nt(e,0)}function Ai(e){return o.lt(e,0)?"-"+Ai(o.neg(e)):o.gt(e,2**51)?Nt(o.div(e,31536e3))+"y":(e=new o(e).toNumber(),e<60?Nt(e)+"s":e<3600?Ye(Math.floor(e/60))+"m "+Nt(e%60)+"s":e<86400?Ye(Math.floor(e/3600))+"h "+Ye(Math.floor(e/60)%60)+"m "+Ye(e%60)+"s":e<31536e3?Ye(Math.floor(e/84600)%365)+"d "+Ye(Math.floor(e/3600)%24)+"h "+Ye(Math.floor(e/60)%60)+"m":Ye(Math.floor(e/31536e3))+"y "+Ye(Math.floor(e/84600)%365)+"d "+Ye(Math.floor(e/3600)%24)+"h")}function Ps(e,t,n){e=new o(e);let r=e.toStringWithDecimalPlaces(t);return new o(r).gte(n)&&(r=o.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),r}function As(e,t){return Nt(e,t,!0)}function Ri(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 Rs=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:jn,commaFormat:pr,regularFormat:Di,format:Nt,formatWhole:Ye,formatTime:Ai,toPlaces:Ps,formatSmall:As,invertOOM:Ri},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Ur,commaFormat:Es,regularFormat:Fs,format:xe,formatWhole:ut,formatTime:yr,toPlaces:Os,formatSmall:Zt,invertOOM:qs}=Rs;window.Decimal=o;window.exponentialFormat=Ur;window.commaFormat=Es;window.regularFormat=Fs;window.format=xe;window.formatWhole=ut;window.formatTime=yr;window.toPlaces=Os;window.formatSmall=Zt;window.invertOOM=qs;function st(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Vs(e){return(e[0]+e.slice(1).replace(/[A-Z]/g,t=>`-${t}`)).toLowerCase()}function Yn(e){return typeof e=="function"}var W=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(W||{});const Zn=Symbol("DoNotCache");function A(e,t){const n=e[t];Yn(n)&&n.length===0&&!n[Zn]?e[t]=y(n.bind(e)):Yn(n)&&(e[t]=n.bind(e),e[t][Zn]=!0)}function _e(e){return Yn(e)&&!e[Zn]&&(e=y(e)),e}const gt=Symbol("Component"),dt=Symbol("GatherProps");let Bs=0;function Qt(e="feature-"){return e+Bs++}var Se=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Se||{});function Ze(e){const t=a(e);return t!==2&&t!==!1}function _n(e){return a(e)===1}function j(e){return e[Zn]=!0,e}function oe(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Xn(e,...t){const n=[],r=i=>{Object.keys(i).forEach(s=>{const l=i[s];l!=null&&typeof l=="object"&&(t.includes(l.type)?n.push(l):!(l instanceof o)&&!Ve(l)&&r(l))})};return r(e),n}var Fe=window.state=Lr({lastTenTicks:[],hasNaN:!1,NaNPath:[],errors:ln([])});const mn={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 Wr=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Wr||{}),It={classic:mn,paper:{...mn,variables:{...mn.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:{...mn,variables:{...mn.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:{...mn,variables:{...mn.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Qe=Ii();"fonts"in document&&(document.fonts.onloadingdone=()=>Qe.emit("fontsLoaded"));var Ls=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Qe},Symbol.toStringTag,{value:"Module"}));function Ei(e={}){return Object.assign({id:`${ve.id}-0`,name:"Default Save",tabs:ve.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:ve.id,modVersion:ve.versionNumber,layers:{}},e)}function bt(e){const t=Yt.compressToUTF16(zr(e!=null?e:Y));return localStorage.setItem((e!=null?e:Y).id,t),t}async function js(){Us();try{let e=localStorage.getItem(ie.active);if(e==null){await bn(Tn());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Yt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==ve.id){await bn(Tn());return}t.id=ie.active,await bn(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
|
|
`,e),await bn(Tn())}}function Tn(){const e=cr(),t=Ei({id:e});return bt(t),ie.saves.push(e),t}function cr(){let e,t=0;do e=`${ve.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const zs=G(!1);async function bn(e){console.info("Loading save",e),zs.value=!0;const{layers:t,removeLayer:n,addLayer:r}=await Hn(()=>Promise.resolve().then(function(){return Bl}),void 0),{fixOldSave:i,getInitialLayers:s}=await Hn(()=>Promise.resolve().then(function(){return Xp}),void 0);for(const l in t){const u=t[l];u&&n(u)}s(e).forEach(l=>r(l,e)),e=Ei(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,ve.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==ve.versionNumber&&(i(e.modVersion,e),e.modVersion=ve.versionNumber),Object.assign(Y,e),ie.active=Y.id,Qe.emit("onLoad")}setInterval(()=>{Y.autosave&&bt()},1e3);window.onbeforeunload=()=>{Y.autosave&&bt()};window.save=bt;const Gs=window.hardReset=async()=>{await bn(Tn())};window.deleteLowerSaves=()=>{const e=Object.values(ie.saves).indexOf(Y.id)+1;Object.values(ie.saves).slice(e).forEach(t=>localStorage.removeItem(t)),ie.saves=ie.saves.slice(0,e)};const Jn=ln({active:"",saves:[],showTPS:!0,theme:Wr.Nordic,unthrottled:!1,alignUnits:!1});wt(Jn,e=>{const t=Yt.compressToUTF16(JSON.stringify(e));localStorage.setItem(ve.id,t)},{deep:!0});var ie=window.settings=Jn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Wr.Nordic,alignUnits:!1};Qe.emit("loadSettings",e),Object.assign(Jn,e),Gs()};function Us(){try{let e=localStorage.getItem(ve.id);if(e!=null&&e!==""){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Yt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Jn,t)}Qe.emit("loadSettings",Jn)}catch{}}const Fi=ln([]);function Oi(e){Fi.push(e)}const Ws=ln([]),Hs=ln([]),Ys={class:"table"},Zs=X({__name:"Column",setup(e){const t=y(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),T("div",Ys,[N("div",{class:Ne(["col",{mergeAdjacent:a(t)}])},[qt(n.$slots,"default")],2)]))}}),Xs={class:"table"},Js=X({__name:"Row",setup(e){const t=y(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),T("div",Xs,[N("div",{class:Ne(["row",{mergeAdjacent:a(t)}])},[qt(n.$slots,"default")],2)]))}});function qi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ca(e)}function fe(e,t="span"){return typeof e=="function"?X({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),X({template:e})):X({render:()=>({})}):e}function ot(e){if(At(e))return typeof e=="function"?e():fe(e);const t=e[gt];return d(t,e[dt](),null)}function Rr(...e){let t;return d(Js,null,qi(t=e.map(ot))?t:{default:()=>[t]})}function Ks(...e){let t;return d(Zs,null,qi(t=e.map(ot))?t:{default:()=>[t]})}function mt(e){if(At(e))return typeof e=="function"?e():typeof e=="string"?d(ne,null,[e]):d(e,null,null);const t=e[gt];return d(t,e[dt](),null)}function mi(e,t){return e.reduce((n,r)=>d(ne,null,[n,t,r]))}function At(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[Zn]===!0}function Vi(e,t){const n=G(null),r=G(void 0);function i(u){n.value||(n.value=setInterval(l,250)),r.value=u}function s(){n.value&&(clearInterval(n.value),n.value=null)}function l(){t&&t.value?t.value():e&&e.value&&e.value(r.value)}return Mi(s),{start:i,stop:s,handleHolding:l}}function Hr(e,t="div"){const n=_t();return Pt(()=>{n.value=fe(Pe(e),t)}),n}function Rn(e,t="div"){const n=_t(null);return Pt(()=>{const r=Pe(e);n.value=r==""||r==null?null:fe(r,t)}),n}function Pe(e){return a(a(e))}function q(...e){return e.includes(Object)||e.push(Object),e}function vi(e){const t=G(!1),n=e[dt].bind(e);return e[dt]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}function Bi(e){return Object.keys(e).reduce((t,n)=>(t[Vs(n)]=e[n],t),{})}const Qs=X({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=G({}),r=new ResizeObserver(u),i=G(null);Qn(()=>{const g=i.value;g!=null&&r.observe(g)});let s=!0,l=G((h=i.value)==null?void 0:h.getBoundingClientRect());function u(){s&&(s=!1,Xt(()=>{var g;l.value=(g=i.value)==null?void 0:g.getBoundingClientRect(),Object.values(n.value).filter(b=>b).forEach(b=>b.rect=b.element.getBoundingClientRect()),t("updateNodes",n.value),s=!0}))}Qe.on("fontsLoaded",u);const c={attributes:!1,childList:!0,subtree:!1};sr(Yr,(g,b)=>{const m=new MutationObserver(()=>p(g));m.observe(b,c),n.value[g]={element:b,observer:m,rect:b.getBoundingClientRect()},u()}),sr(Zr,g=>{var b;(b=n.value[g])==null||b.observer.disconnect(),n.value[g]=void 0,u()}),sr(Xr,n),sr(Jr,l);function p(g){const b=n.value[g];b!=null&&(b.rect=b.element.getBoundingClientRect(),t("updateNodes",n.value))}return(g,b)=>(S(),T(ne,null,[qt(g.$slots,"default",{},void 0,!0),N("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var Li=be(Qs,[["__scopeId","data-v-2b1dc1bc"]]);const eo=["onPointerdown"],to={class:"modal-wrapper"},no={class:"modal-container"},ro={class:"modal-header"},io={class:"modal-body"},ao={class:"modal-footer"},so=N("div",{class:"modal-default-flex-grow"},null,-1),Lt=X({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const i=Ae(e),s=y(()=>a(i.modelValue)||u.value);function l(){n("update:modelValue",!1)}const u=G(!1),c=G(null),p=y(()=>{var h,g;return(g=(h=c.value)==null?void 0:h.nodes)!=null?g:null});return t({isOpen:s,nodes:p}),(h,g)=>(S(),re(pa,{to:"#modal-root"},[d(Wn,{name:"modal",onBeforeEnter:g[0]||(g[0]=b=>u.value=!0),onAfterLeave:g[1]||(g[1]=b=>u.value=!1)},{default:H(()=>[jr(N("div",Vt({class:"modal-mask",onPointerdown:Pn(l,["self"])},h.$attrs),[N("div",to,[N("div",no,[N("div",ro,[qt(h.$slots,"header",{shown:a(s)},()=>[w(" default header ")])]),N("div",io,[d(Li,{ref_key:"contextRef",ref:c},{default:H(()=>[qt(h.$slots,"body",{shown:a(s)},()=>[w(" default body ")])]),_:3},512)]),N("div",ao,[qt(h.$slots,"footer",{shown:a(s)},()=>[N("div",{class:"modal-default-footer"},[so,N("button",{class:"button modal-default-button",onClick:l}," Close ")])])])])])],16,eo),[[da,e.modelValue]])]),_:3})]))}}),an=Symbol("ProxyState");function et(e,t={}){const n=t;let r=!1,i=!1;function s(){return r||(i&&console.error("Cyclical dependency detected. Cannot evaluate lazy proxy."),i=!0,Object.assign(n,e.call(n,n)),r=!0),n}return new Proxy(n,{get(l,u){if(u===an)return s();const c=s()[u];return c!=null&&typeof c=="object"&&Ot in c?c[Ot]:c},set(l,u,c){return s()[u]=c,!0},has(l,u){return u===an?!0:Reflect.has(s(),u)},ownKeys(){return Reflect.ownKeys(s())},getOwnPropertyDescriptor(l,u){return r||(Object.assign(n,e.call(n,n)),r=!0),Object.getOwnPropertyDescriptor(l,u)}})}const ji=o.ln(10);function zn(e){return e}function oo(e,t){return F(t)?t.invert(o.neg(e)):(console.error("Could not invert due to no input being a variable"),0)}function lo(e,t){return F(t)?t.isIntegrable()?f.neg(t.getIntegralFormula(e)):(console.error("Could not integrate due to variable not being integrable"),f.constant(0)):(console.error("Could not integrate due to no input being a variable"),f.constant(0))}function uo(e){return f.neg(e)}function co(e,t,n){return F(t)?t.invert(o.sub(e,Me(n))):F(n)?n.invert(o.sub(e,Me(t))):(console.error("Could not invert due to no input being a variable"),0)}function po(e,t,n){var r,i;if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const s=t.getIntegralFormula(e);return f.times(n,(r=t.innermostVariable)!=null?r:0).add(s)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const s=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).add(s)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function fo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.add(r,n)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e);return f.add(r,t)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function go(e,t,n){return F(t)?t.invert(o.add(e,Me(n))):F(n)?n.invert(o.sub(Me(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function mo(e,t,n){var r,i;if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const s=t.getIntegralFormula(e);return f.sub(s,f.times(n,(r=t.innermostVariable)!=null?r:0))}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const s=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).sub(s)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function vo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.sub(r,n)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e);return f.sub(r,t)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function ho(e,t,n){return F(t)?t.invert(o.div(e,Me(n))):F(n)?n.invert(o.div(e,Me(t))):(console.error("Could not invert due to no input being a variable"),0)}function bo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.times(r,n)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e);return f.times(r,t)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function yo(e,t,n){return F(t)?f.div(e,n):F(n)?f.div(e,t):(console.error("Could not apply substitution due to no input being a variable"),f.constant(0))}function wo(e,t,n){return F(t)?t.invert(o.mul(e,Me(n))):F(n)?n.invert(o.div(Me(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function _o(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.div(r,n)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e);return f.div(t,r)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function No(e,t,n){return F(t)?f.mul(e,n):F(n)?f.mul(e,t):(console.error("Could not apply substitution due to no input being a variable"),f.constant(0))}function Co(e,t){return F(t)?t.invert(o.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function ko(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.ln(n)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function So(e,t){return F(t)?t.invert(o.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function Mo(e){return o.ln(e).sub(1).times(e).div(ji)}function Io(e,t){if(F(t)){const n=ji.times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function xo(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:Mo,invert:Io}):(console.error("Could not integrate due to variable not being integrable"),f.constant(0)):(console.error("Could not integrate due to no input being a variable"),f.constant(0))}function $o(e,t,n){return F(t)?t.invert(o.pow(Me(n),e)):F(n)?n.invert(o.root(Me(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Do(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function To(e,t,n){if(F(t)){const r=o.ln(Me(n)).times(e);return t.invert(r.div(r.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Po(e,t,n){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e),n],evaluate:Do,invert:To}):(console.error("Could not integrate due to variable not being integrable"),f.constant(0)):(console.error("Could not integrate due to no input being a variable"),f.constant(0))}function Ao(e,t){return F(t)?t.invert(o.pow(2,e)):(console.error("Could not invert due to no input being a variable"),0)}function Ro(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function Eo(e,t){if(F(t)){const n=o.ln(2).times(e);return t.invert(n.div(n.div(Math.E).lambertw()))}return console.error("Could not invert due to no input being a variable"),0}function Fo(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:Ro,invert:Eo}):(console.error("Could not integrate due to variable not being integrable"),f.constant(0)):(console.error("Could not integrate due to no input being a variable"),f.constant(0))}function Oo(e,t){return F(t)?t.invert(o.exp(e)):(console.error("Could not invert due to no input being a variable"),0)}function qo(e){return o.ln(e).sub(1).times(e)}function Vo(e,t){return F(t)?t.invert(o.div(e,o.div(e,Math.E).lambertw())):(console.error("Could not invert due to no input being a variable"),0)}function Bo(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:qo,invert:Vo}):(console.error("Could not integrate due to variable not being integrable"),f.constant(0)):(console.error("Could not integrate due to no input being a variable"),f.constant(0))}function Lo(e,t,n){return F(t)?t.invert(o.root(e,Me(n))):F(n)?n.invert(o.ln(e).div(o.ln(Me(t)))):(console.error("Could not invert due to no input being a variable"),0)}function jo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e),i=f.add(n,1);return f.pow(r,i).div(i)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e);return f.pow(t,r).div(f.ln(t))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function zo(e,t){return F(t)?t.invert(o.root(e,10)):(console.error("Could not invert due to no input being a variable"),0)}function Go(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.pow10(n).div(f.ln(10))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Uo(e,t,n){return F(t)?t.invert(o.ln(e).div(o.ln(Me(n)))):F(n)?n.invert(o.root(Me(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Wo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.pow(n,r).div(f.ln(n))}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=n.getIntegralFormula(e),i=f.add(t,1);return f.pow(r,i).div(i)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Ho(e,t,n){return F(t)?t.invert(o.root(e,o.recip(Me(n)))):F(n)?n.invert(o.ln(Me(t)).div(o.ln(e))):(console.error("Could not invert due to no input being a variable"),0)}function Yo(e,t,n){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const r=t.getIntegralFormula(e);return f.pow(r,f.recip(n).add(1)).times(n).div(f.add(n,1))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Zo(e,t){return F(t)?t.invert(o.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function Xo(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.exp(n)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Jo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const r=o.minabs(t,1e308).toNumber();return o.tetrate(e,r,n)}function Ko(e,t,n,r){return F(t)?t.invert(o.ssqrt(e)):(console.error("Could not invert due to no input being a variable"),0)}function Qo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const r=o.minabs(t,1e308).toNumber();return o.iteratedexp(e,r,new o(n))}function el(e,t,n,r){return F(t)?t.invert(o.iteratedlog(e,Math.E,o.minabs(1e308,Me(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function tl(e,t=10,n=2){const r=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,r)}function nl(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function rl(e,t,n){return F(t)?t.invert(o.tetrate(e,o.minabs(1e308,Me(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function il(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.layeradd(e,r,n)}function al(e,t,n,r){return F(t)?t.invert(o.layeradd(e,o.minabs(1e308,Me(n)).negate().toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function sl(e,t){return F(t)?t.invert(o.pow(Math.E,e).times(e)):(console.error("Could not invert due to no input being a variable"),0)}function ol(e,t){return F(t)?t.invert(o.tetrate(e,2)):(console.error("Could not invert due to no input being a variable"),0)}function ll(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.pentate(e,r,n)}function ul(e,t){return F(t)?t.invert(o.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function cl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.cos(n).neg()}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function dl(e,t){return F(t)?t.invert(o.acos(e)):(console.error("Could not invert due to no input being a variable"),0)}function pl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.sin(n)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function fl(e,t){return F(t)?t.invert(o.atan(e)):(console.error("Could not invert due to no input being a variable"),0)}function gl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.cos(n).ln().neg()}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function ml(e,t){return F(t)?t.invert(o.sin(e)):(console.error("Could not invert due to no input being a variable"),0)}function vl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.asin(n).times(n).add(f.sqrt(f.sub(1,f.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function hl(e,t){return F(t)?t.invert(o.cos(e)):(console.error("Could not invert due to no input being a variable"),0)}function bl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.acos(n).times(n).sub(f.sqrt(f.sub(1,f.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function yl(e,t){return F(t)?t.invert(o.tan(e)):(console.error("Could not invert due to no input being a variable"),0)}function wl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.atan(n).times(n).sub(f.ln(f.pow(n,2).add(1)).div(2))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function _l(e,t){return F(t)?t.invert(o.asinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Nl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.cosh(n)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Cl(e,t){return F(t)?t.invert(o.acosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function kl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.sinh(n)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Sl(e,t){return F(t)?t.invert(o.atanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ml(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.cosh(n).ln()}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Il(e,t){return F(t)?t.invert(o.sinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function xl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.asinh(n).times(n).sub(f.pow(n,2).add(1).sqrt())}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function $l(e,t){return F(t)?t.invert(o.cosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Dl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.acosh(n).times(n).sub(f.add(n,1).sqrt().times(f.sub(n,1).sqrt()))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function Tl(e,t){return F(t)?t.invert(o.tanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Pl(e,t){if(F(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const n=t.getIntegralFormula(e);return f.atanh(n).times(n).add(f.sub(1,f.pow(n,2)).ln().div(2))}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function En(e){return(t,n)=>new f({inputs:[t,n],evaluate:e,invert:zn})}function F(e){return e instanceof Re&&e.hasVariable()}function Me(e,t){return e instanceof Re?e.evaluate(t):a(e)}function Al(){return f.pow(this,2).div(2)}function Rl(){return this}const Be=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"&&Ot in n?n[Ot]:n)),"variable"in e?(typeof e.variable=="object"&&Ot in e.variable&&(e.variable=e.variable[Ot]),t=this.setupVariable(e)):"evaluate"in e?t=this.setupFormula(e):t=this.setupConstant(e),this.inputs=t.inputs,this.internalVariables=t.internalVariables,this.innermostVariable=t.innermostVariable,this.internalEvaluate=t.internalEvaluate,this.internalInvert=t.internalInvert,this.internalIntegrate=t.internalIntegrate,this.internalIntegrateInner=t.internalIntegrateInner,this.applySubstitution=t.applySubstitution}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:Al,internalIntegrateInner:Rl,applySubstitution:zn}}setupConstant({inputs:e}){return e.length!==1&&console.error("Evaluate function is required if inputs is not length 1"),{inputs:e,internalVariables:0}}setupFormula(e){var b,m;const{inputs:t,evaluate:n,invert:r,integrate:i,integrateInner:s,applySubstitution:l}=e,u=t.reduce((k,C)=>k+(C instanceof Be?C.internalVariables:0),0),c=t.find(k=>k instanceof Be&&k.hasVariable()),p=u===1?c==null?void 0:c.innermostVariable:void 0,h=(b=c==null?void 0:c.isInvertible())!=null?b:!1,g=(m=c==null?void 0:c.isIntegrable())!=null?m:!1;return{inputs:t,internalEvaluate:n,internalInvert:h?r:void 0,internalIntegrate:g?i:void 0,internalIntegrateInner:s,applySubstitution:l,innermostVariable:p,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,r;return(r=(n=(t=this.internalEvaluate)==null?void 0:t.call(this,...this.inputs.map(i=>Me(i,e))))!=null?n:this.hasVariable()?e:null)!=null?r:Me(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Be&&e.inputs[n]instanceof Be?t.equals(e.inputs[n]):!(t instanceof Be)&&!(e.inputs[n]instanceof Be)&&o.eq(a(t),a(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new f({inputs:[e]})}static variable(e){return new f({variable:e})}static step(e,t,n){const r=n(f.variable(0)),i=_e(t);function s(u){return o.lt(u,a(i))?u:o.add(r.evaluate(o.sub(u,a(i))),a(i))}function l(u,c){return F(c)&&r.isInvertible()?(o.gt(u,a(i))&&(u=o.add(r.invert(o.sub(u,a(i))),a(i))),c.invert(u)):(console.error("Could not invert due to no input being a variable"),0)}return new f({inputs:[e],evaluate:s,invert:r.isInvertible()&&r.hasVariable()?l:void 0})}static if(e,t,n,r){const i=G(0),s=f.variable(i),l=n(s),u=r==null?void 0:r(s),c=_e(t);function p(g){return a(c)?(i.value=g,l.evaluate()):u?(i.value=g,u.evaluate()):g}function h(g,b){return!F(b)||!l.isInvertible()||u!=null&&!u.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):a(c)?b.invert(l.invert(g)):u?b.invert(u.invert(g)):b.invert(g)}return new f({inputs:[e],evaluate:p,invert:l.isInvertible()&&l.hasVariable()?h:void 0})}static conditional(e,t,n,r){return f.if(e,t,n,r)}static abs(e){return new f({inputs:[e],evaluate:o.abs})}static neg(e){return new f({inputs:[e],evaluate:o.neg,invert:oo,applySubstitution:uo,integrate:lo})}static sign(e){return new f({inputs:[e],evaluate:o.sign})}static round(e){return new f({inputs:[e],evaluate:o.round})}static floor(e){return new f({inputs:[e],evaluate:o.floor})}static ceil(e){return new f({inputs:[e],evaluate:o.ceil})}static trunc(e){return new f({inputs:[e],evaluate:o.trunc})}static add(e,t){return new f({inputs:[e,t],evaluate:o.add,invert:co,integrate:po,integrateInner:fo,applySubstitution:zn})}static sub(e,t){return new f({inputs:[e,t],evaluate:o.sub,invert:go,integrate:mo,integrateInner:vo,applySubstitution:zn})}static mul(e,t){return new f({inputs:[e,t],evaluate:o.mul,invert:ho,integrate:bo,applySubstitution:yo})}static div(e,t){return new f({inputs:[e,t],evaluate:o.div,invert:wo,integrate:_o,applySubstitution:No})}static recip(e){return new f({inputs:[e],evaluate:o.recip,invert:Co,integrate:ko})}static clamp(e,t,n){return new f({inputs:[e,t,n],evaluate:o.clamp,invert:zn})}static pLog10(e){return new f({inputs:[e],evaluate:o.pLog10})}static absLog10(e){return new f({inputs:[e],evaluate:o.absLog10})}static log10(e){return new f({inputs:[e],evaluate:o.log10,invert:So,integrate:xo})}static log(e,t){return new f({inputs:[e,t],evaluate:o.log,invert:$o,integrate:Po})}static log2(e){return new f({inputs:[e],evaluate:o.log2,invert:Ao,integrate:Fo})}static ln(e){return new f({inputs:[e],evaluate:o.ln,invert:Oo,integrate:Bo})}static pow(e,t){return new f({inputs:[e,t],evaluate:o.pow,invert:Lo,integrate:jo})}static pow10(e){return new f({inputs:[e],evaluate:o.pow10,invert:zo,integrate:Go})}static pow_base(e,t){return new f({inputs:[e,t],evaluate:o.pow_base,invert:Uo,integrate:Wo})}static root(e,t){return new f({inputs:[e,t],evaluate:o.root,invert:Ho,integrate:Yo})}static factorial(e){return new f({inputs:[e],evaluate:o.factorial})}static gamma(e){return new f({inputs:[e],evaluate:o.gamma})}static lngamma(e){return new f({inputs:[e],evaluate:o.lngamma})}static exp(e){return new f({inputs:[e],evaluate:o.exp,invert:Zo,integrate:Xo})}static sqr(e){return f.pow(e,2)}static sqrt(e){return f.root(e,2)}static cube(e){return f.pow(e,3)}static cbrt(e){return f.root(e,3)}static tetrate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:Jo,invert:Ko})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:Qo,invert:el})}static iteratedlog(e,t=10,n=1){return new f({inputs:[e,t,n],evaluate:tl})}static slog(e,t=10){return new f({inputs:[e,t],evaluate:nl,invert:rl})}static layeradd10(e,t){return new f({inputs:[e,t],evaluate:o.layeradd10})}static layeradd(e,t,n=10){return new f({inputs:[e,t,n],evaluate:il,invert:al})}static lambertw(e){return new f({inputs:[e],evaluate:o.lambertw,invert:sl})}static ssqrt(e){return new f({inputs:[e],evaluate:o.ssqrt,invert:ol})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:ll})}static sin(e){return new f({inputs:[e],evaluate:o.sin,invert:ml,integrate:cl})}static cos(e){return new f({inputs:[e],evaluate:o.cos,invert:hl,integrate:pl})}static tan(e){return new f({inputs:[e],evaluate:o.tan,invert:yl,integrate:gl})}static asin(e){return new f({inputs:[e],evaluate:o.asin,invert:ul,integrate:vl})}static acos(e){return new f({inputs:[e],evaluate:o.acos,invert:dl,integrate:bl})}static atan(e){return new f({inputs:[e],evaluate:o.atan,invert:fl,integrate:wl})}static sinh(e){return new f({inputs:[e],evaluate:o.sinh,invert:Il,integrate:Nl})}static cosh(e){return new f({inputs:[e],evaluate:o.cosh,invert:$l,integrate:kl})}static tanh(e){return new f({inputs:[e],evaluate:o.tanh,invert:Tl,integrate:Ml})}static asinh(e){return new f({inputs:[e],evaluate:o.asinh,invert:_l,integrate:xl})}static acosh(e){return new f({inputs:[e],evaluate:o.acosh,invert:Cl,integrate:Dl})}static atanh(e){return new f({inputs:[e],evaluate:o.atanh,invert:Sl,integrate:Pl})}step(e,t){return f.step(this,e,t)}if(e,t){return f.if(this,e,t)}conditional(e,t){return f.if(this,e,t)}abs(){return f.abs(this)}neg(){return f.neg(this)}sign(){return f.sign(this)}round(){return f.round(this)}floor(){return f.floor(this)}ceil(){return f.ceil(this)}trunc(){return f.trunc(this)}add(e){return f.add(this,e)}sub(e){return f.sub(this,e)}mul(e){return f.mul(this,e)}div(e){return f.div(this,e)}recip(){return f.recip(this)}max(e){return f.max(this,e)}min(e){return f.min(this,e)}maxabs(e){return f.maxabs(this,e)}minabs(e){return f.minabs(this,e)}clamp(e,t){return f.clamp(this,e,t)}clampMin(e){return f.clampMin(this,e)}clampMax(e){return f.clampMax(this,e)}pLog10(){return f.pLog10(this)}absLog10(){return f.absLog10(this)}log10(){return f.log10(this)}log(e){return f.log(this,e)}log2(){return f.log2(this)}ln(){return f.ln(this)}pow(e){return f.pow(this,e)}pow10(){return f.pow10(this)}pow_base(e){return f.pow_base(this,e)}root(e){return f.root(this,e)}factorial(){return f.factorial(this)}gamma(){return f.gamma(this)}lngamma(){return f.lngamma(this)}exp(){return f.exp(this)}sqr(){return f.pow(this,2)}sqrt(){return f.root(this,2)}cube(){return f.pow(this,3)}cbrt(){return f.root(this,3)}tetrate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return f.tetrate(this,e,t)}iteratedexp(e=2,t=o.fromComponents_noNormalize(1,0,1)){return f.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return f.iteratedlog(this,e,t)}slog(e=10){return f.slog(this,e)}layeradd10(e){return f.layeradd10(this,e)}layeradd(e,t){return f.layeradd(this,e,t)}lambertw(){return f.lambertw(this)}ssqrt(){return f.ssqrt(this)}pentate(e=2,t=o.fromComponents_noNormalize(1,0,1)){return f.pentate(this,e,t)}sin(){return f.sin(this)}cos(){return f.cos(this)}tan(){return f.tan(this)}asin(){return f.asin(this)}acos(){return f.acos(this)}atan(){return f.atan(this)}sinh(){return f.sinh(this)}cosh(){return f.cosh(this)}tanh(){return f.tanh(this)}asinh(){return f.asinh(this)}acosh(){return f.acosh(this)}atanh(){return f.atanh(this)}};let Re=Be;Re.negate=Be.neg;Re.negated=Be.neg;Re.sgn=Be.sign;Re.plus=Be.add;Re.subtract=Be.sub;Re.minus=Be.sub;Re.multiply=Be.mul;Re.times=Be.mul;Re.divide=Be.div;Re.divideBy=Be.div;Re.dividedBy=Be.div;Re.reciprocal=Be.recip;Re.reciprocate=Be.recip;Re.max=En(o.max);Re.min=En(o.min);Re.minabs=En(o.minabs);Re.maxabs=En(o.maxabs);Re.clampMin=En(o.clampMin);Re.clampMax=En(o.clampMax);Re.logarithm=Be.log;class f extends Re{invert(t){return this.internalInvert&&this.hasVariable()?this.internalInvert.call(this,t,...this.inputs):this.inputs.length===1&&this.hasVariable()?t:(console.error("Cannot invert non-invertible formula"),0)}evaluateIntegral(t){return this.isIntegrable()?this.getIntegralFormula().evaluate(t):(console.error("Cannot evaluate integral of formula without integral"),0)}invertIntegral(t){return!this.isIntegrable()||!this.getIntegralFormula().isInvertible()?(console.error("Cannot invert integral of formula without invertible integral"),0):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)return console.error("Cannot integrate formula with non-integrable operation"),f.constant(0);let n=this.internalIntegrate.call(this,t,...this.inputs);t.forEach(r=>n=r(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 return console.error("Cannot integrate formula without variable"),f.constant(0);return this.integralFormula}else return this.applySubstitution==null?(console.error("Cannot have two complex operations in an integrable formula"),f.constant(0)):(t.push(n=>this.applySubstitution.call(this,n,...this.inputs)),this.internalIntegrateInner?this.internalIntegrateInner.call(this,t,...this.inputs):this.internalIntegrate?this.internalIntegrate.call(this,t,...this.inputs):this.inputs.length===1&&this.internalEvaluate==null&&this.hasVariable()?this:(console.error("Cannot integrate formula without variable"),f.constant(0)))}}function zi(e,t,n=!0,r,i=o.dInf){const s=_e(n),l=_e(r),u=_e(i);return y(()=>{var b,m,k,C;const c=a(u);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const p=a(s),h=(b=a(l))!=null?b:p?10:0;let g=0;if(o.gt(c,h)){if(!e.isInvertible())return console.error("Cannot calculate max affordable of non-invertible formula with more maxBulkAmount than directSum"),0;if(p){if(!e.isIntegralInvertible())return console.error("Cannot calculate max affordable of formula with non-invertible integral"),0;g=o.floor(e.invertIntegral(o.add(t.value,e.evaluateIntegral()))).sub((m=a(e.innermostVariable))!=null?m:0)}else g=o.floor(e.invert(t.value))}if(g=o.clampMax(g,c),h>0){const $=g;g=o.sub(g,h).clampMin(0);let x;for(p?x=sn(e,g,!0,0):x=e.evaluate(o.add((k=a(e.innermostVariable))!=null?k:0,g));o.lt(g,c)&&o.lt(g,Number.MAX_SAFE_INTEGER)&&o.add($,1).gte(g);){const I=e.evaluate(g.add((C=a(e.innermostVariable))!=null?C:0));if(o.add(x,I).lte(t.value))g=g.add(1),x=o.add(x,I);else break}}return g})}function sn(e,t,n=!0,r){var c;if(o.eq(t,1))return e.evaluate();const i=(c=a(e.innermostVariable))!=null?c:0;let s=o.add(t,i);const l=s;r!=null||(r=n?10:0),s=s.sub(r).clampMin(i);let u=0;if(o.gt(t,r)){if(!e.isInvertible())return console.error("Cannot calculate cost with indirect sum of non-invertible formula"),0;if(n){if(!e.isIntegrable())return console.error("Cannot calculate cost with cumulative cost of non-integrable formula"),0;if(u=o.sub(e.evaluateIntegral(s),e.evaluateIntegral()),l.gt(1e308))return o.add(u,o.sub(l,s).times(e.evaluate(s)))}else if(u=e.evaluate(s),s=s.add(1),l.gt(1e308))return o.sub(l,s).add(1).times(u)}for(let p=s.toNumber();p<l.toNumber();p++)u=o.add(u,e.evaluate(p));return u}const on=Symbol("PersistentState"),Kt=Symbol("DefaultValue"),fr=Symbol("StackTrace"),gr=Symbol("Deleted"),Ot=Symbol("NonPersistent"),yn=Symbol("SaveDataPath"),Kn=Symbol("SkipPersistence");function El(){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 hi(e,t){var n;o.isNaN(t)&&(Fe.hasNaN||(Y.autosave=!1,Fe.hasNaN=!0,Fe.NaNPath=e[yn],Fe.NaNPersistent=e),console.error(`Attempted to save NaN value to ${(n=e[yn])==null?void 0:n.join(".")}`)),e[on].value=t}function ct(e,t=!0){const n=Ve(e)?e:G(e);Ve(e)&&(e=e.value);const r=y({get(){return n.value},set(s){t?hi(i,s):i[on].value=s}});r[Kt]=e;const i={get value(){return n.value},set value(s){t?hi(i,s):i[on].value=s},__v_isRef:!0,[on]:n,[Kt]:e,[fr]:El(),[gr]:!1,[Ot]:r,[yn]:void 0};return ft.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",i,`
|
|
Created at:
|
|
`+i[fr]):wn[ft[ft.length-1]].add(i),i}function Fl(e){return e!=null&&typeof e=="object"&&on in e}function In(e){return!(an in e)&&Ot in e?e[Ot]:new Proxy(e,{get(t,n){if(n!==on)return n===Kn?!0:t[n]},set(t,n,r){return t[n]=r,!0},has(t,n){return n===on?!1:n==Kn?!0:Reflect.has(t,n)}})}function Gi(e){ft.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):wn[ft[ft.length-1]].delete(e),e[gr]=!0}Qe.on("addLayer",(e,t)=>{const n=[],r=(i,s=[])=>{let l=!1;return Object.keys(i).forEach(u=>{let c=i[u];if(c!=null&&typeof c=="object"){if(c[Kn]===!0)return;if(an in c&&(c=c[an]),Fl(c)){if(l=!0,c[gr]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,`
|
|
Created at:
|
|
`+c[fr]);return}wn[e.id].delete(c);const p=[e.id,...s,u];c[yn]!=null&&JSON.stringify(p)!==JSON.stringify(c[yn])&&console.error(`Persistent ref is being saved to \`${p.join(".")}\` when it's already present at \`${c[yn].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),c[yn]=p;const h=s.reduce((b,m)=>(m in b||(b[m]={}),b[m]),t),g=h[u];h[u]=c[on],fa(h)?g!=null?h[u]=g:h[u]=c[Kt]:g!=null?h[u].value=g:h[u].value=c[Kt]}else!(c instanceof o)&&!(c instanceof f)&&!Ve(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),r(c,[...s,u])&&(Bt(c)&&!Bt(i)?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.",an in i?i[an]:i,u):l=!0))}}),l};r(e[an]),wn[e.id].forEach(i=>{i[gr]||console.error(`Created persistent ref in ${e.id} without registering it to the layer!`,`Make sure to include everything persistent in the returned object.
|
|
|
|
Created at:
|
|
`+i[fr])}),wn[e.id].clear()});const Yr=Symbol("RegisterNode"),Zr=Symbol("UnregisterNode"),Xr=Symbol("Nodes"),Jr=Symbol("Bounds"),ge=Lr({});window.layers=ge;const wn={},ft=[];function Kr(e,t){return et(()=>{const n={},r=n.emitter=Ii();if(n.on=r.on.bind(r),n.emit=r.emit.bind(r),n.nodes=G({}),n.id=e,ft.push(e),wn[e]=new Set,n.minimized=ct(!1,!1),Object.assign(n,t.call(n,n)),ft[ft.length-1]==null||ft[ft.length-1]!==e)throw new Error(`Adding layers stack in invalid state. This should not happen
|
|
Stack: ${ft}
|
|
Trying to pop ${n.id}`);ft.pop(),A(n,"color"),A(n,"display"),A(n,"classes"),A(n,"style"),A(n,"name"),oe(n,"name",n.id),A(n,"minWidth"),oe(n,"minWidth",600),A(n,"minimizable"),oe(n,"minimizable",!0),A(n,"minimizedDisplay");const i=n.style;return n.style=y(()=>{var l,u;let s=a(n.minWidth);return(typeof s=="number"||!Number.isNaN(parseInt(s)))&&(s=s+"px"),[(l=a(i))!=null?l:"",(u=n.minimized)!=null&&u.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:s,flexBasis:s,margin:""}]}),n})}function Qr(e,t){if(console.info("Adding layer",e.id),ge[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,ge[e.id]);return}oe(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),ge[e.id]=e,Qe.emit("addLayer",e,t.layers[e.id])}function Ol(e){return ge[e]}function ei(e){console.info("Removing layer",e.id),Qe.emit("removeLayer",e),ge[e.id]=void 0}function ql(e){ei(e),Qr(e,Y)}function Vl(e){const t=G(!1);return{openModal:()=>t.value=!0,modal:j(()=>d(Lt,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>d("h2",null,[a(e.name)]),body:a(e.display)}))}}Qe.on("update",function(t){Object.values(ge).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Bl=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Yr,UnregisterNodeInjectionKey:Zr,NodesInjectionKey:Xr,BoundsInjectionKey:Jr,layers:ge,persistentRefs:wn,addingLayers:ft,createLayer:Kr,addLayer:Qr,getLayer:Ol,removeLayer:ei,reloadLayer:ql,setupLayerModal:Vl},Symbol.toStringTag,{value:"Module"}));const Ll=X({components:{Context:Li,ErrorVue:xi},props:{index:{type:Number,required:!0},display:{type:q(Object,String,Function),required:!0},minimizedDisplay:q(Object,String,Function),minimized:{type:Object,required:!0},name:{type:q(String),required:!0},color:q(String),minimizable:q(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:r,minimizedDisplay:i}=Ae(e),s=Hr(t),l=Rn(i),u=y(()=>ve.allowGoBack&&n.value>0&&!Pe(r));function c(){Y.tabs.splice(a(e.index),1/0)}function p(g){e.nodes.value=g}const h=G([]);return ga((g,b,m)=>(console.warn(`Error caught in "${e.name}" layer`,g,b,m),h.value.push(g instanceof Error?g:new Error(JSON.stringify(g))),!1)),{component:s,minimizedComponent:l,showGoBack:u,updateNodes:p,unref:a,goBack:c,errors:h}}}),jl={key:1};function zl(e,t,n,r,i,s){const l=Ct("ErrorVue"),u=Ct("Context");return e.errors.length>0?(S(),re(l,{key:0,errors:e.errors},null,8,["errors"])):(S(),T("div",Vt({key:1,class:"layer-container",style:{"--layer-color":e.unref(e.color)}},e.$attrs),[e.showGoBack?(S(),T("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...c)=>e.goBack&&e.goBack(...c))},"\u274C")):B("",!0),e.unref(e.minimized)?(S(),T("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=c=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(S(),re(Ke(e.minimizedComponent),{key:0})):(S(),T("div",jl,ee(e.unref(e.name)),1))])):(S(),T("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[d(u,{onUpdateNodes:e.updateNodes},{default:H(()=>[(S(),re(Ke(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(S(),T("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=c=>e.$emit("setMinimized",!0))}," \u25BC ")):B("",!0)],16))}var Gl=be(Ll,[["render",zl],["__scopeId","data-v-a9f5b1da"]]);const Ui=e=>(cn("data-v-4b4bda40"),e=e(),dn(),e),Ul=Ui(()=>N("h2",null,"Changelog",-1)),Wl=Ui(()=>N("details",{open:""},[N("summary",null,[w("v0.0 Initial Commit - "),N("time",null,"2021-09-04")]),w(" This is the first release :D "),N("ul",null,[N("li",{class:"feature"},"Did everything"),N("li",{class:"fix"},"Had some fun"),N("li",{class:"breaking"},"Removed everything"),N("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),Hl=X({__name:"Changelog",setup(e,{expose:t}){const n=G(!1);return t({open(){n.value=!0}}),(r,i)=>(S(),re(Lt,{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=s=>n.value=s)},{header:H(()=>[Ul]),body:H(()=>[Wl]),_:1},8,["modelValue"]))}});var Yl=be(Hl,[["__scopeId","data-v-4b4bda40"]]),Zl=X({props:{element:Object,display:{type:q(Object,String,Function),required:!0},style:q(Object,String,Array),classes:q(Object),direction:q(String),xoffset:q(String),yoffset:q(String),pinned:Object},setup(e){const{element:t,display:n,pinned:r}=Ae(e),i=G(!1),s=y(()=>(Pe(r)||i.value)&&l.value),l=Rn(n),u=_t(fe(j(()=>{const h=Pe(t);return h==null?"":mt(h)})));function c(h){const g=r;h.shiftKey&&g&&(g.value=!g.value,h.stopPropagation(),h.preventDefault())}const p=y(()=>Pe(r)&&It[ie.theme].showPin);return{Direction:W,isHovered:i,isShown:s,comp:l,elementComp:u,unref:a,togglePinned:c,showPin:p}}});const Xl={key:0,class:"material-icons pinned"};function Jl(e,t,n,r,i,s){return S(),T("div",{class:Ne(["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))},[qt(e.$slots,"default",{},void 0,!0),e.elementComp?(S(),re(Ke(e.elementComp),{key:0})):B("",!0),d(Wn,{name:"fade"},{default:H(()=>{var l;return[e.isShown?(S(),T("div",{key:0,class:Ne(["tooltip",{top:e.unref(e.direction)===e.Direction.Up,left:e.unref(e.direction)===e.Direction.Left,right:e.unref(e.direction)===e.Direction.Right,bottom:e.unref(e.direction)===e.Direction.Down,...e.unref(e.classes)}]),style:Le([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(l=e.unref(e.style))!=null?l:{}])},[e.showPin?(S(),T("span",Xl,"push_pin")):B("",!0),e.comp?(S(),re(Ke(e.comp),{key:1})):B("",!0)],6)):B("",!0)]}),_:1})],34)}var qe=be(Zl,[["render",Jl],["__scopeId","data-v-6102fa3a"]]);const Nn=e=>(cn("data-v-4f97aa40"),e=e(),dn(),e),Kl={class:"info-modal-header"},Ql=["src","alt"],eu={class:"info-modal-title"},tu={key:0},nu={key:0},ru={key:0},iu=Nn(()=>N("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),au=Nn(()=>N("br",null,null,-1)),su=Nn(()=>N("br",null,null,-1)),ou=["href"],lu=Nn(()=>N("span",{class:"material-icons info-modal-discord"},"discord",-1)),uu=Nn(()=>N("div",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[N("span",{class:"material-icons info-modal-discord"},"discord"),w(" The Paper Pilot Community ")])],-1)),cu=Nn(()=>N("div",null,[N("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[N("span",{class:"material-icons info-modal-discord"},"discord"),w(" The Modding Tree ")])],-1)),du=Nn(()=>N("br",null,null,-1));var pu=X({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:s,discordName:l,discordLink:u,versionNumber:c,versionTitle:p}=ve,h=Ae(n),g=G(!1),b=y(()=>yr(Y.timePlayed)),m=y(()=>fe(j(()=>d(ne,null,[Ws.map(ot)]))));t({open(){g.value=!0}});function k(){var C;(C=a(h.changelog))==null||C.open()}return(C,$)=>(S(),re(Lt,{modelValue:g.value,"onUpdate:modelValue":$[0]||($[0]=x=>g.value=x)},{header:H(()=>[N("div",Kl,[a(i)?(S(),T("img",{key:0,class:"info-modal-logo",src:a(i),alt:a(r)},null,8,Ql)):B("",!0),N("div",eu,[N("h2",null,ee(a(r)),1),N("h4",null,[w(" v"+ee(a(c)),1),a(p)?(S(),T("span",tu,": "+ee(a(p)),1)):B("",!0)])])])]),body:H(({shown:x})=>[x?(S(),T("div",nu,[a(s)?(S(),T("div",ru,"By "+ee(a(s)),1)):B("",!0),iu,au,N("div",{class:"link",onClick:k},"Changelog"),su,N("div",null,[a(u)?(S(),T("a",{key:0,href:a(u),class:"info-modal-discord-link",target:"_blank"},[lu,w(" "+ee(a(l)),1)],8,ou)):B("",!0)]),uu,cu,du,N("div",null,"Time Played: "+ee(a(b)),1),(S(),re(Ke(a(m))))])):B("",!0)]),_:1},8,["modelValue"]))}});var fu=be(pu,[["__scopeId","data-v-4f97aa40"]]);const gu={class:"field"},mu={key:0,class:"field-title"},ti=X({__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,r=Rn(Jt(n,"title"),"span"),i=G((l=n.options.find(u=>u.value===n.modelValue))!=null?l:null);wt(Jt(n,"modelValue"),u=>{var c;Pe(i)!==u&&(i.value=(c=n.options.find(p=>p.value===u))!=null?c:null)});function s(u){t("update:modelValue",u.value)}return(u,c)=>(S(),T("div",gu,[a(r)?(S(),T("span",mu,[(S(),re(Ke(a(r))))])):B("",!0),d(a(wa),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[c[0]||(c[0]=p=>i.value=p),s],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const vu={class:"field"},hu=X({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=y(()=>{var s;return fe((s=a(n.title))!=null?s:"<span></span>","span")}),i=y({get(){return!!n.modelValue},set(s){t("update:modelValue",s)}});return(s,l)=>(S(),T("label",vu,[jr(N("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":l[0]||(l[0]=u=>Ve(i)?i.value=u:null)},null,512),[[ma,a(i)]]),(S(),re(Ke(a(r))))]))}});var $t=be(hu,[["__scopeId","data-v-11046116"]]);const bu={class:"header"},yu=N("h2",null,"Settings",-1),wu={class:"option-tabs"},_u={key:0},Nu={key:1};var Cu=X({__name:"Options",setup(e,{expose:t}){const n=G(!1),r=G("behaviour");function i(le){return le==r.value}function s(le){r.value=le}t({isTab:i,setTab:s,save:bt,open(){n.value=!0}});const l=Object.keys(It).map(le=>({label:st(le),value:le})),u=y(()=>fe(j(()=>d(ne,null,[Fi.map(ot)])))),{showTPS:c,theme:p,unthrottled:h,alignUnits:g}=Ae(ie),{autosave:b,offlineProd:m}=Ae(Y),k=y({get(){return Y.devSpeed===0},set(le){Y.devSpeed=le?0:null}}),C=j(()=>d("span",{class:"option-title"},[w("Unthrottled"),d("desc",null,[w("Allow the game to run as fast as possible. Not battery friendly.")])])),$=j(()=>d("span",{class:"option-title"},[w("Offline Production"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[w("*")]}),d("desc",null,[w("Simulate production that occurs while the game is closed.")])])),x=j(()=>d("span",{class:"option-title"},[w("Autosave"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[w("*")]}),d("desc",null,[w("Automatically save the game every second or when the game is closed.")])])),I=j(()=>d("span",{class:"option-title"},[w("Pause game"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[w("*")]}),d("desc",null,[w("Stop everything from moving.")])])),R=j(()=>d("span",{class:"option-title"},[w("Theme"),d("desc",null,[w("How the game looks.")])])),L=j(()=>d("span",{class:"option-title"},[w("Show TPS"),d("desc",null,[w("Show TPS meter at the bottom-left corner of the page.")])])),ce=j(()=>d("span",{class:"option-title"},[w("Align modifier units"),d("desc",null,[w("Align numbers to the beginning of the unit in modifier view.")])]));return(le,ae)=>(S(),re(Lt,{modelValue:n.value,"onUpdate:modelValue":ae[10]||(ae[10]=J=>n.value=J)},{header:H(()=>[N("div",bu,[yu,N("div",wu,[N("button",{class:Ne({selected:i("behaviour")}),onClick:ae[0]||(ae[0]=J=>s("behaviour"))},"Behaviour",2),N("button",{class:Ne({selected:i("appearance")}),onClick:ae[1]||(ae[1]=J=>s("appearance"))},"Appearance",2)])])]),body:H(()=>[i("behaviour")?(S(),T("div",_u,[d($t,{title:a(C),modelValue:a(h),"onUpdate:modelValue":ae[2]||(ae[2]=J=>Ve(h)?h.value=J:null)},null,8,["title","modelValue"]),a(ve).enablePausing?(S(),re($t,{key:0,title:a(I),modelValue:a(k),"onUpdate:modelValue":ae[3]||(ae[3]=J=>Ve(k)?k.value=J:null)},null,8,["title","modelValue"])):B("",!0),d($t,{title:a($),modelValue:a(m),"onUpdate:modelValue":ae[4]||(ae[4]=J=>Ve(m)?m.value=J:null)},null,8,["title","modelValue"]),d($t,{title:a(x),modelValue:a(b),"onUpdate:modelValue":ae[5]||(ae[5]=J=>Ve(b)?b.value=J:null)},null,8,["title","modelValue"]),a(b)?B("",!0):(S(),re(Gr,{key:1,class:"button save-button",onClick:ae[6]||(ae[6]=J=>a(bt)())},{default:H(()=>[w("Manually save")]),_:1}))])):B("",!0),i("appearance")?(S(),T("div",Nu,[d(ti,{title:a(R),options:a(l),modelValue:a(p),"onUpdate:modelValue":ae[7]||(ae[7]=J=>Ve(p)?p.value=J:null)},null,8,["title","options","modelValue"]),(S(),re(Ke(a(u)))),d($t,{title:a(L),modelValue:a(c),"onUpdate:modelValue":ae[8]||(ae[8]=J=>Ve(c)?c.value=J:null)},null,8,["title","modelValue"]),d($t,{title:a(ce),modelValue:a(g),"onUpdate:modelValue":ae[9]||(ae[9]=J=>Ve(g)?g.value=J:null)},null,8,["title","modelValue"])])):B("",!0)]),_:1},8,["modelValue"]))}});const ku=["onSubmit"],Su={class:"field"},Mu={key:0,class:"field-title"},Iu=["placeholder"],xu=X({__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,r=Rn(Jt(n,"title"),"span"),i=_t(null);Qn(()=>{var c;(c=i.value)==null||c.focus()});const s=y({get(){var c;return(c=a(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,p)=>(S(),T("form",{onSubmit:Pn(l,["prevent"])},[N("div",Su,[a(r)?(S(),T("span",Mu,[(S(),re(Ke(a(r))))])):B("",!0),e.textArea?(S(),re(a(Na),{key:1,modelValue:a(s),"onUpdate:modelValue":p[0]||(p[0]=h=>Ve(s)?s.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:u,ref_key:"field",ref:i},null,8,["modelValue","placeholder","maxHeight"])):jr((S(),T("input",{key:2,type:"text","onUpdate:modelValue":p[1]||(p[1]=h=>Ve(s)?s.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:u,ref_key:"field",ref:i},null,42,Iu)),[[va,a(s)]])])],40,ku))}});var Wi=be(xu,[["__scopeId","data-v-90bd4994"]]);const $u={key:0},Du=["onClick","disabled"],Tu={key:0},Pu=["onClick"],Au=X({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const r=Ae(e),i=G(!1);wt(i,u=>{t("confirmingChanged",u)});function s(){if(a(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function l(){i.value=!1}return(u,c)=>(S(),T("span",{class:Ne(["container",{confirming:i.value}])},[i.value?(S(),T("span",$u,"Are you sure?")):B("",!0),N("button",{onClick:Pn(s,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(S(),T("span",Tu,"Yes")):qt(u.$slots,"default",{key:1},void 0,!0)],8,Du),i.value?(S(),T("button",{key:1,class:"button",onClick:Pn(l,["stop"])},"No",8,Pu)):B("",!0)],2))}});var Ru=be(Au,[["__scopeId","data-v-2f8ef34c"]]);const en=e=>(cn("data-v-32313015"),e=e(),dn(),e),Eu=en(()=>N("div",{class:"handle material-icons"},"drag_handle",-1)),Fu={key:0,class:"actions"},Ou=en(()=>N("span",{class:"material-icons"},"content_paste",-1)),qu=en(()=>N("span",{class:"material-icons"},"content_copy",-1)),Vu=en(()=>N("span",{class:"material-icons"},"edit",-1)),Bu=en(()=>N("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Lu={key:1,class:"actions"},ju=en(()=>N("span",{class:"material-icons"},"check",-1)),zu=en(()=>N("span",{class:"material-icons"},"close",-1)),Gu={key:2,class:"details"},Uu={class:"save-version"},Wu=en(()=>N("br",null,null,-1)),Hu={key:0},Yu={key:3,class:"details"},Zu={key:4,class:"details error"},Xu=en(()=>N("br",null,null,-1)),Ju=X({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:r}=Ae(n),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),s=G(!1),l=G(!1),u=G("");wt(s,()=>{var g;return u.value=(g=r.value.name)!=null?g:""});const c=y(()=>r.value!=null&&r.value.id===Y.id),p=y(()=>{var g;return c.value?Y.time:(g=r.value!=null&&r.value.time)!=null?g:0});function h(){t("editName",u.value),s.value=!1}return(g,b)=>(S(),T("div",{class:Ne(["save",{active:a(c)}])},[Eu,s.value?(S(),T("div",Lu,[N("button",{onClick:h,class:"button"},[d(qe,{display:"Save",direction:a(W).Left,class:"info"},{default:H(()=>[ju]),_:1},8,["direction"])]),N("button",{onClick:b[5]||(b[5]=m=>s.value=!s.value),class:"button"},[d(qe,{display:"Cancel",direction:a(W).Left,class:"info"},{default:H(()=>[zu]),_:1},8,["direction"])])])):(S(),T("div",Fu,[a(r).error==null&&!l.value?(S(),re(Gr,{key:0,onClick:b[0]||(b[0]=m=>t("export")),class:"button",left:""},{default:H(()=>[d(qe,{display:"Export",direction:a(W).Left,class:"info"},{default:H(()=>[Ou]),_:1},8,["direction"])]),_:1})):B("",!0),a(r).error==null&&!l.value?(S(),T("button",{key:1,onClick:b[1]||(b[1]=m=>t("duplicate")),class:"button"},[d(qe,{display:"Duplicate",direction:a(W).Left,class:"info"},{default:H(()=>[qu]),_:1},8,["direction"])])):B("",!0),a(r).error==null&&!l.value?(S(),T("button",{key:2,onClick:b[2]||(b[2]=m=>s.value=!s.value),class:"button"},[d(qe,{display:"Edit Name",direction:a(W).Left,class:"info"},{default:H(()=>[Vu]),_:1},8,["direction"])])):B("",!0),d(Ru,{disabled:a(c),onClick:b[3]||(b[3]=m=>t("delete")),onConfirmingChanged:b[4]||(b[4]=m=>l.value=m)},{default:H(()=>[d(qe,{display:"Delete",direction:a(W).Left,class:"info"},{default:H(()=>[Bu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),a(r).error==null&&!s.value?(S(),T("div",Gu,[N("button",{class:"button open",onClick:b[6]||(b[6]=m=>t("open"))},[N("h3",null,ee(a(r).name),1)]),N("span",Uu,"v"+ee(a(r).modVersion),1),Wu,a(p)?(S(),T("div",Hu,"Last played "+ee(a(i).format(a(p))),1)):B("",!0)])):a(r).error==null&&s.value?(S(),T("div",Yu,[d(Wi,{modelValue:u.value,"onUpdate:modelValue":b[7]||(b[7]=m=>u.value=m),class:"editname",onSubmit:h},null,8,["modelValue"])])):(S(),T("div",Zu,[w(" Error: Failed to load save with id "+ee(a(r).id),1),Xu,w(ee(a(r).error),1)]))],2))}});var Ku=be(Ju,[["__scopeId","data-v-32313015"]]);const ni=e=>(cn("data-v-2a4275be"),e=e(),dn(),e),Qu=ni(()=>N("h2",null,"Saves Manager",-1)),ec={class:"modal-footer"},tc={class:"field"},nc=ni(()=>N("span",{class:"field-title"},"Create Save",-1)),rc={class:"field-buttons"},ic={class:"footer"},ac=ni(()=>N("div",{style:{"flex-grow":"1"}},null,-1)),sc=X({__name:"SavesManager",setup(e,{expose:t}){const n=G(!1),r=G(null);t({open(){n.value=!0}});const i=G(!1),s=G(""),l=G(null);wt(s,I=>{I?Xt(()=>{try{if(I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=Yt.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I),i.value=!0;return}const R=JSON.parse(I);if(typeof R!="object"){i.value=!0;return}const L=cr();R.id=L,bt(R),s.value="",i.value=!1,ie.saves.push(L)}catch{i.value=!0}}):i.value=!1});let u={},c=G(Object.keys(u).reduce((I,R)=>(I.push({label:R.split("/").slice(-1)[0].slice(0,-4),value:u[R]}),I),[]));const p=Lr({});function h(I){if(p[I]==null){let R=localStorage.getItem(I);if(R==null)p[I]={error:"Save doesn't exist in localStorage",id:I};else if(R==="dW5kZWZpbmVk")p[I]={error:"Save is undefined",id:I};else try{if(R[0]!=="{")if(R[0]==="e")R=decodeURIComponent(escape(atob(R)));else if(R[0]==="\u1BE1")R=Yt.decompressFromUTF16(R);else return console.warn("Unable to determine preset encoding",R),i.value=!0,p[I]={error:"Unable to determine preset encoding",id:I},p[I];p[I]={...JSON.parse(R),id:I}}catch(L){p[I]={error:L,id:I},console.warn(`SavesManager: Failed to load info about save with id ${I}:
|
|
${L}
|
|
${R}`)}}return p[I]}wt(n,I=>{I&&Object.keys(p).forEach(R=>delete p[R])});const g=y(()=>ie.saves.reduce((I,R)=>(I[R]=h(R),I),{}));function b(I){let R;switch(Y.id===I?R=zr(Y):R=JSON.stringify(g.value[I]),ve.exportEncoding){default:console.warn(`Unknown save encoding: ${ve.exportEncoding}. Defaulting to lz`);case"lz":R=Yt.compressToUTF16(R);break;case"base64":R=btoa(unescape(encodeURIComponent(R)));break;case"plain":break}const L=document.createElement("textarea");L.value=R,document.body.appendChild(L),L.select(),L.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(L)}function m(I){Y.id===I&&bt();const R={...g.value[I],id:cr()};bt(R),ie.saves.push(R.id)}function k(I){ie.saves=ie.saves.filter(R=>R!==I),localStorage.removeItem(I),p[I]=void 0}function C(I){g.value[Y.id].time=Y.time,bt(),p[Y.id]=void 0,bn(g.value[I]),p[I]=void 0}function $(I){if(l.value=I,Xt(()=>{l.value=null}),I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=Yt.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I);return}const R=JSON.parse(I);R.id=cr(),bt(R),ie.saves.push(R.id),C(R.id)}function x(I,R){const L=g.value[I];L!=null&&(L.name=R,Y.id===I?(Y.name=R,bt()):(bt(L),p[I]=void 0))}return(I,R)=>(S(),re(Lt,{modelValue:n.value,"onUpdate:modelValue":R[4]||(R[4]=L=>n.value=L),ref_key:"modal",ref:r},{header:H(()=>[Qu]),body:H(({shown:L})=>[L?(S(),re(a(_a),{key:0,list:a(ie).saves,handle:".handle",itemKey:ce=>ce},{item:H(({element:ce})=>[d(Ku,{save:a(g)[ce],onOpen:le=>C(ce),onExport:le=>b(ce),onEditName:le=>x(ce,le),onDuplicate:le=>m(ce),onDelete:le=>k(ce)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):B("",!0)]),footer:H(()=>[N("div",ec,[d(Wi,{modelValue:s.value,"onUpdate:modelValue":R[0]||(R[0]=L=>s.value=L),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:i.value})},null,8,["modelValue","class"]),N("div",tc,[nc,N("div",rc,[N("button",{class:"button",onClick:R[1]||(R[1]=L=>C(a(Tn)().id))},"New Game"),Object.keys(a(c)).length>0?(S(),re(ti,{key:0,options:a(c),modelValue:l.value,"onUpdate:modelValue":R[2]||(R[2]=L=>$(L)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):B("",!0)])]),N("div",ic,[ac,N("button",{class:"button modal-default-button",onClick:R[3]||(R[3]=L=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Hi=be(sc,[["__scopeId","data-v-2a4275be"]]);const kt=e=>(cn("data-v-318a1c31"),e=e(),dn(),e),oc=["src","alt"],lc={key:1,class:"title"},uc=kt(()=>N("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),cc={class:"discord"},dc={class:"discord-links"},pc={key:0},fc=["href"],gc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),mc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),vc={href:"https://forums.moddingtree.com/",target:"_blank"},hc=kt(()=>N("span",{class:"material-icons"},"forum",-1)),bc=kt(()=>N("span",{class:"material-icons"},"info",-1)),yc=kt(()=>N("span",{class:"material-icons"},"library_books",-1)),wc=kt(()=>N("span",{class:"material-icons"},"settings",-1)),_c=kt(()=>N("span",{class:"material-icons"},"library_books",-1)),Nc=kt(()=>N("span",{class:"material-icons"},"settings",-1)),Cc=kt(()=>N("span",{class:"material-icons"},"info",-1)),kc={href:"https://forums.moddingtree.com/",target:"_blank"},Sc=kt(()=>N("span",{class:"material-icons"},"forum",-1)),Mc={class:"discord"},Ic={class:"discord-links"},xc={key:0},$c=["href"],Dc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),Tc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Pc=X({__name:"Nav",setup(e){const t=G(null),n=G(null),r=G(null),i=G(null),{useHeader:s,banner:l,title:u,discordName:c,discordLink:p,versionNumber:h}=ve;function g(){window.open(p,"mywindow")}return(b,m)=>(S(),T(ne,null,[a(s)?(S(),T("div",Vt({key:0,class:"nav"},b.$attrs),[a(l)?(S(),T("img",{key:0,src:a(l),class:"banner",alt:a(u)},null,8,oc)):(S(),T("div",lc,ee(a(u)),1)),N("div",{onClick:m[0]||(m[0]=k=>{var C;return(C=i.value)==null?void 0:C.open()}),class:"version-container"},[d(qe,{display:"Changelog",direction:a(W).Down,class:"version"},{default:H(()=>[N("span",null,"v"+ee(a(h)),1)]),_:1},8,["direction"])]),uc,N("div",cc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",dc,[a(p)?(S(),T("li",pc,[N("a",{href:a(p),target:"_blank"},ee(a(c)),9,fc)])):B("",!0),gc,mc])]),N("div",null,[N("a",vc,[d(qe,{display:"Forums",direction:a(W).Down,yoffset:"5px"},{default:H(()=>[hc]),_:1},8,["direction"])])]),N("div",{onClick:m[1]||(m[1]=k=>{var C;return(C=t.value)==null?void 0:C.open()})},[d(qe,{display:"Info",direction:a(W).Down,class:"info"},{default:H(()=>[bc]),_:1},8,["direction"])]),N("div",{onClick:m[2]||(m[2]=k=>{var C;return(C=n.value)==null?void 0:C.open()})},[d(qe,{display:"Saves",direction:a(W).Down,xoffset:"-20px"},{default:H(()=>[yc]),_:1},8,["direction"])]),N("div",{onClick:m[3]||(m[3]=k=>{var C;return(C=r.value)==null?void 0:C.open()})},[d(qe,{display:"Settings",direction:a(W).Down,xoffset:"-66px"},{default:H(()=>[wc]),_:1},8,["direction"])])],16)):(S(),T("div",Vt({key:1,class:"overlay-nav"},b.$attrs),[N("div",{onClick:m[4]||(m[4]=k=>{var C;return(C=i.value)==null?void 0:C.open()}),class:"version-container"},[d(qe,{display:"Changelog",direction:a(W).Right,xoffset:"25%",class:"version"},{default:H(()=>[N("span",null,"v"+ee(a(h)),1)]),_:1},8,["direction"])]),N("div",{onClick:m[5]||(m[5]=k=>{var C;return(C=n.value)==null?void 0:C.open()})},[d(qe,{display:"Saves",direction:a(W).Right},{default:H(()=>[_c]),_:1},8,["direction"])]),N("div",{onClick:m[6]||(m[6]=k=>{var C;return(C=r.value)==null?void 0:C.open()})},[d(qe,{display:"Settings",direction:a(W).Right},{default:H(()=>[Nc]),_:1},8,["direction"])]),N("div",{onClick:m[7]||(m[7]=k=>{var C;return(C=t.value)==null?void 0:C.open()})},[d(qe,{display:"Info",direction:a(W).Right},{default:H(()=>[Cc]),_:1},8,["direction"])]),N("div",null,[N("a",kc,[d(qe,{display:"Forums",direction:a(W).Right,xoffset:"7px"},{default:H(()=>[Sc]),_:1},8,["direction"])])]),N("div",Mc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",Ic,[a(p)?(S(),T("li",xc,[N("a",{href:a(p),target:"_blank"},ee(a(c)),9,$c)])):B("",!0),Dc,Tc])])],16)),d(fu,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),d(Hi,{ref_key:"savesManager",ref:n},null,512),d(Cu,{ref_key:"options",ref:r},null,512),d(Yl,{ref_key:"changelog",ref:i},null,512)],64))}});var Yi=be(Pc,[["__scopeId","data-v-318a1c31"]]);const Ac={class:"inner-tab"},Rc=X({__name:"Game",setup(e){const t=Jt(Y,"tabs"),n=y(()=>Object.keys(ge)),r=ve.useHeader;function i(s){const{display:l,minimized:u,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}=s;return{display:l,minimized:u,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}}return(s,l)=>(S(),T("div",{class:Ne(["tabs-container",{useHeader:a(r)}])},[(S(!0),T(ne,null,Dt(a(t),(u,c)=>{var p,h;return S(),T("div",{key:c,class:Ne(["tab",a((p=a(ge)[u])==null?void 0:p.classes)]),style:Le(a((h=a(ge)[u])==null?void 0:h.style))},[c===0&&!a(r)?(S(),re(Yi,{key:0})):B("",!0),N("div",Ac,[a(n).includes(u)?(S(),re(Gl,Vt({key:0},i(a(ge)[u]),{index:c,onSetMinimized:g=>a(ge)[u].minimized.value=g}),null,16,["index","onSetMinimized"])):(S(),re(Ke(u),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var Ec=be(Rc,[["__scopeId","data-v-dcd207b4"]]);const Fc=X({__name:"Sticky",setup(e){const t=G("0"),n=new ResizeObserver(i),r=_t(null);function i(){let s=r.value;if(s==null)return;let l=0;for(;s.previousSibling;){const u=s.previousSibling;u.dataset&&"vSticky"in u.dataset&&(l+=u.offsetHeight),s=u}t.value=l+"px"}return Xt(i),document.fonts.ready.then(i),Qn(()=>{var l;const s=(l=r.value)==null?void 0:l.parentElement;s&&n.observe(s)}),(s,l)=>(S(),T("div",{class:"sticky",style:Le({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[qt(s.$slots,"default",{},void 0,!0)],4))}});var mr=be(Fc,[["__scopeId","data-v-cccac690"]]);const Oc=["x1","y1","x2","y2"],qc=X({__name:"BoardLink",props:{link:null,dragging:null,dragged:null},setup(e){const t=e,n=Ae(t),r=y(()=>{var u,c,p,h,g,b,m;const l={...n.link.value.startNode.position};return n.link.value.offsetStart&&(l.x+=a(n.link.value.offsetStart).x,l.y+=a(n.link.value.offsetStart).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.startNode&&(l.x+=(h=(p=(c=n.dragged)==null?void 0:c.value)==null?void 0:p.x)!=null?h:0,l.y+=(m=(b=(g=n.dragged)==null?void 0:g.value)==null?void 0:b.y)!=null?m:0),l}),i=y(()=>{var u,c,p,h,g,b,m;const l={...n.link.value.endNode.position};return n.link.value.offsetEnd&&(l.x+=a(n.link.value.offsetEnd).x,l.y+=a(n.link.value.offsetEnd).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.endNode&&(l.x+=(h=(p=(c=n.dragged)==null?void 0:c.value)==null?void 0:p.x)!=null?h:0,l.y+=(m=(b=(g=n.dragged)==null?void 0:g.value)==null?void 0:b.y)!=null?m:0),l}),s=y(()=>Bi(t.link));return(l,u)=>(S(),T("line",Vt({class:"link"},a(s),{class:{pulsing:e.link.pulsing},x1:a(r).x,y1:a(r).y,x2:a(i).x,y2:a(i).y}),null,16,Oc))}});var Vc=be(qc,[["__scopeId","data-v-0f903ba5"]]);const Bc={key:0},Lc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],jc=["fill","stroke-width","stroke"],zc=["fill"],Gc=X({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const r=Ae(e),i=y(()=>pe(r.nodeType.value.size,a(r.node))),s=y(()=>{var h;return(h=pe(r.nodeType.value.outlineColor,a(r.node)))!=null?h:It[ie.theme].variables["--outline"]}),l=y(()=>{var h;return(h=pe(r.nodeType.value.titleColor,a(r.node)))!=null?h:It[ie.theme].variables["--foreground"]}),u=y(()=>pe(r.nodeType.value.actionDistance,a(r.node)));function c(h,g){t("clickAction",g.id),h.preventDefault(),h.stopPropagation()}function p(h,g){var b;((b=a(r.selectedAction))==null?void 0:b.id)===g.id&&(h.preventDefault(),h.stopPropagation())}return(h,g)=>(S(),re(Wn,{name:"actions",appear:""},{default:H(()=>[e.isSelected&&e.actions?(S(),T("g",Bc,[(S(!0),T(ne,null,Dt(e.actions,(b,m)=>{var k,C;return S(),T("g",{key:b.id,class:Ne(["action",{selected:((k=e.selectedAction)==null?void 0:k.id)===b.id}]),transform:`translate(
|
|
${(-a(i)-30)*Math.sin(((e.actions.length-1)/2-m)*a(u))},
|
|
${(a(i)+30)*Math.cos(((e.actions.length-1)/2-m)*a(u))}
|
|
)`,onMousedown:$=>c($,b),onTouchstart:$=>c($,b),onMouseup:$=>p($,b),onTouchend:Pn($=>p($,b),["stop"])},[N("circle",{fill:a(pe)(b.fillColor,e.node),r:"20","stroke-width":((C=e.selectedAction)==null?void 0:C.id)===b.id?4:0,stroke:a(s)},null,8,jc),N("text",{fill:a(l),class:"material-icons"},ee(a(pe)(b.icon,e.node)),9,zc)],42,Lc)}),128))])):B("",!0)]),_:1}))}});var Uc=be(Gc,[["__scopeId","data-v-9efb2a56"]]);const Wc=["transform"],Hc={key:0},Yc=["r","fill","stroke"],Zc=["r","fill","stroke"],Xc=["r","fill"],Jc=["r","stroke-dasharray","stroke-dashoffset","stroke"],Kc=["fill","transform"],Qc={key:1,transform:"rotate(45, 0, 0)"},ed=["width","height","transform","fill","stroke"],td=["width","height","transform","fill","stroke"],nd=["width","height","transform","fill"],rd=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],id=["fill","y"],ad=["fill"],sd=["fill","y"],od={key:0},ld=["fill","y"],ud=["fill","y"],cd=X({__name:"BoardNode",props:{node:null,nodeType:null,dragging:null,dragged:null,hasDragged:{type:Boolean},receivingNode:{type:Boolean},isSelected:{type:Boolean},selectedAction:null},emits:["mouseDown","endDragging","clickAction"],setup(e,{emit:t}){const n=e,r=Math.sqrt(2),i=Ae(n),s=y(()=>pe(i.nodeType.value.draggable,a(i.node)));wt(s,K=>{const $e=a(i.node);a(i.dragging)===$e&&!K&&t("endDragging",$e)});const l=y(()=>{var $e;const K=a(i.node);return($e=pe(i.nodeType.value.actions,K))==null?void 0:$e.filter(nt=>Ze(pe(nt.visibility,K)))}),u=y(()=>{var $e;const K=a(i.node);if(pe(i.nodeType.value.draggable,K)&&(($e=a(i.dragging))==null?void 0:$e.id)===K.id&&a(i.dragged)!=null){const{x:nt,y:ht}=a(i.dragged);return{x:K.position.x+Math.round(nt/25)*25,y:K.position.y+Math.round(ht/25)*25}}return K.position}),c=y(()=>pe(i.nodeType.value.shape,a(i.node))),p=y(()=>pe(i.nodeType.value.title,a(i.node))),h=y(()=>pe(i.nodeType.value.otherSubtitle,a(i.node))),g=y(()=>{var K;return(K=i.isSelected.value?a(i.selectedAction)&&pe(a(i.selectedAction).tooltip,a(i.node)):null)!=null?K:pe(i.nodeType.value.label,a(i.node))}),b=y(()=>{var K,$e;return pe(($e=(K=a(i.selectedAction))==null?void 0:K.confirmationLabel)!=null?$e:{text:"Tap again to confirm"},a(i.node))}),m=y(()=>pe(i.nodeType.value.size,a(i.node))),k=y(()=>{var K;return(K=pe(i.nodeType.value.progress,a(i.node)))!=null?K:0}),C=y(()=>It[ie.theme].variables["--background"]),$=y(()=>{var K;return(K=pe(i.nodeType.value.outlineColor,a(i.node)))!=null?K:It[ie.theme].variables["--outline"]}),x=y(()=>{var K;return(K=pe(i.nodeType.value.fillColor,a(i.node)))!=null?K:It[ie.theme].variables["--raised-background"]}),I=y(()=>pe(i.nodeType.value.progressColor,a(i.node))),R=y(()=>{var K;return(K=pe(i.nodeType.value.titleColor,a(i.node)))!=null?K:It[ie.theme].variables["--foreground"]}),L=y(()=>pe(i.nodeType.value.progressDisplay,a(i.node))),ce=y(()=>i.dragging.value!=null&&a(i.hasDragged)&&pe(i.nodeType.value.canAccept,a(i.node),i.dragging.value)),le=y(()=>pe(i.nodeType.value.style,a(i.node))),ae=y(()=>pe(i.nodeType.value.classes,a(i.node)));function J(K){t("mouseDown",K,i.node.value,s.value)}function Ie(K){var $e,nt,ht;($e=i.hasDragged)!=null&&$e.value||(t("endDragging",i.node.value),(ht=(nt=i.nodeType.value).onClick)==null||ht.call(nt,i.node.value),K.stopPropagation())}const he=y(()=>pe(i.nodeType.value.subtitle,a(i.node))),Ue=y(()=>pe(i.nodeType.value.showStar,a(i.node))),vt=y(()=>pe(i.nodeType.value.fillStar,a(i.node)));return(K,$e)=>{var nt,ht,pt;return S(),T("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:a(s),...a(ae)}]),style:Le([{opacity:((nt=e.dragging)==null?void 0:nt.id)===e.node.id&&e.hasDragged?.5:1},(ht=a(le))!=null?ht:[]]),transform:`translate(${a(u).x},${a(u).y})${e.isSelected?" scale(1.2)":""}`},[d(Uc,{actions:(pt=a(l))!=null?pt:[],"is-selected":e.isSelected,node:e.node,"node-type":e.nodeType,"selected-action":e.selectedAction,onClickAction:$e[0]||($e[0]=St=>t("clickAction",St))},null,8,["actions","is-selected","node","node-type","selected-action"]),N("g",{class:"node-container",onMousedown:J,onTouchstartPassive:J,onMouseup:Ie,onTouchendPassive:Ie},[a(c)===a(Ge).Circle?(S(),T("g",Hc,[a(ce)?(S(),T("circle",{key:0,class:"receiver",r:a(m)+8,fill:a(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Yc)):B("",!0),N("circle",{class:"body",r:a(m),fill:a(x),stroke:a($),"stroke-width":4},null,8,Zc),a(L)===a(un).Fill?(S(),T("circle",{key:1,class:"progress progressFill",r:Math.max(a(m)*a(k)-2,0),fill:a(I)},null,8,Xc)):(S(),T("circle",{key:2,r:a(m)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(a(m)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(a(m)+4.5)*2*Math.PI-a(k)*(a(m)+4.5)*2*Math.PI,stroke:a(I)},null,8,Jc)),a(Ue)?(S(),T("path",{key:3,d:"m25,1 6,17h18l-14,11 5,17-15-10-15,10 5-17-14-11h18z",stroke:"var(--bought)","stroke-width":4,fill:a(vt)?"var(--bought)":"none",transform:`translate(${-a(m)/4}, ${-a(m)-10}), scale(0.5)`},null,8,Kc)):B("",!0)])):a(c)===a(Ge).Diamond?(S(),T("g",Qc,[a(ce)?(S(),T("rect",{key:0,class:"receiver",width:a(m)*a(r)+16,height:a(m)*a(r)+16,transform:`translate(${-(a(m)*a(r)+16)/2}, ${-(a(m)*a(r)+16)/2})`,fill:a(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,ed)):B("",!0),N("rect",{class:"body",width:a(m)*a(r),height:a(m)*a(r),transform:`translate(${-a(m)*a(r)/2}, ${-a(m)*a(r)/2})`,fill:a(x),stroke:a($),"stroke-width":4},null,8,td),a(L)===a(un).Fill?(S(),T("rect",{key:1,class:"progress progressFill",width:Math.max(a(m)*a(r)*a(k)-2,0),height:Math.max(a(m)*a(r)*a(k)-2,0),transform:`translate(${-Math.max(a(m)*a(r)*a(k)-2,0)/2}, ${-Math.max(a(m)*a(r)*a(k)-2,0)/2})`,fill:a(I)},null,8,nd)):(S(),T("rect",{key:2,class:"progress progressDiamond",width:a(m)*a(r)+9,height:a(m)*a(r)+9,transform:`translate(${-(a(m)*a(r)+9)/2}, ${-(a(m)*a(r)+9)/2})`,fill:"transparent","stroke-dasharray":(a(m)*a(r)+9)*4,"stroke-width":5,"stroke-dashoffset":(a(m)*a(r)+9)*4-a(k)*(a(m)*a(r)+9)*4,stroke:a(I)},null,8,rd))])):B("",!0),N("text",{fill:a(R),class:"node-title",y:a(h)&&!a(he)?-10:0},ee(a(p)),9,id),a(he)?(S(),T("text",{key:2,fill:a(R),class:"node-subtitle",y:"-25"},ee(a(he)),9,ad)):B("",!0),a(h)?(S(),T("text",{key:3,fill:a(R),class:"node-subtitle",y:a(he)?25:15},ee(a(h)),9,sd)):B("",!0)],32),d(Wn,{name:"fade",appear:""},{default:H(()=>{var St;return[a(g)?(S(),T("g",od,[N("text",{fill:(St=a(g).color)!=null?St:a(R),class:Ne(["node-title",{pulsing:a(g).pulsing}]),y:-a(m)-20},ee(a(g).text),11,ld)])):B("",!0)]}),_:1}),d(Wn,{name:"fade",appear:""},{default:H(()=>{var St;return[e.isSelected&&e.selectedAction?(S(),T("text",{key:0,fill:(St=a(b).color)!=null?St:a(R),class:Ne(["node-title",{pulsing:a(b).pulsing}]),y:a(m)+75},ee(a(b).text),11,ud)):B("",!0)]}),_:1})],14,Wc)}}});var dd=be(cd,[["__scopeId","data-v-85b0e9a6"]]);const pd={class:"stage",width:"100%",height:"100%"},fd={class:"g1"},gd=X({__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=Ae(e),r=G({x:0,y:0}),i=G({x:0,y:0}),s=G(!1),l=G(null),u=y(()=>{const m=n.nodes.value.slice();if(n.selectedNode.value){const k=m.splice(m.indexOf(n.selectedNode.value),1)[0];m.push(k)}if(n.draggingNode.value){const k=m.splice(m.indexOf(n.draggingNode.value),1)[0];m.push(k)}return m});Pt(()=>{const m=n.draggingNode.value;if(m==null)return null;const k={x:m.position.x+i.value.x,y:m.position.y+i.value.y};let C=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce(($,x)=>{if(x.id===m.id)return $;const I=n.types.value[x.type];if(!pe(I.canAccept,x,m))return $;const L=Math.pow(k.x-x.position.x,2)+Math.pow(k.y-x.position.y,2);let ce=pe(I.size,x);return L>C||L>ce*ce?$:(C=L,x)},null))});function c(m){m.setTransformOrigin(null),m.moveTo(l.value.$el.clientWidth/2,l.value.$el.clientHeight/2)}function p(m,k=null,C=!1){if(n.draggingNode.value==null){m.preventDefault(),m.stopPropagation();let $,x;if("touches"in m)if(m.touches.length===1)$=m.touches[0].clientX,x=m.touches[0].clientY;else return;else $=m.clientX,x=m.clientY;r.value={x:$,y:x},i.value={x:0,y:0},s.value=!1,C&&n.setDraggingNode.value(k)}k!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(m){const{x:k,y:C,scale:$}=l.value.panZoomInstance.getTransform();let x,I;if("touches"in m)if(m.touches.length===1)x=m.touches[0].clientX,I=m.touches[0].clientY;else{g(n.draggingNode.value),n.mousePosition.value=null;return}else x=m.clientX,I=m.clientY;n.mousePosition.value={x:(x-k)/$,y:(I-C)/$},i.value={x:i.value.x+(x-r.value.x)/$,y:i.value.y+(I-r.value.y)/$},r.value={x,y:I},(Math.abs(i.value.x)>10||Math.abs(i.value.y)>10)&&(s.value=!0),n.draggingNode.value!=null&&(m.preventDefault(),m.stopPropagation())}function g(m,k=!1){var C,$;if(n.draggingNode.value!=null&&n.draggingNode.value===m){n.receivingNode.value==null&&(n.draggingNode.value.position.x+=Math.round(i.value.x/25)*25,n.draggingNode.value.position.y+=Math.round(i.value.y/25)*25);const x=n.nodes.value;x.push(x.splice(x.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&(($=(C=n.types.value[n.receivingNode.value.type]).onDrop)==null||$.call(C,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!s.value&&!k&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(m,k){var $,x;const C=n.types.value[m.type];pe((x=($=C.actions)==null?void 0:$.find(I=>I.id===k))==null?void 0:x.confirmationLabel,m)==null&&(n.state.value.selectedAction=k),n.state.value.selectedAction===k?a(n.selectedAction).onClick(a(n.selectedNode)):n.state.value={...n.state.value,selectedAction:k}}return(m,k)=>{const C=Ct("panZoom");return a(Ze)(e.visibility)?(S(),re(C,{key:0,style:Le([{width:e.width,height:e.height},e.style]),class:Ne(e.classes),selector:".g1",options:{initialZoom:1,minZoom:.1,maxZoom:10,zoomDoubleClickSpeed:1},ref_key:"stage",ref:l,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:k[0]||(k[0]=$=>p($)),onTouchstart:k[1]||(k[1]=$=>p($)),onMouseup:k[2]||(k[2]=()=>g(a(e.draggingNode))),onTouchendPassive:k[3]||(k[3]=()=>g(a(e.draggingNode))),onMouseleave:k[4]||(k[4]=()=>g(a(e.draggingNode),!0))},{default:H(()=>[(S(),T("svg",pd,[N("g",fd,[d(ui,{name:"link",appear:""},{default:H(()=>[(S(!0),T(ne,null,Dt(a(e.links)||[],$=>(S(),T("g",{key:`${$.startNode.id}-${$.endNode.id}`},[d(Vc,{link:$,dragging:a(e.draggingNode),dragged:$.startNode===a(e.draggingNode)||$.endNode===a(e.draggingNode)?i.value:void 0},null,8,["link","dragging","dragged"])]))),128))]),_:1}),d(ui,{name:"grow",duration:500,appear:""},{default:H(()=>[(S(!0),T(ne,null,Dt(a(u),$=>(S(),T("g",{key:$.id,style:{"transition-duration":"0s"}},[d(dd,{node:$,nodeType:e.types[$.type],dragging:a(e.draggingNode),dragged:a(e.draggingNode)===$?i.value:void 0,hasDragged:a(e.draggingNode)==null?!1:s.value,receivingNode:a(e.receivingNode)===$,isSelected:a(e.selectedNode)===$,selectedAction:a(e.selectedNode)===$?a(e.selectedAction):null,onMouseDown:p,onEndDragging:g,onClickAction:x=>b($,x)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","isSelected","selectedAction","onClickAction"])]))),128))]),_:1})])]))]),_:1},8,["style","class","options"])):B("",!0)}}});Qe.on("setupVue",e=>Ca.install(e));const Zi=Symbol("Board");var un=(e=>(e.Outline="Outline",e.Fill="Fill",e))(un||{}),Ge=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Ge||{});function md(e){const t=ct({nodes:[],selectedNode:null,selectedAction:null},!1);return et(n=>{const r=e.call(n,n);r.id=Qt("board-"),r.type=Zi,r[gt]=gd,r.state?(Gi(t),A(r,"state")):(t[Kt]={nodes:r.startNodes().map((u,c)=>(u.id=c,u)),selectedNode:null,selectedAction:null},r.state=t),r.nodes=y(()=>a(l.state).nodes),r.selectedNode=y({get(){return l.nodes.value.find(u=>u.id===a(l.state).selectedNode)||null},set(u){var c,p;Ve(l.state)?l.state.value={...l.state.value,selectedNode:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedNode=(p=u==null?void 0:u.id)!=null?p:null}}),r.selectedAction=y({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(p=>p.id===a(l.state).selectedAction)||null},set(u){var c,p;Ve(l.state)?l.state.value={...l.state.value,selectedAction:(c=u==null?void 0:u.id)!=null?c:null}:l.state.selectedAction=(p=u==null?void 0:u.id)!=null?p:null}}),r.mousePosition=G(null),r.links?A(r,"links"):r.links=y(()=>l.selectedAction.value==null?null:l.selectedAction.value.links&&l.selectedNode.value?pe(l.selectedAction.value.links,l.selectedNode.value):null),r.draggingNode=G(null),r.receivingNode=G(null),A(r,"visibility"),oe(r,"visibility",Se.Visible),A(r,"width"),oe(r,"width","100%"),A(r,"height"),oe(r,"height","100%"),A(r,"classes"),A(r,"style");for(const u in r.types){const c=r.types[u];if(A(c,"title"),A(c,"subtitle"),A(c,"label"),A(c,"size"),oe(c,"size",50),A(c,"style"),A(c,"classes"),A(c,"draggable"),oe(c,"draggable",!1),A(c,"shape"),oe(c,"shape","Circle"),A(c,"canAccept"),oe(c,"canAccept",!1),A(c,"progress"),A(c,"progressDisplay"),oe(c,"progressDisplay","Fill"),A(c,"progressColor"),oe(c,"progressColor","none"),A(c,"fillColor"),A(c,"outlineColor"),A(c,"titleColor"),A(c,"actionDistance"),oe(c,"actionDistance",Math.PI/6),A(c,"otherSubtitle"),A(c,"showStar"),A(c,"fillStar"),c.nodes=y(()=>a(l.state).nodes.filter(p=>p.type===u)),oe(c,"onClick",function(p){a(l.state).selectedNode=p.id}),c.actions)for(const p of c.actions)A(p,"visibility"),oe(p,"visibility",Se.Visible),A(p,"icon"),A(p,"fillColor"),A(p,"tooltip"),A(p,"confirmationLabel"),oe(p,"confirmationLabel",{text:"Tap again to confirm"}),A(p,"links")}function i(u){r.draggingNode.value=u}function s(u){r.receivingNode.value=u}r.placeInAvailableSpace=function(u,c=100,p=W.Right){const h=l.nodes.value.slice().filter(g=>g===u||(p===W.Down||p===W.Up)&&Math.abs(g.position.x-u.position.x)>c||(p===W.Left||p===W.Right)&&Math.abs(g.position.y-u.position.y)>c?!1:!(p===W.Right&&g.position.x<u.position.x-c||p===W.Left&&g.position.x>u.position.x+c||p===W.Up&&g.position.y>u.position.y+c||p===W.Down&&g.position.y<u.position.y-c)).sort(p===W.Right?(g,b)=>g.position.x-b.position.x:p===W.Left?(g,b)=>b.position.x-g.position.x:p===W.Up?(g,b)=>b.position.y-g.position.y:(g,b)=>g.position.y-b.position.y);for(let g=0;g<h.length;g++){const b=h[g],m=p===W.Right||p===W.Left?Math.abs(u.position.x-b.position.x):Math.abs(u.position.y-b.position.y);if(m<c)p===W.Right?u.position.x=b.position.x+c:p===W.Left?u.position.x=b.position.x-c:p===W.Up?u.position.y=b.position.y-c:p===W.Down&&(u.position.y=b.position.y+c);else if(g>0&&m>c)break}},r[dt]=function(){const{nodes:u,types:c,state:p,visibility:h,width:g,height:b,style:m,classes:k,links:C,selectedAction:$,selectedNode:x,mousePosition:I,draggingNode:R,receivingNode:L}=this;return{nodes:u,types:c,state:p,visibility:h,width:g,height:b,style:a(m),classes:k,links:C,selectedAction:$,selectedNode:x,mousePosition:I,draggingNode:R,receivingNode:L,setDraggingNode:i,setReceivingNode:s}};const l=r;return l})}function pe(e,t,...n){return Yn(e)?e(t,...n):a(e)}function An(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const Gn={};Qe.on("addLayer",e=>{const t=Xn(e,Zi);Gn[e.id]=e.on("postUpdate",n=>{t.forEach(r=>{Object.values(r.types).forEach(i=>i.nodes.value.forEach(s=>{var l;return(l=i.update)==null?void 0:l.call(i,s,n)}))})})});Qe.on("removeLayer",e=>{var t;(t=Gn[e.id])==null||t.call(Gn),Gn[e.id]=void 0});function $n(e,t="points",n=0,r=void 0){const i=Ve(e)?e:ct(e);if(i.displayName=t,i.precision=n,i.small=r,!Ve(e)){const s=i[Ot];s.displayName=t,s.precision=n,s.small=r}return i}new o("10^^8");new o("1e100");function vr(e,t){const n=t!=null?t:e.value;return o.eq(e.precision,0)?ut(e.small?n:o.floor(n)):xe(n,e.precision,e.small)}Qe.on("setupVue",e=>e.use(ka));function vd(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 hd=X({props:{visibility:{type:q(Number,Boolean),required:!0},display:{type:q(Object,String,Function),required:!0},style:q(String,Object,Array),classes:q(Object),glowColor:q(String),active:Boolean,floating:Boolean},emits:["selectTab"],setup(e,{emit:t}){const{display:n,glowColor:r,floating:i}=Ae(e),s=Hr(n),l=y(()=>{const c=Pe(r);return c==null||c===""?{}:a(i)?vd(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function u(){t("selectTab")}return{selectTab:u,component:s,glowColorStyle:l,unref:a,Visibility:Se,isVisible:Ze,isHidden:_n}}});function bd(e,t,n,r,i,s){var l;return e.isVisible(e.visibility)?(S(),T("button",{key:0,onClick:t[0]||(t[0]=(...u)=>e.selectTab&&e.selectTab(...u)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(l=e.unref(e.style))!=null?l:{}])},[(S(),re(Ke(e.component)))],6)):B("",!0)}var Xi=be(hd,[["render",bd],["__scopeId","data-v-21427abb"]]);const yd=X({props:{visibility:{type:q(Number,Boolean),required:!0},activeTab:{type:q(Object),required:!0},selected:{type:Object,required:!0},tabs:{type:q(Object),required:!0},style:q(String,Object,Array),classes:q(Object),buttonContainerStyle:q(String,Object,Array),buttonContainerClasses:q(Object)},components:{Sticky:mr,TabButton:Xi},setup(e){const{activeTab:t}=Ae(e),n=y(()=>It[ie.theme].floatingTabs),r=_t("");Pt(()=>{const u=Pe(t);if(u==null){r.value="";return}if(At(u)){r.value=fe(u);return}r.value=fe(a(u.display))});const i=y(()=>{const u=Pe(t);return At(u)||!u?void 0:a(u.classes)}),s=y(()=>{const u=Pe(t);return At(u)||!u?void 0:a(u.style)});function l(u){const{display:c,style:p,classes:h,glowColor:g,visibility:b}=u;return{display:c,style:a(p),classes:h,glowColor:g,visibility:b}}return{floating:n,tabClasses:i,tabStyle:s,Visibility:Se,component:r,gatherButtonProps:l,unref:a,isVisible:Ze,isHidden:_n}}});function wd(e,t,n,r,i,s){var c,p;const l=Ct("TabButton"),u=Ct("Sticky");return e.isVisible(e.visibility)?(S(),T("div",{key:0,class:Ne(["tab-family-container",{...e.unref(e.classes),...e.tabClasses}]),style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[],(p=e.tabStyle)!=null?p:[]])},[d(u,{class:Ne(["tab-buttons-container",e.unref(e.buttonContainerClasses)]),style:Le(e.unref(e.buttonContainerStyle))},{default:H(()=>[N("div",{class:Ne(["tab-buttons",{floating:e.floating}])},[(S(!0),T(ne,null,Dt(e.unref(e.tabs),(h,g)=>(S(),re(l,Vt({onSelectTab:b=>e.selected.value=g,floating:e.floating,key:g,active:e.unref(h.tab)===e.unref(e.activeTab)},e.gatherButtonProps(h)),null,16,["onSelectTab","floating","active"]))),128))],2)]),_:1},8,["class","style"]),e.unref(e.activeTab)?(S(),re(Ke(e.unref(e.component)),{key:0})):B("",!0)],6)):B("",!0)}var _d=be(yd,[["render",wd],["__scopeId","data-v-58dbf83a"]]);const Nd=Symbol("TabButton"),Cd=Symbol("TabFamily");function Ji(e,t){Object.keys(e).length===0&&console.error("Cannot create tab family with 0 tabs");const n=ct(Object.keys(e)[0],!1);return et(r=>{var l;const i=(l=t==null?void 0:t.call(r,r))!=null?l:{};i.id=Qt("tabFamily-"),i.type=Cd,i[gt]=_d,i.tabs=Object.keys(e).reduce((u,c)=>{const p=e[c]();return p.type=Nd,p[gt]=Xi,A(p,"visibility"),oe(p,"visibility",Se.Visible),A(p,"tab"),A(p,"display"),A(p,"classes"),A(p,"style"),A(p,"glowColor"),u[c]=p,u},{}),i.selected=n,i.activeTab=y(()=>{const u=a(s.tabs);if(n.value in u&&Ze(u[n.value].visibility))return a(u[n.value].tab);const c=Object.values(u).find(p=>Ze(p.visibility));return c?a(c.tab):null}),A(i,"visibility"),oe(i,"visibility",Se.Visible),A(i,"classes"),A(i,"style"),A(i,"buttonContainerClasses"),A(i,"buttonContainerStyle"),i[dt]=function(){const{visibility:u,activeTab:c,selected:p,tabs:h,style:g,classes:b,buttonContainerClasses:m,buttonContainerStyle:k}=this;return{visibility:u,activeTab:c,selected:p,tabs:h,style:a(g),classes:b,buttonContainerClasses:m,buttonContainerStyle:k}};const s=i;return s})}function Ht(e){return et(t=>{const{addend:n,description:r,enabled:i,smallerIsBetter:s}=e.call(t,t),l=_e(n),u=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.add(p,a(l)),invert:p=>o.sub(p,a(l)),getFormula:p=>f.add(p,l),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[a(u)!=null?d("span",{class:"modifier-description"},[mt(a(u))]):null,d("span",{class:"modifier-amount",style:(s===!0?o.gt(a(l),0):o.lt(a(l),0))?"color: var(--danger)":""},[o.gte(a(l),0)?"+":"",Zt(a(l))])]))}})}function Ce(e){return et(t=>{const{multiplier:n,description:r,enabled:i,smallerIsBetter:s}=e.call(t,t),l=_e(n),u=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.times(p,a(l)),invert:p=>o.div(p,a(l)),getFormula:p=>f.times(p,l),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[a(u)!=null?d("span",{class:"modifier-description"},[mt(a(u))]):null,d("span",{class:"modifier-amount",style:(s===!0?o.gt(a(l),1):o.lt(a(l),1))?"color: var(--danger)":""},[w("\xD7"),Zt(a(l))])]))}})}function kd(e){return et(t=>{const{exponent:n,description:r,enabled:i,supportLowNumbers:s,smallerIsBetter:l}=e.call(t,t),u=_e(n),c=_e(r),p=i==null?void 0:_e(i);return{apply:h=>{let g=h;return s&&(g=o.add(g,1)),g=o.pow(g,a(u)),s&&(g=o.sub(g,1)),g},invert:h=>{let g=h;return s&&(g=o.add(g,1)),g=o.root(g,a(u)),s&&(g=o.sub(g,1)),g},getFormula:h=>s?f.add(h,1).pow(u).sub(1):f.pow(h,u),enabled:p,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[a(c)!=null?d("span",{class:"modifier-description"},[mt(a(c)),s?" (+1 effective)":null]):null,d("span",{class:"modifier-amount",style:(l===!0?o.gt(a(u),1):o.lt(a(u),1))?"color: var(--danger)":""},[w("^"),Zt(a(u))])]))}})}function Mt(e){return et(()=>{const t=e();return{apply:n=>t.filter(r=>a(r.enabled)!==!1).reduce((r,i)=>i.apply(r),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(r=>a(r.enabled)!==!1).reduceRight((r,i)=>i.invert(r),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(r=>a(r.enabled)!==!1).reduce((r,i)=>i.getFormula(r),n):void 0,enabled:t.some(n=>n.enabled!=null)?y(()=>t.filter(n=>a(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?j(()=>d(ne,null,[t.filter(n=>a(n.enabled)!==!1).map(n=>a(n.description)).filter(n=>n).map(mt)])):void 0}})}const Br=f.variable(0).step(2e3,e=>e.pow_base(1.02)).step(100,e=>e.pow(1.5)).step(o.pow(900,1.5).add(100),e=>e.pow(1.5)).pow(1.5),pn={id:"deselect",icon:"close",tooltip:e=>({text:"portals"in e.state?"Disconnect portals":"tools"in e.state?"Disconnect tools":"Disconnect resources"}),onClick(e){var t;Array.isArray((t=e.state)==null?void 0:t.data)?e.state={...e.state,data:[]}:"portals"in e.state?e.state={...e.state,portals:[]}:"resources"in e.state?e.state={...e.state,resources:[]}:"tools"in e.state&&(e.state={...e.state,tools:[]}),v.board.selectedAction.value=null,v.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"portals"in e.state?e.state.portals.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},jt={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${ut(v.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},v.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function Cn(e,t=1/0){const n=e(f.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(r){return{text:`Increase Connections - ${ut(n.evaluate(r.state.maxConnections))} energy`}},fillColor(r){return o.gte(v.energy.value,n.evaluate(r.state.maxConnections))?"var(--bought)":"var(--locked)"},confirmationLabel:r=>o.gte(v.energy.value,n.evaluate(r.state.maxConnections))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(r){const i=n.evaluate(r.state.maxConnections);o.gte(v.energy.value,i)&&(v.energy.value=o.sub(v.energy.value,i),r.state={...r.state,maxConnections:o.add(r.state.maxConnections,1)},v.board.selectedAction.value=null)},visibility:r=>o.add(r.state.maxConnections,v.computedBonusConnectionsModifier.value).lt(t)}}function Ki(e,t){var n,r;if(((n=v.board.draggingNode.value)==null?void 0:n.type)==="resource"){const i=((r=v.board.draggingNode.value)==null?void 0:r.state).type,{maxConnections:s,resources:l}=e.state;return l.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(s,v.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function Sd(e,t){var n,r;if(((n=v.board.draggingNode.value)==null?void 0:n.type)==="passive"){const i=(r=v.board.draggingNode.value)==null?void 0:r.state,{maxConnections:s,tools:l}=e.state;return l.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(s,v.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function wr(e,t){var n,r;if(((n=v.board.draggingNode.value)==null?void 0:n.type)==="portal"){const i=((r=v.board.draggingNode.value)==null?void 0:r.state).id,{maxConnections:s,portals:l}=e.state;return l.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(s,v.computedBonusConnectionsModifier.value).lte(l.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function Qi(e,t){if(t.type!=="resource")return!1;const n=t.state.type,{maxConnections:r,resources:i}=e.state;return i.includes(n)?!0:!o.add(r,v.computedBonusConnectionsModifier.value).lte(i.length)}function ea(e,t){if(t.type!=="resource")return;const n=t.state.type,r=e.state.resources;r.includes(n)?e.state={...e.state,resources:r.filter(i=>i!==n)}:e.state={...e.state,resources:[...r,n]},v.board.selectedNode.value=e}function Md(e,t){if(t.type!=="passive")return!1;const n=t.state,{maxConnections:r,tools:i}=e.state;return i.includes(n)?!0:!o.add(r,v.computedBonusConnectionsModifier.value).lte(i.length)}function Id(e,t){if(t.type!=="passive")return;const n=t.state,r=e.state.tools;r.includes(n)?e.state={...e.state,tools:r.filter(i=>i!==n)}:e.state={...e.state,tools:[...r,n]},v.board.selectedNode.value=e}function _r(e,t){if(t.type!=="portal")return!1;const n=t.state.id,{maxConnections:r,portals:i}=e.state;return i.includes(n)?!0:!o.add(r,v.computedBonusConnectionsModifier.value).lte(i.length)}function Nr(e,t){if(t.type!=="portal")return;const n=t.state.id,{portals:r}=e.state;r.includes(n)?e.state={...e.state,portals:r.filter(i=>i!==n)}:e.state={...e.state,portals:[...r,n]},v.board.selectedNode.value=e}function ke(e){return e===v.board.selectedNode.value||e.state.powered}function te(e){return v.empowerer.value!=null&&ke(v.empowerer.value)&&v.empowerer.value.state.tools.includes(e)}function xd(e){var s,l,u;const t=(u=(l=(s=v.resourceNodes.value[e])==null?void 0:s.state)==null?void 0:l.amount)!=null?u:0,n=v.resourceLevels.value[e],r=Br.evaluate(n),i=Br.evaluate(o.add(n,1));return o.sub(t,r).max(0).div(o.sub(i,r)).toNumber()}function vn(e,t,n){if(t.value){const r=t.value.state,i=r[n],s=r.maxConnections;o.gt(i.length,o.add(s,e))&&(t.value.state={...t.value.state,[n]:i.slice(0,o.add(s,e).toNumber())})}}function zt(e){return{id:"help",icon:"question_mark",tooltip:{text:"Help"},onClick(){v.helpModals[e].showModal.value=!0,v.board.selectedAction.value=null},confirmationLabel:null}}function bi(e){return t=>ie.lineVisibility||e===v.board.selectedNode.value||e===v.board.draggingNode.value||v.resourceNodes.value[t]===v.board.draggingNode.value}const $d={key:0},Dd={key:0,class:"mark star"},Td=["src"],Pd=X({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(S(),T("div",$d,[e.mark===!0?(S(),T("div",Dd)):(S(),T("img",{key:1,class:"mark",src:e.mark},null,8,Td))])):B("",!0)}});var er=be(Pd,[["__scopeId","data-v-2207999f"]]);const Ad=X({__name:"Node",props:{id:null},setup(e){const n=Ae(e),r=dr(Yr,()=>{}),i=dr(Zr,()=>{}),s=_t(null),l=y(()=>s.value&&s.value.parentElement);return wt([l,n.id],([u,c],[p,h])=>{p&&i(a(h)),u&&r(c,u)}),Mi(()=>i(a(n.id))),(u,c)=>(S(),T("div",{class:"node",ref_key:"node",ref:s},null,512))}});var tr=be(Ad,[["__scopeId","data-v-a48cb382"]]),Rd=X({props:{display:{type:q(Object,String,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),onClick:Function,onHold:Function,canClick:{type:q(Boolean),required:!0},small:Boolean,mark:q(Boolean,String),id:{type:String,required:!0}},components:{Node:tr,MarkNode:er},setup(e){const{display:t,onClick:n,onHold:r}=Ae(e),i=_t("");Pt(()=>{var h;const u=Pe(t);if(u==null){i.value="";return}if(At(u)){i.value=fe(u);return}const c=fe((h=u.title)!=null?h:"","h3"),p=fe(u.description,"div");i.value=fe(j(()=>d("span",null,[u.title!=null?d("div",null,[d(c,null,null)]):null,d(p,null,null)])))});const{start:s,stop:l}=Vi(n,r);return{start:s,stop:l,comp:i,Visibility:Se,isVisible:Ze,isHidden:_n,unref:a}}});function Ed(e,t,n,r,i,s){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(S(),T("button",{key:0,style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:[]]),onClick:t[0]||(t[0]=(...p)=>e.onClick&&e.onClick(...p)),onMousedown:t[1]||(t[1]=(...p)=>e.start&&e.start(...p)),onMouseleave:t[2]||(t[2]=(...p)=>e.stop&&e.stop(...p)),onMouseup:t[3]||(t[3]=(...p)=>e.stop&&e.stop(...p)),onTouchstartPassive:t[4]||(t[4]=(...p)=>e.start&&e.start(...p)),onTouchendPassive:t[5]||(t[5]=(...p)=>e.stop&&e.stop(...p)),onTouchcancelPassive:t[6]||(t[6]=(...p)=>e.stop&&e.stop(...p)),class:Ne({feature:!0,clickable:!0,can:e.unref(e.canClick),locked:!e.unref(e.canClick),small:e.small,...e.unref(e.classes)})},[e.unref(e.comp)?(S(),re(Ke(e.unref(e.comp)),{key:0})):B("",!0),d(l,{mark:e.unref(e.mark)},null,8,["mark"]),d(u,{id:e.id},null,8,["id"])],38)):B("",!0)}var ta=be(Rd,[["render",Ed],["__scopeId","data-v-211328c0"]]);const na=Symbol("Clickable");function yi(e,...t){const n=t.reduce((r,i)=>{var s;return Object.assign(r,(s=i.getPersistentData)==null?void 0:s.call(i))},{});return et(r=>{var l,u,c;const i=(l=e==null?void 0:e.call(r,r))!=null?l:{};i.id=Qt("clickable-"),i.type=na,i[gt]=ta;for(const p of t)(u=p.preConstruct)==null||u.call(p,i);if(Object.assign(i,n),A(i,"visibility"),oe(i,"visibility",Se.Visible),A(i,"canClick"),oe(i,"canClick",!0),A(i,"classes"),A(i,"style"),A(i,"mark"),A(i,"display"),i.onClick){const p=i.onClick.bind(i);i.onClick=function(h){a(i.canClick)!==!1&&p(h)}}if(i.onHold){const p=i.onHold.bind(i);i.onHold=function(){a(i.canClick)!==!1&&p()}}for(const p of t)(c=p.postConstruct)==null||c.call(p,i);const s=t.reduce((p,h)=>{var g;return Object.assign(p,(g=h.getGatheredProps)==null?void 0:g.call(h,i))},{});return i[dt]=function(){const{display:p,visibility:h,style:g,classes:b,onClick:m,onHold:k,canClick:C,small:$,mark:x,id:I}=this;return{display:p,visibility:h,style:a(g),classes:b,onClick:m,onHold:k,canClick:C,small:$,mark:x,id:I,...s}},i})}function Fd(e,t,n=[]){n=n.length===0?Xn(e,na):n;const r=typeof t=="function"?y(t):t;return e.on("update",()=>{a(r)&&n.filter(i=>a(i.canClick)).forEach(i=>{var s;return(s=i.onClick)==null?void 0:s.call(i)})})}const Od=["x1","y1","x2","y2"],qd=X({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const t=e,n=Ae(t),r=y(()=>{const l=n.startNode.value.rect,u=n.boundingRect.value,c=u?{x:l.x+l.width/2-u.x,y:l.y+l.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(c.x+=n.link.value.offsetStart.x,c.y+=n.link.value.offsetStart.y),c}),i=y(()=>{const l=n.endNode.value.rect,u=n.boundingRect.value,c=u?{x:l.x+l.width/2-u.x,y:l.y+l.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(c.x+=n.link.value.offsetEnd.x,c.y+=n.link.value.offsetEnd.y),c}),s=y(()=>Bi(t.link));return(l,u)=>(S(),T("line",Vt({"stroke-width":"15px",stroke:"white"},a(s),{x1:a(r).x,y1:a(r).y,x2:a(i).x,y2:a(i).y}),null,16,Od))}});const Vd=X({__name:"Links",props:{links:null},setup(e){var c;const n=Jt(e,"links"),r=G(null),i=dr(Xr,G({})),s=dr(Jr,G(void 0)),l=G((c=r.value)==null?void 0:c.getBoundingClientRect());wt(s,()=>{var p;return l.value=(p=r.value)==null?void 0:p.getBoundingClientRect()}),Qn(()=>{var p;return l.value=(p=r.value)==null?void 0:p.getBoundingClientRect()});const u=y(()=>{var h,g;const p=i.value;return(g=(h=n.value)==null?void 0:h.filter(b=>{var m,k;return((m=p[b.startNode.id])==null?void 0:m.rect)&&((k=p[b.startNode.id])==null?void 0:k.rect)}))!=null?g:[]});return(p,h)=>(S(),T(ne,null,[a(u)?(S(),T("svg",ha(Vt({key:0},p.$attrs)),[(S(!0),T(ne,null,Dt(a(u),(g,b)=>(S(),re(qd,{key:b,link:g,boundingRect:l.value,startNode:a(i)[g.startNode.id],endNode:a(i)[g.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):B("",!0),N("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var Bd=be(Vd,[["__scopeId","data-v-063f6d6b"]]);X({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:Bd},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:r}=Ae(e),i=_t();Pt(()=>{const u=Pe(t);i.value=fe(j(()=>d(ne,null,[u.map(c=>d("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(mt)]))])))});const s=_t();Pt(()=>{const u=Pe(n);s.value=u?fe(j(()=>d("span",{class:"left-side-nodes small"},[u.map(mt)]))):""});const l=_t();return Pt(()=>{const u=Pe(r);l.value=u?fe(j(()=>d("span",{class:"side-nodes small"},[u.map(mt)]))):""}),{unref:a,nodesComp:i,leftNodesComp:s,rightNodesComp:l}}});X({props:{display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),onClick:Function,onHold:Function,color:q(String),glowColor:q(String),canClick:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:er,Node:tr},setup(e){const{onClick:t,onHold:n,display:r}=Ae(e),i=Rn(r),{start:s,stop:l}=Vi(t,n);return{start:s,stop:l,comp:i,unref:a,Visibility:Se,isCoercableComponent:At,isVisible:Ze,isHidden:_n}}});function Un(e){const t=[],n={};let r=!1;function i(){return r||(t.push(...e()),n.base=t.map(u=>_e(u.base)),n.baseText=t.map(u=>_e(u.baseText)),n.visible=t.map(u=>_e(u.visible)),n.title=t.map(u=>_e(u.title)),n.subtitle=t.map(u=>_e(u.subtitle)),r=!0),t}const s=ct({},!1);return[j(()=>{const u=i();let c=!0;const p=u.map((h,g)=>{var x,I,R;if(a(n.visible[g])===!1)return null;const b=d("h3",{onClick:()=>s.value[g]=!s.value[g],style:"cursor: pointer"},[d("span",{class:"modifier-toggle"+(a(s.value[g])?" collapsed":"")},[w("\u25BC")]),a(n.title[g]),a(n.subtitle[g])!=null?d("span",{class:"subtitle"},[w(" ("),a(n.subtitle[g]),w(")")]):null]),m=a(s.value[g])?null:d(ne,null,[d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[mt((x=a(n.baseText[g]))!=null?x:"Base")]),d("span",{class:"modifier-amount"},[xe((I=a(n.base[g]))!=null?I:1),h.unit])]),h.modifier.description==null?null:mt(a(h.modifier.description))]),k=!c;c=!1;const C=(R=a(n.base[g]))!=null?R:1,$=h.modifier.apply(C);return d(ne,null,[k?d("br",null,null):null,d("div",{style:{"--unit":ie.alignUnits&&h.unit!=null?"'"+h.unit+"'":""}},[b,d("br",null,null),m,d("hr",null,null),d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[w("Total")]),d("span",{class:"modifier-amount",style:(h.smallerIsBetter===!0?o.gt($,C!=null?C:1):o.lt($,C!=null?C:1))?"color: var(--danger)":""},[Zt($),h.unit])])])])});return d(ne,null,[p])}),s]}function Er(e,t,n){const r=_e(t),i=_e(n);return y(()=>{const s=a(r),l=a(i);return o.gte(e.value,l)?"Now":o.lte(s,0)?"Never":yr(o.sub(l,e.value).div(s))})}function hn(e,t,n=1){const r=_e(t),i=_e(n);return e.hasVariable()||console.error("Cannot create formula preview if the formula does not have a variable"),j(()=>{var s;if(a(r)){const l=Zt(e.evaluate()),u=Zt(e.evaluate(o.add(a((s=e.innermostVariable)!=null?s:0),a(i))));return d(ne,null,[d("b",null,[d("i",null,[l,w(" \u2192 "),u])])])}return d(ne,null,[Zt(e.evaluate())])})}const Tt={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},Et=Object.keys(Tt),ze={dirt:{cost:1e3,name:"Pickaxe",type:"passive",state:"dirt"},sand:{cost:1e4,name:"Dowsing Rod",type:"dowsing",state:{resources:[],maxConnections:1,powered:!1}},gravel:{cost:1e5,name:"Ore Processor",type:"passive",state:"gravel"},wood:{cost:1e6,name:"Quarry",type:"quarry",state:{resources:[],maxConnections:1,powered:!1,progress:0}},stone:{cost:1e7,name:"Energizer",type:"passive",state:"stone"},coal:{cost:1e8,name:"Tool Empowerer",type:"empowerer",state:{tools:[],maxConnections:1,powered:!1}},copper:{cost:1e9,name:"Book",type:"passive",state:"copper"},iron:{cost:1e10,name:"Portal Generator",type:"portalGenerator",state:{tier:void 0,influences:[]}},silver:{cost:1e12,name:"Robotics",type:"passive",state:"silver"},gold:{cost:1e15,name:"Booster",type:"booster",state:{portals:[],maxConnections:1,powered:!1,level:1}},emerald:{cost:1e19,name:"AI",type:"passive",state:"emerald"},platinum:{cost:1e24,name:"Upgrader",type:"upgrader",state:{portals:[],maxConnections:1,powered:!1}},diamond:{cost:1e30,name:"ML",type:"passive",state:"diamond"},berylium:{cost:1e37,name:"Automator",type:"automator",state:{portals:[],maxConnections:1,powered:!1}},unobtainium:{cost:1e45,name:"National Grid",type:"passive",state:"unobtainium"},ultimatum:{cost:1e54,name:"Investments",type:"investments",state:{portals:[],maxConnections:1,powered:!1}}},Ft={dirt:"BOGO Coupon",sand:"Metal Detector",gravel:"Neural Nets",wood:"Mining Laser",stone:"Replicator",coal:"Planar Intelligence",copper:"Efficient Code",iron:"Trade Agreements",silver:"Machine Synergizer",gold:"XP Market",emerald:"Efficient Portals",platinum:"Time Dilation",diamond:"Paypal",berylium:"Tiered Mining",unobtainium:"OC'ed Portals",ultimatum:"Rebates"},Ld={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 40% stronger":"Material level is 20% stronger"},silver:{description:e=>e?"Quadruples each plane's resource gain":"Doubles each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase (diminishing)":"+1% plane's resource gain per repeatable purchase (diminishing)"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"All upgrades apply twice":"Non-multiplicative upgrades apply twice"},coalRelic:{description:e=>e?"Every treasure boosts planar speed by +20%":"Every treasure boosts planar speed by +10%"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give quadruple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Powered machines)^2 boost quarry speed":"Powered machines boost quarry speed"},goldRelic:{description:e=>e?"Each treasure gives +50% XP gain":"Each treasure gives +25% XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs 20x less energy":"Creating portals costs 10x less energy"},platinumRelic:{description:e=>e?"Quadruple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"log(energy)^0.5 boosts planes' resource gain":"log(energy)^0.25 boosts planes' resource gain"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},yt={increaseResources:{display:"+resource",description:e=>{const t=e.data;return t.length===0?"Increase resource odds - Drag a resource to me!":t.length===1?`Increase ${t[0]}'s odds`:`Increase ${t.length} resources' odds`},cost:2,initialData:[]},decreaseResources:{display:"-resource",description:e=>{const t=e.data;return t.length===0?"Decrease resource odds - Drag a resource to me!":t.length===1?`Decrease ${t[0]}'s odds`:`Decrease ${t.length} resources' odds`},cost:2,initialData:[]},increaseLength:{display:"+length",description:"Increase length",cost:100,initialData:void 0},increaseCaches:{display:"+caches",description:"Increase caches odds",cost:10,initialData:void 0},increaseGens:{display:"+gens",description:"Increase generators odds",cost:10,initialData:void 0},increaseInfluences:{display:"+influences",description:"Increase influences odds",cost:10,initialData:void 0},increaseEnergyMults:{display:"+energy mults",description:"Increase energy mults odds",cost:10,initialData:void 0},increaseResourceMults:{display:"+resource mults",description:"Increase resource mults odds",cost:10,initialData:void 0},increaseDiff:{display:"+difficulty",description:"Increase difficulty/rewards odds",cost:10,initialData:void 0},decreaseDiff:{display:"-difficulty",description:"Decrease difficulty/rewards odds",cost:10,initialData:void 0},increaseRewards:{display:"+rewards",description:"Increase rewards level",cost:1e4,initialData:void 0},relic:{display:"+relic",description:"Max length/difficulty, add tier-unique relic",cost:1e6,initialData:void 0}},or=f.variable(0).add(8).times(2).pow10(),jd=X({__name:"Tab",props:{display:null},setup(e){const t=e,{display:n}=Ae(t),r=Hr(n);return(i,s)=>(S(),re(Ke(a(r))))}}),zd=Symbol("Tab");function Fr(e){return et(t=>{const n=e.call(t,t);return n.id=Qt("tab-"),n.type=zd,n[gt]=jd,n[dt]=function(){const{display:r}=this;return{display:r}},n})}function Gt(e,t,n={}){const r=ct(!1);return{modal:j(()=>d(Lt,{modelValue:r.value,"onUpdate:modelValue":s=>r.value=s},{header:()=>d("h2",null,[e]),body:t})),showModal:r,...n}}function Gd(){return Gt("Getting Started",j(()=>d("div",null,[d("p",null,[w(`Welcome to Planar Pioneers! Your job is to gather resources and eventually explore and conquer increasingly difficult "planes", which are like alien worlds. To start you'll use the mine (\u26CF\uFE0F) machine to gather resources.`)]),d("br",null,null),d("p",null,[w(`You'll gain energy every second based on how much of each resource you have. You can check the exact calculation and various other information by clicking the "modifiers" button near the top of the screen.`)]),d("br",null,null),d("p",null,[w("Select the machine by clicking it to make the mine active. You can also drag them around to organize your various machines and other objects. While selected machines will have various actions you can take, such as viewing the help for that machine. There's also an action to power the machine, allowing it to be active even while not selected, at the cost of energy per second (cost increases based on the total number of machines being powered).")])])))}function Ud(){return Gt("Forging",j(()=>d("div",null,[d("p",null,[w("You've repaired the forge (\u{1F6E0}\uFE0F)! This is the next main line of progression. Here you'll be able to craft a total of 16 machines and passive bonuses to create - one for each resource!")]),d("br",null,null),d("p",null,[w("Drag a resource onto the forge to select that resource tier. You can then use an action on the forge to create that item, at the cost of energy based on the resource tier. You can only have 1 of each item.")])])))}function Wd(){return Gt("Dowsing",j(()=>d("div",null,[d("p",null,[w("You've created the dowsing rod (\u{1F962})! This machine lets you bias the odds of specified resources from mining. It will double the odds of each specified resource, so keep in mind rare resources will still be fairly rare.")]),d("br",null,null),d("p",null,[w("Specify resources to boost by dragging them to the dowsing rod. You can only select a single resource to start, but that can be increased using an action.")])])))}function Hd(){return Gt("Quarry",j(()=>d("div",null,[d("p",null,[w("You've created the Quarry (\u26F0\uFE0F)! This machine lets you gather specified resources. Unlike the mine, this machine will always output the same resources. However, rarer resources will take longer to gather.")]),d("br",null,null),d("p",null,[w("Specify resources to gather by dragging them to the quarry. You can only select a single resource to start, but that can be increased using an action.")])])))}function Yd(){return Gt("Tool Empowerer",j(()=>d("div",null,[d("p",null,[w("You've created the Tool Empowerer (\u{1F50C})! This machine lets you increase the effect of specified passives. Experimenting with which passives to empower can really help you progress!")]),d("br",null,null),d("p",null,[w("Specify passives to empower by dragging them to the empowerer. You can only select a single passive to start, but that can be increased using an action.")])])))}function Zd(){const e=Ji({general:()=>({display:"General",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Fr(()=>({display:j(()=>d("div",null,[d("p",null,[w("You've created the Portal Generator (\u26E9\uFE0F)! This machine lets you create portals to other planes, which will have treasures that help you in various ways! To create a portal you need to specify a tier by dragging a resource to the generator - higher tier planes cost more energy to generate portals for, but offer more and better treasures! Keep in mind time in planes will be paused if the portal is inactive (not selected nor powered).")]),d("br",null,null),d("p",null,[w("You've also gained a trash can for portals (\u{1F5D1}\uFE0F). Dragging a portal here will permanently destroy it. Any treasures that require the portal to be active will no longer work. This can be used to keep your workspace clean from old portals you no longer need or want.")]),d("br",null,null),d("p",null,[w("Once you have portals, the lines on the board might getting particularly necessary. Here's a setting (also accessible in the settings modal) to disable resource gain lines unless the node is active.")]),d("br",null,null),d($t,{title:j(()=>d("span",{class:"option-title"},[w("Always show lines to resource nodes")])),modelValue:ie.lineVisibility,"onUpdate:modelValue":t=>ie.lineVisibility=t},null)]))}))}),treasures:()=>({display:"Treasures",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Fr(()=>({display:j(()=>d("div",null,[w("Types of potential treasures:"),d("ul",{style:"list-style-type: unset"},[d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Caches")]),w(": Gain an amount of a resource based on your current amount.")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Gen")]),w(": Passively gain an amount of a resource while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Resource Mult")]),w(": Increase the amount gained of a resource from all sources (except caches) while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Energy Mult")]),w(": Increase the energy gained per second while the portal is active (selected or powered).")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Influences")]),w(": Gain a influence. See the influences tab for details. You can only have 1 of each influence.")]),d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("Relic")]),w(": Gain the relic unique to this tier of plane. These are powerful passive boosts that can be empowered. You can only have 1 of each relic. Relics can only appear with the +relic influence, and will always be the last treasure on a plane.")])])]))}))}),influences:()=>({display:"Influences",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Fr(()=>({display:j(()=>d("div",null,[d("p",null,[w("Some treasures will grant you influences that can help the portal generator create portals to planes with specified qualities. Each influence will multiply the energy cost of creating the portal.")]),d("br",null,null),Object.keys(v.influenceNodes.value).length>0?d("div",null,[w("Discovered influences:"),d("ul",{style:"list-style-type: unset"},[v.influenceNodes.value.increaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+resource")]),w(": Can be connected to resources and will cause any treasures that reference resources (caches, gens, and resource mults) to have increased odds of picking a selected resource.")]),v.influenceNodes.value.decreaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("-resource")]),w(": Can be connected to resources and will cause any treasures that reference resources (caches, gens, and resource mults) to have decreased odds of picking a selected resource.")]),v.influenceNodes.value.increaseLength==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+length")]),w(": Cause the plane to have 1 extra treasure than it otherwise would have.")]),v.influenceNodes.value.increaseCaches==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+caches")]),w(": Causes treasures to have an increased chance to be caches.")]),v.influenceNodes.value.increaseGens==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+gens")]),w(": Causes treasures to have an increased chance to be gens.")]),v.influenceNodes.value.increaseResourceMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+resource mults")]),w(": Causes treasures to have an increased chance to be resource mults.")]),v.influenceNodes.value.increaseEnergyMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+energy mults")]),w(": Causes treasures to have an increased chance to be energy mults.")]),v.influenceNodes.value.increaseInfluences==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+influences")]),w(": Causes treasures to have an increased chance to be influences.")]),v.influenceNodes.value.relic==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+relic")]),w(": Maximizes length and difficulty for this tier of plane, and makes the last treasure a relic (unique per tier of plane). Overrides any other difficulty-changing influences.")]),v.influenceNodes.value.increaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+difficulty")]),w(": Causes the difficulty and rewards to be in the upper half of what's possible at this tier.")]),v.influenceNodes.value.decreaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("-difficulty")]),w(": Causes the difficulty and rewards to be in the lower half of what's possible at this tier.")]),v.influenceNodes.value.increaseRewards==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[w("+rewards")]),w(": Causes the quality of treasures to be 1 tier higher. Does not affect influences or relics treasures.")])])]):d("div",null,[w("Once you discover influences, summaries will appear here describing their effects.")])]))}))})});return Gt("Portal Generator",j(()=>mt(e)),{tabFamily:e})}function Xd(){return Gt("Booster",j(()=>d("div",null,[d("p",null,[w("You've created the Booster (\u231B)! This machine lets you increase the rate of time of planes! This affects its resource gain, gen treasures, and any other effects of time.")]),d("br",null,null),d("p",null,[w("Specify planes to boost by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")]),d("br",null,null),d("p",null,[w("Initially the booster will double the rate of time, but that can be increased using an action.")])])))}function Jd(){return Gt("Upgrader",j(()=>d("div",null,[d("p",null,[w("You've created the Upgrader (\u{1F916})! This machine lets you automatically purchase upgrades within planes (includes prestiges but not repeatables or dimensions)!")]),d("br",null,null),d("p",null,[w("Specify planes to auto-purchase upgrades from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}function Kd(){return Gt("Automator",j(()=>d("div",null,[d("p",null,[w("You've created the Automator (\u{1F9BE})! This machine lets you automatically purchase repeatables and dimensions within planes!")]),d("br",null,null),d("p",null,[w("Specify planes to auto-purchase repeatables and dimensions from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}function Qd(){return Gt("Investments",j(()=>d("div",null,[d("p",null,[w("You've created the Investments machine (\u{1F4B1})! This machine lets you automatically gain the resources from conversions without spending the plane's primary resource!")]),d("br",null,null),d("p",null,[w("Specify planes to gain converted resources from by dragging their portals to the booster. You can only select a single plane to start, but that can be increased using an action.")])])))}const ep=X({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(S(),T("div",{style:Le({width:e.width,height:e.height})},null,4))}});function Bn(e){return et(t=>{var r;const n=e.call(t,t);return n.partialDisplay=i=>d("span",{style:a(n.requirementMet)?"":"color: var(--danger)"},[vr(n.resource,n.cost instanceof f?sn(n.cost,i!=null?i:1,a(n.cumulativeCost),a(n.directSum)):a(n.cost))," ",n.resource.displayName]),n.display=i=>d("div",null,[a(n.requiresPay)?"Costs: ":"Requires: ",vr(n.resource,n.cost instanceof f?sn(n.cost,i!=null?i:1,a(n.cumulativeCost),a(n.directSum)):a(n.cost))," ",n.resource.displayName]),A(n,"visibility"),oe(n,"visibility",Se.Visible),A(n,"cost"),A(n,"requiresPay"),oe(n,"requiresPay",!0),A(n,"cumulativeCost"),oe(n,"cumulativeCost",!0),A(n,"maxBulkAmount"),oe(n,"maxBulkAmount",1),A(n,"directSum"),oe(n,"pay",function(i){const s=n.cost instanceof f?sn(n.cost,i!=null?i:1,a(n.cumulativeCost),a(n.directSum)):a(n.cost);n.resource.value=o.sub(n.resource.value,s).max(0)}),n.canMaximize=y(()=>{var u;if(!(n.cost instanceof f))return!1;const i=a(n.maxBulkAmount);if(o.lte(i,1))return!1;const s=a(n.cumulativeCost),l=(u=a(n.directSum))!=null?u:s?10:0;return o.lte(i,l)?!0:!(!n.cost.isInvertible()||s===!0&&!n.cost.isIntegrable())}),n.cost instanceof f?n.requirementMet=zi(n.cost,n.resource,(r=n.cumulativeCost)!=null?r:!0,n.directSum,n.maxBulkAmount):n.requirementMet=y(()=>o.gte(n.resource.value,a(n.cost))),n})}function ri(e){return et(()=>({requirementMet:y(()=>Ze(e.visibility)),visibility:Se.None,requiresPay:!1}))}function tp(e,t){return et(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:j(()=>mt(t)),display:t==null?void 0:j(()=>d(ne,null,[w("Req: "),mt(t)])),visibility:t==null?Se.None:Se.Visible,requiresPay:!1}))}function Cr(e){if(Bt(e))return e.every(Cr);const t=a(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function ra(e){if(Bt(e))return e.map(ra).reduce(o.min);const t=a(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&a(e.canMaximize)!==!0?1:t}function kr(e,t=1){var n,r;if(Bt(e)&&(e=e.filter(i=>Ze(i.visibility)),e.length===1&&(e=e[0])),Bt(e)){e=e.filter(l=>"partialDisplay"in l);const i=e.filter(l=>a(l.requiresPay)),s=e.filter(l=>!a(l.requiresPay));return d(ne,null,[i.length>0?d("div",null,[w("Costs:")," ",mi(i.map(l=>l.partialDisplay(t)),d(ne,null,[w(", ")]))]):null,s.length>0?d("div",null,[w("Requires:")," ",mi(s.map(l=>l.partialDisplay(t)),d(ne,null,[w(", ")]))]):null])}return(r=(n=e.display)==null?void 0:n.call(e))!=null?r:d(ne,null,null)}function ia(e,t=1){var n;Bt(e)?e.filter(r=>a(r.requiresPay)).forEach(r=>{var i;return(i=r.pay)==null?void 0:i.call(r,t)}):a(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var np=X({props:{visibility:{type:q(Number,Boolean),required:!0},display:q(Object,String,Function),earned:{type:q(Boolean),required:!0},requirements:q(Object,Array),image:q(String),style:q(String,Object,Array),classes:q(Object),mark:q(Boolean,String),small:q(Boolean),id:{type:String,required:!0}},components:{Node:tr,MarkNode:er},setup(e){const{display:t,requirements:n,earned:r}=Ae(e),i=_t("");return Pt(()=>{const s=Pe(t);if(s==null){i.value="";return}if(At(s)){i.value=fe(s);return}const l=fe(s.requirement?s.requirement:j(()=>{var p;return kr((p=Pe(n))!=null?p:[])}),"h3"),u=fe(s.effectDisplay||"","b"),c=Pe(r)?fe(s.optionsDisplay||"","span"):"";i.value=fe(j(()=>d("span",null,[d(l,null,null),s.effectDisplay!=null?d("div",null,[d(u,null,null)]):null,s.optionsDisplay!=null?d("div",{class:"equal-spaced"},[d(c,null,null)]):null])))}),{comp:i,unref:a,Visibility:Se,isVisible:Ze,isHidden:_n}}});function rp(e,t,n,r,i,s){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(S(),T("div",{key:0,style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0,backgroundImage:e.earned&&e.image&&`url(${e.image})`||""},(c=e.unref(e.style))!=null?c:[]]),class:Ne({feature:!0,achievement:!0,locked:!e.unref(e.earned),done:e.unref(e.earned),small:e.unref(e.small),...e.unref(e.classes)})},[e.comp?(S(),re(Ke(e.comp),{key:0})):B("",!0),d(l,{mark:e.unref(e.mark)},null,8,["mark"]),d(u,{id:e.id},null,8,["id"])],6)):B("",!0)}var ip=be(np,[["render",rp],["__scopeId","data-v-5673325a"]]);const ap=hr(),sp=Symbol("Achievement");let Dn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function op(e,...t){const n=ct(!1,!1),r=t.reduce((i,s)=>{var l;return Object.assign(i,(l=s.getPersistentData)==null?void 0:l.call(s))},{});return et(i=>{var c,p,h;const s=(c=e==null?void 0:e.call(i,i))!=null?c:{};s.id=Qt("achievement-"),s.type=sp,s[gt]=ip;for(const g of t)(p=g.preConstruct)==null||p.call(g,s);s.earned=n,s.complete=function(){var b,m;if(n.value)return;n.value=!0;const g=s;if((b=g.onComplete)==null||b.call(g),g.display!=null&&a(g.showPopups)===!0){const k=a(g.display);let C;At(k)?C=fe(k):k.requirement!=null?C=fe(k.requirement):C=kr((m=g.requirements)!=null?m:[]),ap.info(d("div",null,[d("h3",null,[w("Treasure earned!")]),d("div",null,[d(C,null,null)])]))}},Object.assign(s,r),A(s,"visibility"),oe(s,"visibility",Se.Visible);const l=s.visibility;s.visibility=ba(()=>{const g=a(s.display);switch(ie.msDisplay){default:case Dn.All:return a(l);case Dn.Configurable:return a(s.earned)&&!(g!=null&&typeof g=="object"&&"optionsDisplay"in g)?Se.None:a(l);case Dn.Incomplete:return a(s.earned)?Se.None:a(l);case Dn.None:return Se.None}}),A(s,"display"),A(s,"mark"),A(s,"small"),A(s,"image"),A(s,"style"),A(s,"classes"),A(s,"showPopups"),oe(s,"showPopups",!0);for(const g of t)(h=g.postConstruct)==null||h.call(g,s);const u=t.reduce((g,b)=>{var m;return Object.assign(g,(m=b.getGatheredProps)==null?void 0:m.call(b,s))},{});if(s[dt]=function(){const{visibility:g,display:b,requirements:m,earned:k,image:C,style:$,classes:x,mark:I,small:R,id:L}=this;return{visibility:g,display:b,requirements:m,earned:k,image:C,style:a($),classes:x,mark:I,small:R,id:L,...u}},s.requirements){const g=s,b=[ri(g),tp(()=>!g.earned.value),...Bt(s.requirements)?s.requirements:[s.requirements]];Pt(()=>{ie.active===Y.id&&Cr(b)&&g.complete()})}return s})}Qe.on("loadSettings",e=>{oe(e,"msDisplay",Dn.All)});const lp=Object.values(Dn).map(e=>({label:st(e),value:e}));Oi(j(()=>d(ti,{title:j(()=>d("span",{class:"option-title"},[w("Show achievements"),d("desc",null,[w("Select which achievements to display based on criterias.")])])),options:lp,"onUpdate:modelValue":e=>ie.msDisplay=e,modelValue:ie.msDisplay},null)));const up=X({props:{progress:{type:q(String,Object,Number),required:!0},width:{type:q(Number),required:!0},height:{type:q(Number),required:!0},direction:{type:q(String),required:!0},display:q(Object,String,Function),visibility:{type:q(Number,Boolean),required:!0},style:q(Object,String,Array),classes:q(Object),borderStyle:q(Object,String,Array),textStyle:q(Object,String,Array),baseStyle:q(Object,String,Array),fillStyle:q(Object,String,Array),mark:q(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:er,Node:tr},setup(e){const{progress:t,width:n,height:r,direction:i,display:s}=Ae(e),l=y(()=>{let p=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(p,0),1))*100}),u=y(()=>{const p={width:Pe(n)+.5+"px",height:Pe(r)+.5+"px"};switch(a(i)){case W.Up:p.clipPath=`inset(${l.value}% 0% 0% 0%)`,p.width=Pe(n)+1+"px";break;case W.Down:p.clipPath=`inset(0% 0% ${l.value}% 0%)`,p.width=Pe(n)+1+"px";break;case W.Right:p.clipPath=`inset(0% ${l.value}% 0% 0%)`;break;case W.Left:p.clipPath=`inset(0% 0% 0% ${l.value} + '%)`;break;case W.Default:p.clipPath="inset(0% 50% 0% 0%)";break}return p}),c=Rn(s);return{normalizedProgress:l,barStyle:u,component:c,unref:a,Visibility:Se,isVisible:Ze,isHidden:_n}}});function cp(e,t,n,r,i,s){var c,p,h,g,b,m,k;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(S(),T("div",{key:0,style:Le([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px",visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),class:Ne({bar:!0,...e.unref(e.classes)})},[N("div",{class:"overlayTextContainer border",style:Le([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(p=e.unref(e.borderStyle))!=null?p:{}])},[e.component?(S(),T("span",{key:0,class:"overlayText",style:Le(e.unref(e.textStyle))},[(S(),re(Ke(e.component)))],4)):B("",!0)],4),N("div",{class:"border",style:Le([{width:e.unref(e.width)+"px",height:e.unref(e.height)+"px"},(h=e.unref(e.style))!=null?h:{},(g=e.unref(e.baseStyle))!=null?g:{},(b=e.unref(e.borderStyle))!=null?b:{}])},[N("div",{class:"fill",style:Le([e.barStyle,(m=e.unref(e.style))!=null?m:{},(k=e.unref(e.fillStyle))!=null?k:{}])},null,4)],4),d(l,{mark:e.unref(e.mark)},null,8,["mark"]),d(u,{id:e.id},null,8,["id"])],6)):B("",!0)}var dp=be(up,[["render",cp],["__scopeId","data-v-6bd06b56"]]);const pp=Symbol("Bar");function fp(e,...t){const n=t.reduce((r,i)=>{var s;return Object.assign(r,(s=i.getPersistentData)==null?void 0:s.call(i))},{});return et(r=>{var l,u;const i=e.call(r,r);i.id=Qt("bar-"),i.type=pp,i[gt]=dp;for(const c of t)(l=c.preConstruct)==null||l.call(c,i);Object.assign(i,n),A(i,"visibility"),oe(i,"visibility",Se.Visible),A(i,"width"),A(i,"height"),A(i,"direction"),A(i,"style"),A(i,"classes"),A(i,"borderStyle"),A(i,"baseStyle"),A(i,"textStyle"),A(i,"fillStyle"),A(i,"progress"),A(i,"display"),A(i,"mark");for(const c of t)(u=c.postConstruct)==null||u.call(c,i);const s=t.reduce((c,p)=>{var h;return Object.assign(c,(h=p.getGatheredProps)==null?void 0:h.call(p,i))},{});return i[dt]=function(){const{progress:c,width:p,height:h,direction:g,display:b,visibility:m,style:k,classes:C,borderStyle:$,textStyle:x,baseStyle:I,fillStyle:R,mark:L,id:ce}=this;return{progress:c,width:p,height:h,direction:g,display:b,visibility:m,style:a(k),classes:C,borderStyle:$,textStyle:x,baseStyle:I,fillStyle:R,mark:L,id:ce,...s}},i})}function gp(e,...t){return et(n=>{var i,s;const r=e.call(n,n);for(const l of t)(i=l.preConstruct)==null||i.call(l,r);r.formula=r.formula(f.variable(r.baseResource)),r.currentGain==null&&(r.currentGain=y(()=>{let l=o.floor(r.formula.evaluate(r.baseResource.value)).max(0);return a(r.buyMax)===!1&&(l=l.min(1)),l})),r.actualGain==null&&(r.actualGain=r.currentGain),r.currentAt==null&&(r.currentAt=y(()=>r.formula.invert(o.floor(a(r.currentGain))))),r.nextAt==null&&(r.nextAt=y(()=>r.formula.invert(o.floor(a(r.currentGain)).add(1)))),r.convert==null&&(r.convert=function(){var u;const l=a(r.currentGain);r.gainResource.value=o.add(r.gainResource.value,l),r.spend(l),(u=r.onConvert)==null||u.call(r,l)}),r.spend==null&&(r.spend=function(){r.baseResource.value=0}),A(r,"currentGain"),A(r,"actualGain"),A(r,"currentAt"),A(r,"nextAt"),A(r,"buyMax"),oe(r,"buyMax",!0);for(const l of t)(s=l.postConstruct)==null||s.call(l,r);return r})}function mp(e){return gp(e)}function vp(e,t,n=1,r=o.dInf){const i=_e(n),s=_e(r);e.on("preUpdate",l=>{const u=a(i);o.neq(u,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(u,l).times(o.ceil(a(t.actualGain)))).min(a(s)).max(t.gainResource.value))})}const hp={postConstruct(e){e.amount===void 0&&console.error(`Decorated feature ${e.id} does not contain the required 'amount' property"`),A(e,"bonusAmount"),e.totalAmount===void 0&&(e.totalAmount=y(()=>{var t;return o.add(a((t=e.amount)!=null?t:0),a(e.bonusAmount))}))}},aa=Symbol("Repeatable");function wi(e,...t){const n=ct(0),r=t.reduce((i,s)=>{var l;return Object.assign(i,(l=s.getPersistentData)==null?void 0:l.call(s))},{});return et(i=>{var b,m,k;const s=e.call(i,i);s.id=Qt("repeatable-"),s.type=aa,s[gt]=ta;for(const C of t)(b=C.preConstruct)==null||b.call(C,s);s.amount=n,s.amount[Kt]=(m=s.initialAmount)!=null?m:0,Object.assign(s,r);const l={requirementMet:y(()=>o.sub(a(s.limit),s.amount.value)),requiresPay:!1,visibility:Se.None,canMaximize:!0},u=ri(s);Bt(s.requirements)?(s.requirements.unshift(u),s.requirements.push(l)):s.requirements=[u,s.requirements,l],s.maxed=y(()=>o.gte(s.amount.value,a(s.limit))),A(s,"classes");const c=s.classes;s.classes=y(()=>{const C=a(c)||{};return s.maxed.value&&(C.bought=!0),C}),s.amountToIncrease=y(()=>o.clampMin(ra(s.requirements),1)),s.canClick=y(()=>Cr(s.requirements));const p=s.onClick;s.onClick=function(C){var I;const $=s;if(!a($.canClick))return;const x=(I=a(s.amountToIncrease))!=null?I:1;ia(s.requirements,x),$.amount.value=o.add($.amount.value,x),p==null||p(C)},A(s,"display");const h=s.display;s.display=j(()=>{var $,x,I;const C=a(h);if(At(C)){const R=fe(C);return d(R,null,null)}if(C!=null){const R=s,L=fe(($=C.title)!=null?$:"","h3"),ce=fe((x=C.description)!=null?x:""),le=fe((I=C.effectDisplay)!=null?I:"");return d("span",null,[C.title==null?null:d("div",null,[d(L,null,null)]),C.description==null?null:d(ce,null,null),C.showAmount===!1?null:d("div",null,[d("br",null,null),d(ne,null,[w("Amount: "),ut(R.amount.value)]),o.isFinite(a(R.limit))?d(ne,null,[w(" / "),ut(a(R.limit))]):void 0]),C.effectDisplay==null?null:d("div",null,[d("br",null,null),w("Currently: "),d(le,null,null)]),R.maxed.value?null:d("div",null,[d("br",null,null),kr(R.requirements,a(s.amountToIncrease))])])}return""}),A(s,"visibility"),oe(s,"visibility",Se.Visible),A(s,"limit"),oe(s,"limit",o.dInf),A(s,"style"),A(s,"mark"),A(s,"small");for(const C of t)(k=C.postConstruct)==null||k.call(C,s);const g=t.reduce((C,$)=>{var x;return Object.assign(C,(x=$.getGatheredProps)==null?void 0:x.call($,s))},{});return s[dt]=function(){const{display:C,visibility:$,style:x,classes:I,onClick:R,canClick:L,small:ce,mark:le,id:ae}=this;return{display:C,visibility:$,style:a(x),classes:I,onClick:R,canClick:L,small:ce,mark:le,id:ae,...g}},s})}const bp=Symbol("Reset");function yp(e){return et(t=>{const n=e.call(t,t);return n.id=Qt("reset-"),n.type=bp,n.reset=function(){var i;const r=s=>{if(s!=null&&typeof s=="object"&&!(s instanceof o)&&!(s instanceof f)){if(Kn in s&&s[Kn]===!0)return;if(Kt in s){const l=s;l.value=l[Kt]}else!(s instanceof o)&&!Ve(s)&&Object.values(s).forEach(l=>r(l))}};a(n.thingsToReset).forEach(r),Qe.emit("reset",n),(i=n.onReset)==null||i.call(n)},A(n,"thingsToReset"),n})}const lr={};Qe.on("removeLayer",e=>{var t;(t=lr[e.id])==null||t.call(lr),lr[e.id]=void 0});function Or(e,t){return A(t,"display"),A(t,"classes"),A(t,"style"),A(t,"direction"),oe(t,"direction",W.Up),A(t,"xoffset"),A(t,"yoffset"),t.pinnable&&(t.pinned=ct(!1,!1)),Xt(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Gi(t.pinned)):e.pinned=t.pinned);const n=e[gt];e[gt]=qe;const r=e[dt].bind(e);e[dt]=function(){const{display:s,classes:l,style:u,direction:c,xoffset:p,yoffset:h,pinned:g}=this;return{element:{[gt]:n,[dt]:r},display:s,classes:l,style:a(u),direction:c,xoffset:p,yoffset:h,pinned:g}}.bind(t)}),t}var wp=X({props:{display:{type:q(String,Object,Function),required:!0},visibility:{type:q(Number,Boolean),required:!0},style:q(String,Object,Array),classes:q(Object),requirements:{type:Object,required:!0},canPurchase:{type:q(Boolean),required:!0},bought:{type:q(Boolean),required:!0},mark:q(Boolean,String),id:{type:String,required:!0},purchase:{type:Function,required:!0}},components:{Node:tr,MarkNode:er},setup(e){const{display:t,requirements:n,bought:r}=Ae(e),i=_t("");return Pt(()=>{const s=Pe(t);if(s==null){i.value="";return}if(At(s)){i.value=fe(s);return}const l=fe(s.title||"","h3"),u=fe(s.description,"div"),c=fe(s.effectDisplay||"");i.value=fe(j(()=>d("span",null,[s.title!=null?d("div",null,[d(l,null,null)]):null,d(u,null,null),s.effectDisplay!=null?d("div",null,[w("Currently: "),d(c,null,null)]):null,r.value?null:d(ne,null,[d("br",null,null),kr(n.value)])])))}),{component:i,unref:a,Visibility:Se,isVisible:Ze,isHidden:_n}}});const _p=["disabled"];function Np(e,t,n,r,i,s){var c;const l=Ct("MarkNode"),u=Ct("Node");return e.isVisible(e.visibility)?(S(),T("button",{key:0,style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(c=e.unref(e.style))!=null?c:{}]),onClick:t[0]||(t[0]=(...p)=>e.purchase&&e.purchase(...p)),class:Ne({feature:!0,upgrade:!0,can:e.unref(e.canPurchase),locked:!e.unref(e.canPurchase),bought:e.unref(e.bought),...e.unref(e.classes)}),disabled:!e.unref(e.canPurchase)},[e.unref(e.component)?(S(),re(Ke(e.unref(e.component)),{key:0})):B("",!0),d(l,{mark:e.unref(e.mark)},null,8,["mark"]),d(u,{id:e.id},null,8,["id"])],14,_p)):B("",!0)}var Cp=be(wp,[["render",Np],["__scopeId","data-v-9be6bac0"]]);const ii=Symbol("Upgrade");function _i(e,...t){const n=ct(!1,!1),r=t.reduce((i,s)=>{var l;return Object.assign(i,(l=s.getPersistentData)==null?void 0:l.call(s))},{});return et(i=>{var c,p;const s=e.call(i,i);s.id=Qt("upgrade-"),s.type=ii,s[gt]=Cp;for(const h of t)(c=h.preConstruct)==null||c.call(h,s);s.bought=n,Object.assign(s,r),s.canPurchase=y(()=>!n.value&&Cr(s.requirements)),s.purchase=function(){var g;const h=s;!a(h.canPurchase)||(ia(s.requirements),n.value=!0,(g=h.onPurchase)==null||g.call(h))};const l=ri(s);Bt(s.requirements)?s.requirements.unshift(l):s.requirements=[l,s.requirements],A(s,"visibility"),oe(s,"visibility",Se.Visible),A(s,"classes"),A(s,"style"),A(s,"display"),A(s,"mark");for(const h of t)(p=h.postConstruct)==null||p.call(h,s);const u=t.reduce((h,g)=>{var b;return Object.assign(h,(b=g.getGatheredProps)==null?void 0:b.call(g,s))},{});return s[dt]=function(){const{display:h,visibility:g,style:b,classes:m,requirements:k,canPurchase:C,bought:$,mark:x,id:I,purchase:R}=this;return{display:h,visibility:g,style:a(b),classes:m,requirements:k,canPurchase:C,bought:$,mark:x,id:I,purchase:R,...u}},s})}function kp(e,t,n=[]){n=n.length===0?Xn(e,ii):n;const r=Yn(t)?y(t):t;e.on("update",()=>{a(r)&&n.forEach(i=>i.purchase())})}function Sp(e,t,n,r){return function(){e>>>=0,t>>>=0,n>>>=0,r>>>=0;let i=e+t|0;return e=t^t>>>9,t=n+(n<<3)|0,n=n<<21|n>>>11,r=r+1|0,i=i+r|0,n=n+i|0,(i>>>0)/4294967296}}const Mp={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"]},Ni=[[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 qr(e){const t=Ni[Math.floor(e()*Ni.length)];let n="";for(let r=0;r<t.length;r++){const i=Mp[t[r]];n+=i[Math.floor(e()*i.length)]}return st(n)}const Ip={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"]},Ci=[[1,2,1,4,5],[1,4,5],[2,1,4,5],[1,2,3,4,5],[3,4,5]];function xn(e){const t=Ci[Math.floor(e()*Ci.length)];let n="";for(let r=0;r<t.length;r++){const i=Ip[t[r]];n+=i[Math.floor(e()*i.length)]}return st(n)}function Ln(e,t){const[n,r,i]=xp(...e);let s=Math.floor(t()*320);s>n-20&&(s+=40);const[l,u,c]=$p(s,r,i);return`rgb(${l*255}, ${u*255}, ${c*255})`}function xp(e,t,n){const r=Math.max(e,t,n),i=r-Math.min(e,t,n),s=i&&(r==e?(t-n)/i:r==t?2+(n-e)/i:4+(e-t)/i);return[60*(s<0?s+6:s),r&&i/r,r]}function $p(e,t,n){const r=(i,s=(i+e/60)%6)=>n-n*t*Math.max(Math.min(s,4-s,1),0);return[r(5),r(3),r(1)]}const ki=hr();function sa(e,t,n,r){return Kr(e,function(){const i=Sp(0,n>>0,n>>32,1);for(let V=0;V<12;V++)i();const s=qr(i),l=Ln([.56,.74,.73],i),u=Ln([.18,.2,.25],i),c=$n(0,qr(i)),p=ct(0),h=Et.indexOf(t);let g=i();const b=r.reduce((V,z)=>(V[z.type]=z.data,V),{});"increaseDiff"in b&&(g=g/2+.5),"decreaseDiff"in b&&(g=g/2),"relic"in b&&(g=1);const m=g+h+1,k=v.toolNodes.value.sandRelic!=null?te("sandRelic")?2:1:0,C=ct(k),$=y(()=>("increaseRewards"in b?m+1:m)+C.value);let x="relic"in b?h+2:Math.ceil(i()*(h+2));"increaseLength"in b&&x++;const I=[],R=Mt(()=>I),L=y(()=>R.apply(0)),ce=[],le={};function ae({feature:V,canClick:z,modifier:De,cost:rt,previewModifier:Sn,showETA:We,previewCost:Rt}){z=_e(z),We=_e(We);const Ut=vi(V);ce.push({shouldShowPreview:y(()=>a(z)&&Ut.value),modifier:Mt(()=>{const Wt=I.slice();return Wt.splice(Wt.indexOf(De),1,Sn),Wt}),cost:Rt!=null?Rt:rt}),I.push(De);const xt=Er(c,L,()=>Me(rt)),it=Or(V,{display:We==null?xt:()=>a(We)?xt.value:"",direction:W.Down});return{isHovering:Ut,eta:xt,tooltip:it}}const J=[],Ie=G(0);let he=f.variable(Ie).times(0),Ue=0,vt=!0;const K=y(()=>o.add(m,i()-.5).pow_base(2).times(10).times(he.evaluate()));for(let V=0;V<x;V++){const z={upgrades:32,repeatables:V<=1?0:16,conversion:V<=2?0:12,xp:V<=3?0:8,dimensions:V<=4?0:6,prestige:V<=5||V>=x-1?0:4};switch(ur(z,i)){case"upgrades":const P=[];for(let E=0;E<4;E++){const Z=ur({add:1,mult:V===0&&E===0?0:1},i),Te=K.value,Xe=xn(i);let je="",Oe,me;switch(Z){case"add":{const de=o.add(Te,10).pow(i()/4+1);je=`Gain ${xe(de)} ${c.displayName}/s`,he=he.add(de),Oe=at=>Ht(()=>({addend:de,description:Xe,enabled:at==null?we.bought:()=>at()&&we.bought.value})),me=Ht(()=>({addend:de}));break}case"mult":{const de=i()*5+1;je=`Multiply previous ${c.displayName} gain by x${xe(de)}.`;const at=Ue;he=he.add(o.sub(de,1).times(at)),Oe=Je=>Ce(()=>({multiplier:de,description:Xe,enabled:Je==null?we.bought:()=>Je()&&we.bought.value})),me=Ce(()=>({multiplier:de}));break}}Ue=he.evaluate(),Ie.value++;const Ee=vt,we=_i(()=>({requirements:Bn(()=>({resource:In(c),cost:Te,requiresPay:()=>v.toolNodes.value.unobtainiumRelic==null})),display:{title:Xe,description:je},visibility:y(()=>ye.value.length!==x&&a(Ee))}));ae({feature:we,canClick:()=>we.canPurchase.value,modifier:Oe(),cost:Te,previewCost:y(()=>v.toolNodes.value.unobtainiumRelic==null?Te:0),showETA:()=>!we.bought.value,previewModifier:me}),I.push(Oe(()=>Z==="add"?v.toolNodes.value.stoneRelic!=null:te("stoneRelic"))),P.push(we)}J.push(P);break;case"repeatables":const O=[];for(let E=0;E<3;E++){const Z=ur({add:1.5,mult:3},i),Te=Ie.value,Xe=K.value,je=xn(i);let Oe="",me,Ee,we,de;const at=f.variable(y(()=>ue.amount.value)).times(2);switch(Z){case"add":{const He=o.add(Xe,10).times(i()+.5);Oe=`Gain ${xe(He)} ${c.displayName}/s`,de=at.add(1).times(Xe),he=he.add(y(()=>o.sub(Ie.value,Te).times(2).add(1).pow(2).clampMax(100).times(He))),me=y(()=>xe(o.times(He,a(ue.totalAmount)))+"/s"),Ee=Ht(()=>({addend:()=>o.times(He,a(ue.totalAmount)),description:je,enabled:()=>o.gt(a(ue.totalAmount),0)})),we=Ht(()=>({addend:()=>o.add(a(ue.totalAmount),ue.amountToIncrease.value).times(He)}));break}case"mult":{const He=i()*.75+1.25;Oe=`Multiply previous ${c.displayName} gain by x${xe(He)}.`,de=at.add(1).pow_base(He).times(Xe);const lt=Ue;he=he.add(y(()=>o.sub(Ie.value,Te).times(2).add(1).pow(2).clampMax(100).pow_base(He).sub(1).times(lt))),me=y(()=>"x"+xe(o.pow(He,a(ue.totalAmount)))),Ee=Ce(()=>({multiplier:()=>o.pow(He,a(ue.totalAmount)),description:je,enabled:()=>o.gt(a(ue.totalAmount),0)})),we=Ce(()=>({multiplier:()=>o.add(a(ue.totalAmount),ue.amountToIncrease.value).pow_base(He)}));break}}Ue=he.evaluate(),Ie.value++;const Je=vt,ue=wi(()=>({requirements:Bn(()=>({resource:In(c),cost:de,maxBulkAmount:()=>v.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>v.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:je,description:`${Oe}<br/><br/>Amount: ${ut(ue.amount.value)}${o.gt(a(ue.bonusAmount),0)?` [+${ut(a(ue.bonusAmount))}]`:""}`,effectDisplay:a(me),showAmount:!1}),visibility:y(()=>ye.value.length!==x&&a(Je)),limit:100,bonusAmount:()=>o.gt(ue.amount.value,0)?te("dirtRelic")?2:v.toolNodes.value.dirtRelic!=null?1:0:0}),hp);ae({feature:ue,canClick:()=>a(ue.canClick),modifier:Ee,cost:de,previewModifier:we,previewCost:y(()=>v.toolNodes.value.unobtainiumRelic==null?sn(de,ue.amountToIncrease.value):0),showETA:()=>!ue.maxed.value}),O.push(ue)}J.push(O);break;case"conversion":{const E=$n(0,qr(i)),U=Ln([.56,.74,.73],i),Z=K.value,Te=i()/2+.25,Xe=i()/2+.25,je=Ie.value,Oe=Ue;he=he.add(y(()=>o.sub(Ie.value,je).add(1).pow10().times(Oe)));const me=mp(()=>({baseResource:In(c),gainResource:E,formula:Tr=>Tr.div(Z).pow(Te).times(y(()=>v.toolNodes.value.ironRelic!=null?te("ironRelic")?4:2:1)),spend(){c.value=0}}));Ue=he.evaluate(),Ie.value+=2;const Ee=vt,we=xn(i),de=f.variable(E).pow(Xe).add(1),at=Ce(()=>({multiplier:()=>de.evaluate(),description:we,enabled:()=>o.gt(E.value,0)})),Je=Ce(()=>({multiplier:()=>de.evaluate(o.add(E.value,me.actualGain.value))})),ue=yi(()=>({display:{title:we,description:j(()=>d("span",null,[w("Reset "),c.displayName,w(" for")," ",vr(E,o.clampMin(me.actualGain.value,1))," ",E.displayName,d("br",null,null),d("div",null,[w("Next:")," ",vr(c,o.lt(me.actualGain.value,1)?me.currentAt.value:me.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(me.actualGain.value,1),prestigeResource:E,onClick:me.convert,visibility:y(()=>ye.value.length!==x&&a(Ee))})),{isHovering:He}=ae({feature:ue,canClick:()=>a(ue.canClick),modifier:at,cost:Z,previewCost:c,previewModifier:Je}),lt=y(()=>He.value&&ue.canClick.value);J.push([ue]);const Vn=hn(f.variable(E),lt,me.actualGain),tt=hn(de,lt,me.actualGain);le[V*2]=j(()=>d(ne,null,[Ze(ue.visibility)?d("div",{style:"margin: 10px"},[w("You have")," ",d("h2",{style:{color:U,textShadow:`0px 0px 10px ${U}`}},[Vn()])," ",E.displayName,w(","),d("br",null,null),w("providing a "),tt(),w("x multiplier to previous")," ",c.displayName,w(" gain")]):null,Rr(ue)])),vp(this,me,()=>ye.value.length<x&&v.investments.value!=null&&ke(v.investments.value)&&v.investments.value.state.portals.includes(e)?o.div(pt.value,100):0);break}case"xp":{const E=$n(0),U=vt,Z=Ie.value,Te=xn(i),Xe=o.add(m,i()-.5).pow_base(1.25).times(10),je=i()/4+1.125,Oe=i()/2+1.25,me=f.variable(0).pow(je).times(Xe),Ee=zi(me,E,!0,10,o.dInf),we=y(()=>sn(me,Ee.value,!0,10)),de=y(()=>sn(me,o.add(Ee.value,1),!0,10)),at=y(()=>o.pow(Oe,Ee.value)),Je=Ce(()=>({multiplier:at,description:Te,enabled:()=>Ze(lt.visibility)})),ue=Ue;he=he.add(y(()=>o.sub(Ie.value,Z).add(1).times(3).pow(Oe).times(ue))),Ue=he.evaluate(),Ie.value+=2;const He=Ln([.56,.74,.73],i),lt=fp(()=>({direction:W.Right,width:300,height:20,progress:()=>o.sub(E.value,we.value).div(o.sub(de.value,we.value)).toNumber(),visibility:y(()=>ye.value.length!==x&&a(U)),xp:E,display:j(()=>d("span",null,[xe(E.value),w("/"),xe(de.value)])),fillStyle:`background-color: ${He}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",Vn=>{if(ye.value.length<x&&v.activePortals.value.some(tt=>tt.state.id===e)&&Ze(lt.visibility)){let tt=o.times(pt.value,Vn);v.toolNodes.value.goldRelic!=null&&(tt=o.times(te("goldRelic")?.5:.25,ye.value.length).add(1).times(tt)),E.value=o.add(tt,E.value)}}),I.push(Je),J.push([lt]),le[V*2]=j(()=>d(ne,null,[Ze(lt.visibility)?d("div",{style:"margin: 10px"},[w("You have "),d("h3",null,[Te]),w(" Lv. "),ut(Ee.value),w(","),d("br",null,null),w("providing a "),xe(at.value),w("x multiplier to previous")," ",c.displayName,w(" gain"),d("br",null,null)]):null,Rr(lt)]));break}case"dimensions":{const E=xn(i),U=$n(0,E+" energy"),Z=Ln([.56,.74,.73],i),Te=Ie.value,Xe=Ue;he=he.add(y(()=>o.sub(Ie.value,Te).add(1).pow_base(32).add(1).log2().add(1).times(Xe)));const je=y(()=>o.add(U.value,1).log2().add(1)),Oe=Ce(()=>({multiplier:je,description:E,enabled:()=>o.gt(U.value,0)}));I.push(Oe);const me=vt,Ee=[];for(let we=0;we<4;we++){const de=o.add(m,i()-.5).pow_base(2).times(10).recip(),at=K.value,Je=f.variable(y(()=>tt.amount.value)),ue=Je.pow_base(o.pow10(we+1)).times(at),He=["First","Second","Third","Fourth"][we]+" "+E+" Dimension",lt=$n(0,He),Vn=Je.sub(1).pow_base(2).times(de).times(y(()=>o.add(tt.amount.value,lt.value))),tt=wi(()=>({display:{title:He,description:j(()=>d("div",null,[d("div",null,[w("Amount:")," ",xe(o.add(lt.value,tt.amount.value))," ",w("["),ut(tt.amount.value),w("]")])])),effectDisplay:j(()=>d("span",null,[la()," ",we===0?U.displayName:["First","Second","Third","Fourth"][we-1]+" "+E+" Dimension",w("/s")])),showAmount:!1},style:{width:"400px"},effect:Vn,dimensions:lt,limit:100,energy:we===0?U:void 0,requirements:Bn(()=>({resource:In(c),cost:ue,maxBulkAmount:()=>te("diamondRelic")!=null?o.dInf:1,requiresPay:()=>!te("unobtainiumRelic")})),visibility:y(()=>ye.value.length!==x&&a(me))}));Ee.push(tt);const Tr=vi(tt),oi=y(()=>a(tt.canClick)&&Tr.value),oa=new f({inputs:[Je],evaluate(li){return o.sub(li,1).pow_base(2).times(de).times(o.add(li,lt.value))}}),la=hn(oa,oi);ce.push({shouldShowPreview:oi,cost:y(()=>te("unobtainiumRelic")?0:sn(ue,tt.amountToIncrease.value))});const ua=Er(c,L,()=>Me(ue));Or(tt,{display:ua,direction:W.Down}),Ue=he.evaluate(),Ie.value++}this.on("preUpdate",we=>{if(ye.value.length<x&&v.activePortals.value.some(de=>de.state.id===e)&&Ze(me)){let de=o.times(pt.value,we);v.toolNodes.value.platinumRelic!=null&&(de=o.times(te("platinumRelic")?4:2,de));const at=Ee[0].effect.evaluate();U.value=o.times(at,de).add(U.value);for(let Je=1;Je<4;Je++){const ue=Ee[Je].effect.evaluate();Ee[Je-1].dimensions.value=o.times(ue,de).add(Ee[Je-1].dimensions.value)}}}),J.push(Ee),le[V*2]=j(()=>d(ne,null,[Ze(ye.value.length!==x&&a(me))?d("div",{style:"margin: 10px"},[w("You have")," ",d("h2",{style:{color:Z,textShadow:`0px 0px 10px ${Z}`}},[xe(U.value)])," ",U.displayName,w(","),d("br",null,null),w("providing a "),xe(je.value),w("x multiplier to previous")," ",c.displayName,w(" gain")]):null,Ks(...Ee)]));break}case"prestige":{const E=xn(i),U=vt,Z=i()/10+1.1,Te=K.value;he=he.pow(Z);const Xe=kd(()=>({exponent:Z,description:E,enabled:me.bought}));Ue=he.evaluate(),Ie.value+=20;const je=J.filter((we,de)=>de%2===0),Oe=yp(()=>({thingsToReset:je,onReset(){c.value=0}})),me=_i(()=>({display:{title:E,description:`Reset all previous ${s} content to raise all previous ${c.displayName} gain to the ^${xe(Z)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{te("unobtainiumRelic")||Oe.reset()},visibility:y(()=>ye.value.length!==x&&a(U)),requirements:Bn(()=>({resource:In(c),cost:Te,requiresPay:!1}))})),Ee=Ce(()=>({multiplier:0}));ae({feature:me,canClick:()=>a(me.canPurchase),modifier:Xe,cost:Te,previewCost:y(()=>te("unobtainiumRelic")?0:c.value),previewModifier:Ee,showETA:()=>!a(me.bought)}),J.push([me]);break}}const rt={cache:"increaseCaches"in b?8:.8,generation:"increaseGens"in b?10:1,resourceMulti:"increaseResourceMults"in b?10:1,energyMulti:"increaseEnergyMults"in b?2.5:.25,influences:"increaseInfluences"in b?20:2,relic:0};let Sn=ur(rt,i);V===x-1&&"relic"in b&&(Sn="relic");let We="",Rt,Ut,xt,it,Wt,nn;switch(Sn){case"cache":it=Vr(i,r),We=`Cache: Gain ${xe(o.div($.value,12))}x your current ${it} (no modifiers).`,Ut=()=>{var E,U,Z;return v.grantResource(it,o.times((Z=(U=(E=v.resourceNodes.value[it])==null?void 0:E.state)==null?void 0:U.amount)!=null?Z:0,o.div($.value,12)))};break;case"generation":it=Vr(i,r);const P=o.pow($.value,2).div(40).times(Tt[it]);We=`Gen: Gain ${xe(P)} ${it}/s while plane is active.`,Rt=E=>v.grantResource(it,o.times(E,P)),xt=it;break;case"resourceMulti":Wt=it=Vr(i,r),nn=o.pow($.value,2).div(10).pow_base(1.5),We=`Resource Mult: Gain ${xe(nn)}x ${it} while plane is active.`;break;case"energyMulti":Wt="energy",nn=o.div($.value,8).add(1),We=`Energy Mult: Gain ${xe(nn)}x energy while plane is active.`;break;case"influences":const O=Object.keys(yt)[Math.floor(i()*Object.keys(yt).length)];We=`Influence: Gain a portal influence (${yt[O].display})`,Ut=()=>{if(O in v.influenceNodes.value){ki.warning(`You already have a ${yt[O].display} influence, skipping treasure`);return}const E={id:An(v.board),position:{...v.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"influence",state:{type:O,data:yt[O].initialData}};v.board.placeInAvailableSpace(E),v.board.nodes.value.push(E)};break;case"relic":We=t==="ultimatum"?"Win the game!":`Relic: Gain the ${t}-tier planar relic (${Ft[t]})`,Ut=()=>{if(t==="ultimatum"){ai.value=!0;return}if(`${t}Relic`in v.toolNodes.value)ki.warning(`You already have a ${Ft[t]} relic, skipping treasure`);else{const E={id:An(v.board),position:{...v.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"passive",state:`${t}Relic`};v.board.placeInAvailableSpace(E),v.board.nodes.value.push(E)}}}const Dr=vt,Mn=K.value,fn=op(()=>({requirements:Bn(()=>({resource:In(c),cost:Mn})),visibility:y(()=>a(Dr)),display:{requirement:`${xe(Mn)} ${c.displayName}`,effectDisplay:We},style:"width: 100%",classes:{final:V===x-1},update:Rt,onComplete:Ut,link:xt,effectedResource:Wt,resourceMulti:nn})),D=Er(c,L,Mn);Or(fn,{display:()=>fn.earned.value?"":D.value,direction:W.Down}),J.push([fn]),vt=fn.earned,le[V*2+1]=j(()=>mt(fn))}const $e=Xn(J,ii),nt=Xn(J,aa);I.push(Ce(()=>({multiplier:()=>te("silver")?4:2,description:()=>(te("silver")?"Empowered ":"")+ze.silver.name,enabled:()=>v.toolNodes.value.silver!=null})),Ce(()=>({multiplier:()=>o.add(1,(te("diamond")?2:1)*$e.filter(V=>V.bought.value).length/10),description:()=>(te("diamond")?"Empowered ":"")+ze.diamond.name,enabled:()=>v.toolNodes.value.diamond!=null})),Ce(()=>({multiplier:()=>o.div(p.value,6e3).times(te("emerald")?2:1).add(1),description:()=>(te("emerald")?"Empowered ":"")+ze.emerald.name,enabled:()=>v.toolNodes.value.emerald!=null})),Ce(()=>({multiplier:()=>o.div(nt.reduce((V,z)=>V.add(a(z.totalAmount)),o.dZero),100).times(te("gravelRelic")?2:1).add(1).pow(.75),description:()=>(te("gravelRelic")?"Empowered ":"")+Ft.gravel,enabled:()=>v.toolNodes.value.gravelRelic!=null})),Ce(()=>({multiplier:()=>o.add(v.energy.value,1).log10().add(1).pow(te("beryliumRelic")?.5:.25),description:()=>(te("beryliumRelic")?"Empowered ":"")+Ft.berylium,enabled:()=>v.toolNodes.value.beryliumRelic!=null})));const ht=Mt(()=>[Ce(()=>({multiplier:()=>{var V,z,De;return o.add((De=(z=(V=v.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:z.level)!=null?De:0,1)},description:"Booster",enabled:()=>{var V,z,De;return(De=(z=(V=v.board.types.booster.nodes.value[0])==null?void 0:V.state)==null?void 0:z.portals.includes(e))!=null?De:!1}})),Ce(()=>({multiplier:()=>o.times(te("coalRelic")?.2:.1,ye.value.length).add(1),description:()=>(te("coalRelic")?"Empowered ":"")+Ft.coal,enabled:()=>v.toolNodes.value.coalRelic!=null}))]),pt=y(()=>ht.apply(1)),[St,Mr]=Un(()=>[{title:`${st(c.displayName)} Gain`,modifier:R,base:0,unit:"/s"},{title:`${st(c.displayName)} Time Speed`,modifier:ht,base:1,visible:()=>o.gt(pt.value,1)}]),kn=G(!1),rr=j(()=>d(Lt,{modelValue:kn.value,"onUpdate:modelValue":V=>kn.value=V},{header:()=>d("h2",null,[w("Modifiers")]),body:()=>ot(St)}));this.on("preUpdate",V=>{if(!v.activePortals.value.some(De=>De.state.id===e))return;const z=o.times(pt.value,V);p.value=o.add(p.value,z),ye.value.length<x&&(c.value=o.times(L.value,z).add(c.value)),ye.value.forEach(De=>{var rt;(rt=De.update)==null||rt.call(De,z)})}),kp(this,()=>ye.value.length<x&&v.upgrader.value!=null&&ke(v.upgrader.value)&&v.upgrader.value.state.portals.includes(e),$e),Fd(this,()=>ye.value.length<x&&v.automator.value!=null&&ke(v.automator.value)&&v.automator.value.state.portals.includes(e),nt);const Fn=y(()=>{const V=ce.find(z=>z.shouldShowPreview.value);return V?o.neg(Me(V.cost)):0}),On=y(()=>{const V=ce.find(z=>z.shouldShowPreview.value);return V&&V.modifier?o.sub(V.modifier.apply(0),L.value):0}),tn=hn(f.variable(0).add(c),()=>o.neq(Fn.value,0),Fn),qn=hn(f.variable(0).add(L),()=>o.neq(On.value,0),On),ir=y(()=>{const V=[];return ye.value.forEach(z=>{z.link&&V.push(z.link)}),V}),ar=y(()=>{const V={};return ye.value.forEach(z=>{z.effectedResource!=null&&z.resourceMulti!=null&&(V[z.effectedResource]!=null?V[z.effectedResource]=o.times(V[z.effectedResource],z.resourceMulti):V[z.effectedResource]=z.resourceMulti)}),V}),ye=y(()=>{const V=[];for(let z=1;z<J.length;z+=2){const De=J[z][0];De.earned.value&&V.push(De)}return V}),Ir=y(()=>o.lt(ye.value.length,x)&&J.some(V=>V.some(z=>"earned"in z&&a(z.earned)||"bought"in z&&a(z.bought)?!1:("canClick"in z&&a(z.canClick)||"canPurchase"in z&&a(z.canPurchase),!0)))),xr=y(()=>{const V=J.findIndex((De,rt)=>rt>0&&rt%2===0&&!J[rt-1][0].earned.value);let z;return V===-1?z=J:z=J.slice(0,V),z.map((De,rt)=>rt in le?ot(le[rt]):Rr(...De))}),$r=yi(()=>({display:{description:"Select Portal Node"},onClick(){v.board.selectedNode.value=v.portalNodes.value[e]},style:"min-height: 30px; width: 200px; margin-bottom: 20px"}));return{tier:ct(t),seed:ct(n),influences:ct(r),name:s,color:l,resource:c,background:u,style:{background:u,"--background":u},classes:{plane:!0},features:J,resourceTabCollapsed:Mr,links:ir,resourceMultis:ar,earnedTreasures:ye,showNotif:Ir,timeActive:p,bonusRewardsLevel:C,display:j(()=>d(ne,null,[d(mr,{class:"nav-container",style:"z-index: 5"},{default:()=>[d("span",{class:"nav-segment"},[d("h2",null,[s])]),d("span",{class:"nav-segment"},[d("h3",null,[t,w("-tier")])]),r.length===0?null:d("span",{class:"nav-segment"},[d(qe,{display:r.map(V=>{const z=yt[V.type].description;return typeof z=="function"?z(V):z}).join("<br/>"),direction:W.Down,style:"width: 300px"},{default:()=>[d("h3",null,[r.length,w(" influence"),r.length===1?"":"s"])]})]),d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>kn.value=!0},[w("modifiers")])])]}),ye.value.length===x?null:d(mr,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[ot(tn)])," ",c.displayName]),d("span",{class:"nav-segment"},[w("("),d("h3",{style:`color: ${l}; text-shadow: 0px 0px 10px ${l};`},[o.gt(L.value,0)?"+":"",ot(qn)]),w("/s)")]),o.neq(pt.value,1)?d("span",{class:"nav-segment"},[w("Speed: "),xe(pt.value),w("x")]):null]}),d(ep,{height:ye.value.length===x?"30px":"60px"},null),ot($r),ye.value.length===x?d("div",null,[d("h1",{style:"color: var(--layer-color)"},[w("Plane Complete!")])]):null,xr.value,ye.value.length+1<x?d("div",null,[w("+"),ut(x-ye.value.length-1),w(" remaining treasures")]):null,ot(rr)])),minimizedDisplay:j(()=>d("div",null,[d("span",null,[s]),d("span",{style:"font-size: large; vertical-align: sub;"},[" ",t,w("-tier |")," ",ye.value.length===x?d("span",null,[w("Plane Complete")]):d("span",null,[ye.value.length,w("/"),x,w(" treasures")])])]))}})}function Vr(e,t){t=t.filter(u=>u.type==="increaseResources"||u.type==="decreaseResources");const n=Object.keys(Tt).reduce((u,c)=>{let p=Tt[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?p*=1e3:p/=1e3}),u+p},0),r=Object.keys(Tt),i=Math.floor(e()*n);let s=0,l;for(let u=0;u<r.length;u++){const c=r[u];if(s+=Tt[c],i<s){l=c;break}}return l}function ur(e,t){const n=Object.values(e).reduce((u,c)=>u+c),r=Object.keys(e);let i=0,s=null;const l=t()*n;for(let u=0;u<r.length;u++){const c=r[u];if(i+=e[c],l<i){s=c;break}}if(s==null)throw new Error("Failed to pick random. This should not happen");return s}const Dp={shape:Ge.Diamond,size:50,title:"\u26CF\uFE0F",label:e=>e===v.board.selectedNode.value?{text:"Mining"}:Object.keys(v.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[jt,zt("mine")],progress:e=>ke(e)?new o(e.state.progress).toNumber():0,progressDisplay:un.Outline,progressColor:"var(--accent2)",classes:e=>({running:ke(e)}),draggable:!0},Tp={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===v.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(v.energy.value,100)&&(e.type="factory",v.energy.value=o.sub(v.energy.value,100),v.helpModals.factory.showModal.value=!0)},confirmationLabel:()=>o.gte(v.energy.value,100)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},Pp={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===v.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${ze[e.state].name}`};if(((t=v.board.draggingNode.value)==null?void 0:t.type)==="resource"){const r=((n=v.board.draggingNode.value)==null?void 0:n.state).type,i=e.state===r?"Disconnect":v.toolNodes.value[r]==null?ze[r].name:"Already crafted",s=e.state===r||v.toolNodes.value[r]==null?"var(--accent2)":"var(--danger)";return{text:i,color:s}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(e){e.state=void 0,v.board.selectedAction.value=null,v.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${ze[e.state].name} - ${Ye(ze[e.state].cost)} energy`}),onClick(e){const t=ze[e.state];if(o.gte(v.energy.value,t.cost)&&v.toolNodes.value[e.state]==null){v.energy.value=o.sub(v.energy.value,t.cost);const n={id:An(v.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};if(v.board.placeInAvailableSpace(n),v.board.nodes.value.push(n),e.state==="iron"){const r={id:An(v.board),position:{...e.position},type:"trashCan"};v.board.placeInAvailableSpace(r),v.board.nodes.value.push(r)}v.board.selectedAction.value=null,v.board.selectedNode.value=null,e.state=void 0,t.type in v.helpModals&&(v.helpModals[t.type].showModal.value=!0)}},fillColor:e=>o.gte(v.energy.value,ze[e.state].cost)&&v.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(v.energy.value,ze[e.state].cost)?v.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}},zt("factory")],progress:e=>e.state==null||v.toolNodes.value[e.state]!=null?0:o.div(o.sqrt(v.energy.value),o.sqrt(ze[e.state].cost)).clampMax(1).toNumber(),progressDisplay:un.Fill,progressColor:e=>e.state!=null&&o.gte(v.energy.value,ze[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){var r;if(t.type!=="resource")return!1;const n=((r=v.board.draggingNode.value)==null?void 0:r.state).type;return v.toolNodes.value[n]==null},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,v.board.selectedNode.value=e},draggable:!0},Ap=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],Rp={shape:Ge.Circle,size:50,title:e=>st(e.state.type),subtitle:e=>Ye(e.state.amount),otherSubtitle:e=>Ap[Et.indexOf(e.state.type)],progress:e=>xd(e.state.type),onClick(){},progressDisplay:un.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":v.dowsing.value!=null&&ke(v.dowsing.value)&&v.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=v.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0,showStar:e=>v.toolNodes.value[e.state.type]!=null,fillStar:e=>`${e.state.type}Relic`in v.toolNodes.value},Ep={shape:Ge.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?Ft[t.slice(0,-5)]:ze[t].name},label:e=>e===v.board.selectedNode.value?{text:Ld[e.state].description(te(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":te(e.state)}),draggable:!0},Fp={shape:Ge.Diamond,size:50,title:"\u{1F962}",label:e=>e===v.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,v.computedBonusConnectionsModifier.value)})`}:Ki(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(2).pow_base(100),16),jt,zt("dowsing")],classes:e=>({running:ke(e)}),canAccept:Qi,onDrop:ea,draggable:!0},Op={shape:Ge.Diamond,size:50,title:"\u26F0\uFE0F",label:e=>e===v.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,v.computedBonusConnectionsModifier.value)})`}:Ki(e,t=>`Gather ${Nt(o.div(v.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(2).pow_base(1e4),16),jt,zt("quarry")],progress:e=>ke(e)?o.eq(v.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(v.quarryProgressRequired.value).toNumber():0,progressDisplay:un.Outline,progressColor:"var(--accent2)",canAccept:Qi,onDrop:ea,classes:e=>({running:ke(e)}),draggable:!0},qp={shape:Ge.Diamond,size:50,title:"\u{1F50C}",label:e=>e===v.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,v.computedBonusConnectionsModifier.value)})`}:Sd(e,t=>t.includes("Relic")?`Double ${Ft[t.slice(0,-5)]}'s effect`:`Double ${ze[t].name}'s effect`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(3).pow_base(1e3),24),jt,zt("empowerer")],canAccept:Md,onDrop:Id,classes:e=>({running:ke(e)}),draggable:!0},Vp={shape:Ge.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===v.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=v.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${st(n)}-tier Portal`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="influence"){const n=t.state.type;if(e.state.influences.includes(n))return{text:"Disconnect",color:"var(--accent2)"};const i=yt[n].cost;let s;return o.lt(i,1e3)?s=Ye(i):s=Ur(i,0),{text:`Add influence (${s}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${ge[t.state.id].name}`};return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(e){e.state={...e.state,tier:void 0,influences:[]},v.board.selectedAction.value=null,v.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 - ${Ye(v.computedPortalCost.value)} energy`}),fillColor:()=>o.gte(v.energy.value,v.computedPortalCost.value)?"var(--accent2)":"var(--danger)",confirmationLabel:()=>o.gte(v.energy.value,v.computedPortalCost.value)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(e){if(o.lt(v.energy.value,v.computedPortalCost.value))return;let t=0;for(;`portal-${t}`in ge;)t++;v.energy.value=o.sub(v.energy.value,v.computedPortalCost.value);const{tier:n,influences:r}=e.state;Qr(sa(`portal-${t}`,n,Math.floor(Math.random()*4294967296),r.map(s=>v.influenceNodes.value[s].state)),Y);const i={id:An(v.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};v.board.placeInAvailableSpace(i),v.board.nodes.value.push(i),v.board.selectedAction.value=null,v.board.selectedNode.value=null,e.state={tier:void 0,influences:[]}},visibility:e=>e.state.tier!=null},zt("portalGenerator")],canAccept(e,t){return t.type==="resource"||t.type==="influence"||t.type==="portal"},onDrop(e,t){if(t.type==="resource"){const n=t.state.type,r=e.state.tier;e.state={...e.state,tier:n===r?void 0:n}}else if(t.type==="influence"){const n=t.state.type,r=e.state.influences;r.includes(n)?e.state={...e.state,influences:r.filter(i=>i!==n)}:e.state={...e.state,influences:[...r,n]}}else if(t.type==="portal"){const n=ge[t.state.id];e.state={...e.state,tier:n.tier.value,influences:n.influences.value.map(r=>r.type)}}v.board.selectedNode.value=e},progress:e=>e.state.tier==null?0:o.div(o.sqrt(v.energy.value),o.sqrt(v.computedPortalCost.value)).clampMax(1).toNumber(),progressDisplay:un.Fill,progressColor:e=>e.state.tier!=null&&o.gte(v.energy.value,v.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},Bp={shape:Ge.Diamond,size:50,title:"\u{1F300}",label:e=>e===v.board.selectedNode.value?{text:`Portal to ${ge[e.state.id].name}`,color:ge[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[jt],classes:e=>({running:ke(e),showNotif:ge[e.state.id].showNotif.value,"affected-node":v.booster.value!=null&&ke(v.booster.value)&&v.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>ge[e.state.id].background,draggable:!0,onClick(e){v.board.selectedNode.value=e,ge[e.state.id].minimized.value=!1}},Lp={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?Ge.Diamond:Ge.Circle,size:50,title:e=>yt[e.state.type].display,otherSubtitle:e=>{const t=yt[e.state.type].cost;return o.lt(t,1e3)?`${Ye(t)}x cost`:`${Ur(t,0)}x cost`},label:e=>{if(e===v.board.selectedNode.value){const n=e.state,r=yt[n.type].description;return{text:typeof r=="function"?r(n):r}}const t=v.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type,{type:r,data:i}=e.state;let s;if(Array.isArray(i)&&i.includes(n))s="Disconnect";else if(r==="increaseResources")s=`Increase ${st(n)} odds`;else if(r==="decreaseResources")s=`Decrease ${st(n)} odds`;else return null;return{text:s,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[pn],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,r=e.state.data;r!=null&&(r.includes(n)?e.state={...e.state,data:r.filter(i=>i!==n)}:e.state={...e.state,data:[...r,n]},v.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},jp={shape:Ge.Diamond,size:50,title:"\u231B",label:e=>e===v.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${Ye(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,v.computedBonusConnectionsModifier.value)})`}:wr(e,t=>`Boost ${ge[t].name}'s speed`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${Ye(or.evaluate(e.state.level))} energy`}},fillColor(e){return o.gte(v.energy.value,or.evaluate(e.state.level))?"var(--bought)":"var(--locked)"},confirmationLabel(e){return o.gte(v.energy.value,or.evaluate(e.state.level))?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}},onClick(e){const t=or.evaluate(e.state.level);o.gte(v.energy.value,t)&&(v.energy.value=o.sub(v.energy.value,t),e.state={...e.state,level:o.add(e.state.level,1)},v.board.selectedAction.value=null)}},jt,zt("booster")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},zp={shape:Ge.Diamond,size:50,title:"\u{1F916}",label:e=>e===v.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,v.computedBonusConnectionsModifier.value)})`}:wr(e,t=>`Auto-buy ${ge[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(4).pow_base(1e6)),jt,zt("upgrader")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},Gp={shape:Ge.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===v.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,v.computedBonusConnectionsModifier.value)})`}:wr(e,t=>`Auto-buy ${ge[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(4).pow_base(1e6)),jt,zt("automator")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},Up={shape:Ge.Diamond,size:50,title:"\u{1F4B1}",label:e=>e===v.board.selectedNode.value?{text:e.state.portals.length===0?"Investments - Drag a portal to me!":`Investing (${e.state.portals.length}/${o.add(e.state.maxConnections,v.computedBonusConnectionsModifier.value)})`}:wr(e,t=>`Passively generate ${ge[t].name}'s conversions`),actionDistance:Math.PI/4,actions:[pn,Cn(e=>e.add(3).pow_base(1e8)),jt,zt("investments")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},Wp={shape:Ge.Diamond,size:50,title:"\u{1F5D1}\uFE0F",label:e=>{var t;if(e===v.board.selectedNode.value)return{text:"Trash Can - Drag a portal to me!"};if(((t=v.board.draggingNode.value)==null?void 0:t.type)==="portal"){const n=v.board.draggingNode.value.state.id;return{text:`Delete ${ge[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;ei(ge[n]),delete Y.layers[n],v.board.state.value.nodes=v.board.state.value.nodes.filter(r=>r!==t),v.booster.value&&(v.booster.value.state={...v.booster.value.state,portals:v.booster.value.state.portals.filter(r=>r!==n)}),v.upgrader.value&&(v.upgrader.value.state={...v.upgrader.value.state,portals:v.upgrader.value.state.portals.filter(r=>r!==n)}),v.automator.value&&(v.automator.value.state={...v.automator.value.state,portals:v.automator.value.state.portals.filter(r=>r!==n)}),v.investments.value&&(v.investments.value.state={...v.investments.value.state,portals:v.investments.value.state.portals.filter(r=>r!==n)}),Y.tabs=Y.tabs.filter(r=>r!==n)},draggable:!0},Si=hr(),Hp={mine:Dp,brokenFactory:Tp,factory:Pp,resource:Rp,passive:Ep,dowsing:Fp,quarry:Op,empowerer:qp,portalGenerator:Vp,portal:Bp,influence:Lp,booster:jp,upgrader:zp,automator:Gp,investments:Up,trashCan:Wp},v=Kr("main",function(){const e=$n(0,"energy"),t=y(()=>m.types.resource.nodes.value.reduce((D,P)=>(D[P.state.type]=P,D),{})),n=y(()=>({...m.types.passive.nodes.value.reduce((D,P)=>(D[P.state]=P,D),{}),sand:m.types.dowsing.nodes.value[0],wood:m.types.quarry.nodes.value[0],coal:m.types.empowerer.nodes.value[0],iron:m.types.portalGenerator.nodes.value[0],gold:m.types.booster.nodes.value[0],platinum:m.types.upgrader.nodes.value[0],berylium:m.types.automator.nodes.value[0],ultimatum:m.types.investments.nodes.value[0]})),r=y(()=>Object.keys(Ft).filter(D=>`${D}Relic`in n.value).length),i=y(()=>({...m.types.influence.nodes.value.reduce((D,P)=>(D[P.state.type]=P,D),{})})),s=y(()=>({...m.types.portal.nodes.value.reduce((D,P)=>(D[P.state.id]=P,D),{})})),l=y(()=>Et.reduce((D,P)=>{var E,U,Z;const O=(Z=(U=(E=t.value[P])==null?void 0:E.state)==null?void 0:U.amount)!=null?Z:0;return D[P]=o.floor(Br.invert(O)),D},{})),u=ln({}),c=ln({});Xt(()=>{Et.forEach(D=>{wt(()=>l.value[D],(P,O)=>{const E=o.sub(P,O);(o.eq(P,1)||o.gt(E,1))&&o.gt(E,o.div(O,100))&&ie.active===Y.id&&Si.info(d("div",null,[d("h3",null,[o.eq(P,1)?`${st(D)} discovered`:`${st(D)} is now Level ${ut(P)}`,w("!")]),o.gt(E,1)?d("div",null,[w("Gained "),ut(E),w(" levels")]):null]))})})});const p=y(()=>J.filter(D=>{var P,O;return(O=(P=D.value)==null?void 0:P.state)==null?void 0:O.powered}).length+m.types.portal.nodes.value.filter(D=>D.state.powered).length),h=y(()=>{let D=p.value;return n.value.copperRelic!=null&&(D--,te("copperRelic")&&D--),D}),g=y(()=>{const D=h.value;return o.lt(D,0)?0:o.eq(D,0)?10:o.add(D,1).pow_base(100).div(10).times(.99)}),b=y(()=>{if(x.value==null)return 0;let P=x.value.state.resources.reduce((O,E)=>o.div(100,tn[E].computedModifier.value).add(O),o.dZero);return n.value.silverRelic!=null&&(P=o.div(P,o.add(p.value,1)),te("silverRelic")&&(P=o.div(P,o.add(p.value,1)))),P}),m=md(D=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:Hp,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const P=[];if(P.push(...Object.keys(u).filter(bi(k.value)).map(O=>({startNode:k.value,endNode:t.value[O],stroke:"var(--accent3)",strokeWidth:5}))),C.value!=null&&C.value.state!=null&&P.push({startNode:C.value,endNode:t.value[C.value.state],stroke:"var(--foreground)",strokeWidth:4}),$.value!=null&&$.value.state.resources.forEach(O=>{P.push({startNode:$.value,endNode:t.value[O],stroke:ke($.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),x.value!=null&&x.value.state.resources.forEach(O=>{P.push({startNode:x.value,endNode:t.value[O],stroke:O in c?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),I.value!=null&&I.value.state.tools.forEach(O=>{P.push({startNode:I.value,endNode:n.value[O],stroke:ke(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),R.value!=null){const O=R.value.state;O.tier!=null&&P.push({startNode:R.value,endNode:t.value[O.tier],stroke:"var(--foreground)",strokeWidth:4}),O.influences.forEach(E=>{P.push({startNode:R.value,endNode:i.value[E],stroke:"var(--foreground)",strokeWidth:4})}),D.types.portal.nodes.value.forEach(E=>{const U=ge[E.state.id];return Et.filter(bi(E)).forEach(Z=>{let Te;if(U.links.value.includes(Z))Te="var(--accent3)";else if(Z in U.resourceMultis.value)Te="var(--accent1)";else return;P.push({startNode:E,endNode:t.value[Z],stroke:ke(E)?Te:"var(--foreground)",strokeWidth:4})}),P})}return L.value!=null&&L.value.state.portals.filter(O=>s.value[O]!=null).forEach(O=>{P.push({startNode:L.value,endNode:s.value[O],stroke:ke(L.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),ce.value!=null&&ce.value.state.portals.filter(O=>s.value[O]!=null).forEach(O=>{P.push({startNode:ce.value,endNode:s.value[O],stroke:"var(--foreground)",strokeWidth:4})}),le.value!=null&&le.value.state.portals.filter(O=>s.value[O]!=null).forEach(O=>{P.push({startNode:le.value,endNode:s.value[O],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(O=>s.value[O]!=null).forEach(O=>{P.push({startNode:ae.value,endNode:s.value[O],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(i.value).forEach(O=>{const E=O.state;(E.type==="increaseResources"||E.type==="decreaseResources")&&E.data.forEach(U=>{P.push({startNode:O,endNode:t.value[U],stroke:"var(--foreground)",strokeWidth:4})})}),P}})),k=y(()=>m.types.mine.nodes.value[0]),C=y(()=>m.types.factory.nodes.value[0]),$=y(()=>n.value.sand),x=y(()=>n.value.wood),I=y(()=>n.value.coal),R=y(()=>n.value.iron),L=y(()=>n.value.gold),ce=y(()=>n.value.platinum),le=y(()=>n.value.berylium),ae=y(()=>n.value.ultimatum),J=[k,$,x,I,L,ce,le,ae];function Ie(D,P){let O=t.value[D];if(P=o.times(P,qn[D].computedModifier.value),O==null)O={id:An(m),position:{...k.value.position},type:"resource",state:{type:D,amount:P}},m.placeInAvailableSpace(O),m.nodes.value.push(O);else{const E=O.state;O.state={...E,amount:o.add(E.amount,P)}}}const he=y(()=>Object.keys(Tt).reduce((D,P)=>D+new o(tn[P].computedModifier.value).toNumber(),0)),Ue=y(()=>{const D={};return m.types.portal.nodes.value.forEach(P=>{if(!ke(P))return;const E=ge[P.state.id].resourceMultis.value;Object.keys(E).forEach(U=>{D[U]!=null?D[U]=o.times(D[U],E[U]):D[U]=E[U]})}),D}),vt=Mt(()=>Et.map(D=>Ht(()=>({description:()=>st(D),addend:()=>l.value[D],enabled:()=>o.gt(l.value[D],0)})))),K=y(()=>vt.apply(0)),$e=Mt(()=>[Ht(()=>({addend:K,description:"Resource Levels"})),Ce(()=>({multiplier:()=>o.pow(On.value,K.value),description:()=>`${Zt(On.value,3)}x per Resource Level`})),Ce(()=>({multiplier:()=>te("stone")?4:2,description:()=>(te("stone")?"Empowered ":"")+ze.stone.name,enabled:()=>n.value.stone!=null})),Ce(()=>({multiplier:()=>{var D;return(D=Ue.value.energy)!=null?D:1},description:"Planar Treasures",enabled:()=>{var D;return o.neq((D=Ue.value.energy)!=null?D:1,1)}})),Ht(()=>({addend:()=>o.pow(100,h.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(h.value,0)}))]),nt=y(()=>$e.apply(0)),ht=Mt(()=>[Ht(()=>({addend:()=>te("unobtainium")?2:1,description:()=>(te("unobtainium")?"Empowered ":"")+ze.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),pt=y(()=>ht.apply(0)),St=Mt(()=>[Ce(()=>({multiplier:()=>te("dirt")?4:2,description:()=>(te("dirt")?"Empowered ":"")+ze.dirt.name,enabled:()=>n.value.dirt!=null})),Ce(()=>({multiplier:()=>o.pow(r.value,te("woodRelic")?2:1),description:()=>(te("woodRelic")?"Empowered ":"")+Ft.wood,enabled:()=>n.value.woodRelic!=null}))]),Mr=y(()=>St.apply(1)),kn=Mt(()=>[Ce(()=>({multiplier:()=>te("gravel")?4:2,description:()=>(te("gravel")?"Empowered ":"")+ze.gravel.name,enabled:()=>n.value.gravel!=null}))]),rr=y(()=>kn.apply(1)),Fn=Mt(()=>[Ht(()=>({addend:()=>te("copper")?.004:.002,description:()=>(te("copper")?"Empowered ":"")+ze.copper.name,enabled:()=>n.value.copper!=null}))]),On=y(()=>Fn.apply(1.01)),tn=Object.keys(Tt).reduce((D,P)=>{const O=Mt(()=>[Ce(()=>({multiplier:2,description:"Dowsing",enabled:()=>$.value!=null&&ke($.value)&&$.value.state.resources.includes(P)}))]),E=y(()=>O.apply(Tt[P])),U={title:`${st(P)} Drop Rate`,modifier:O,base:Tt[P]};return D[P]={modifier:O,computedModifier:E,section:U},D},{}),qn=Object.keys(Tt).reduce((D,P)=>{const O=Mt(()=>[Ce(()=>({multiplier:()=>{var Z;return(Z=Ue.value[P])!=null?Z:1},description:"Planar Treasures",enabled:()=>{var Z;return o.neq((Z=Ue.value[P])!=null?Z:1,1)}}))]),E=y(()=>O.apply(1)),U={title:`${st(P)} Gain`,modifier:O};return D[P]={modifier:O,computedModifier:E,section:U},D},{}),ir=y(()=>{var P,O,E;const D=Et.indexOf((E=(O=(P=R.value)==null?void 0:P.state)==null?void 0:O.tier)!=null?E:"dirt");return o.add(D,1).times(D).div(2).add(9).pow10()}),ar=Mt(()=>[...Object.keys(yt).map(D=>Ce(()=>({multiplier:yt[D].cost,description:yt[D].display,enabled:()=>{var P,O,E;return(E=(O=(P=R.value)==null?void 0:P.state)==null?void 0:O.influences.includes(D))!=null?E:!1},smallerIsBetter:!0}))),Ce(()=>({multiplier:()=>te("emeraldRelic")?.05:.1,description:()=>(te("emeraldRelic")?"Empowered ":"")+Ft.emerald,enabled:()=>n.value.emeraldRelic!=null,smallerIsBetter:!0}))]),ye=y(()=>ar.apply(ir.value)),[Ir,xr]=Un(()=>[{title:"Resource Levels",modifier:vt,base:0},{title:"Energy Gain",modifier:$e,base:0,unit:"/s"},{title:"Portal Cost",modifier:ar,base:ir,unit:" energy",baseText:()=>{var D,P,O;return`${st((O=(P=(D=R.value)==null?void 0:D.state)==null?void 0:P.tier)!=null?O:"dirt")}-tier Base Cost`},visible:()=>R.value!=null,smallerIsBetter:!0},{title:"Bonus Connections",modifier:ht,base:0,visible:()=>o.gt(pt.value,0)}]),[$r,V]=Un(()=>[{title:"Mining Speed",modifier:St,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:kn,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:Fn,base:1.01,visible:()=>n.value.copper!=null}]),[z,De]=Un(()=>Object.values(tn).map(D=>D.section)),[rt,Sn]=Un(()=>Object.values(qn).map(D=>D.section)),We=Ji({general:()=>({display:"General",glowColor(){return We.activeTab.value===this.tab?"white":""},tab:Ir,energyTabCollapsed:xr}),mining:()=>({display:"Mine",glowColor(){return We.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(n.value).filter(D=>D!=null).length>0,tab:$r,miningTabCollapsed:V}),resources:()=>({display:"Ore Rates",glowColor(){return We.activeTab.value===this.tab?"white":""},visibility:()=>$.value!=null,tab:z,resourcesCollapsed:De}),resourcesGain:()=>({display:"Ore Gain",glowColor(){return We.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(qn).some(D=>o.neq(D.computedModifier.value,1)),tab:rt,resourceGainCollapsed:Sn})}),Rt=G(!1),Ut=j(()=>d(Lt,{modelValue:Rt.value,"onUpdate:modelValue":D=>Rt.value=D},{header:()=>d("h2",null,[w("Modifiers")]),body:()=>ot(We)})),xt={mine:Gd(),factory:Ud(),dowsing:Wd(),quarry:Hd(),empowerer:Yd(),portalGenerator:Zd(),booster:Xd(),upgrader:Jd(),automator:Kd(),investments:Qd()};xt.mine.showModal[Kt]=!0,xt.mine.showModal.value=!0,this.on("preUpdate",D=>{if(Object.keys(u).forEach(P=>{u[P]-=D,u[P]<=0&&delete u[P]}),Object.keys(c).forEach(P=>{c[P]-=D,c[P]<=0&&delete c[P]}),ke(k.value)){const P=o.add(k.value.state.progress,o.times(Mr.value,D)),O=P.floor();k.value.state={...k.value.state,progress:o.sub(P,O)};const E=O.div(he.value).floor();E.gt(0)&&Et.forEach(Z=>{Ie(Z,o.times(new o(tn[Z].computedModifier.value).toNumber(),E).times(rr.value)),u[Z]=.3});const U=o.sub(O,E).toNumber();for(let Z=0;Z<U;Z++){const Te=Math.floor(Math.random()*he.value);let Xe=0;for(let je=0;je<Et.length;je++){const Oe=Et[je];if(Xe+=new o(tn[Oe].computedModifier.value).toNumber(),Te<Xe){Ie(Oe,rr.value),u[Oe]=.3;break}}}}if(x.value!=null&&ke(x.value)){const{progress:P,resources:O}=x.value.state;if(O.length>0){let E=o.add(P,D);const U=o.div(P,b.value).floor();E=o.sub(E,o.times(U,b.value)),x.value.state={...x.value.state,progress:E},o.gt(U,0)&&O.forEach(Z=>{Ie(Z,U),c[Z]=.3})}}e.value=o.add(e.value,o.times(nt.value,D)),o.lt(e.value,0)&&(e.value=0,J.map(P=>P.value).filter(P=>P!=null).forEach(P=>{(P==null?void 0:P.state).powered=!1}),Object.values(s.value).forEach(P=>{P.state.powered=!1}),k.value.state={...k.value.state,powered:!1},Si.warning(d("div",null,[d("h3",null,[w("Ran out of energy!")]),d("div",null,[w("All machines have been turned off.")])])))});const it=y(()=>{var D,P;return m.selectedAction.value===m.types.brokenFactory.actions[0]?-100:m.selectedAction.value===m.types.factory.actions[1]?o.neg(ze[m.selectedNode.value.state].cost):((D=m.selectedAction.value)==null?void 0:D.id)==="moreConnections"?o.neg(m.selectedAction.value.formula.evaluate(((P=m.selectedNode.value)==null?void 0:P.state).maxConnections)):0}),Wt=hn(f.variable(0).add(e),()=>o.neq(it.value,0),it),nn=y(()=>{var D;return m.selectedAction.value===jt?((D=m.selectedNode.value)==null?void 0:D.state).powered?o.eq(p.value,1)?10:o.pow(100,p.value).div(10).times(.99):o.neg(g.value):0}),Dr=hn(f.variable(0).add(nt),()=>o.neq(nn.value,0),nn),Mn=y(()=>m.types.portal.nodes.value.filter(D=>ke(D))),fn=y(()=>Mn.value.sort((D,P)=>{var U,Z;const O=(U=ge[D.state.id])!=null&&U.minimized.value?1:0,E=(Z=ge[P.state.id])!=null&&Z.minimized.value?1:0;return O-E}).map(D=>D.state.id));return wt(fn,D=>{Xt(()=>{Y.tabs=["main",...D]})}),wt(pt,(D,P)=>{o.lt(D,P)&&(vn(D,$,"resources"),vn(D,x,"resources"),vn(D,I,"tools"),vn(D,L,"portals"),vn(D,ce,"portals"),vn(D,le,"portals"),vn(D,ae,"portals"))}),{name:"World",board:m,energy:e,modifierTabs:We,resourceNodes:t,toolNodes:n,influenceNodes:i,portalNodes:s,grantResource:Ie,activePortals:Mn,nextPowerCost:g,computedBonusConnectionsModifier:pt,quarryProgressRequired:b,dropRates:tn,dowsing:$,empowerer:I,booster:L,upgrader:ce,automator:le,investments:ae,resourceLevels:l,planarMultis:Ue,computedPortalCost:ye,helpModals:xt,display:j(()=>d(ne,null,[d(mr,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h2",{style:"color: white; text-shadow: 0px 0px 10px white;"},[ot(Wt)])," ",w("energy")]),d("span",{class:"nav-segment"},[w("("),d("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(nt.value,0)?"+":"",ot(Dr)]),w("/s)")]),o.gt(p.value,0)?d("span",{class:"nav-segment"},[d("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[ut(p.value)])," ",o.eq(p.value,1)?"machine":"machines"," ",w("powered")]):null,d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>Rt.value=!0},[w("modifiers")])]),Y.devSpeed===0?d("span",{class:"nav-segment"},[w("Game Paused")]):Y.devSpeed!=null&&Y.devSpeed!==1?d("span",{class:"nav-segment"},[w("Dev Speed: "),xe(Y.devSpeed),w("x")]):null]}),ot(m),ot(Ut),Object.values(xt).map(({modal:D})=>D())]))}});Qe.on("loadSettings",e=>{oe(e,"lineVisibility",!0)});Oi(j(()=>d($t,{title:j(()=>d("span",{class:"option-title"},[w("Always show lines to resource nodes"),d("desc",null,[w("Otherwise, will only be visible when either end of the line is selected.")])])),modelValue:ie.lineVisibility,"onUpdate:modelValue":e=>ie.lineVisibility=e},null)));const Yp=e=>{var n,r,i,s,l;const t=[v];return(l=(s=(i=(r=(n=e.layers)==null?void 0:n.main)==null?void 0:r.board)==null?void 0:i.state)==null?void 0:s.nodes)==null||l.filter(u=>(u==null?void 0:u.type)==="portal").map(u=>{var c,p;return(p=(c=u==null?void 0:u.state)==null?void 0:c.id)!=null?p:""}).forEach(u=>{var p,h,g,b;const c=(p=e.layers)==null?void 0:p[u];t.push(sa(u,(h=c.tier)!=null?h:"dirt",(g=c.seed)!=null?g:Math.floor(Math.random()*4294967296),(b=c.influences)!=null?b:[]))}),t},ai=G(!1);function Zp(e,t){}var Xp=Object.freeze(Object.defineProperty({__proto__:null,main:v,getInitialLayers:Yp,hasWon:ai,fixOldSave:Zp},Symbol.toStringTag,{value:"Module"}));const nr=e=>(cn("data-v-4a50ce42"),e=e(),dn(),e),Jp={class:"game-over-modal-header"},Kp=["src","alt"],Qp={class:"game-over-modal-title"},ef=nr(()=>N("h2",null,"Congratulations!",-1)),tf={key:0},nf=nr(()=>N("br",null,null,-1)),rf=nr(()=>N("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),af=nr(()=>N("br",null,null,-1)),sf=["href"],of=nr(()=>N("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),lf=X({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:s,versionTitle:l}=ve,u=y(()=>yr(Y.timePlayed)),c=y(()=>ai.value&&!Y.keepGoing),p=Jt(Y,"autosave");function h(){Y.keepGoing=!0}function g(){bn(Tn())}return(b,m)=>(S(),re(Lt,{"model-value":a(c)},{header:H(()=>[N("div",Jp,[a(n)?(S(),T("img",{key:0,class:"game-over-modal-logo",src:a(n),alt:a(t)},null,8,Kp)):B("",!0),N("div",Qp,[ef,N("h4",null,"You've beaten "+ee(a(t))+" v"+ee(a(s))+": "+ee(a(l)),1)])])]),body:H(({shown:k})=>[k?(S(),T("div",tf,[N("div",null,"It took you "+ee(a(u))+" to beat the game.",1),nf,rf,af,N("div",null,[N("a",{href:a(i),class:"game-over-modal-discord-link"},[of,w(" "+ee(a(r)),1)],8,sf)]),d($t,{title:"Autosave",modelValue:a(p),"onUpdate:modelValue":m[0]||(m[0]=C=>Ve(p)?p.value=C:null)},null,8,["modelValue"])])):B("",!0)]),footer:H(()=>[N("div",{class:"game-over-footer"},[N("button",{onClick:h,class:"button"},"Keep Going"),N("button",{onClick:g,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var uf=be(lf,[["__scopeId","data-v-4a50ce42"]]);const Sr=e=>(cn("data-v-2776d67d"),e=e(),dn(),e),cf=Sr(()=>N("div",{class:"nan-modal-header"},[N("h2",null,"NaN value detected!")],-1)),df={key:0},pf=Sr(()=>N("br",null,null,-1)),ff=["href"],gf=Sr(()=>N("span",{class:"material-icons nan-modal-discord"},"discord",-1)),mf=Sr(()=>N("br",null,null,-1)),vf={class:"nan-footer"},hf=X({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=ve,r=G(!0),i=G(!0),s=Jt(Fe,"hasNaN"),l=G(null);wt(s,b=>{b?(r.value=Y.autosave,i.value=Y.devSpeed===0):(Y.autosave=r.value,Y.devSpeed=i.value?0:null)});const u=y(()=>{var b;return(b=Fe.NaNPath)==null?void 0:b.join(".")}),c=y(()=>Fe.NaNPersistent!=null?Fe.NaNPersistent.value:null);function p(){Fe.NaNPersistent!=null&&(Fe.NaNPersistent.value=new o(0),Fe.hasNaN=!1)}function h(){Fe.NaNPersistent&&(Fe.NaNPersistent.value=new o(1),Fe.hasNaN=!1)}function g(){Fe.NaNPersistent&&(Fe.NaNPersistent.value=new o(NaN),Fe.hasNaN=!1)}return(b,m)=>(S(),T(ne,null,[d(Lt,Vt({modelValue:a(s),"onUpdate:modelValue":m[4]||(m[4]=k=>Ve(s)?s.value=k:null)},b.$attrs),{header:H(()=>[cf]),body:H(()=>[N("div",null,[w(' Attempted to assign "'+ee(a(u))+'" to NaN',1),a(c)?(S(),T("span",df,ee(" ")+"(previously "+ee(a(xe)(a(c)))+")",1)):B("",!0),w(". Auto-saving has been "+ee(r.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),pf,N("div",null,[N("a",{href:a(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[gf,w(" "+ee(a(t)||"The Paper Pilot Community"),1)],8,ff)]),mf,d($t,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=k=>r.value=k)},null,8,["modelValue"]),a(ve).enablePausing?(S(),re($t,{key:0,title:"Pause game",modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=k=>i.value=k)},null,8,["modelValue"])):B("",!0)]),footer:H(()=>[N("div",vf,[N("button",{onClick:m[2]||(m[2]=k=>{var C;return(C=l.value)==null?void 0:C.open()}),class:"button"},"Open Saves Manager"),N("button",{onClick:p,class:"button"},"Set to 0"),N("button",{onClick:h,class:"button"},"Set to 1"),a(c)&&a(o).neq(a(c),0)&&a(o).neq(a(c),1)?(S(),T("button",{key:0,onClick:m[3]||(m[3]=k=>s.value=!1),class:"button"}," Set to previous ")):B("",!0),N("button",{onClick:g,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),d(Hi,{ref_key:"savesManager",ref:l},null,512)],64))}});var bf=be(hf,[["__scopeId","data-v-2776d67d"]]);const yf={key:0,class:"tpsDisplay"},wf=X({__name:"TPS",setup(e){const t=y(()=>o.div(Fe.lastTenTicks.length,Fe.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>a(t).isNan()?B("",!0):(S(),T("div",yf,"TPS: "+ee(a(ut)(a(t))),1))}});var _f=be(wf,[["__scopeId","data-v-89b89152"]]);var Nf=X({__name:"App",setup(e){const t=ve.useHeader,n=y(()=>It[ie.theme].variables),r=Jt(ie,"showTPS"),i=Jt(Fe,"errors"),s=y(()=>fe(j(()=>d(ne,null,[Hs.map(ot)]))));return(l,u)=>a(i).length>0?(S(),T("div",{key:0,class:"error-container",style:Le(a(n))},[d(xi,{errors:a(i)},null,8,["errors"])],4)):(S(),T(ne,{key:1},[N("div",{id:"modal-root",style:Le(a(n))},null,4),N("div",{class:Ne(["app",{useHeader:a(t)}]),style:Le(a(n))},[a(t)?(S(),re(Yi,{key:0})):B("",!0),d(Ec),a(a(r))?(S(),re(_f,{key:1})):B("",!0),d(uf),d(bf),(S(),re(Ke(a(s))))],6)],64))}});var Cf=be(Nf,[["__scopeId","data-v-bf4e22ac"]]);function kf(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:s,onRegisterError:l}=e;let u,c,p,h;const g=async(m=!0)=>{await p,m&&(u==null||u.addEventListener("controlling",k=>{k.isUpdate&&window.location.reload()})),await(h==null?void 0:h())};async function b(){if("serviceWorker"in navigator){const{Workbox:m,messageSW:k}=await Hn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await k(c.waiting,{type:"SKIP_WAITING"})},u=new m("./sw.js",{scope:"./",type:"classic"}),u.addEventListener("activated",C=>{C.isUpdate||r==null||r()});{const C=()=>{n==null||n()};u.addEventListener("waiting",C),u.addEventListener("externalwaiting",C)}u.register({immediate:t}).then(C=>{c=C,s?s("./sw.js",C):i==null||i(C)}).catch(C=>{l==null||l(C)})}}return p=b(),g}function Sf(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:s,onRegisterError:l}=e,u=G(!1),c=G(!1);return{updateServiceWorker:kf({immediate:t,onNeedRefresh(){u.value=!0,n==null||n()},onOfflineReady(){c.value=!0,r==null||r()},onRegistered:i,onRegisteredSW:s,onRegisterError:l}),offlineReady:c,needRefresh:u}}const si=console.error;console.error=function(...e){si(...e)};window.onerror=function(e,t,n,r,i){return Fe.errors.push(i instanceof Error?i:new Error(JSON.stringify(i))),si(i),!0};window.onunhandledrejection=function(e){Fe.errors.push(e.reason instanceof Error?e.reason:new Error(JSON.stringify(e.reason))),si(e.reason)};document.title=ve.title;window.projInfo=ve;ve.id===""&&console.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 js();const{globalBus:e}=await Hn(()=>Promise.resolve().then(function(){return Ls}),void 0),{startGameLoop:t}=await Hn(()=>import("./gameLoop.659c1ba3.js"),["assets/gameLoop.659c1ba3.js","assets/@fontsource.f66d05e7.css","assets/vue.c16a309b.js","assets/amator.1e5a40c8.js","assets/bezier-easing.a990b400.js","assets/@vue.6b211d3c.js","assets/lz-string.dccec454.js","assets/nanoevents.1080beb7.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=ya(Cf);n.config.errorHandler=function(r,i,s){console.error(r,s,i)},e.emit("setupVue",n),n.mount("#app"),Xt(()=>{const r=hr(),{updateServiceWorker:i}=Sf({onNeedRefresh(){r.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(){i()}})},onOfflineReady(){r.info("App ready to work offline")},onRegisterError:console.warn,onRegistered(s){s&&setInterval(()=>s.update(),60*60*1e3)}})}),t()});export{o as D,Hn as _,Fe as a,ve as b,Xp as c,Qe as g,zs as l,Y as p,ie as s};
|