diff --git a/assets/gameLoop.48d12127.js b/assets/gameLoop.a8abe3ac.js similarity index 92% rename from assets/gameLoop.48d12127.js rename to assets/gameLoop.a8abe3ac.js index 5b55777..0188875 100644 --- a/assets/gameLoop.48d12127.js +++ b/assets/gameLoop.a8abe3ac.js @@ -1 +1 @@ -import{_ as d,s as p,p as e,a as o,l as T,D as l,b as m,g as u}from"./index.a00e3eeb.js";import"./vue.c16a309b.js";import{b2 as c}from"./@vue.6b211d3c.js";/* empty css */import"./lz-string.dccec454.js";import"./nanoevents.1080beb7.js";import"./vue-next-select.ded54c4a.js";import"./vuedraggable.1879de79.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-panzoom.8ce6f9b1.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";import"./vue-toastification.9c2dad53.js";let n=null,f=null;function a(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const r=i;if(o.lastTenTicks.push(r),o.lastTenTicks.length>10&&(o.lastTenTicks=o.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!o.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,m.offlineLimit*3600)&&(e.offlineTime=m.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,m.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,r),p.unthrottled?(requestAnimationFrame(a),n!=null&&(clearInterval(n),n=null)):n==null&&(n=setInterval(a,50)))}}async function A(){f=(await d(()=>import("./index.a00e3eeb.js").then(function(t){return t.c}),["assets/index.a00e3eeb.js","assets/index.8a0a226e.css","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"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(a):n=setInterval(a,50)}export{A as startGameLoop}; +import{_ as d,s as p,p as e,a as o,l as T,D as l,b as m,g as u}from"./index.3f4ba557.js";import"./vue.c16a309b.js";import{b2 as c}from"./@vue.6b211d3c.js";/* empty css */import"./lz-string.dccec454.js";import"./nanoevents.1080beb7.js";import"./vue-next-select.ded54c4a.js";import"./vuedraggable.1879de79.js";import"./amator.1e5a40c8.js";import"./bezier-easing.a990b400.js";import"./sortablejs.a0f68e5e.js";import"./vue-textarea-autosize.35804eaf.js";import"./vue-panzoom.8ce6f9b1.js";import"./panzoom.30c56ba6.js";import"./wheel.f2ae740f.js";import"./ngraph.events.083734c6.js";import"./vue-toastification.9c2dad53.js";let n=null,f=null;function a(){const t=Date.now();let i=(t-e.time)/1e3;e.time=t;const r=i;if(o.lastTenTicks.push(r),o.lastTenTicks.length>10&&(o.lastTenTicks=o.lastTenTicks.slice(1)),!((f==null?void 0:f.value)&&!e.keepGoing)&&!o.hasNaN&&(i=Math.max(i,0),e.devSpeed!==0)){if(T.value=!1,e.offlineTime!=null){if(l.gt(e.offlineTime,m.offlineLimit*3600)&&(e.offlineTime=m.offlineLimit*3600),l.gt(e.offlineTime,0)&&e.devSpeed!==0){const s=Math.max(e.offlineTime/10,i);e.offlineTime=e.offlineTime-s,i+=s}else e.devSpeed===0&&(e.offlineTime+=i);(!e.offlineProd||l.lt(e.offlineTime,0))&&(e.offlineTime=null)}i=Math.min(i,m.maxTickLength),e.devSpeed!=null&&(i*=e.devSpeed),Number.isFinite(i)||(i=1e308),!l.eq(i,0)&&(e.timePlayed+=i,Number.isFinite(e.timePlayed)||(e.timePlayed=1e308),u.emit("update",i,r),p.unthrottled?(requestAnimationFrame(a),n!=null&&(clearInterval(n),n=null)):n==null&&(n=setInterval(a,50)))}}async function A(){f=(await d(()=>import("./index.3f4ba557.js").then(function(t){return t.c}),["assets/index.3f4ba557.js","assets/index.8a0a226e.css","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"])).hasWon,c(f,t=>{t&&u.emit("gameWon")}),p.unthrottled?requestAnimationFrame(a):n=setInterval(a,50)}export{A as startGameLoop}; diff --git a/assets/index.3f4ba557.js b/assets/index.3f4ba557.js new file mode 100644 index 0000000..e48078b --- /dev/null +++ b/assets/index.3f4ba557.js @@ -0,0 +1,21 @@ +/* empty css */import"./vue.c16a309b.js";import{q as ln,C as s,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 w,az as Qn,a2 as N,J as ee,O as ne,aK as Dt,a0 as B,I as Le,a8 as y,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 ua,aH as sr,A as Ae,$ as re,b9 as jr,ar as Vt,bt as ca,bc as Wn,T as da,j as pa,bw as Bt,ay as fa,aM as Ct,aO as Ke,z as Jt,bo as ga,bs as ma,bd as ui,am as dr,H as va,bx as ha,bf as ba}from"./@vue.6b211d3c.js";import{L as Yt}from"./lz-string.dccec454.js";import{c as Ii}from"./nanoevents.1080beb7.js";import{Y as ya}from"./vue-next-select.ded54c4a.js";import{D as wa}from"./vuedraggable.1879de79.js";import{p as _a}from"./vue-textarea-autosize.35804eaf.js";import{P as Na}from"./vue-panzoom.8ce6f9b1.js";import{s as Ca,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 ka=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 a of i)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerpolicy&&(a.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?a.credentials="include":i.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}};ka();const Sa="modulepreload",ci={},Ma="./",Hn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${Ma}${r}`,r in ci)return;ci[r]=!0;const i=r.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${a}`))return;const u=document.createElement("link");if(u.rel=i?"stylesheet":Sa,i||(u.as="script",u.crossOrigin=""),u.href=r,document.head.appendChild(u),i)return new Promise((l,c)=>{u.addEventListener("load",l),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())},Ia="./projInfo-schema.json",xa="Planar Pioneers",$a="A game about controlling and exploiting planes!",Da="planar-pioneers",Ta="thepaperpilot",Pa="",Aa="",Ra="0.0",Ea="Initial Commit",Fa=!1,Oa=!1,qa=2,Va=!0,Ba=null,La="",ja=["main"],za=3600,Ga=0,Ua=!0,Wa="base64";var ve={$schema:Ia,title:xa,description:$a,id:Da,author:Ta,discordName:Pa,discordLink:Aa,versionNumber:Ra,versionTitle:Ea,allowGoBack:Fa,defaultShowSmall:Oa,defaultDecimalsShown:qa,useHeader:Va,banner:Ba,logo:La,initialTabs:ja,maxTickLength:za,offlineLimit:Ga,enablePausing:Ua,exportEncoding:Wa};const Ha=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=Ha;function zr(e){return JSON.stringify(e,(t,n)=>s(n))}var be=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const Ya=["onClick"],Za=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(a,u)=>(S(),T("button",{onClick:Pn(i,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[qt(a.$slots,"default",{},void 0,!0)],10,Ya))}});var Gr=be(Za,[["__scopeId","data-v-01a1b95c"]]);const br=e=>(cn("data-v-ac351c02"),e=e(),dn(),e),Xa={class:"error"},Ja={class:"error-title"},Ka={class:"error-details",style:{"margin-top":"-10px"}},Qa={key:0},es={class:"instructions"},ts=["href"],ns=br(()=>N("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),rs=br(()=>N("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),is=br(()=>N("br",null,null,-1)),as={key:0,style:{"margin-top":"20px"}},ss=br(()=>N("h3",null,"Other errors",-1)),os=[ss],ls={class:"error-details"},us={key:0,style:{"margin-top":"10px"}},cs={key:1,style:{"margin-top":"10px"}},ds=X({__name:"Error",props:{errors:null},setup(e){const t=e,n=w(()=>t.errors[0]),r=w(()=>t.errors.map(u=>u.stack==null?[]:u.stack.split(` +`))),i=w(()=>t.errors.map(u=>u.cause==null?[]:(typeof u.cause=="string"?u.cause:JSON.stringify(u.cause)).split(` +`)));function a(){let u=zr(Y);switch(ve.exportEncoding){default:console.warn(`Unknown save encoding: ${ve.exportEncoding}. Defaulting to lz`);case"lz":u=Yt.compressToUTF16(u);break;case"base64":u=btoa(unescape(encodeURIComponent(u)));break;case"plain":break}console.log(u);const l=document.createElement("textarea");l.value=u,document.body.appendChild(l),l.select(),l.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(l)}return Qn(()=>{Y.autosave=!1,Y.devSpeed=0}),(u,l)=>(S(),T("div",Xa,[N("h1",Ja,ee(s(n).name)+": "+ee(s(n).message),1),N("div",Ka,[s(n).cause?(S(),T("div",Qa,[(S(!0),T(ne,null,Dt(s(i)[0],c=>(S(),T("div",{key:c},ee(c),1))),128))])):B("",!0),s(n).stack?(S(),T("div",{key:1,style:Le(s(n).cause?"margin-top: 10px":"")},[(S(!0),T(ne,null,Dt(s(r)[0],c=>(S(),T("div",{key:c},ee(c),1))),128))],4)):B("",!0)]),N("div",es,[y(" Check the console for more details, and consider sharing it with the developers on "),N("a",{href:s(ve).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,ts),y("! "),d(Gr,{onClick:a,class:"button",style:{display:"inline-flex"}},{default:H(()=>[ns,rs]),_:1}),is,e.errors.length>1?(S(),T("div",as,os)):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",ls,[N("summary",null,ee(c.name)+": "+ee(c.message),1),c.cause?(S(),T("div",us,[(S(!0),T(ne,null,Dt(s(i)[p+1],h=>(S(),T("div",{key:h},ee(h),1))),128))])):B("",!0),c.stack?(S(),T("div",cs,[(S(!0),T(ne,null,Dt(s(r)[p+1],h=>(S(),T("div",{key:h},ee(h),1))),128))])):B("",!0)])]))),128))])]))}});var xi=be(ds,[["__scopeId","data-v-ac351c02"]]);class ps{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 fs(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 fs{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Pr=17,gs=9e15,ms=Math.log10(9e15),vs=1/9e15,hs=308,bs=-324,di=5,ys=(1<<10)-1,ws=function(){const e=[];for(let n=bs+1;n<=hs;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],_s=[[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]],Ns=[[-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))),a=Math.round(t*Math.pow(10,r-i))*Math.pow(10,i-r);return parseFloat(a.toFixed(Math.max(r-i,0)))},Ar=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},Cs=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).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 a=t.add(r.mul(n)).sub(n.div(2)),u=a.pow(2);return a.neg().add(u.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,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=gs)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=_.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 a=e.split("^");if(a.length===2){const k=parseFloat(a[0]),C=parseFloat(a[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 u,l,c=e.split("pt");if(c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(u)&&isFinite(l)){const C=_.tetrate(u,l,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){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(u)&&isFinite(l)){const C=_.tetrate(u,l,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=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 v=parseFloat(p[p.length-1]);if(h>=2){const k=parseFloat(p[p.length-2]);isFinite(k)&&(v*=Math.sign(k),v+=Ar(k))}if(!isFinite(b))this.sign=p[0]==="-"?-1:1,this.layer=h,this.mag=v;else if(h===1)this.sign=Math.sign(b),this.layer=1,this.mag=v+Math.log10(Math.abs(b));else if(this.sign=Math.sign(b),this.layer=h,h===2){const k=_.mul(Q(1,2,v),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=v;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),a=r.layer*Math.sign(r.mag);if(i-a>=2)return n;if(i===0&&a===-1){if(Math.abs(r.mag-Math.log10(n.mag))>Pr)return n;{const u=Math.pow(10,Math.log10(n.mag)-r.mag),l=r.sign+n.sign*u;return Q(Math.sign(l),1,r.mag+Math.log10(Math.abs(l)))}}if(i===1&&a===0){if(Math.abs(n.mag-Math.log10(r.mag))>Pr)return n;{const u=Math.pow(10,n.mag-Math.log10(r.mag)),l=r.sign+n.sign*u;return Q(Math.sign(l),1,Math.log10(r.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-r.mag)>Pr)return n;{const u=Math.pow(10,n.mag-r.mag),l=r.sign+n.sign*u;return Q(Math.sign(l),1,r.mag+Math.log10(Math.abs(l)))}}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.sign0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=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.layer0?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(Cs(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,a=1/i,u=t+a;if(u===t||(t=u,r=r*n,i=360*r,a=1/i,u=t-a,u===t))return _.exp(t);t=u,r=r*n,i=1260*r;let l=1/i;return t=t+l,r=r*n,i=1680*r,l=1/i,t=t-l,_.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 a=_.ln(this).neg();return a.lambertw().div(a)}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;i3)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 a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a1e4)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,a=this.slog_internal(e).toNumber();for(let u=1;u1&&i!=c&&(r=!0),i=c,r?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return _.fromNumber(a)}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,Ns)}static tetrate_critical(e,t){return _.critical_section(e,t,_s)}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 u=0;ue){const l=(e-gn[u])/(gn[u+1]-gn[u]);r=n[u][Math.floor(t)]*(1-l)+n[u+1][Math.floor(t)]*l,i=n[u][Math.ceil(t)]*(1-l)+n[u+1][Math.ceil(t)]*l;break}const a=t-Math.floor(t);return r<=0||i<=0?r*(1-a)+i*a:Math.pow(e,Math.log(r)/Math.log(e)*(1-a)+Math.log(i)/Math.log(e)*a)}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;i10)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 ps(ys);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 ks=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=ks,r=r.add(1));const a=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"+a:"e"+a}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 Ss=new o("eeee1000"),Ms=new o("e100000"),gi=new o("e1000"),Ti=new o(1e9),Is=new o(1e6),xs=new o(1e3),$s=new o(.98),Ds=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(Ss)){const r=e.slog();return r.gte(Is)?"F"+Nt(r.floor()):o.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+pr(r.floor(),0)}else{if(e.gte(Ms))return jn(e,0,!1);if(e.gte(gi))return jn(e,0);if(e.gte(Ti))return jn(e,t);if(e.gte(xs))return pr(e,0);if(e.gte(Ds)||!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($s)&&!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 Ts(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 Ps(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 As=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:jn,commaFormat:pr,regularFormat:Di,format:Nt,formatWhole:Ye,formatTime:Ai,toPlaces:Ts,formatSmall:Ps,invertOOM:Ri},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Ur,commaFormat:Rs,regularFormat:Es,format:xe,formatWhole:ut,formatTime:yr,toPlaces:Fs,formatSmall:Zt,invertOOM:Os}=As;window.Decimal=o;window.exponentialFormat=Ur;window.commaFormat=Rs;window.regularFormat=Es;window.format=xe;window.formatWhole=ut;window.formatTime=yr;window.toPlaces=Fs;window.formatSmall=Zt;window.invertOOM=Os;function st(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}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]=w(n.bind(e)):Yn(n)&&(e[t]=n.bind(e),e[t][Zn]=!0)}function _e(e){return Yn(e)&&!e[Zn]&&(e=w(e)),e}const gt=Symbol("Component"),dt=Symbol("GatherProps");let qs=0;function Qt(e="feature-"){return e+qs++}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=s(e);return t!==2&&t!==!1}function _n(e){return s(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(a=>{const u=i[a];u!=null&&typeof u=="object"&&(t.includes(u.type)?n.push(u):!(u instanceof o)&&!Ve(u)&&r(u))})};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 Vs=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 Bs(){zs();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 Ls=G(!1);async function bn(e){console.info("Loading save",e),Ls.value=!0;const{layers:t,removeLayer:n,addLayer:r}=await Hn(()=>Promise.resolve().then(function(){return ql}),void 0),{fixOldSave:i,getInitialLayers:a}=await Hn(()=>Promise.resolve().then(function(){return Yp}),void 0);for(const u in t){const l=t[u];l&&n(l)}a(e).forEach(u=>r(u,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 js=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),js()};function zs(){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 Gs=ln([]),Us=ln([]),Ws={class:"table"},Hs=X({__name:"Column",setup(e){const t=w(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),T("div",Ws,[N("div",{class:Ne(["col",{mergeAdjacent:s(t)}])},[qt(n.$slots,"default")],2)]))}}),Ys={class:"table"},Zs=X({__name:"Row",setup(e){const t=w(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),T("div",Ys,[N("div",{class:Ne(["row",{mergeAdjacent:s(t)}])},[qt(n.$slots,"default")],2)]))}});function qi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!ua(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}`),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(Zs,null,qi(t=e.map(ot))?t:{default:()=>[t]})}function Xs(...e){let t;return d(Hs,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(l){n.value||(n.value=setInterval(u,250)),r.value=l}function a(){n.value&&(clearInterval(n.value),n.value=null)}function u(){t&&t.value?t.value():e&&e.value&&e.value(r.value)}return Mi(a),{start:i,stop:a,handleHolding:u}}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 s(s(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}const Js=X({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=G({}),r=new ResizeObserver(l),i=G(null);Qn(()=>{const g=i.value;g!=null&&r.observe(g)});let a=!0,u=G((h=i.value)==null?void 0:h.getBoundingClientRect());function l(){a&&(a=!1,Xt(()=>{var g;u.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),a=!0}))}Qe.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};sr(Yr,(g,b)=>{const v=new MutationObserver(()=>p(g));v.observe(b,c),n.value[g]={element:b,observer:v,rect:b.getBoundingClientRect()},l()}),sr(Zr,g=>{var b;(b=n.value[g])==null||b.observer.disconnect(),n.value[g]=void 0,l()}),sr(Xr,n),sr(Jr,u);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 Bi=be(Js,[["__scopeId","data-v-2b1dc1bc"]]);const Ks=["onPointerdown"],Qs={class:"modal-wrapper"},eo={class:"modal-container"},to={class:"modal-header"},no={class:"modal-body"},ro={class:"modal-footer"},io=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),a=w(()=>s(i.modelValue)||l.value);function u(){n("update:modelValue",!1)}const l=G(!1),c=G(null),p=w(()=>{var h,g;return(g=(h=c.value)==null?void 0:h.nodes)!=null?g:null});return t({isOpen:a,nodes:p}),(h,g)=>(S(),re(da,{to:"#modal-root"},[d(Wn,{name:"modal",onBeforeEnter:g[0]||(g[0]=b=>l.value=!0),onAfterLeave:g[1]||(g[1]=b=>l.value=!1)},{default:H(()=>[jr(N("div",Vt({class:"modal-mask",onPointerdown:Pn(u,["self"])},h.$attrs),[N("div",Qs,[N("div",eo,[N("div",to,[qt(h.$slots,"header",{shown:s(a)},()=>[y(" default header ")])]),N("div",no,[d(Bi,{ref_key:"contextRef",ref:c},{default:H(()=>[qt(h.$slots,"body",{shown:s(a)},()=>[y(" default body ")])]),_:3},512)]),N("div",ro,[qt(h.$slots,"footer",{shown:s(a)},()=>[N("div",{class:"modal-default-footer"},[io,N("button",{class:"button modal-default-button",onClick:u}," Close ")])])])])])],16,Ks),[[ca,e.modelValue]])]),_:3})]))}}),an=Symbol("ProxyState");function et(e,t={}){const n=t;let r=!1,i=!1;function a(){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(u,l){if(l===an)return a();const c=a()[l];return c!=null&&typeof c=="object"&&Ot in c?c[Ot]:c},set(u,l,c){return a()[l]=c,!0},has(u,l){return l===an?!0:Reflect.has(a(),l)},ownKeys(){return Reflect.ownKeys(a())},getOwnPropertyDescriptor(u,l){return r||(Object.assign(n,e.call(n,n)),r=!0),Object.getOwnPropertyDescriptor(u,l)}})}const Li=o.ln(10);function zn(e){return e}function ao(e,t){return F(t)?t.invert(o.neg(e)):(console.error("Could not invert due to no input being a variable"),0)}function so(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 oo(e){return f.neg(e)}function lo(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 uo(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 a=t.getIntegralFormula(e);return f.times(n,(r=t.innermostVariable)!=null?r:0).add(a)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const a=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).add(a)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function co(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 po(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 fo(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 a=t.getIntegralFormula(e);return f.sub(a,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 a=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).sub(a)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function go(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 mo(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 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.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 ho(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 bo(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 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.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 wo(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 _o(e,t){return F(t)?t.invert(o.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function No(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 Co(e,t){return F(t)?t.invert(o.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function ko(e){return o.ln(e).sub(1).times(e).div(Li)}function So(e,t){if(F(t)){const n=Li.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 Mo(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:ko,invert:So}):(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 Io(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 xo(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function $o(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 Do(e,t,n){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e),n],evaluate:xo,invert:$o}):(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 To(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 Po(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function Ao(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 Ro(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:Po,invert:Ao}):(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 Eo(e,t){return F(t)?t.invert(o.exp(e)):(console.error("Could not invert due to no input being a variable"),0)}function Fo(e){return o.ln(e).sub(1).times(e)}function Oo(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 qo(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:Fo,invert:Oo}):(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 Vo(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 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),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 Lo(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 jo(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 zo(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 Go(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 Uo(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 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(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 Ho(e,t){return F(t)?t.invert(o.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function Yo(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 Zo(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const r=o.minabs(t,1e308).toNumber();return o.tetrate(e,r,n)}function Xo(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 Jo(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 Ko(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 Qo(e,t=10,n=2){const r=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,r)}function el(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function tl(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 nl(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.layeradd(e,r,n)}function rl(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 il(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 al(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 sl(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.pentate(e,r,n)}function ol(e,t){return F(t)?t.invert(o.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function ll(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 ul(e,t){return F(t)?t.invert(o.acos(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.sin(n)}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.atan(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.cos(n).ln().neg()}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.sin(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.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 ml(e,t){return F(t)?t.invert(o.cos(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.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 hl(e,t){return F(t)?t.invert(o.tan(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.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 yl(e,t){return F(t)?t.invert(o.asinh(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.cosh(n)}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.acosh(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.sinh(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.atanh(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.cosh(n).ln()}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.sinh(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.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 Il(e,t){return F(t)?t.invert(o.cosh(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.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 $l(e,t){return F(t)?t.invert(o.tanh(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.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):s(e)}function Tl(){return f.pow(this,2).div(2)}function Pl(){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:Tl,internalIntegrateInner:Pl,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,v;const{inputs:t,evaluate:n,invert:r,integrate:i,integrateInner:a,applySubstitution:u}=e,l=t.reduce((k,C)=>k+(C instanceof Be?C.internalVariables:0),0),c=t.find(k=>k instanceof Be&&k.hasVariable()),p=l===1?c==null?void 0:c.innermostVariable:void 0,h=(b=c==null?void 0:c.isInvertible())!=null?b:!1,g=(v=c==null?void 0:c.isIntegrable())!=null?v:!1;return{inputs:t,internalEvaluate:n,internalInvert:h?r:void 0,internalIntegrate:g?i:void 0,internalIntegrateInner:a,applySubstitution:u,innermostVariable:p,internalVariables:l}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,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(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new 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 a(l){return o.lt(l,s(i))?l:o.add(r.evaluate(o.sub(l,s(i))),s(i))}function u(l,c){return F(c)&&r.isInvertible()?(o.gt(l,s(i))&&(l=o.add(r.invert(o.sub(l,s(i))),s(i))),c.invert(l)):(console.error("Could not invert due to no input being a variable"),0)}return new f({inputs:[e],evaluate:a,invert:r.isInvertible()&&r.hasVariable()?u:void 0})}static if(e,t,n,r){const i=G(0),a=f.variable(i),u=n(a),l=r==null?void 0:r(a),c=_e(t);function p(g){return s(c)?(i.value=g,u.evaluate()):l?(i.value=g,l.evaluate()):g}function h(g,b){return!F(b)||!u.isInvertible()||l!=null&&!l.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):s(c)?b.invert(u.invert(g)):l?b.invert(l.invert(g)):b.invert(g)}return new f({inputs:[e],evaluate:p,invert:u.isInvertible()&&u.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:ao,applySubstitution:oo,integrate:so})}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:lo,integrate:uo,integrateInner:co,applySubstitution:zn})}static sub(e,t){return new f({inputs:[e,t],evaluate:o.sub,invert:po,integrate:fo,integrateInner:go,applySubstitution:zn})}static mul(e,t){return new f({inputs:[e,t],evaluate:o.mul,invert:mo,integrate:vo,applySubstitution:ho})}static div(e,t){return new f({inputs:[e,t],evaluate:o.div,invert:bo,integrate:yo,applySubstitution:wo})}static recip(e){return new f({inputs:[e],evaluate:o.recip,invert:_o,integrate:No})}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:Co,integrate:Mo})}static log(e,t){return new f({inputs:[e,t],evaluate:o.log,invert:Io,integrate:Do})}static log2(e){return new f({inputs:[e],evaluate:o.log2,invert:To,integrate:Ro})}static ln(e){return new f({inputs:[e],evaluate:o.ln,invert:Eo,integrate:qo})}static pow(e,t){return new f({inputs:[e,t],evaluate:o.pow,invert:Vo,integrate:Bo})}static pow10(e){return new f({inputs:[e],evaluate:o.pow10,invert:Lo,integrate:jo})}static pow_base(e,t){return new f({inputs:[e,t],evaluate:o.pow_base,invert:zo,integrate:Go})}static root(e,t){return new f({inputs:[e,t],evaluate:o.root,invert:Uo,integrate:Wo})}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:Ho,integrate:Yo})}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:Zo,invert:Xo})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:Jo,invert:Ko})}static iteratedlog(e,t=10,n=1){return new f({inputs:[e,t,n],evaluate:Qo})}static slog(e,t=10){return new f({inputs:[e,t],evaluate:el,invert:tl})}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:nl,invert:rl})}static lambertw(e){return new f({inputs:[e],evaluate:o.lambertw,invert:il})}static ssqrt(e){return new f({inputs:[e],evaluate:o.ssqrt,invert:al})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:sl})}static sin(e){return new f({inputs:[e],evaluate:o.sin,invert:fl,integrate:ll})}static cos(e){return new f({inputs:[e],evaluate:o.cos,invert:ml,integrate:cl})}static tan(e){return new f({inputs:[e],evaluate:o.tan,invert:hl,integrate:pl})}static asin(e){return new f({inputs:[e],evaluate:o.asin,invert:ol,integrate:gl})}static acos(e){return new f({inputs:[e],evaluate:o.acos,invert:ul,integrate:vl})}static atan(e){return new f({inputs:[e],evaluate:o.atan,invert:dl,integrate:bl})}static sinh(e){return new f({inputs:[e],evaluate:o.sinh,invert:Sl,integrate:wl})}static cosh(e){return new f({inputs:[e],evaluate:o.cosh,invert:Il,integrate:Nl})}static tanh(e){return new f({inputs:[e],evaluate:o.tanh,invert:$l,integrate:kl})}static asinh(e){return new f({inputs:[e],evaluate:o.asinh,invert:yl,integrate:Ml})}static acosh(e){return new f({inputs:[e],evaluate:o.acosh,invert:_l,integrate:xl})}static atanh(e){return new f({inputs:[e],evaluate:o.atanh,invert:Cl,integrate:Dl})}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 ji(e,t,n=!0,r,i=o.dInf){const a=_e(n),u=_e(r),l=_e(i);return w(()=>{var b,v,k,C;const c=s(l);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const p=s(a),h=(b=s(u))!=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((v=s(e.innermostVariable))!=null?v: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=s(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=s(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=s(e.innermostVariable))!=null?c:0;let a=o.add(t,i);const u=a;r!=null||(r=n?10:0),a=a.sub(r).clampMin(i);let l=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(l=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),u.gt(1e308))return o.add(l,o.sub(u,a).times(e.evaluate(a)))}else if(l=e.evaluate(a),a=a.add(1),u.gt(1e308))return o.sub(u,a).add(1).times(l)}for(let p=a.toNumber();pn.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=w({get(){return n.value},set(a){t?hi(i,a):i[on].value=a}});r[Kt]=e;const i={get value(){return n.value},set value(a){t?hi(i,a):i[on].value=a},__v_isRef:!0,[on]:n,[Kt]:e,[fr]:Al(),[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 Rl(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 zi(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,a=[])=>{let u=!1;return Object.keys(i).forEach(l=>{let c=i[l];if(c!=null&&typeof c=="object"){if(c[Kn]===!0)return;if(an in c&&(c=c[an]),Rl(c)){if(u=!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,...a,l];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=a.reduce((b,v)=>(v in b||(b[v]={}),b[v]),t),g=h[l];h[l]=c[on],pa(h)?g!=null?h[l]=g:h[l]=c[Kt]:g!=null?h[l].value=g:h[l].value=c[Kt]}else!(c instanceof o)&&!(c instanceof f)&&!Ve(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),r(c,[...a,l])&&(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,l):u=!0))}}),u};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=w(()=>{var u,l;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(u=s(i))!=null?u:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function 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 El(e){return ge[e]}function ei(e){console.info("Removing layer",e.id),Qe.emit("removeLayer",e),ge[e.id]=void 0}function Fl(e){ei(e),Qr(e,Y)}function Ol(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,[s(e.name)]),body:s(e.display)}))}}Qe.on("update",function(t){Object.values(ge).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("update",t)}),Object.values(ge).forEach(n=>{n==null||n.emit("postUpdate",t)})});var ql=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:El,removeLayer:ei,reloadLayer:Fl,setupLayerModal:Ol},Symbol.toStringTag,{value:"Module"}));const Vl=X({components:{Context:Bi,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),a=Hr(t),u=Rn(i),l=w(()=>ve.allowGoBack&&n.value>0&&!Pe(r));function c(){Y.tabs.splice(s(e.index),1/0)}function p(g){e.nodes.value=g}const h=G([]);return fa((g,b,v)=>(console.warn(`Error caught in "${e.name}" layer`,g,b,v),h.value.push(g instanceof Error?g:new Error(JSON.stringify(g))),!1)),{component:a,minimizedComponent:u,showGoBack:l,updateNodes:p,unref:s,goBack:c,errors:h}}}),Bl={key:1};function Ll(e,t,n,r,i,a){const u=Ct("ErrorVue"),l=Ct("Context");return e.errors.length>0?(S(),re(u,{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",Bl,ee(e.unref(e.name)),1))])):(S(),T("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[d(l,{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 jl=be(Vl,[["render",Ll],["__scopeId","data-v-a9f5b1da"]]);const Gi=e=>(cn("data-v-4b4bda40"),e=e(),dn(),e),zl=Gi(()=>N("h2",null,"Changelog",-1)),Gl=Gi(()=>N("details",{open:""},[N("summary",null,[y("v0.0 Initial Commit - "),N("time",null,"2021-09-04")]),y(" 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)),Ul=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]=a=>n.value=a)},{header:H(()=>[zl]),body:H(()=>[Gl]),_:1},8,["modelValue"]))}});var Wl=be(Ul,[["__scopeId","data-v-4b4bda40"]]),Hl=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),a=w(()=>(Pe(r)||i.value)&&u.value),u=Rn(n),l=_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=w(()=>Pe(r)&&It[ie.theme].showPin);return{Direction:W,isHovered:i,isShown:a,comp:u,elementComp:l,unref:s,togglePinned:c,showPin:p}}});const Yl={key:0,class:"material-icons pinned"};function Zl(e,t,n,r,i,a){return S(),T("div",{class:Ne(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=u=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=u=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...u)=>e.togglePinned&&e.togglePinned(...u))},[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 u;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"},(u=e.unref(e.style))!=null?u:{}])},[e.showPin?(S(),T("span",Yl,"push_pin")):B("",!0),e.comp?(S(),re(Ke(e.comp),{key:1})):B("",!0)],6)):B("",!0)]}),_:1})],34)}var qe=be(Hl,[["render",Zl],["__scopeId","data-v-6102fa3a"]]);const Nn=e=>(cn("data-v-4f97aa40"),e=e(),dn(),e),Xl={class:"info-modal-header"},Jl=["src","alt"],Kl={class:"info-modal-title"},Ql={key:0},eu={key:0},tu={key:0},nu=Nn(()=>N("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),ru=Nn(()=>N("br",null,null,-1)),iu=Nn(()=>N("br",null,null,-1)),au=["href"],su=Nn(()=>N("span",{class:"material-icons info-modal-discord"},"discord",-1)),ou=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"),y(" The Paper Pilot Community ")])],-1)),lu=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"),y(" The Modding Tree ")])],-1)),uu=Nn(()=>N("br",null,null,-1));var cu=X({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:a,discordName:u,discordLink:l,versionNumber:c,versionTitle:p}=ve,h=Ae(n),g=G(!1),b=w(()=>yr(Y.timePlayed)),v=w(()=>fe(j(()=>d(ne,null,[Gs.map(ot)]))));t({open(){g.value=!0}});function k(){var C;(C=s(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",Xl,[s(i)?(S(),T("img",{key:0,class:"info-modal-logo",src:s(i),alt:s(r)},null,8,Jl)):B("",!0),N("div",Kl,[N("h2",null,ee(s(r)),1),N("h4",null,[y(" v"+ee(s(c)),1),s(p)?(S(),T("span",Ql,": "+ee(s(p)),1)):B("",!0)])])])]),body:H(({shown:x})=>[x?(S(),T("div",eu,[s(a)?(S(),T("div",tu,"By "+ee(s(a)),1)):B("",!0),nu,ru,N("div",{class:"link",onClick:k},"Changelog"),iu,N("div",null,[s(l)?(S(),T("a",{key:0,href:s(l),class:"info-modal-discord-link",target:"_blank"},[su,y(" "+ee(s(u)),1)],8,au)):B("",!0)]),ou,lu,uu,N("div",null,"Time Played: "+ee(s(b)),1),(S(),re(Ke(s(v))))])):B("",!0)]),_:1},8,["modelValue"]))}});var du=be(cu,[["__scopeId","data-v-4f97aa40"]]);const pu={class:"field"},fu={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 u;const n=e,r=Rn(Jt(n,"title"),"span"),i=G((u=n.options.find(l=>l.value===n.modelValue))!=null?u:null);wt(Jt(n,"modelValue"),l=>{var c;Pe(i)!==l&&(i.value=(c=n.options.find(p=>p.value===l))!=null?c:null)});function a(l){t("update:modelValue",l.value)}return(l,c)=>(S(),T("div",pu,[s(r)?(S(),T("span",fu,[(S(),re(Ke(s(r))))])):B("",!0),d(s(ya),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[c[0]||(c[0]=p=>i.value=p),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const gu={class:"field"},mu=X({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=w(()=>{var a;return fe((a=s(n.title))!=null?a:"","span")}),i=w({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,u)=>(S(),T("label",gu,[jr(N("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":u[0]||(u[0]=l=>Ve(i)?i.value=l:null)},null,512),[[ga,s(i)]]),(S(),re(Ke(s(r))))]))}});var $t=be(mu,[["__scopeId","data-v-11046116"]]);const vu={class:"header"},hu=N("h2",null,"Settings",-1),bu={class:"option-tabs"},yu={key:0},wu={key:1};var _u=X({__name:"Options",setup(e,{expose:t}){const n=G(!1),r=G("behaviour");function i(le){return le==r.value}function a(le){r.value=le}t({isTab:i,setTab:a,save:bt,open(){n.value=!0}});const u=Object.keys(It).map(le=>({label:st(le),value:le})),l=w(()=>fe(j(()=>d(ne,null,[Fi.map(ot)])))),{showTPS:c,theme:p,unthrottled:h,alignUnits:g}=Ae(ie),{autosave:b,offlineProd:v}=Ae(Y),k=w({get(){return Y.devSpeed===0},set(le){Y.devSpeed=le?0:null}}),C=j(()=>d("span",{class:"option-title"},[y("Unthrottled"),d("desc",null,[y("Allow the game to run as fast as possible. Not battery friendly.")])])),$=j(()=>d("span",{class:"option-title"},[y("Offline Production"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[y("*")]}),d("desc",null,[y("Simulate production that occurs while the game is closed.")])])),x=j(()=>d("span",{class:"option-title"},[y("Autosave"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[y("*")]}),d("desc",null,[y("Automatically save the game every second or when the game is closed.")])])),I=j(()=>d("span",{class:"option-title"},[y("Pause game"),d(qe,{display:"Save-specific",direction:W.Right},{default:()=>[y("*")]}),d("desc",null,[y("Stop everything from moving.")])])),R=j(()=>d("span",{class:"option-title"},[y("Theme"),d("desc",null,[y("How the game looks.")])])),L=j(()=>d("span",{class:"option-title"},[y("Show TPS"),d("desc",null,[y("Show TPS meter at the bottom-left corner of the page.")])])),ce=j(()=>d("span",{class:"option-title"},[y("Align modifier units"),d("desc",null,[y("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",vu,[hu,N("div",bu,[N("button",{class:Ne({selected:i("behaviour")}),onClick:ae[0]||(ae[0]=J=>a("behaviour"))},"Behaviour",2),N("button",{class:Ne({selected:i("appearance")}),onClick:ae[1]||(ae[1]=J=>a("appearance"))},"Appearance",2)])])]),body:H(()=>[i("behaviour")?(S(),T("div",yu,[d($t,{title:s(C),modelValue:s(h),"onUpdate:modelValue":ae[2]||(ae[2]=J=>Ve(h)?h.value=J:null)},null,8,["title","modelValue"]),s(ve).enablePausing?(S(),re($t,{key:0,title:s(I),modelValue:s(k),"onUpdate:modelValue":ae[3]||(ae[3]=J=>Ve(k)?k.value=J:null)},null,8,["title","modelValue"])):B("",!0),d($t,{title:s($),modelValue:s(v),"onUpdate:modelValue":ae[4]||(ae[4]=J=>Ve(v)?v.value=J:null)},null,8,["title","modelValue"]),d($t,{title:s(x),modelValue:s(b),"onUpdate:modelValue":ae[5]||(ae[5]=J=>Ve(b)?b.value=J:null)},null,8,["title","modelValue"]),s(b)?B("",!0):(S(),re(Gr,{key:1,class:"button save-button",onClick:ae[6]||(ae[6]=J=>s(bt)())},{default:H(()=>[y("Manually save")]),_:1}))])):B("",!0),i("appearance")?(S(),T("div",wu,[d(ti,{title:s(R),options:s(u),modelValue:s(p),"onUpdate:modelValue":ae[7]||(ae[7]=J=>Ve(p)?p.value=J:null)},null,8,["title","options","modelValue"]),(S(),re(Ke(s(l)))),d($t,{title:s(L),modelValue:s(c),"onUpdate:modelValue":ae[8]||(ae[8]=J=>Ve(c)?c.value=J:null)},null,8,["title","modelValue"]),d($t,{title:s(ce),modelValue:s(g),"onUpdate:modelValue":ae[9]||(ae[9]=J=>Ve(g)?g.value=J:null)},null,8,["title","modelValue"])])):B("",!0)]),_:1},8,["modelValue"]))}});const Nu=["onSubmit"],Cu={class:"field"},ku={key:0,class:"field-title"},Su=["placeholder"],Mu=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 a=w({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function u(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,p)=>(S(),T("form",{onSubmit:Pn(u,["prevent"])},[N("div",Cu,[s(r)?(S(),T("span",ku,[(S(),re(Ke(s(r))))])):B("",!0),e.textArea?(S(),re(s(_a),{key:1,modelValue:s(a),"onUpdate:modelValue":p[0]||(p[0]=h=>Ve(a)?a.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,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(a)?a.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:i},null,42,Su)),[[ma,s(a)]])])],40,Nu))}});var Ui=be(Mu,[["__scopeId","data-v-90bd4994"]]);const Iu={key:0},xu=["onClick","disabled"],$u={key:0},Du=["onClick"],Tu=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,l=>{t("confirmingChanged",l)});function a(){if(s(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function u(){i.value=!1}return(l,c)=>(S(),T("span",{class:Ne(["container",{confirming:i.value}])},[i.value?(S(),T("span",Iu,"Are you sure?")):B("",!0),N("button",{onClick:Pn(a,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(S(),T("span",$u,"Yes")):qt(l.$slots,"default",{key:1},void 0,!0)],8,xu),i.value?(S(),T("button",{key:1,class:"button",onClick:Pn(u,["stop"])},"No",8,Du)):B("",!0)],2))}});var Pu=be(Tu,[["__scopeId","data-v-2f8ef34c"]]);const en=e=>(cn("data-v-32313015"),e=e(),dn(),e),Au=en(()=>N("div",{class:"handle material-icons"},"drag_handle",-1)),Ru={key:0,class:"actions"},Eu=en(()=>N("span",{class:"material-icons"},"content_paste",-1)),Fu=en(()=>N("span",{class:"material-icons"},"content_copy",-1)),Ou=en(()=>N("span",{class:"material-icons"},"edit",-1)),qu=en(()=>N("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Vu={key:1,class:"actions"},Bu=en(()=>N("span",{class:"material-icons"},"check",-1)),Lu=en(()=>N("span",{class:"material-icons"},"close",-1)),ju={key:2,class:"details"},zu={class:"save-version"},Gu=en(()=>N("br",null,null,-1)),Uu={key:0},Wu={key:3,class:"details"},Hu={key:4,class:"details error"},Yu=en(()=>N("br",null,null,-1)),Zu=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"}),a=G(!1),u=G(!1),l=G("");wt(a,()=>{var g;return l.value=(g=r.value.name)!=null?g:""});const c=w(()=>r.value!=null&&r.value.id===Y.id),p=w(()=>{var g;return c.value?Y.time:(g=r.value!=null&&r.value.time)!=null?g:0});function h(){t("editName",l.value),a.value=!1}return(g,b)=>(S(),T("div",{class:Ne(["save",{active:s(c)}])},[Au,a.value?(S(),T("div",Vu,[N("button",{onClick:h,class:"button"},[d(qe,{display:"Save",direction:s(W).Left,class:"info"},{default:H(()=>[Bu]),_:1},8,["direction"])]),N("button",{onClick:b[5]||(b[5]=v=>a.value=!a.value),class:"button"},[d(qe,{display:"Cancel",direction:s(W).Left,class:"info"},{default:H(()=>[Lu]),_:1},8,["direction"])])])):(S(),T("div",Ru,[s(r).error==null&&!u.value?(S(),re(Gr,{key:0,onClick:b[0]||(b[0]=v=>t("export")),class:"button",left:""},{default:H(()=>[d(qe,{display:"Export",direction:s(W).Left,class:"info"},{default:H(()=>[Eu]),_:1},8,["direction"])]),_:1})):B("",!0),s(r).error==null&&!u.value?(S(),T("button",{key:1,onClick:b[1]||(b[1]=v=>t("duplicate")),class:"button"},[d(qe,{display:"Duplicate",direction:s(W).Left,class:"info"},{default:H(()=>[Fu]),_:1},8,["direction"])])):B("",!0),s(r).error==null&&!u.value?(S(),T("button",{key:2,onClick:b[2]||(b[2]=v=>a.value=!a.value),class:"button"},[d(qe,{display:"Edit Name",direction:s(W).Left,class:"info"},{default:H(()=>[Ou]),_:1},8,["direction"])])):B("",!0),d(Pu,{disabled:s(c),onClick:b[3]||(b[3]=v=>t("delete")),onConfirmingChanged:b[4]||(b[4]=v=>u.value=v)},{default:H(()=>[d(qe,{display:"Delete",direction:s(W).Left,class:"info"},{default:H(()=>[qu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(r).error==null&&!a.value?(S(),T("div",ju,[N("button",{class:"button open",onClick:b[6]||(b[6]=v=>t("open"))},[N("h3",null,ee(s(r).name),1)]),N("span",zu,"v"+ee(s(r).modVersion),1),Gu,s(p)?(S(),T("div",Uu,"Last played "+ee(s(i).format(s(p))),1)):B("",!0)])):s(r).error==null&&a.value?(S(),T("div",Wu,[d(Ui,{modelValue:l.value,"onUpdate:modelValue":b[7]||(b[7]=v=>l.value=v),class:"editname",onSubmit:h},null,8,["modelValue"])])):(S(),T("div",Hu,[y(" Error: Failed to load save with id "+ee(s(r).id),1),Yu,y(ee(s(r).error),1)]))],2))}});var Xu=be(Zu,[["__scopeId","data-v-32313015"]]);const ni=e=>(cn("data-v-2a4275be"),e=e(),dn(),e),Ju=ni(()=>N("h2",null,"Saves Manager",-1)),Ku={class:"modal-footer"},Qu={class:"field"},ec=ni(()=>N("span",{class:"field-title"},"Create Save",-1)),tc={class:"field-buttons"},nc={class:"footer"},rc=ni(()=>N("div",{style:{"flex-grow":"1"}},null,-1)),ic=X({__name:"SavesManager",setup(e,{expose:t}){const n=G(!1),r=G(null);t({open(){n.value=!0}});const i=G(!1),a=G(""),u=G(null);wt(a,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),a.value="",i.value=!1,ie.saves.push(L)}catch{i.value=!0}}):i.value=!1});let l={},c=G(Object.keys(l).reduce((I,R)=>(I.push({label:R.split("/").slice(-1)[0].slice(0,-4),value:l[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=w(()=>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 v(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(u.value=I,Xt(()=>{u.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(()=>[Ju]),body:H(({shown:L})=>[L?(S(),re(s(wa),{key:0,list:s(ie).saves,handle:".handle",itemKey:ce=>ce},{item:H(({element:ce})=>[d(Xu,{save:s(g)[ce],onOpen:le=>C(ce),onExport:le=>b(ce),onEditName:le=>x(ce,le),onDuplicate:le=>v(ce),onDelete:le=>k(ce)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):B("",!0)]),footer:H(()=>[N("div",Ku,[d(Ui,{modelValue:a.value,"onUpdate:modelValue":R[0]||(R[0]=L=>a.value=L),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:i.value})},null,8,["modelValue","class"]),N("div",Qu,[ec,N("div",tc,[N("button",{class:"button",onClick:R[1]||(R[1]=L=>C(s(Tn)().id))},"New Game"),Object.keys(s(c)).length>0?(S(),re(ti,{key:0,options:s(c),modelValue:u.value,"onUpdate:modelValue":R[2]||(R[2]=L=>$(L)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):B("",!0)])]),N("div",nc,[rc,N("button",{class:"button modal-default-button",onClick:R[3]||(R[3]=L=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Wi=be(ic,[["__scopeId","data-v-2a4275be"]]);const kt=e=>(cn("data-v-318a1c31"),e=e(),dn(),e),ac=["src","alt"],sc={key:1,class:"title"},oc=kt(()=>N("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),lc={class:"discord"},uc={class:"discord-links"},cc={key:0},dc=["href"],pc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),fc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),gc={href:"https://forums.moddingtree.com/",target:"_blank"},mc=kt(()=>N("span",{class:"material-icons"},"forum",-1)),vc=kt(()=>N("span",{class:"material-icons"},"info",-1)),hc=kt(()=>N("span",{class:"material-icons"},"library_books",-1)),bc=kt(()=>N("span",{class:"material-icons"},"settings",-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"},"info",-1)),Nc={href:"https://forums.moddingtree.com/",target:"_blank"},Cc=kt(()=>N("span",{class:"material-icons"},"forum",-1)),kc={class:"discord"},Sc={class:"discord-links"},Mc={key:0},Ic=["href"],xc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),$c=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Dc=X({__name:"Nav",setup(e){const t=G(null),n=G(null),r=G(null),i=G(null),{useHeader:a,banner:u,title:l,discordName:c,discordLink:p,versionNumber:h}=ve;function g(){window.open(p,"mywindow")}return(b,v)=>(S(),T(ne,null,[s(a)?(S(),T("div",Vt({key:0,class:"nav"},b.$attrs),[s(u)?(S(),T("img",{key:0,src:s(u),class:"banner",alt:s(l)},null,8,ac)):(S(),T("div",sc,ee(s(l)),1)),N("div",{onClick:v[0]||(v[0]=k=>{var C;return(C=i.value)==null?void 0:C.open()}),class:"version-container"},[d(qe,{display:"Changelog",direction:s(W).Down,class:"version"},{default:H(()=>[N("span",null,"v"+ee(s(h)),1)]),_:1},8,["direction"])]),oc,N("div",lc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",uc,[s(p)?(S(),T("li",cc,[N("a",{href:s(p),target:"_blank"},ee(s(c)),9,dc)])):B("",!0),pc,fc])]),N("div",null,[N("a",gc,[d(qe,{display:"Forums",direction:s(W).Down,yoffset:"5px"},{default:H(()=>[mc]),_:1},8,["direction"])])]),N("div",{onClick:v[1]||(v[1]=k=>{var C;return(C=t.value)==null?void 0:C.open()})},[d(qe,{display:"Info",direction:s(W).Down,class:"info"},{default:H(()=>[vc]),_:1},8,["direction"])]),N("div",{onClick:v[2]||(v[2]=k=>{var C;return(C=n.value)==null?void 0:C.open()})},[d(qe,{display:"Saves",direction:s(W).Down,xoffset:"-20px"},{default:H(()=>[hc]),_:1},8,["direction"])]),N("div",{onClick:v[3]||(v[3]=k=>{var C;return(C=r.value)==null?void 0:C.open()})},[d(qe,{display:"Settings",direction:s(W).Down,xoffset:"-66px"},{default:H(()=>[bc]),_:1},8,["direction"])])],16)):(S(),T("div",Vt({key:1,class:"overlay-nav"},b.$attrs),[N("div",{onClick:v[4]||(v[4]=k=>{var C;return(C=i.value)==null?void 0:C.open()}),class:"version-container"},[d(qe,{display:"Changelog",direction:s(W).Right,xoffset:"25%",class:"version"},{default:H(()=>[N("span",null,"v"+ee(s(h)),1)]),_:1},8,["direction"])]),N("div",{onClick:v[5]||(v[5]=k=>{var C;return(C=n.value)==null?void 0:C.open()})},[d(qe,{display:"Saves",direction:s(W).Right},{default:H(()=>[yc]),_:1},8,["direction"])]),N("div",{onClick:v[6]||(v[6]=k=>{var C;return(C=r.value)==null?void 0:C.open()})},[d(qe,{display:"Settings",direction:s(W).Right},{default:H(()=>[wc]),_:1},8,["direction"])]),N("div",{onClick:v[7]||(v[7]=k=>{var C;return(C=t.value)==null?void 0:C.open()})},[d(qe,{display:"Info",direction:s(W).Right},{default:H(()=>[_c]),_:1},8,["direction"])]),N("div",null,[N("a",Nc,[d(qe,{display:"Forums",direction:s(W).Right,xoffset:"7px"},{default:H(()=>[Cc]),_:1},8,["direction"])])]),N("div",kc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",Sc,[s(p)?(S(),T("li",Mc,[N("a",{href:s(p),target:"_blank"},ee(s(c)),9,Ic)])):B("",!0),xc,$c])])],16)),d(du,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),d(Wi,{ref_key:"savesManager",ref:n},null,512),d(_u,{ref_key:"options",ref:r},null,512),d(Wl,{ref_key:"changelog",ref:i},null,512)],64))}});var Hi=be(Dc,[["__scopeId","data-v-318a1c31"]]);const Tc={class:"inner-tab"},Pc=X({__name:"Game",setup(e){const t=Jt(Y,"tabs"),n=w(()=>Object.keys(ge)),r=ve.useHeader;function i(a){const{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}=a;return{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}}return(a,u)=>(S(),T("div",{class:Ne(["tabs-container",{useHeader:s(r)}])},[(S(!0),T(ne,null,Dt(s(t),(l,c)=>{var p,h;return S(),T("div",{key:c,class:Ne(["tab",s((p=s(ge)[l])==null?void 0:p.classes)]),style:Le(s((h=s(ge)[l])==null?void 0:h.style))},[c===0&&!s(r)?(S(),re(Hi,{key:0})):B("",!0),N("div",Tc,[s(n).includes(l)?(S(),re(jl,Vt({key:0},i(s(ge)[l]),{index:c,onSetMinimized:g=>s(ge)[l].minimized.value=g}),null,16,["index","onSetMinimized"])):(S(),re(Ke(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var Ac=be(Pc,[["__scopeId","data-v-dcd207b4"]]);const Rc=X({__name:"Sticky",setup(e){const t=G("0"),n=new ResizeObserver(i),r=_t(null);function i(){let a=r.value;if(a==null)return;let u=0;for(;a.previousSibling;){const l=a.previousSibling;l.dataset&&"vSticky"in l.dataset&&(u+=l.offsetHeight),a=l}t.value=u+"px"}return Xt(i),document.fonts.ready.then(i),Qn(()=>{var u;const a=(u=r.value)==null?void 0:u.parentElement;a&&n.observe(a)}),(a,u)=>(S(),T("div",{class:"sticky",style:Le({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[qt(a.$slots,"default",{},void 0,!0)],4))}});var mr=be(Rc,[["__scopeId","data-v-cccac690"]]);const Ec=["x1","y1","x2","y2"],Fc=X({__name:"BoardLink",props:{link:null,dragging:null,dragged:null},setup(e){const n=Ae(e),r=w(()=>{var u,l,c,p,h,g,b;const a={...n.link.value.startNode.position};return n.link.value.offsetStart&&(a.x+=s(n.link.value.offsetStart).x,a.y+=s(n.link.value.offsetStart).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.startNode&&(a.x+=(p=(c=(l=n.dragged)==null?void 0:l.value)==null?void 0:c.x)!=null?p:0,a.y+=(b=(g=(h=n.dragged)==null?void 0:h.value)==null?void 0:g.y)!=null?b:0),a}),i=w(()=>{var u,l,c,p,h,g,b;const a={...n.link.value.endNode.position};return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.endNode&&(a.x+=(p=(c=(l=n.dragged)==null?void 0:l.value)==null?void 0:c.x)!=null?p:0,a.y+=(b=(g=(h=n.dragged)==null?void 0:h.value)==null?void 0:g.y)!=null?b:0),a});return(a,u)=>(S(),T("line",Vt({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:s(r).x,y1:s(r).y,x2:s(i).x,y2:s(i).y}),null,16,Ec))}});var Oc=be(Fc,[["__scopeId","data-v-58e8d695"]]);const qc={key:0},Vc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],Bc=["fill","stroke-width","stroke"],Lc=["fill"],jc=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=w(()=>pe(r.nodeType.value.size,s(r.node))),a=w(()=>{var h;return(h=pe(r.nodeType.value.outlineColor,s(r.node)))!=null?h:It[ie.theme].variables["--outline"]}),u=w(()=>{var h;return(h=pe(r.nodeType.value.titleColor,s(r.node)))!=null?h:It[ie.theme].variables["--foreground"]}),l=w(()=>pe(r.nodeType.value.actionDistance,s(r.node)));function c(h,g){t("clickAction",g.id),h.preventDefault(),h.stopPropagation()}function p(h,g){var b;((b=s(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",qc,[(S(!0),T(ne,null,Dt(e.actions,(b,v)=>{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( + ${(-s(i)-30)*Math.sin(((e.actions.length-1)/2-v)*s(l))}, + ${(s(i)+30)*Math.cos(((e.actions.length-1)/2-v)*s(l))} + )`,onMousedown:$=>c($,b),onTouchstart:$=>c($,b),onMouseup:$=>p($,b),onTouchend:Pn($=>p($,b),["stop"])},[N("circle",{fill:s(pe)(b.fillColor,e.node),r:"20","stroke-width":((C=e.selectedAction)==null?void 0:C.id)===b.id?4:0,stroke:s(a)},null,8,Bc),N("text",{fill:s(u),class:"material-icons"},ee(s(pe)(b.icon,e.node)),9,Lc)],42,Vc)}),128))])):B("",!0)]),_:1}))}});var zc=be(jc,[["__scopeId","data-v-9efb2a56"]]);const Gc=["transform"],Uc={key:0},Wc=["r","fill","stroke"],Hc=["r","fill","stroke"],Yc=["r","fill"],Zc=["r","stroke-dasharray","stroke-dashoffset","stroke"],Xc=["fill","transform"],Jc={key:1,transform:"rotate(45, 0, 0)"},Kc=["width","height","transform","fill","stroke"],Qc=["width","height","transform","fill","stroke"],ed=["width","height","transform","fill"],td=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],nd=["fill","y"],rd=["fill"],id=["fill","y"],ad={key:0},sd=["fill","y"],od=["fill","y"],ld=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),a=w(()=>pe(i.nodeType.value.draggable,s(i.node)));wt(a,K=>{const $e=s(i.node);s(i.dragging)===$e&&!K&&t("endDragging",$e)});const u=w(()=>{var $e;const K=s(i.node);return($e=pe(i.nodeType.value.actions,K))==null?void 0:$e.filter(nt=>Ze(pe(nt.visibility,K)))}),l=w(()=>{var $e;const K=s(i.node);if(pe(i.nodeType.value.draggable,K)&&(($e=s(i.dragging))==null?void 0:$e.id)===K.id&&s(i.dragged)!=null){const{x:nt,y:ht}=s(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=w(()=>pe(i.nodeType.value.shape,s(i.node))),p=w(()=>pe(i.nodeType.value.title,s(i.node))),h=w(()=>pe(i.nodeType.value.otherSubtitle,s(i.node))),g=w(()=>{var K;return(K=i.isSelected.value?s(i.selectedAction)&&pe(s(i.selectedAction).tooltip,s(i.node)):null)!=null?K:pe(i.nodeType.value.label,s(i.node))}),b=w(()=>{var K,$e;return pe(($e=(K=s(i.selectedAction))==null?void 0:K.confirmationLabel)!=null?$e:{text:"Tap again to confirm"},s(i.node))}),v=w(()=>pe(i.nodeType.value.size,s(i.node))),k=w(()=>{var K;return(K=pe(i.nodeType.value.progress,s(i.node)))!=null?K:0}),C=w(()=>It[ie.theme].variables["--background"]),$=w(()=>{var K;return(K=pe(i.nodeType.value.outlineColor,s(i.node)))!=null?K:It[ie.theme].variables["--outline"]}),x=w(()=>{var K;return(K=pe(i.nodeType.value.fillColor,s(i.node)))!=null?K:It[ie.theme].variables["--raised-background"]}),I=w(()=>pe(i.nodeType.value.progressColor,s(i.node))),R=w(()=>{var K;return(K=pe(i.nodeType.value.titleColor,s(i.node)))!=null?K:It[ie.theme].variables["--foreground"]}),L=w(()=>pe(i.nodeType.value.progressDisplay,s(i.node))),ce=w(()=>i.dragging.value!=null&&s(i.hasDragged)&&pe(i.nodeType.value.canAccept,s(i.node),i.dragging.value)),le=w(()=>pe(i.nodeType.value.style,s(i.node))),ae=w(()=>pe(i.nodeType.value.classes,s(i.node)));function J(K){t("mouseDown",K,i.node.value,a.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=w(()=>pe(i.nodeType.value.subtitle,s(i.node))),Ue=w(()=>pe(i.nodeType.value.showStar,s(i.node))),vt=w(()=>pe(i.nodeType.value.fillStar,s(i.node)));return(K,$e)=>{var nt,ht,pt;return S(),T("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:s(a),...s(ae)}]),style:Le([{opacity:((nt=e.dragging)==null?void 0:nt.id)===e.node.id&&e.hasDragged?.5:1},(ht=s(le))!=null?ht:[]]),transform:`translate(${s(l).x},${s(l).y})${e.isSelected?" scale(1.2)":""}`},[d(zc,{actions:(pt=s(u))!=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},[s(c)===s(Ge).Circle?(S(),T("g",Uc,[s(ce)?(S(),T("circle",{key:0,class:"receiver",r:s(v)+8,fill:s(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Wc)):B("",!0),N("circle",{class:"body",r:s(v),fill:s(x),stroke:s($),"stroke-width":4},null,8,Hc),s(L)===s(un).Fill?(S(),T("circle",{key:1,class:"progress progressFill",r:Math.max(s(v)*s(k)-2,0),fill:s(I)},null,8,Yc)):(S(),T("circle",{key:2,r:s(v)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(v)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(v)+4.5)*2*Math.PI-s(k)*(s(v)+4.5)*2*Math.PI,stroke:s(I)},null,8,Zc)),s(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:s(vt)?"var(--bought)":"none",transform:`translate(${-s(v)/4}, ${-s(v)-10}), scale(0.5)`},null,8,Xc)):B("",!0)])):s(c)===s(Ge).Diamond?(S(),T("g",Jc,[s(ce)?(S(),T("rect",{key:0,class:"receiver",width:s(v)*s(r)+16,height:s(v)*s(r)+16,transform:`translate(${-(s(v)*s(r)+16)/2}, ${-(s(v)*s(r)+16)/2})`,fill:s(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Kc)):B("",!0),N("rect",{class:"body",width:s(v)*s(r),height:s(v)*s(r),transform:`translate(${-s(v)*s(r)/2}, ${-s(v)*s(r)/2})`,fill:s(x),stroke:s($),"stroke-width":4},null,8,Qc),s(L)===s(un).Fill?(S(),T("rect",{key:1,class:"progress progressFill",width:Math.max(s(v)*s(r)*s(k)-2,0),height:Math.max(s(v)*s(r)*s(k)-2,0),transform:`translate(${-Math.max(s(v)*s(r)*s(k)-2,0)/2}, ${-Math.max(s(v)*s(r)*s(k)-2,0)/2})`,fill:s(I)},null,8,ed)):(S(),T("rect",{key:2,class:"progress progressDiamond",width:s(v)*s(r)+9,height:s(v)*s(r)+9,transform:`translate(${-(s(v)*s(r)+9)/2}, ${-(s(v)*s(r)+9)/2})`,fill:"transparent","stroke-dasharray":(s(v)*s(r)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(v)*s(r)+9)*4-s(k)*(s(v)*s(r)+9)*4,stroke:s(I)},null,8,td))])):B("",!0),N("text",{fill:s(R),class:"node-title",y:s(h)&&!s(he)?-10:0},ee(s(p)),9,nd),s(he)?(S(),T("text",{key:2,fill:s(R),class:"node-subtitle",y:"-25"},ee(s(he)),9,rd)):B("",!0),s(h)?(S(),T("text",{key:3,fill:s(R),class:"node-subtitle",y:s(he)?25:15},ee(s(h)),9,id)):B("",!0)],32),d(Wn,{name:"fade",appear:""},{default:H(()=>{var St;return[s(g)?(S(),T("g",ad,[N("text",{fill:(St=s(g).color)!=null?St:s(R),class:Ne(["node-title",{pulsing:s(g).pulsing}]),y:-s(v)-20},ee(s(g).text),11,sd)])):B("",!0)]}),_:1}),d(Wn,{name:"fade",appear:""},{default:H(()=>{var St;return[e.isSelected&&e.selectedAction?(S(),T("text",{key:0,fill:(St=s(b).color)!=null?St:s(R),class:Ne(["node-title",{pulsing:s(b).pulsing}]),y:s(v)+75},ee(s(b).text),11,od)):B("",!0)]}),_:1})],14,Gc)}}});var ud=be(ld,[["__scopeId","data-v-85b0e9a6"]]);const cd={class:"stage",width:"100%",height:"100%"},dd={class:"g1"},pd=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}),a=G(!1),u=G(null),l=w(()=>{const v=n.nodes.value.slice();if(n.selectedNode.value){const k=v.splice(v.indexOf(n.selectedNode.value),1)[0];v.push(k)}if(n.draggingNode.value){const k=v.splice(v.indexOf(n.draggingNode.value),1)[0];v.push(k)}return v});Pt(()=>{const v=n.draggingNode.value;if(v==null)return null;const k={x:v.position.x+i.value.x,y:v.position.y+i.value.y};let C=Number.MAX_VALUE;n.setReceivingNode.value(n.nodes.value.reduce(($,x)=>{if(x.id===v.id)return $;const I=n.types.value[x.type];if(!pe(I.canAccept,x,v))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(v){v.setTransformOrigin(null),v.moveTo(u.value.$el.clientWidth/2,u.value.$el.clientHeight/2)}function p(v,k=null,C=!1){if(n.draggingNode.value==null){v.preventDefault(),v.stopPropagation();let $,x;if("touches"in v)if(v.touches.length===1)$=v.touches[0].clientX,x=v.touches[0].clientY;else return;else $=v.clientX,x=v.clientY;r.value={x:$,y:x},i.value={x:0,y:0},a.value=!1,C&&n.setDraggingNode.value(k)}k!=null&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function h(v){const{x:k,y:C,scale:$}=u.value.panZoomInstance.getTransform();let x,I;if("touches"in v)if(v.touches.length===1)x=v.touches[0].clientX,I=v.touches[0].clientY;else{g(n.draggingNode.value),n.mousePosition.value=null;return}else x=v.clientX,I=v.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)&&(a.value=!0),n.draggingNode.value!=null&&(v.preventDefault(),v.stopPropagation())}function g(v,k=!1){var C,$;if(n.draggingNode.value!=null&&n.draggingNode.value===v){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!a.value&&!k&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(v,k){var $,x;const C=n.types.value[v.type];pe((x=($=C.actions)==null?void 0:$.find(I=>I.id===k))==null?void 0:x.confirmationLabel,v)==null&&(n.state.value.selectedAction=k),n.state.value.selectedAction===k?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:k}}return(v,k)=>{const C=Ct("panZoom");return s(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:u,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:k[0]||(k[0]=$=>p($)),onTouchstart:k[1]||(k[1]=$=>p($)),onMouseup:k[2]||(k[2]=()=>g(s(e.draggingNode))),onTouchendPassive:k[3]||(k[3]=()=>g(s(e.draggingNode))),onMouseleave:k[4]||(k[4]=()=>g(s(e.draggingNode),!0))},{default:H(()=>[(S(),T("svg",cd,[N("g",dd,[d(ui,{name:"link",appear:""},{default:H(()=>[(S(!0),T(ne,null,Dt(s(e.links)||[],$=>(S(),T("g",{key:`${$.startNode.id}-${$.endNode.id}`},[d(Oc,{link:$,dragging:s(e.draggingNode),dragged:$.startNode===s(e.draggingNode)||$.endNode===s(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(s(l),$=>(S(),T("g",{key:$.id,style:{"transition-duration":"0s"}},[d(ud,{node:$,nodeType:e.types[$.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===$?i.value:void 0,hasDragged:s(e.draggingNode)==null?!1:a.value,receivingNode:s(e.receivingNode)===$,isSelected:s(e.selectedNode)===$,selectedAction:s(e.selectedNode)===$?s(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=>Na.install(e));const Yi=Symbol("Board");var un=(e=>(e.Outline="Outline",e.Fill="Fill",e))(un||{}),Ge=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(Ge||{});function fd(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=Yi,r[gt]=pd,r.state?(zi(t),A(r,"state")):(t[Kt]={nodes:r.startNodes().map((l,c)=>(l.id=c,l)),selectedNode:null,selectedAction:null},r.state=t),r.nodes=w(()=>s(u.state).nodes),r.selectedNode=w({get(){return u.nodes.value.find(l=>l.id===s(u.state).selectedNode)||null},set(l){var c,p;Ve(u.state)?u.state.value={...u.state.value,selectedNode:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedNode=(p=l==null?void 0:l.id)!=null?p:null}}),r.selectedAction=w({get(){const l=u.selectedNode.value;if(l==null)return null;const c=u.types[l.type];return c.actions==null?null:c.actions.find(p=>p.id===s(u.state).selectedAction)||null},set(l){var c,p;Ve(u.state)?u.state.value={...u.state.value,selectedAction:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedAction=(p=l==null?void 0:l.id)!=null?p:null}}),r.mousePosition=G(null),r.links?A(r,"links"):r.links=w(()=>u.selectedAction.value==null?null:u.selectedAction.value.links&&u.selectedNode.value?pe(u.selectedAction.value.links,u.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 l in r.types){const c=r.types[l];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=w(()=>s(u.state).nodes.filter(p=>p.type===l)),oe(c,"onClick",function(p){s(u.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(l){r.draggingNode.value=l}function a(l){r.receivingNode.value=l}r.placeInAvailableSpace=function(l,c=100,p=W.Right){const h=u.nodes.value.slice().filter(g=>g===l||(p===W.Down||p===W.Up)&&Math.abs(g.position.x-l.position.x)>c||(p===W.Left||p===W.Right)&&Math.abs(g.position.y-l.position.y)>c?!1:!(p===W.Right&&g.position.xl.position.x+c||p===W.Up&&g.position.y>l.position.y+c||p===W.Down&&g.position.yg.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;g0&&v>c)break}},r[dt]=function(){const{nodes:l,types:c,state:p,visibility:h,width:g,height:b,style:v,classes:k,links:C,selectedAction:$,selectedNode:x,mousePosition:I,draggingNode:R,receivingNode:L}=this;return{nodes:l,types:c,state:p,visibility:h,width:g,height:b,style:s(v),classes:k,links:C,selectedAction:$,selectedNode:x,mousePosition:I,draggingNode:R,receivingNode:L,setDraggingNode:i,setReceivingNode:a}};const u=r;return u})}function pe(e,t,...n){return Yn(e)?e(t,...n):s(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,Yi);Gn[e.id]=e.on("postUpdate",n=>{t.forEach(r=>{Object.values(r.types).forEach(i=>i.nodes.value.forEach(a=>{var u;return(u=i.update)==null?void 0:u.call(i,a,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 a=i[Ot];a.displayName=t,a.precision=n,a.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(Ca));function gd(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 md=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),a=Hr(n),u=w(()=>{const c=Pe(r);return c==null||c===""?{}:s(i)?gd(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:a,glowColorStyle:u,unref:s,Visibility:Se,isVisible:Ze,isHidden:_n}}});function vd(e,t,n,r,i,a){var u;return e.isVisible(e.visibility)?(S(),T("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(u=e.unref(e.style))!=null?u:{}])},[(S(),re(Ke(e.component)))],6)):B("",!0)}var Zi=be(md,[["render",vd],["__scopeId","data-v-21427abb"]]);const hd=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:Zi},setup(e){const{activeTab:t}=Ae(e),n=w(()=>It[ie.theme].floatingTabs),r=_t("");Pt(()=>{const l=Pe(t);if(l==null){r.value="";return}if(At(l)){r.value=fe(l);return}r.value=fe(s(l.display))});const i=w(()=>{const l=Pe(t);return At(l)||!l?void 0:s(l.classes)}),a=w(()=>{const l=Pe(t);return At(l)||!l?void 0:s(l.style)});function u(l){const{display:c,style:p,classes:h,glowColor:g,visibility:b}=l;return{display:c,style:s(p),classes:h,glowColor:g,visibility:b}}return{floating:n,tabClasses:i,tabStyle:a,Visibility:Se,component:r,gatherButtonProps:u,unref:s,isVisible:Ze,isHidden:_n}}});function bd(e,t,n,r,i,a){var c,p;const u=Ct("TabButton"),l=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(l,{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(u,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 yd=be(hd,[["render",bd],["__scopeId","data-v-58dbf83a"]]);const wd=Symbol("TabButton"),_d=Symbol("TabFamily");function Xi(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 u;const i=(u=t==null?void 0:t.call(r,r))!=null?u:{};i.id=Qt("tabFamily-"),i.type=_d,i[gt]=yd,i.tabs=Object.keys(e).reduce((l,c)=>{const p=e[c]();return p.type=wd,p[gt]=Zi,A(p,"visibility"),oe(p,"visibility",Se.Visible),A(p,"tab"),A(p,"display"),A(p,"classes"),A(p,"style"),A(p,"glowColor"),l[c]=p,l},{}),i.selected=n,i.activeTab=w(()=>{const l=s(a.tabs);if(n.value in l&&Ze(l[n.value].visibility))return s(l[n.value].tab);const c=Object.values(l).find(p=>Ze(p.visibility));return c?s(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:l,activeTab:c,selected:p,tabs:h,style:g,classes:b,buttonContainerClasses:v,buttonContainerStyle:k}=this;return{visibility:l,activeTab:c,selected:p,tabs:h,style:s(g),classes:b,buttonContainerClasses:v,buttonContainerStyle:k}};const a=i;return a})}function Ht(e){return et(t=>{const{addend:n,description:r,enabled:i,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.add(p,s(u)),invert:p=>o.sub(p,s(u)),getFormula:p=>f.add(p,u),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[mt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),0):o.lt(s(u),0))?"color: var(--danger)":""},[o.gte(s(u),0)?"+":"",Zt(s(u))])]))}})}function Ce(e){return et(t=>{const{multiplier:n,description:r,enabled:i,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.times(p,s(u)),invert:p=>o.div(p,s(u)),getFormula:p=>f.times(p,u),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[mt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[y("\xD7"),Zt(s(u))])]))}})}function Nd(e){return et(t=>{const{exponent:n,description:r,enabled:i,supportLowNumbers:a,smallerIsBetter:u}=e.call(t,t),l=_e(n),c=_e(r),p=i==null?void 0:_e(i);return{apply:h=>{let g=h;return a&&(g=o.add(g,1)),g=o.pow(g,s(l)),a&&(g=o.sub(g,1)),g},invert:h=>{let g=h;return a&&(g=o.add(g,1)),g=o.root(g,s(l)),a&&(g=o.sub(g,1)),g},getFormula:h=>a?f.add(h,1).pow(l).sub(1):f.pow(h,l),enabled:p,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(c)!=null?d("span",{class:"modifier-description"},[mt(s(c)),a?" (+1 effective)":null]):null,d("span",{class:"modifier-amount",style:(u===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[y("^"),Zt(s(l))])]))}})}function Mt(e){return et(()=>{const t=e();return{apply:n=>t.filter(r=>s(r.enabled)!==!1).reduce((r,i)=>i.apply(r),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(r=>s(r.enabled)!==!1).reduceRight((r,i)=>i.invert(r),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(r=>s(r.enabled)!==!1).reduce((r,i)=>i.getFormula(r),n):void 0,enabled:t.some(n=>n.enabled!=null)?w(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?j(()=>d(ne,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(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:[]}),m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{var t;return Array.isArray((t=e.state)==null?void 0:t.data)?e.state.data.length>0:"portals"in e.state?e.state.portals.length>0:"resources"in e.state?e.state.resources.length>0:"tools"in e.state?e.state.tools.length>0:!1}},jt={id:"toggle",icon:"bolt",tooltip:e=>({text:e.state.powered?"Turn Off":`Turn On - Always runs for ${ut(m.nextPowerCost.value)} energy/s`}),onClick(e){e.state={...e.state,powered:!e.state.powered},m.board.selectedAction.value=null},fillColor:e=>e.state.powered?"var(--accent1)":"var(--locked)"};function 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(m.energy.value,n.evaluate(r.state.maxConnections))?"var(--bought)":"var(--locked)"},confirmationLabel:r=>o.gte(m.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(m.energy.value,i)&&(m.energy.value=o.sub(m.energy.value,i),r.state={...r.state,maxConnections:o.add(r.state.maxConnections,1)},m.board.selectedAction.value=null)},visibility:r=>o.add(r.state.maxConnections,m.computedBonusConnectionsModifier.value).lt(t)}}function Ji(e,t){var n,r;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="resource"){const i=((r=m.board.draggingNode.value)==null?void 0:r.state).type,{maxConnections:a,resources:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function Cd(e,t){var n,r;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="passive"){const i=(r=m.board.draggingNode.value)==null?void 0:r.state,{maxConnections:a,tools:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function wr(e,t){var n,r;if(((n=m.board.draggingNode.value)==null?void 0:n.type)==="portal"){const i=((r=m.board.draggingNode.value)==null?void 0:r.state).id,{maxConnections:a,portals:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,m.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function Ki(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,m.computedBonusConnectionsModifier.value).lte(i.length)}function Qi(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]},m.board.selectedNode.value=e}function kd(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,m.computedBonusConnectionsModifier.value).lte(i.length)}function Sd(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]},m.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,m.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]},m.board.selectedNode.value=e}function ke(e){return e===m.board.selectedNode.value||e.state.powered}function te(e){return m.empowerer.value!=null&&ke(m.empowerer.value)&&m.empowerer.value.state.tools.includes(e)}function Md(e){var a,u,l;const t=(l=(u=(a=m.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:u.amount)!=null?l:0,n=m.resourceLevels.value[e],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],a=r.maxConnections;o.gt(i.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:i.slice(0,o.add(a,e).toNumber())})}}function zt(e){return{id:"help",icon:"question_mark",tooltip:{text:"Help"},onClick(){m.helpModals[e].showModal.value=!0,m.board.selectedAction.value=null},confirmationLabel:null}}function bi(e){return t=>ie.lineVisibility||e===m.board.selectedNode.value||e===m.board.draggingNode.value||m.resourceNodes.value[t]===m.board.draggingNode.value}const Id={key:0},xd={key:0,class:"mark star"},$d=["src"],Dd=X({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(S(),T("div",Id,[e.mark===!0?(S(),T("div",xd)):(S(),T("img",{key:1,class:"mark",src:e.mark},null,8,$d))])):B("",!0)}});var er=be(Dd,[["__scopeId","data-v-2207999f"]]);const Td=X({__name:"Node",props:{id:null},setup(e){const n=Ae(e),r=dr(Yr,()=>{}),i=dr(Zr,()=>{}),a=_t(null),u=w(()=>a.value&&a.value.parentElement);return wt([u,n.id],([l,c],[p,h])=>{p&&i(s(h)),l&&r(c,l)}),Mi(()=>i(s(n.id))),(l,c)=>(S(),T("div",{class:"node",ref_key:"node",ref:a},null,512))}});var tr=be(Td,[["__scopeId","data-v-a48cb382"]]),Pd=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 l=Pe(t);if(l==null){i.value="";return}if(At(l)){i.value=fe(l);return}const c=fe((h=l.title)!=null?h:"","h3"),p=fe(l.description,"div");i.value=fe(j(()=>d("span",null,[l.title!=null?d("div",null,[d(c,null,null)]):null,d(p,null,null)])))});const{start:a,stop:u}=Vi(n,r);return{start:a,stop:u,comp:i,Visibility:Se,isVisible:Ze,isHidden:_n,unref:s}}});function Ad(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=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(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],38)):B("",!0)}var ea=be(Pd,[["render",Ad],["__scopeId","data-v-211328c0"]]);const ta=Symbol("Clickable");function yi(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return et(r=>{var u,l,c;const i=(u=e==null?void 0:e.call(r,r))!=null?u:{};i.id=Qt("clickable-"),i.type=ta,i[gt]=ea;for(const p of t)(l=p.preConstruct)==null||l.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){s(i.canClick)!==!1&&p(h)}}if(i.onHold){const p=i.onHold.bind(i);i.onHold=function(){s(i.canClick)!==!1&&p()}}for(const p of t)(c=p.postConstruct)==null||c.call(p,i);const a=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:v,onHold:k,canClick:C,small:$,mark:x,id:I}=this;return{display:p,visibility:h,style:s(g),classes:b,onClick:v,onHold:k,canClick:C,small:$,mark:x,id:I,...a}},i})}function Rd(e,t,n=[]){n=n.length===0?Xn(e,ta):n;const r=typeof t=="function"?w(t):t;return e.on("update",()=>{s(r)&&n.filter(i=>s(i.canClick)).forEach(i=>{var a;return(a=i.onClick)==null?void 0:a.call(i)})})}const Ed=["x1","y1","x2","y2"],Fd=X({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=Ae(e),r=w(()=>{const a=n.startNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),i=w(()=>{const a=n.endNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(a,u)=>(S(),T("line",Vt({"stroke-width":"15px",stroke:"white"},e.link,{x1:s(r).x,y1:s(r).y,x2:s(i).x,y2:s(i).y}),null,16,Ed))}});const Od=X({__name:"Links",props:{links:null},setup(e){var c;const n=Jt(e,"links"),r=G(null),i=dr(Xr,G({})),a=dr(Jr,G(void 0)),u=G((c=r.value)==null?void 0:c.getBoundingClientRect());wt(a,()=>{var p;return u.value=(p=r.value)==null?void 0:p.getBoundingClientRect()}),Qn(()=>{var p;return u.value=(p=r.value)==null?void 0:p.getBoundingClientRect()});const l=w(()=>{var h,g;const p=i.value;return(g=(h=n.value)==null?void 0:h.filter(b=>{var v,k;return((v=p[b.startNode.id])==null?void 0:v.rect)&&((k=p[b.startNode.id])==null?void 0:k.rect)}))!=null?g:[]});return(p,h)=>(S(),T(ne,null,[s(l)?(S(),T("svg",va(Vt({key:0},p.$attrs)),[(S(!0),T(ne,null,Dt(s(l),(g,b)=>(S(),re(Fd,{key:b,link:g,boundingRect:u.value,startNode:s(i)[g.startNode.id],endNode:s(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 qd=be(Od,[["__scopeId","data-v-063f6d6b"]]);X({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:qd},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:r}=Ae(e),i=_t();Pt(()=>{const l=Pe(t);i.value=fe(j(()=>d(ne,null,[l.map(c=>d("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(mt)]))])))});const a=_t();Pt(()=>{const l=Pe(n);a.value=l?fe(j(()=>d("span",{class:"left-side-nodes small"},[l.map(mt)]))):""});const u=_t();return Pt(()=>{const l=Pe(r);u.value=l?fe(j(()=>d("span",{class:"side-nodes small"},[l.map(mt)]))):""}),{unref:s,nodesComp:i,leftNodesComp:a,rightNodesComp:u}}});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:a,stop:u}=Vi(t,n);return{start:a,stop:u,comp:i,unref:s,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(l=>_e(l.base)),n.baseText=t.map(l=>_e(l.baseText)),n.visible=t.map(l=>_e(l.visible)),n.title=t.map(l=>_e(l.title)),n.subtitle=t.map(l=>_e(l.subtitle)),r=!0),t}const a=ct({},!1);return[j(()=>{const l=i();let c=!0;const p=l.map((h,g)=>{var x,I,R;if(s(n.visible[g])===!1)return null;const b=d("h3",{onClick:()=>a.value[g]=!a.value[g],style:"cursor: pointer"},[d("span",{class:"modifier-toggle"+(s(a.value[g])?" collapsed":"")},[y("\u25BC")]),s(n.title[g]),s(n.subtitle[g])!=null?d("span",{class:"subtitle"},[y(" ("),s(n.subtitle[g]),y(")")]):null]),v=s(a.value[g])?null:d(ne,null,[d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[mt((x=s(n.baseText[g]))!=null?x:"Base")]),d("span",{class:"modifier-amount"},[xe((I=s(n.base[g]))!=null?I:1),h.unit])]),h.modifier.description==null?null:mt(s(h.modifier.description))]),k=!c;c=!1;const C=(R=s(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),v,d("hr",null,null),d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[y("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])}),a]}function Er(e,t,n){const r=_e(t),i=_e(n);return w(()=>{const a=s(r),u=s(i);return o.gte(e.value,u)?"Now":o.lte(a,0)?"Never":yr(o.sub(u,e.value).div(a))})}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 a;if(s(r)){const u=Zt(e.evaluate()),l=Zt(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(i))));return d(ne,null,[d("b",null,[d("i",null,[u,y(" \u2192 "),l])])])}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"},Vd={dirt:{description:e=>e?"Quadruples mining speed":"Doubles mining speed"},gravel:{description:e=>e?"Quadruples mine ore drops":"Doubles mine ore drops"},stone:{description:e=>e?"Quadruples energy gain":"Doubles energy gain"},copper:{description:e=>e?"Material level is 40% stronger":"Material level is 20% stronger"},silver:{description:e=>e?"Quadruples each plane's resource gain":"Doubles each plane's resource gain"},diamond:{description:e=>e?"+20% plane's resource gain per upgrade bought":"+10% plane's resource gain per upgrade bought"},emerald:{description:e=>e?"+2% plane's resource gain per minute active":"+1% plane's resource gain per minute active"},unobtainium:{description:e=>e?"+2 max connections per machine":"+1 max connections per machine"},dirtRelic:{description:e=>e?"2 free levels for repeatables":"1 free level for repeatables"},sandRelic:{description:e=>e?"Treasure's 2 tiers stronger":"Treasure's 1 tier stronger"},gravelRelic:{description:e=>e?"+2% plane's resource gain per repeatable purchase (diminishing)":"+1% plane's resource gain per repeatable purchase (diminishing)"},woodRelic:{description:e=>e?"(Relics)^2 boost mine speed":"Relics boost mine speed"},stoneRelic:{description:e=>e?"All upgrades apply twice":"Non-multiplicative upgrades apply twice"},coalRelic:{description:e=>e?"Every treasure boosts planar speed by +20%":"Every treasure boosts planar speed by +10%"},copperRelic:{description:e=>e?"Power 2 machines free":"Power 1 machine free"},ironRelic:{description:e=>e?"Conversions give quadruple output":"Conversions give double output"},silverRelic:{description:e=>e?"(Powered machines)^2 boost quarry speed":"Powered machines boost quarry speed"},goldRelic:{description:e=>e?"Each treasure gives +50% XP gain":"Each treasure gives +25% XP gain"},emeraldRelic:{description:e=>e?"Creating portals costs 20x less energy":"Creating portals costs 10x less energy"},platinumRelic:{description:e=>e?"Quadruple dimensions' tick rate":"Double dimensions' tick rate"},diamondRelic:{description:e=>e?"Repeatables/dimensions buy max at once":"Repeatables buy max at once"},beryliumRelic:{description:e=>e?"log(energy)^0.5 boosts planes' resource gain":"log(energy)^0.25 boosts planes' resource gain"},unobtainiumRelic:{description:e=>e?"Upgrades/repeatables/dimensions/prestige no longer spend on purchase":"Upgrades/repeatables no longer spend on purchase"}},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(),Bd=X({__name:"Tab",props:{display:null},setup(e){const t=e,{display:n}=Ae(t),r=Hr(n);return(i,a)=>(S(),re(Ke(s(r))))}}),Ld=Symbol("Tab");function Fr(e){return et(t=>{const n=e.call(t,t);return n.id=Qt("tab-"),n.type=Ld,n[gt]=Bd,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":a=>r.value=a},{header:()=>d("h2",null,[e]),body:t})),showModal:r,...n}}function jd(){return Gt("Getting Started",j(()=>d("div",null,[d("p",null,[y(`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,[y(`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,[y("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 zd(){return Gt("Forging",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Gd(){return Gt("Dowsing",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Ud(){return Gt("Quarry",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Wd(){return Gt("Tool Empowerer",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Hd(){const e=Xi({general:()=>({display:"General",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Fr(()=>({display:j(()=>d("div",null,[d("p",null,[y("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,[y("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,[y("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"},[y("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,[y("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)"},[y("Caches")]),y(": 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)"},[y("Gen")]),y(": 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)"},[y("Resource Mult")]),y(": 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)"},[y("Energy Mult")]),y(": 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)"},[y("Influences")]),y(": 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)"},[y("Relic")]),y(": 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,[y("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(m.influenceNodes.value).length>0?d("div",null,[y("Discovered influences:"),d("ul",{style:"list-style-type: unset"},[m.influenceNodes.value.increaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+resource")]),y(": 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.")]),m.influenceNodes.value.decreaseResources==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("-resource")]),y(": 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.")]),m.influenceNodes.value.increaseLength==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+length")]),y(": Cause the plane to have 1 extra treasure than it otherwise would have.")]),m.influenceNodes.value.increaseCaches==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+caches")]),y(": Causes treasures to have an increased chance to be caches.")]),m.influenceNodes.value.increaseGens==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+gens")]),y(": Causes treasures to have an increased chance to be gens.")]),m.influenceNodes.value.increaseResourceMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+resource mults")]),y(": Causes treasures to have an increased chance to be resource mults.")]),m.influenceNodes.value.increaseEnergyMults==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+energy mults")]),y(": Causes treasures to have an increased chance to be energy mults.")]),m.influenceNodes.value.increaseInfluences==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+influences")]),y(": Causes treasures to have an increased chance to be influences.")]),m.influenceNodes.value.relic==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+relic")]),y(": 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.")]),m.influenceNodes.value.increaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+difficulty")]),y(": Causes the difficulty and rewards to be in the upper half of what's possible at this tier.")]),m.influenceNodes.value.decreaseDiff==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("-difficulty")]),y(": Causes the difficulty and rewards to be in the lower half of what's possible at this tier.")]),m.influenceNodes.value.increaseRewards==null?null:d("li",{style:"margin-top: var(--feature-margin)"},[d("b",{style:"color: var(--bought)"},[y("+rewards")]),y(": Causes the quality of treasures to be 1 tier higher. Does not affect influences or relics treasures.")])])]):d("div",null,[y("Once you discover influences, summaries will appear here describing their effects.")])]))}))})});return Gt("Portal Generator",j(()=>mt(e)),{tabFamily:e})}function Yd(){return Gt("Booster",j(()=>d("div",null,[d("p",null,[y("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,[y("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,[y("Initially the booster will double the rate of time, but that can be increased using an action.")])])))}function Zd(){return Gt("Upgrader",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Xd(){return Gt("Automator",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Jd(){return Gt("Investments",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Kd=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:s(n.requirementMet)?"":"color: var(--danger)"},[vr(n.resource,n.cost instanceof f?sn(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=i=>d("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",vr(n.resource,n.cost instanceof f?sn(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(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 a=n.cost instanceof f?sn(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost);n.resource.value=o.sub(n.resource.value,a).max(0)}),n.canMaximize=w(()=>{var l;if(!(n.cost instanceof f))return!1;const i=s(n.maxBulkAmount);if(o.lte(i,1))return!1;const a=s(n.cumulativeCost),u=(l=s(n.directSum))!=null?l:a?10:0;return o.lte(i,u)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof f?n.requirementMet=ji(n.cost,n.resource,(r=n.cumulativeCost)!=null?r:!0,n.directSum,n.maxBulkAmount):n.requirementMet=w(()=>o.gte(n.resource.value,s(n.cost))),n})}function ri(e){return et(()=>({requirementMet:w(()=>Ze(e.visibility)),visibility:Se.None,requiresPay:!1}))}function Qd(e,t){return et(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:j(()=>mt(t)),display:t==null?void 0:j(()=>d(ne,null,[y("Req: "),mt(t)])),visibility:t==null?Se.None:Se.Visible,requiresPay:!1}))}function Cr(e){if(Bt(e))return e.every(Cr);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function na(e){if(Bt(e))return e.map(na).reduce(o.min);const t=s(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&s(e.canMaximize)!==!0?1:t}function 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(u=>"partialDisplay"in u);const i=e.filter(u=>s(u.requiresPay)),a=e.filter(u=>!s(u.requiresPay));return d(ne,null,[i.length>0?d("div",null,[y("Costs:")," ",mi(i.map(u=>u.partialDisplay(t)),d(ne,null,[y(", ")]))]):null,a.length>0?d("div",null,[y("Requires:")," ",mi(a.map(u=>u.partialDisplay(t)),d(ne,null,[y(", ")]))]):null])}return(r=(n=e.display)==null?void 0:n.call(e))!=null?r:d(ne,null,null)}function ra(e,t=1){var n;Bt(e)?e.filter(r=>s(r.requiresPay)).forEach(r=>{var i;return(i=r.pay)==null?void 0:i.call(r,t)}):s(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var ep=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 a=Pe(t);if(a==null){i.value="";return}if(At(a)){i.value=fe(a);return}const u=fe(a.requirement?a.requirement:j(()=>{var p;return kr((p=Pe(n))!=null?p:[])}),"h3"),l=fe(a.effectDisplay||"","b"),c=Pe(r)?fe(a.optionsDisplay||"","span"):"";i.value=fe(j(()=>d("span",null,[d(u,null,null),a.effectDisplay!=null?d("div",null,[d(l,null,null)]):null,a.optionsDisplay!=null?d("div",{class:"equal-spaced"},[d(c,null,null)]):null])))}),{comp:i,unref:s,Visibility:Se,isVisible:Ze,isHidden:_n}}});function tp(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=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(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):B("",!0)}var np=be(ep,[["render",tp],["__scopeId","data-v-5673325a"]]);const rp=hr(),ip=Symbol("Achievement");let Dn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function ap(e,...t){const n=ct(!1,!1),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(i=>{var c,p,h;const a=(c=e==null?void 0:e.call(i,i))!=null?c:{};a.id=Qt("achievement-"),a.type=ip,a[gt]=np;for(const g of t)(p=g.preConstruct)==null||p.call(g,a);a.earned=n,a.complete=function(){var b,v;if(n.value)return;n.value=!0;const g=a;if((b=g.onComplete)==null||b.call(g),g.display!=null&&s(g.showPopups)===!0){const k=s(g.display);let C;At(k)?C=fe(k):k.requirement!=null?C=fe(k.requirement):C=kr((v=g.requirements)!=null?v:[]),rp.info(d("div",null,[d("h3",null,[y("Treasure earned!")]),d("div",null,[d(C,null,null)])]))}},Object.assign(a,r),A(a,"visibility"),oe(a,"visibility",Se.Visible);const u=a.visibility;a.visibility=ha(()=>{const g=s(a.display);switch(ie.msDisplay){default:case Dn.All:return s(u);case Dn.Configurable:return s(a.earned)&&!(g!=null&&typeof g=="object"&&"optionsDisplay"in g)?Se.None:s(u);case Dn.Incomplete:return s(a.earned)?Se.None:s(u);case Dn.None:return Se.None}}),A(a,"display"),A(a,"mark"),A(a,"small"),A(a,"image"),A(a,"style"),A(a,"classes"),A(a,"showPopups"),oe(a,"showPopups",!0);for(const g of t)(h=g.postConstruct)==null||h.call(g,a);const l=t.reduce((g,b)=>{var v;return Object.assign(g,(v=b.getGatheredProps)==null?void 0:v.call(b,a))},{});if(a[dt]=function(){const{visibility:g,display:b,requirements:v,earned:k,image:C,style:$,classes:x,mark:I,small:R,id:L}=this;return{visibility:g,display:b,requirements:v,earned:k,image:C,style:s($),classes:x,mark:I,small:R,id:L,...l}},a.requirements){const g=a,b=[ri(g),Qd(()=>!g.earned.value),...Bt(a.requirements)?a.requirements:[a.requirements]];Pt(()=>{ie.active===Y.id&&Cr(b)&&g.complete()})}return a})}Qe.on("loadSettings",e=>{oe(e,"msDisplay",Dn.All)});const sp=Object.values(Dn).map(e=>({label:st(e),value:e}));Oi(j(()=>d(ti,{title:j(()=>d("span",{class:"option-title"},[y("Show achievements"),d("desc",null,[y("Select which achievements to display based on criterias.")])])),options:sp,"onUpdate:modelValue":e=>ie.msDisplay=e,modelValue:ie.msDisplay},null)));const op=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:a}=Ae(e),u=w(()=>{let p=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(p,0),1))*100}),l=w(()=>{const p={width:Pe(n)+.5+"px",height:Pe(r)+.5+"px"};switch(s(i)){case W.Up:p.clipPath=`inset(${u.value}% 0% 0% 0%)`,p.width=Pe(n)+1+"px";break;case W.Down:p.clipPath=`inset(0% 0% ${u.value}% 0%)`,p.width=Pe(n)+1+"px";break;case W.Right:p.clipPath=`inset(0% ${u.value}% 0% 0%)`;break;case W.Left:p.clipPath=`inset(0% 0% 0% ${u.value} + '%)`;break;case W.Default:p.clipPath="inset(0% 50% 0% 0%)";break}return p}),c=Rn(a);return{normalizedProgress:u,barStyle:l,component:c,unref:s,Visibility:Se,isVisible:Ze,isHidden:_n}}});function lp(e,t,n,r,i,a){var c,p,h,g,b,v,k;const u=Ct("MarkNode"),l=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,(v=e.unref(e.style))!=null?v:{},(k=e.unref(e.fillStyle))!=null?k:{}])},null,4)],4),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):B("",!0)}var up=be(op,[["render",lp],["__scopeId","data-v-6bd06b56"]]);const cp=Symbol("Bar");function dp(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return et(r=>{var u,l;const i=e.call(r,r);i.id=Qt("bar-"),i.type=cp,i[gt]=up;for(const c of t)(u=c.preConstruct)==null||u.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)(l=c.postConstruct)==null||l.call(c,i);const a=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:v,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:v,style:s(k),classes:C,borderStyle:$,textStyle:x,baseStyle:I,fillStyle:R,mark:L,id:ce,...a}},i})}function pp(e,...t){return et(n=>{var i,a;const r=e.call(n,n);for(const u of t)(i=u.preConstruct)==null||i.call(u,r);r.formula=r.formula(f.variable(r.baseResource)),r.currentGain==null&&(r.currentGain=w(()=>{let u=o.floor(r.formula.evaluate(r.baseResource.value)).max(0);return s(r.buyMax)===!1&&(u=u.min(1)),u})),r.actualGain==null&&(r.actualGain=r.currentGain),r.currentAt==null&&(r.currentAt=w(()=>r.formula.invert(o.floor(s(r.currentGain))))),r.nextAt==null&&(r.nextAt=w(()=>r.formula.invert(o.floor(s(r.currentGain)).add(1)))),r.convert==null&&(r.convert=function(){var l;const u=s(r.currentGain);r.gainResource.value=o.add(r.gainResource.value,u),r.spend(u),(l=r.onConvert)==null||l.call(r,u)}),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 u of t)(a=u.postConstruct)==null||a.call(u,r);return r})}function fp(e){return pp(e)}function gp(e,t,n=1,r=o.dInf){const i=_e(n),a=_e(r);e.on("preUpdate",u=>{const l=s(i);o.neq(l,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(l,u).times(o.ceil(s(t.actualGain)))).min(s(a)).max(t.gainResource.value))})}const mp={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=w(()=>{var t;return o.add(s((t=e.amount)!=null?t:0),s(e.bonusAmount))}))}},ia=Symbol("Repeatable");function wi(e,...t){const n=ct(0),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(i=>{var b,v,k;const a=e.call(i,i);a.id=Qt("repeatable-"),a.type=ia,a[gt]=ea;for(const C of t)(b=C.preConstruct)==null||b.call(C,a);a.amount=n,a.amount[Kt]=(v=a.initialAmount)!=null?v:0,Object.assign(a,r);const u={requirementMet:w(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:Se.None,canMaximize:!0},l=ri(a);Bt(a.requirements)?(a.requirements.unshift(l),a.requirements.push(u)):a.requirements=[l,a.requirements,u],a.maxed=w(()=>o.gte(a.amount.value,s(a.limit))),A(a,"classes");const c=a.classes;a.classes=w(()=>{const C=s(c)||{};return a.maxed.value&&(C.bought=!0),C}),a.amountToIncrease=w(()=>o.clampMin(na(a.requirements),1)),a.canClick=w(()=>Cr(a.requirements));const p=a.onClick;a.onClick=function(C){var I;const $=a;if(!s($.canClick))return;const x=(I=s(a.amountToIncrease))!=null?I:1;ra(a.requirements,x),$.amount.value=o.add($.amount.value,x),p==null||p(C)},A(a,"display");const h=a.display;a.display=j(()=>{var $,x,I;const C=s(h);if(At(C)){const R=fe(C);return d(R,null,null)}if(C!=null){const R=a,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,[y("Amount: "),ut(R.amount.value)]),o.isFinite(s(R.limit))?d(ne,null,[y(" / "),ut(s(R.limit))]):void 0]),C.effectDisplay==null?null:d("div",null,[d("br",null,null),y("Currently: "),d(le,null,null)]),R.maxed.value?null:d("div",null,[d("br",null,null),kr(R.requirements,s(a.amountToIncrease))])])}return""}),A(a,"visibility"),oe(a,"visibility",Se.Visible),A(a,"limit"),oe(a,"limit",o.dInf),A(a,"style"),A(a,"mark"),A(a,"small");for(const C of t)(k=C.postConstruct)==null||k.call(C,a);const g=t.reduce((C,$)=>{var x;return Object.assign(C,(x=$.getGatheredProps)==null?void 0:x.call($,a))},{});return a[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:s(x),classes:I,onClick:R,canClick:L,small:ce,mark:le,id:ae,...g}},a})}const vp=Symbol("Reset");function hp(e){return et(t=>{const n=e.call(t,t);return n.id=Qt("reset-"),n.type=vp,n.reset=function(){var i;const r=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof o)&&!(a instanceof f)){if(Kn in a&&a[Kn]===!0)return;if(Kt in a){const u=a;u.value=u[Kt]}else!(a instanceof o)&&!Ve(a)&&Object.values(a).forEach(u=>r(u))}};s(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,zi(t.pinned)):e.pinned=t.pinned);const n=e[gt];e[gt]=qe;const r=e[dt].bind(e);e[dt]=function(){const{display:a,classes:u,style:l,direction:c,xoffset:p,yoffset:h,pinned:g}=this;return{element:{[gt]:n,[dt]:r},display:a,classes:u,style:s(l),direction:c,xoffset:p,yoffset:h,pinned:g}}.bind(t)}),t}var bp=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 a=Pe(t);if(a==null){i.value="";return}if(At(a)){i.value=fe(a);return}const u=fe(a.title||"","h3"),l=fe(a.description,"div"),c=fe(a.effectDisplay||"");i.value=fe(j(()=>d("span",null,[a.title!=null?d("div",null,[d(u,null,null)]):null,d(l,null,null),a.effectDisplay!=null?d("div",null,[y("Currently: "),d(c,null,null)]):null,r.value?null:d(ne,null,[d("br",null,null),kr(n.value)])])))}),{component:i,unref:s,Visibility:Se,isVisible:Ze,isHidden:_n}}});const yp=["disabled"];function wp(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=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(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],14,yp)):B("",!0)}var _p=be(bp,[["render",wp],["__scopeId","data-v-9be6bac0"]]);const ii=Symbol("Upgrade");function _i(e,...t){const n=ct(!1,!1),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return et(i=>{var c,p;const a=e.call(i,i);a.id=Qt("upgrade-"),a.type=ii,a[gt]=_p;for(const h of t)(c=h.preConstruct)==null||c.call(h,a);a.bought=n,Object.assign(a,r),a.canPurchase=w(()=>!n.value&&Cr(a.requirements)),a.purchase=function(){var g;const h=a;!s(h.canPurchase)||(ra(a.requirements),n.value=!0,(g=h.onPurchase)==null||g.call(h))};const u=ri(a);Bt(a.requirements)?a.requirements.unshift(u):a.requirements=[u,a.requirements],A(a,"visibility"),oe(a,"visibility",Se.Visible),A(a,"classes"),A(a,"style"),A(a,"display"),A(a,"mark");for(const h of t)(p=h.postConstruct)==null||p.call(h,a);const l=t.reduce((h,g)=>{var b;return Object.assign(h,(b=g.getGatheredProps)==null?void 0:b.call(g,a))},{});return a[dt]=function(){const{display:h,visibility:g,style:b,classes:v,requirements:k,canPurchase:C,bought:$,mark:x,id:I,purchase:R}=this;return{display:h,visibility:g,style:s(b),classes:v,requirements:k,canPurchase:C,bought:$,mark:x,id:I,purchase:R,...l}},a})}function Np(e,t,n=[]){n=n.length===0?Xn(e,ii):n;const r=Yn(t)?w(t):t;e.on("update",()=>{s(r)&&n.forEach(i=>i.purchase())})}function Cp(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 kp={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;rn-20&&(a+=40);const[u,l,c]=Ip(a,r,i);return`rgb(${u*255}, ${l*255}, ${c*255})`}function Mp(e,t,n){const r=Math.max(e,t,n),i=r-Math.min(e,t,n),a=i&&(r==e?(t-n)/i:r==t?2+(n-e)/i:4+(e-t)/i);return[60*(a<0?a+6:a),r&&i/r,r]}function Ip(e,t,n){const r=(i,a=(i+e/60)%6)=>n-n*t*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}const ki=hr();function aa(e,t,n,r){return Kr(e,function(){const i=Cp(0,n>>0,n>>32,1);for(let V=0;V<12;V++)i();const a=qr(i),u=Ln([.56,.74,.73],i),l=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 v=g+h+1,k=m.toolNodes.value.sandRelic!=null?te("sandRelic")?2:1:0,C=ct(k),$=w(()=>("increaseRewards"in b?v+1:v)+C.value);let x="relic"in b?h+2:Math.ceil(i()*(h+2));"increaseLength"in b&&x++;const I=[],R=Mt(()=>I),L=w(()=>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:w(()=>s(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:()=>s(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=w(()=>o.add(v,i()-.5).pow_base(2).times(10).times(he.evaluate()));for(let V=0;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:()=>m.toolNodes.value.unobtainiumRelic==null})),display:{title:Xe,description:je},visibility:w(()=>ye.value.length!==x&&s(Ee))}));ae({feature:we,canClick:()=>we.canPurchase.value,modifier:Oe(),cost:Te,previewCost:w(()=>m.toolNodes.value.unobtainiumRelic==null?Te:0),showETA:()=>!we.bought.value,previewModifier:me}),I.push(Oe(()=>Z==="add"?m.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(w(()=>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(w(()=>o.sub(Ie.value,Te).times(2).add(1).pow(2).clampMax(100).times(He))),me=w(()=>xe(o.times(He,s(ue.totalAmount)))+"/s"),Ee=Ht(()=>({addend:()=>o.times(He,s(ue.totalAmount)),description:je,enabled:()=>o.gt(s(ue.totalAmount),0)})),we=Ht(()=>({addend:()=>o.add(s(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(w(()=>o.sub(Ie.value,Te).times(2).add(1).pow(2).clampMax(100).pow_base(He).sub(1).times(lt))),me=w(()=>"x"+xe(o.pow(He,s(ue.totalAmount)))),Ee=Ce(()=>({multiplier:()=>o.pow(He,s(ue.totalAmount)),description:je,enabled:()=>o.gt(s(ue.totalAmount),0)})),we=Ce(()=>({multiplier:()=>o.add(s(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:()=>m.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>m.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:je,description:`${Oe}

Amount: ${ut(ue.amount.value)}${o.gt(s(ue.bonusAmount),0)?` [+${ut(s(ue.bonusAmount))}]`:""}`,effectDisplay:s(me),showAmount:!1}),visibility:w(()=>ye.value.length!==x&&s(Je)),limit:100,bonusAmount:()=>o.gt(ue.amount.value,0)?te("dirtRelic")?2:m.toolNodes.value.dirtRelic!=null?1:0:0}),mp);ae({feature:ue,canClick:()=>s(ue.canClick),modifier:Ee,cost:de,previewModifier:we,previewCost:w(()=>m.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(w(()=>o.sub(Ie.value,je).add(1).pow10().times(Oe)));const me=fp(()=>({baseResource:In(c),gainResource:E,formula:Tr=>Tr.div(Z).pow(Te).times(w(()=>m.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,[y("Reset "),c.displayName,y(" for")," ",vr(E,o.clampMin(me.actualGain.value,1))," ",E.displayName,d("br",null,null),d("div",null,[y("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:w(()=>ye.value.length!==x&&s(Ee))})),{isHovering:He}=ae({feature:ue,canClick:()=>s(ue.canClick),modifier:at,cost:Z,previewCost:c,previewModifier:Je}),lt=w(()=>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"},[y("You have")," ",d("h2",{style:{color:U,textShadow:`0px 0px 10px ${U}`}},[Vn()])," ",E.displayName,y(","),d("br",null,null),y("providing a "),tt(),y("x multiplier to previous")," ",c.displayName,y(" gain")]):null,Rr(ue)])),gp(this,me,()=>ye.value.lengthsn(me,Ee.value,!0,10)),de=w(()=>sn(me,o.add(Ee.value,1),!0,10)),at=w(()=>o.pow(Oe,Ee.value)),Je=Ce(()=>({multiplier:at,description:Te,enabled:()=>Ze(lt.visibility)})),ue=Ue;he=he.add(w(()=>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=dp(()=>({direction:W.Right,width:300,height:20,progress:()=>o.sub(E.value,we.value).div(o.sub(de.value,we.value)).toNumber(),visibility:w(()=>ye.value.length!==x&&s(U)),xp:E,display:j(()=>d("span",null,[xe(E.value),y("/"),xe(de.value)])),fillStyle:`background-color: ${He}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",Vn=>{if(ye.value.lengthtt.state.id===e)&&Ze(lt.visibility)){let tt=o.times(pt.value,Vn);m.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"},[y("You have "),d("h3",null,[Te]),y(" Lv. "),ut(Ee.value),y(","),d("br",null,null),y("providing a "),xe(at.value),y("x multiplier to previous")," ",c.displayName,y(" 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(w(()=>o.sub(Ie.value,Te).add(1).pow_base(32).add(1).log2().add(1).times(Xe)));const je=w(()=>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(v,i()-.5).pow_base(2).times(10).recip(),at=K.value,Je=f.variable(w(()=>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(w(()=>o.add(tt.amount.value,lt.value))),tt=wi(()=>({display:{title:He,description:j(()=>d("div",null,[d("div",null,[y("Amount:")," ",xe(o.add(lt.value,tt.amount.value))," ",y("["),ut(tt.amount.value),y("]")])])),effectDisplay:j(()=>d("span",null,[oa()," ",we===0?U.displayName:["First","Second","Third","Fourth"][we-1]+" "+E+" Dimension",y("/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:w(()=>ye.value.length!==x&&s(me))}));Ee.push(tt);const Tr=vi(tt),oi=w(()=>s(tt.canClick)&&Tr.value),sa=new f({inputs:[Je],evaluate(li){return o.sub(li,1).pow_base(2).times(de).times(o.add(li,lt.value))}}),oa=hn(sa,oi);ce.push({shouldShowPreview:oi,cost:w(()=>te("unobtainiumRelic")?0:sn(ue,tt.amountToIncrease.value))});const la=Er(c,L,()=>Me(ue));Or(tt,{display:la,direction:W.Down}),Ue=he.evaluate(),Ie.value++}this.on("preUpdate",we=>{if(ye.value.lengthde.state.id===e)&&Ze(me)){let de=o.times(pt.value,we);m.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&&s(me))?d("div",{style:"margin: 10px"},[y("You have")," ",d("h2",{style:{color:Z,textShadow:`0px 0px 10px ${Z}`}},[xe(U.value)])," ",U.displayName,y(","),d("br",null,null),y("providing a "),xe(je.value),y("x multiplier to previous")," ",c.displayName,y(" gain")]):null,Xs(...Ee)]));break}case"prestige":{const E=xn(i),U=vt,Z=i()/10+1.1,Te=K.value;he=he.pow(Z);const Xe=Nd(()=>({exponent:Z,description:E,enabled:me.bought}));Ue=he.evaluate(),Ie.value+=20;const je=J.filter((we,de)=>de%2===0),Oe=hp(()=>({thingsToReset:je,onReset(){c.value=0}})),me=_i(()=>({display:{title:E,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${xe(Z)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{te("unobtainiumRelic")||Oe.reset()},visibility:w(()=>ye.value.length!==x&&s(U)),requirements:Bn(()=>({resource:In(c),cost:Te,requiresPay:!1}))})),Ee=Ce(()=>({multiplier:0}));ae({feature:me,canClick:()=>s(me.canPurchase),modifier:Xe,cost:Te,previewCost:w(()=>te("unobtainiumRelic")?0:c.value),previewModifier:Ee,showETA:()=>!s(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 m.grantResource(it,o.times((Z=(U=(E=m.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=>m.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 m.influenceNodes.value){ki.warning(`You already have a ${yt[O].display} influence, skipping treasure`);return}const E={id:An(m.board),position:{...m.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"influence",state:{type:O,data:yt[O].initialData}};m.board.placeInAvailableSpace(E),m.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 m.toolNodes.value)ki.warning(`You already have a ${Ft[t]} relic, skipping treasure`);else{const E={id:An(m.board),position:{...m.board.types.portal.nodes.value.find(U=>U.state.id===e).position},type:"passive",state:`${t}Relic`};m.board.placeInAvailableSpace(E),m.board.nodes.value.push(E)}}}const Dr=vt,Mn=K.value,fn=ap(()=>({requirements:Bn(()=>({resource:In(c),cost:Mn})),visibility:w(()=>s(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,ia);I.push(Ce(()=>({multiplier:()=>te("silver")?4:2,description:()=>(te("silver")?"Empowered ":"")+ze.silver.name,enabled:()=>m.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:()=>m.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:()=>m.toolNodes.value.emerald!=null})),Ce(()=>({multiplier:()=>o.div(nt.reduce((V,z)=>V.add(s(z.totalAmount)),o.dZero),100).times(te("gravelRelic")?2:1).add(1).pow(.75),description:()=>(te("gravelRelic")?"Empowered ":"")+Ft.gravel,enabled:()=>m.toolNodes.value.gravelRelic!=null})),Ce(()=>({multiplier:()=>o.add(m.energy.value,1).log10().add(1).pow(te("beryliumRelic")?.5:.25),description:()=>(te("beryliumRelic")?"Empowered ":"")+Ft.berylium,enabled:()=>m.toolNodes.value.beryliumRelic!=null})));const ht=Mt(()=>[Ce(()=>({multiplier:()=>{var V,z,De;return o.add((De=(z=(V=m.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=m.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:()=>m.toolNodes.value.coalRelic!=null}))]),pt=w(()=>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,[y("Modifiers")]),body:()=>ot(St)}));this.on("preUpdate",V=>{if(!m.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{var rt;(rt=De.update)==null||rt.call(De,z)})}),Np(this,()=>ye.value.lengthye.value.length{const V=ce.find(z=>z.shouldShowPreview.value);return V?o.neg(Me(V.cost)):0}),On=w(()=>{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=w(()=>{const V=[];return ye.value.forEach(z=>{z.link&&V.push(z.link)}),V}),ar=w(()=>{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=w(()=>{const V=[];for(let z=1;zo.lt(ye.value.length,x)&&J.some(V=>V.some(z=>"earned"in z&&s(z.earned)||"bought"in z&&s(z.bought)?!1:("canClick"in z&&s(z.canClick)||"canPurchase"in z&&s(z.canPurchase),!0)))),xr=w(()=>{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(){m.board.selectedNode.value=m.portalNodes.value[e]},style:"min-height: 30px; width: 200px; margin-bottom: 20px"}));return{tier:ct(t),seed:ct(n),influences:ct(r),name:a,color:u,resource:c,background:l,style:{background:l,"--background":l},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,[a])]),d("span",{class:"nav-segment"},[d("h3",null,[t,y("-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("
"),direction:W.Down,style:"width: 300px"},{default:()=>[d("h3",null,[r.length,y(" influence"),r.length===1?"":"s"])]})]),d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>kn.value=!0},[y("modifiers")])])]}),ye.value.length===x?null:d(mr,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[ot(tn)])," ",c.displayName]),d("span",{class:"nav-segment"},[y("("),d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[o.gt(L.value,0)?"+":"",ot(qn)]),y("/s)")]),o.neq(pt.value,1)?d("span",{class:"nav-segment"},[y("Speed: "),xe(pt.value),y("x")]):null]}),d(Kd,{height:ye.value.length===x?"30px":"60px"},null),ot($r),ye.value.length===x?d("div",null,[d("h1",{style:"color: var(--layer-color)"},[y("Plane Complete!")])]):null,xr.value,ye.value.length+1d("div",null,[d("span",null,[a]),d("span",{style:"font-size: large; vertical-align: sub;"},[" ",t,y("-tier |")," ",ye.value.length===x?d("span",null,[y("Plane Complete")]):d("span",null,[ye.value.length,y("/"),x,y(" treasures")])])]))}})}function Vr(e,t){t=t.filter(l=>l.type==="increaseResources"||l.type==="decreaseResources");const n=Object.keys(Tt).reduce((l,c)=>{let p=Tt[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?p*=1e3:p/=1e3}),l+p},0),r=Object.keys(Tt),i=Math.floor(e()*n);let a=0,u;for(let l=0;ll+c),r=Object.keys(e);let i=0,a=null;const u=t()*n;for(let l=0;le===m.board.selectedNode.value?{text:"Mining"}:Object.keys(m.resourceNodes.value).length===0?{text:"Click me!"}:null,actionDistance:Math.PI/4,actions:[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},$p={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>e===m.board.selectedNode.value?{text:"Broken Forge"}:null,actionDistance:Math.PI/4,actions:[{id:"repair",icon:"build",tooltip:{text:"Repair - 100 energy"},onClick(e){o.gte(m.energy.value,100)&&(e.type="factory",m.energy.value=o.sub(m.energy.value,100),m.helpModals.factory.showModal.value=!0)},confirmationLabel:()=>o.gte(m.energy.value,100)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"}}],draggable:!0},Dp={shape:Ge.Diamond,size:50,title:"\u{1F6E0}\uFE0F",label:e=>{var t,n;if(e===m.board.selectedNode.value)return{text:e.state==null?"Forge - Drag a resource to me!":`Forging ${ze[e.state].name}`};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="resource"){const r=((n=m.board.draggingNode.value)==null?void 0:n.state).type,i=e.state===r?"Disconnect":m.toolNodes.value[r]==null?ze[r].name:"Already crafted",a=e.state===r||m.toolNodes.value[r]==null?"var(--accent2)":"var(--danger)";return{text:i,color:a}}return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect resource"},onClick(e){e.state=void 0,m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>e.state!=null},{id:"craft",icon:"done",tooltip:e=>({text:`Forge ${ze[e.state].name} - ${Ye(ze[e.state].cost)} energy`}),onClick(e){const t=ze[e.state];if(o.gte(m.energy.value,t.cost)&&m.toolNodes.value[e.state]==null){m.energy.value=o.sub(m.energy.value,t.cost);const n={id:An(m.board),position:{...e.position},type:t.type,state:"state"in t?t.state:void 0};if(m.board.placeInAvailableSpace(n),m.board.nodes.value.push(n),e.state==="iron"){const r={id:An(m.board),position:{...e.position},type:"trashCan"};m.board.placeInAvailableSpace(r),m.board.nodes.value.push(r)}m.board.selectedAction.value=null,m.board.selectedNode.value=null,e.state=void 0,t.type in m.helpModals&&(m.helpModals[t.type].showModal.value=!0)}},fillColor:e=>o.gte(m.energy.value,ze[e.state].cost)&&m.toolNodes.value[e.state]==null?"var(--accent2)":"var(--danger)",visibility:e=>e.state!=null,confirmationLabel:e=>o.gte(m.energy.value,ze[e.state].cost)?m.toolNodes.value[e.state]==null?{text:"Tap again to confirm"}:{text:"Already crafted",color:"var(--danger)"}:{text:"Cannot afford",color:"var(--danger)"}},zt("factory")],progress:e=>e.state==null||m.toolNodes.value[e.state]!=null?0:o.div(o.sqrt(m.energy.value),o.sqrt(ze[e.state].cost)).clampMax(1).toNumber(),progressDisplay:un.Fill,progressColor:e=>e.state!=null&&o.gte(m.energy.value,ze[e.state].cost)?"var(--accent2)":"var(--foreground)",canAccept(e,t){var r;if(t.type!=="resource")return!1;const n=((r=m.board.draggingNode.value)==null?void 0:r.state).type;return m.toolNodes.value[n]==null},onDrop(e,t){const n=t.state.type;e.state===n?e.state=void 0:e.state=n,m.board.selectedNode.value=e},draggable:!0},Tp=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],Pp={shape:Ge.Circle,size:50,title:e=>st(e.state.type),subtitle:e=>Ye(e.state.amount),otherSubtitle:e=>Tp[Et.indexOf(e.state.type)],progress:e=>Md(e.state.type),onClick(){},progressDisplay:un.Outline,progressColor:"var(--accent3)",classes:e=>{var t;return{"affected-node":m.dowsing.value!=null&&ke(m.dowsing.value)&&m.dowsing.value.state.resources.includes(e.state.type)||o.neq((t=m.planarMultis.value[e.state.type])!=null?t:1,1)}},draggable:!0,showStar:e=>m.toolNodes.value[e.state.type]!=null,fillStar:e=>`${e.state.type}Relic`in m.toolNodes.value},Ap={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===m.board.selectedNode.value?{text:Vd[e.state].description(te(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":te(e.state)}),draggable:!0},Rp={shape:Ge.Diamond,size:50,title:"\u{1F962}",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Dowsing - Drag a resource to me!":`Dowsing (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:Ji(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:Ki,onDrop:Qi,draggable:!0},Ep={shape:Ge.Diamond,size:50,title:"\u26F0\uFE0F",label:e=>e===m.board.selectedNode.value?{text:e.state.resources.length===0?"Quarry - Drag a resource to me!":`Quarrying (${e.state.resources.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:Ji(e,t=>`Gather ${Nt(o.div(m.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(m.quarryProgressRequired.value,0)?0:new o(e.state.progress).div(m.quarryProgressRequired.value).toNumber():0,progressDisplay:un.Outline,progressColor:"var(--accent2)",canAccept:Ki,onDrop:Qi,classes:e=>({running:ke(e)}),draggable:!0},Fp={shape:Ge.Diamond,size:50,title:"\u{1F50C}",label:e=>e===m.board.selectedNode.value?{text:e.state.tools.length===0?"Empowerer - Drag a tool to me!":`Empowering (${e.state.tools.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}:Cd(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:kd,onDrop:Sd,classes:e=>({running:ke(e)}),draggable:!0},Op={shape:Ge.Diamond,size:50,title:"\u26E9\uFE0F",label:e=>{if(e===m.board.selectedNode.value)return{text:e.state.tier==null?"Portal Spawner - Drag a resource to me!":`Spawning ${e.state.tier}-tier portal`};const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type;return{text:e.state.tier===n?"Disconnect":`${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 a;return o.lt(i,1e3)?a=Ye(i):a=Ur(i,0),{text:`Add influence (${a}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${ge[t.state.id].name}`};return null},actionDistance:Math.PI/4,actions:[{id:"deselect",icon:"close",tooltip:{text:"Disconnect all"},onClick(e){e.state={...e.state,tier:void 0,influences:[]},m.board.selectedAction.value=null,m.board.selectedNode.value=null},visibility:e=>{const{tier:t,influences:n}=e.state;return t!=null||n.length>0}},{id:"makePortal",icon:"done",tooltip:e=>({text:`Spawn ${e.state.tier}-tier portal - ${Ye(m.computedPortalCost.value)} energy`}),fillColor:()=>o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--danger)",confirmationLabel:()=>o.gte(m.energy.value,m.computedPortalCost.value)?{text:"Tap again to confirm"}:{text:"Cannot afford",color:"var(--danger)"},onClick(e){if(o.lt(m.energy.value,m.computedPortalCost.value))return;let t=0;for(;`portal-${t}`in ge;)t++;m.energy.value=o.sub(m.energy.value,m.computedPortalCost.value);const{tier:n,influences:r}=e.state;Qr(aa(`portal-${t}`,n,Math.floor(Math.random()*4294967296),r.map(a=>m.influenceNodes.value[a].state)),Y);const i={id:An(m.board),position:{...e.position},type:"portal",state:{id:`portal-${t}`,powered:!1}};m.board.placeInAvailableSpace(i),m.board.nodes.value.push(i),m.board.selectedAction.value=null,m.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)}}m.board.selectedNode.value=e},progress:e=>e.state.tier==null?0:o.div(o.sqrt(m.energy.value),o.sqrt(m.computedPortalCost.value)).clampMax(1).toNumber(),progressDisplay:un.Fill,progressColor:e=>e.state.tier!=null&&o.gte(m.energy.value,m.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},qp={shape:Ge.Diamond,size:50,title:"\u{1F300}",label:e=>e===m.board.selectedNode.value?{text:`Portal to ${ge[e.state.id].name}`,color:ge[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[jt],classes:e=>({running:ke(e),showNotif:ge[e.state.id].showNotif.value,"affected-node":m.booster.value!=null&&ke(m.booster.value)&&m.booster.value.state.portals.includes(e.state.id)}),outlineColor:e=>ge[e.state.id].background,draggable:!0,onClick(e){m.board.selectedNode.value=e,ge[e.state.id].minimized.value=!1}},Vp={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===m.board.selectedNode.value){const n=e.state,r=yt[n.type].description;return{text:typeof r=="function"?r(n):r}}const t=m.board.draggingNode.value;if((t==null?void 0:t.type)==="resource"){const n=t.state.type,{type:r,data:i}=e.state;let a;if(Array.isArray(i)&&i.includes(n))a="Disconnect";else if(r==="increaseResources")a=`Increase ${st(n)} odds`;else if(r==="decreaseResources")a=`Decrease ${st(n)} odds`;else return null;return{text:a,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]},m.board.selectedNode.value=e)},outlineColor:"var(--danger)",draggable:!0},Bp={shape:Ge.Diamond,size:50,title:"\u231B",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Booster - Drag a portal to me!":`Boosting by ${Ye(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,m.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(m.energy.value,or.evaluate(e.state.level))?"var(--bought)":"var(--locked)"},confirmationLabel(e){return o.gte(m.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(m.energy.value,t)&&(m.energy.value=o.sub(m.energy.value,t),e.state={...e.state,level:o.add(e.state.level,1)},m.board.selectedAction.value=null)}},jt,zt("booster")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},Lp={shape:Ge.Diamond,size:50,title:"\u{1F916}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Upgrader - Drag a portal to me!":`Auto-Upgrading (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}: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},jp={shape:Ge.Diamond,size:50,title:"\u{1F9BE}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Automator - Drag a portal to me!":`Automatating (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}: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},zp={shape:Ge.Diamond,size:50,title:"\u{1F4B1}",label:e=>e===m.board.selectedNode.value?{text:e.state.portals.length===0?"Investments - Drag a portal to me!":`Investing (${e.state.portals.length}/${o.add(e.state.maxConnections,m.computedBonusConnectionsModifier.value)})`}: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},Gp={shape:Ge.Diamond,size:50,title:"\u{1F5D1}\uFE0F",label:e=>{var t;if(e===m.board.selectedNode.value)return{text:"Trash Can - Drag a portal to me!"};if(((t=m.board.draggingNode.value)==null?void 0:t.type)==="portal"){const n=m.board.draggingNode.value.state.id;return{text:`Delete ${ge[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;ei(ge[n]),delete Y.layers[n],m.board.state.value.nodes=m.board.state.value.nodes.filter(r=>r!==t),m.booster.value&&(m.booster.value.state={...m.booster.value.state,portals:m.booster.value.state.portals.filter(r=>r!==n)}),m.upgrader.value&&(m.upgrader.value.state={...m.upgrader.value.state,portals:m.upgrader.value.state.portals.filter(r=>r!==n)}),m.automator.value&&(m.automator.value.state={...m.automator.value.state,portals:m.automator.value.state.portals.filter(r=>r!==n)}),m.investments.value&&(m.investments.value.state={...m.investments.value.state,portals:m.investments.value.state.portals.filter(r=>r!==n)}),Y.tabs=Y.tabs.filter(r=>r!==n)},draggable:!0},Si=hr(),Up={mine:xp,brokenFactory:$p,factory:Dp,resource:Pp,passive:Ap,dowsing:Rp,quarry:Ep,empowerer:Fp,portalGenerator:Op,portal:qp,influence:Vp,booster:Bp,upgrader:Lp,automator:jp,investments:zp,trashCan:Gp},m=Kr("main",function(){const e=$n(0,"energy"),t=w(()=>v.types.resource.nodes.value.reduce((D,P)=>(D[P.state.type]=P,D),{})),n=w(()=>({...v.types.passive.nodes.value.reduce((D,P)=>(D[P.state]=P,D),{}),sand:v.types.dowsing.nodes.value[0],wood:v.types.quarry.nodes.value[0],coal:v.types.empowerer.nodes.value[0],iron:v.types.portalGenerator.nodes.value[0],gold:v.types.booster.nodes.value[0],platinum:v.types.upgrader.nodes.value[0],berylium:v.types.automator.nodes.value[0],ultimatum:v.types.investments.nodes.value[0]})),r=w(()=>Object.keys(Ft).filter(D=>`${D}Relic`in n.value).length),i=w(()=>({...v.types.influence.nodes.value.reduce((D,P)=>(D[P.state.type]=P,D),{})})),a=w(()=>({...v.types.portal.nodes.value.reduce((D,P)=>(D[P.state.id]=P,D),{})})),u=w(()=>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},{})),l=ln({}),c=ln({});Xt(()=>{Et.forEach(D=>{wt(()=>u.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)}`,y("!")]),o.gt(E,1)?d("div",null,[y("Gained "),ut(E),y(" levels")]):null]))})})});const p=w(()=>J.filter(D=>{var P,O;return(O=(P=D.value)==null?void 0:P.state)==null?void 0:O.powered}).length+v.types.portal.nodes.value.filter(D=>D.state.powered).length),h=w(()=>{let D=p.value;return n.value.copperRelic!=null&&(D--,te("copperRelic")&&D--),D}),g=w(()=>{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=w(()=>{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}),v=fd(D=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:Up,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const P=[];if(P.push(...Object.keys(l).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=>a.value[O]!=null).forEach(O=>{P.push({startNode:L.value,endNode:a.value[O],stroke:ke(L.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),ce.value!=null&&ce.value.state.portals.filter(O=>a.value[O]!=null).forEach(O=>{P.push({startNode:ce.value,endNode:a.value[O],stroke:"var(--foreground)",strokeWidth:4})}),le.value!=null&&le.value.state.portals.filter(O=>a.value[O]!=null).forEach(O=>{P.push({startNode:le.value,endNode:a.value[O],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(O=>a.value[O]!=null).forEach(O=>{P.push({startNode:ae.value,endNode:a.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=w(()=>v.types.mine.nodes.value[0]),C=w(()=>v.types.factory.nodes.value[0]),$=w(()=>n.value.sand),x=w(()=>n.value.wood),I=w(()=>n.value.coal),R=w(()=>n.value.iron),L=w(()=>n.value.gold),ce=w(()=>n.value.platinum),le=w(()=>n.value.berylium),ae=w(()=>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(v),position:{...k.value.position},type:"resource",state:{type:D,amount:P}},v.placeInAvailableSpace(O),v.nodes.value.push(O);else{const E=O.state;O.state={...E,amount:o.add(E.amount,P)}}}const he=w(()=>Object.keys(Tt).reduce((D,P)=>D+new o(tn[P].computedModifier.value).toNumber(),0)),Ue=w(()=>{const D={};return v.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:()=>u.value[D],enabled:()=>o.gt(u.value[D],0)})))),K=w(()=>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=w(()=>$e.apply(0)),ht=Mt(()=>[Ht(()=>({addend:()=>te("unobtainium")?2:1,description:()=>(te("unobtainium")?"Empowered ":"")+ze.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),pt=w(()=>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=w(()=>St.apply(1)),kn=Mt(()=>[Ce(()=>({multiplier:()=>te("gravel")?4:2,description:()=>(te("gravel")?"Empowered ":"")+ze.gravel.name,enabled:()=>n.value.gravel!=null}))]),rr=w(()=>kn.apply(1)),Fn=Mt(()=>[Ht(()=>({addend:()=>te("copper")?.004:.002,description:()=>(te("copper")?"Empowered ":"")+ze.copper.name,enabled:()=>n.value.copper!=null}))]),On=w(()=>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=w(()=>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=w(()=>O.apply(1)),U={title:`${st(P)} Gain`,modifier:O};return D[P]={modifier:O,computedModifier:E,section:U},D},{}),ir=w(()=>{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=w(()=>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=Xi({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,[y("Modifiers")]),body:()=>ot(We)})),xt={mine:jd(),factory:zd(),dowsing:Gd(),quarry:Ud(),empowerer:Wd(),portalGenerator:Hd(),booster:Yd(),upgrader:Zd(),automator:Xd(),investments:Jd()};xt.mine.showModal[Kt]=!0,xt.mine.showModal.value=!0,this.on("preUpdate",D=>{if(Object.keys(l).forEach(P=>{l[P]-=D,l[P]<=0&&delete l[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)),l[Z]=.3});const U=o.sub(O,E).toNumber();for(let Z=0;Z0){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(a.value).forEach(P=>{P.state.powered=!1}),k.value.state={...k.value.state,powered:!1},Si.warning(d("div",null,[d("h3",null,[y("Ran out of energy!")]),d("div",null,[y("All machines have been turned off.")])])))});const it=w(()=>{var D,P;return v.selectedAction.value===v.types.brokenFactory.actions[0]?-100:v.selectedAction.value===v.types.factory.actions[1]?o.neg(ze[v.selectedNode.value.state].cost):((D=v.selectedAction.value)==null?void 0:D.id)==="moreConnections"?o.neg(v.selectedAction.value.formula.evaluate(((P=v.selectedNode.value)==null?void 0:P.state).maxConnections)):0}),Wt=hn(f.variable(0).add(e),()=>o.neq(it.value,0),it),nn=w(()=>{var D;return v.selectedAction.value===jt?((D=v.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=w(()=>v.types.portal.nodes.value.filter(D=>ke(D))),fn=w(()=>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:v,energy:e,modifierTabs:We,resourceNodes:t,toolNodes:n,influenceNodes:i,portalNodes:a,grantResource:Ie,activePortals:Mn,nextPowerCost:g,computedBonusConnectionsModifier:pt,quarryProgressRequired:b,dropRates:tn,dowsing:$,empowerer:I,booster:L,upgrader:ce,automator:le,investments:ae,resourceLevels:u,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)])," ",y("energy")]),d("span",{class:"nav-segment"},[y("("),d("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(nt.value,0)?"+":"",ot(Dr)]),y("/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"," ",y("powered")]):null,d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>Rt.value=!0},[y("modifiers")])]),Y.devSpeed===0?d("span",{class:"nav-segment"},[y("Game Paused")]):Y.devSpeed!=null&&Y.devSpeed!==1?d("span",{class:"nav-segment"},[y("Dev Speed: "),xe(Y.devSpeed),y("x")]):null]}),ot(v),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"},[y("Always show lines to resource nodes"),d("desc",null,[y("Otherwise, will only be visible when either end of the line is selected.")])])),modelValue:ie.lineVisibility,"onUpdate:modelValue":e=>ie.lineVisibility=e},null)));const Wp=e=>{var n,r,i,a,u;const t=[m];return(u=(a=(i=(r=(n=e.layers)==null?void 0:n.main)==null?void 0:r.board)==null?void 0:i.state)==null?void 0:a.nodes)==null||u.filter(l=>(l==null?void 0:l.type)==="portal").map(l=>{var c,p;return(p=(c=l==null?void 0:l.state)==null?void 0:c.id)!=null?p:""}).forEach(l=>{var p,h,g,b;const c=(p=e.layers)==null?void 0:p[l];t.push(aa(l,(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 Hp(e,t){}var Yp=Object.freeze(Object.defineProperty({__proto__:null,main:m,getInitialLayers:Wp,hasWon:ai,fixOldSave:Hp},Symbol.toStringTag,{value:"Module"}));const nr=e=>(cn("data-v-4a50ce42"),e=e(),dn(),e),Zp={class:"game-over-modal-header"},Xp=["src","alt"],Jp={class:"game-over-modal-title"},Kp=nr(()=>N("h2",null,"Congratulations!",-1)),Qp={key:0},ef=nr(()=>N("br",null,null,-1)),tf=nr(()=>N("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),nf=nr(()=>N("br",null,null,-1)),rf=["href"],af=nr(()=>N("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),sf=X({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:a,versionTitle:u}=ve,l=w(()=>yr(Y.timePlayed)),c=w(()=>ai.value&&!Y.keepGoing),p=Jt(Y,"autosave");function h(){Y.keepGoing=!0}function g(){bn(Tn())}return(b,v)=>(S(),re(Lt,{"model-value":s(c)},{header:H(()=>[N("div",Zp,[s(n)?(S(),T("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,Xp)):B("",!0),N("div",Jp,[Kp,N("h4",null,"You've beaten "+ee(s(t))+" v"+ee(s(a))+": "+ee(s(u)),1)])])]),body:H(({shown:k})=>[k?(S(),T("div",Qp,[N("div",null,"It took you "+ee(s(l))+" to beat the game.",1),ef,tf,nf,N("div",null,[N("a",{href:s(i),class:"game-over-modal-discord-link"},[af,y(" "+ee(s(r)),1)],8,rf)]),d($t,{title:"Autosave",modelValue:s(p),"onUpdate:modelValue":v[0]||(v[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 of=be(sf,[["__scopeId","data-v-4a50ce42"]]);const Sr=e=>(cn("data-v-2776d67d"),e=e(),dn(),e),lf=Sr(()=>N("div",{class:"nan-modal-header"},[N("h2",null,"NaN value detected!")],-1)),uf={key:0},cf=Sr(()=>N("br",null,null,-1)),df=["href"],pf=Sr(()=>N("span",{class:"material-icons nan-modal-discord"},"discord",-1)),ff=Sr(()=>N("br",null,null,-1)),gf={class:"nan-footer"},mf=X({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=ve,r=G(!0),i=G(!0),a=Jt(Fe,"hasNaN"),u=G(null);wt(a,b=>{b?(r.value=Y.autosave,i.value=Y.devSpeed===0):(Y.autosave=r.value,Y.devSpeed=i.value?0:null)});const l=w(()=>{var b;return(b=Fe.NaNPath)==null?void 0:b.join(".")}),c=w(()=>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,v)=>(S(),T(ne,null,[d(Lt,Vt({modelValue:s(a),"onUpdate:modelValue":v[4]||(v[4]=k=>Ve(a)?a.value=k:null)},b.$attrs),{header:H(()=>[lf]),body:H(()=>[N("div",null,[y(' Attempted to assign "'+ee(s(l))+'" to NaN',1),s(c)?(S(),T("span",uf,ee(" ")+"(previously "+ee(s(xe)(s(c)))+")",1)):B("",!0),y(". 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)]),cf,N("div",null,[N("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[pf,y(" "+ee(s(t)||"The Paper Pilot Community"),1)],8,df)]),ff,d($t,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=k=>r.value=k)},null,8,["modelValue"]),s(ve).enablePausing?(S(),re($t,{key:0,title:"Pause game",modelValue:i.value,"onUpdate:modelValue":v[1]||(v[1]=k=>i.value=k)},null,8,["modelValue"])):B("",!0)]),footer:H(()=>[N("div",gf,[N("button",{onClick:v[2]||(v[2]=k=>{var C;return(C=u.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"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(S(),T("button",{key:0,onClick:v[3]||(v[3]=k=>a.value=!1),class:"button"}," Set to previous ")):B("",!0),N("button",{onClick:g,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),d(Wi,{ref_key:"savesManager",ref:u},null,512)],64))}});var vf=be(mf,[["__scopeId","data-v-2776d67d"]]);const hf={key:0,class:"tpsDisplay"},bf=X({__name:"TPS",setup(e){const t=w(()=>o.div(Fe.lastTenTicks.length,Fe.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>s(t).isNan()?B("",!0):(S(),T("div",hf,"TPS: "+ee(s(ut)(s(t))),1))}});var yf=be(bf,[["__scopeId","data-v-89b89152"]]);var wf=X({__name:"App",setup(e){const t=ve.useHeader,n=w(()=>It[ie.theme].variables),r=Jt(ie,"showTPS"),i=Jt(Fe,"errors"),a=w(()=>fe(j(()=>d(ne,null,[Us.map(ot)]))));return(u,l)=>s(i).length>0?(S(),T("div",{key:0,class:"error-container",style:Le(s(n))},[d(xi,{errors:s(i)},null,8,["errors"])],4)):(S(),T(ne,{key:1},[N("div",{id:"modal-root",style:Le(s(n))},null,4),N("div",{class:Ne(["app",{useHeader:s(t)}]),style:Le(s(n))},[s(t)?(S(),re(Hi,{key:0})):B("",!0),d(Ac),s(s(r))?(S(),re(yf,{key:1})):B("",!0),d(of),d(vf),(S(),re(Ke(s(a))))],6)],64))}});var _f=be(wf,[["__scopeId","data-v-bf4e22ac"]]);function Nf(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:u}=e;let l,c,p,h;const g=async(v=!0)=>{await p,v&&(l==null||l.addEventListener("controlling",k=>{k.isUpdate&&window.location.reload()})),await(h==null?void 0:h())};async function b(){if("serviceWorker"in navigator){const{Workbox:v,messageSW:k}=await Hn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await k(c.waiting,{type:"SKIP_WAITING"})},l=new v("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",C=>{C.isUpdate||r==null||r()});{const C=()=>{n==null||n()};l.addEventListener("waiting",C),l.addEventListener("externalwaiting",C)}l.register({immediate:t}).then(C=>{c=C,a?a("./sw.js",C):i==null||i(C)}).catch(C=>{u==null||u(C)})}}return p=b(),g}function Cf(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:u}=e,l=G(!1),c=G(!1);return{updateServiceWorker:Nf({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,r==null||r()},onRegistered:i,onRegisteredSW:a,onRegisterError:u}),offlineReady:c,needRefresh:l}}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 Bs();const{globalBus:e}=await Hn(()=>Promise.resolve().then(function(){return Vs}),void 0),{startGameLoop:t}=await Hn(()=>import("./gameLoop.a8abe3ac.js"),["assets/gameLoop.a8abe3ac.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=ba(_f);n.config.errorHandler=function(r,i,a){console.error(r,a,i)},e.emit("setupVue",n),n.mount("#app"),Xt(()=>{const r=hr(),{updateServiceWorker:i}=Cf({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(a){a&&setInterval(()=>a.update(),60*60*1e3)}})}),t()});export{o as D,Hn as _,Fe as a,ve as b,Yp as c,Qe as g,Ls as l,Y as p,ie as s}; diff --git a/assets/index.a00e3eeb.js b/assets/index.a00e3eeb.js deleted file mode 100644 index f2d4a3b..0000000 --- a/assets/index.a00e3eeb.js +++ /dev/null @@ -1,21 +0,0 @@ -/* empty css */import"./vue.c16a309b.js";import{q as on,C as s,ab as Z,t as G,aF as S,a1 as P,aL as qt,bv as Dn,G as Ne,as as Yt,_ as w,az as Kn,a2 as N,J as ee,O as ne,aK as Dt,a0 as B,I as Le,a8 as y,a9 as d,b7 as H,aI as un,aG as cn,l as Ve,u as Br,b2 as wt,aD as ki,w as _t,b3 as Pt,ap as oa,aH as sr,A as Pe,$ as re,b9 as Lr,ar as Vt,bt as la,bc as Un,T as ua,j as ca,bw as Bt,ay as da,aM as Ct,aO as Je,z as Zt,bo as pa,bs as fa,bd as li,am as dr,H as ga,bx as ma,bf as va}from"./@vue.6b211d3c.js";import{L as Wt}from"./lz-string.dccec454.js";import{c as Si}from"./nanoevents.1080beb7.js";import{Y as ha}from"./vue-next-select.ded54c4a.js";import{D as ba}from"./vuedraggable.1879de79.js";import{p as ya}from"./vue-textarea-autosize.35804eaf.js";import{P as wa}from"./vue-panzoom.8ce6f9b1.js";import{s as _a,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 Na=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 a of i)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerpolicy&&(a.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?a.credentials="include":i.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}};Na();const Ca="modulepreload",ui={},ka="./",Wn=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${ka}${r}`,r in ui)return;ui[r]=!0;const i=r.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${a}`))return;const u=document.createElement("link");if(u.rel=i?"stylesheet":Ca,i||(u.as="script",u.crossOrigin=""),u.href=r,document.head.appendChild(u),i)return new Promise((l,c)=>{u.addEventListener("load",l),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())},Sa="./projInfo-schema.json",Ma="Planar Pioneers",Ia="A game about controlling and exploiting planes!",xa="planar-pioneers",$a="thepaperpilot",Da="",Ta="",Pa="0.0",Aa="Initial Commit",Ra=!1,Ea=!1,Fa=2,Oa=!0,qa=null,Va="",Ba=["main"],La=3600,ja=0,za=!0,Ga="base64";var ve={$schema:Sa,title:Ma,description:Ia,id:xa,author:$a,discordName:Da,discordLink:Ta,versionNumber:Pa,versionTitle:Aa,allowGoBack:Ra,defaultShowSmall:Ea,defaultDecimalsShown:Fa,useHeader:Oa,banner:qa,logo:Va,initialTabs:Ba,maxTickLength:La,offlineLimit:ja,enablePausing:za,exportEncoding:Ga};const Ua=on({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var Y=window.player=Ua;function jr(e){return JSON.stringify(e,(t,n)=>s(n))}var be=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const Wa=["onClick"],Ha=Z({__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,Yt(()=>{n.value=!0,r.value=setTimeout(()=>n.value=!1,500)})}return(a,u)=>(S(),P("button",{onClick:Dn(i,["stop"]),class:Ne(["feedback",{activated:n.value,left:e.left}])},[qt(a.$slots,"default",{},void 0,!0)],10,Wa))}});var zr=be(Ha,[["__scopeId","data-v-01a1b95c"]]);const br=e=>(un("data-v-ac351c02"),e=e(),cn(),e),Ya={class:"error"},Za={class:"error-title"},Xa={class:"error-details",style:{"margin-top":"-10px"}},Ja={key:0},Ka={class:"instructions"},Qa=["href"],es=br(()=>N("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),ts=br(()=>N("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),ns=br(()=>N("br",null,null,-1)),rs={key:0,style:{"margin-top":"20px"}},is=br(()=>N("h3",null,"Other errors",-1)),as=[is],ss={class:"error-details"},os={key:0,style:{"margin-top":"10px"}},ls={key:1,style:{"margin-top":"10px"}},us=Z({__name:"Error",props:{errors:null},setup(e){const t=e,n=w(()=>t.errors[0]),r=w(()=>t.errors.map(u=>u.stack==null?[]:u.stack.split(` -`))),i=w(()=>t.errors.map(u=>u.cause==null?[]:(typeof u.cause=="string"?u.cause:JSON.stringify(u.cause)).split(` -`)));function a(){let u=jr(Y);switch(ve.exportEncoding){default:console.warn(`Unknown save encoding: ${ve.exportEncoding}. Defaulting to lz`);case"lz":u=Wt.compressToUTF16(u);break;case"base64":u=btoa(unescape(encodeURIComponent(u)));break;case"plain":break}console.log(u);const l=document.createElement("textarea");l.value=u,document.body.appendChild(l),l.select(),l.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(l)}return Kn(()=>{Y.autosave=!1,Y.devSpeed=0}),(u,l)=>(S(),P("div",Ya,[N("h1",Za,ee(s(n).name)+": "+ee(s(n).message),1),N("div",Xa,[s(n).cause?(S(),P("div",Ja,[(S(!0),P(ne,null,Dt(s(i)[0],c=>(S(),P("div",{key:c},ee(c),1))),128))])):B("",!0),s(n).stack?(S(),P("div",{key:1,style:Le(s(n).cause?"margin-top: 10px":"")},[(S(!0),P(ne,null,Dt(s(r)[0],c=>(S(),P("div",{key:c},ee(c),1))),128))],4)):B("",!0)]),N("div",Ka,[y(" Check the console for more details, and consider sharing it with the developers on "),N("a",{href:s(ve).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,Qa),y("! "),d(zr,{onClick:a,class:"button",style:{display:"inline-flex"}},{default:H(()=>[es,ts]),_:1}),ns,e.errors.length>1?(S(),P("div",rs,as)):B("",!0),(S(!0),P(ne,null,Dt(e.errors.slice(1),(c,p)=>(S(),P("div",{key:p,style:{"margin-top":"20px"}},[N("details",ss,[N("summary",null,ee(c.name)+": "+ee(c.message),1),c.cause?(S(),P("div",os,[(S(!0),P(ne,null,Dt(s(i)[p+1],h=>(S(),P("div",{key:h},ee(h),1))),128))])):B("",!0),c.stack?(S(),P("div",ls,[(S(!0),P(ne,null,Dt(s(r)[p+1],h=>(S(),P("div",{key:h},ee(h),1))),128))])):B("",!0)])]))),128))])]))}});var Mi=be(us,[["__scopeId","data-v-ac351c02"]]);class cs{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 ds(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 ds{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const Tr=17,ps=9e15,fs=Math.log10(9e15),gs=1/9e15,ms=308,vs=-324,ci=5,hs=(1<<10)-1,bs=function(){const e=[];for(let n=vs+1;n<=ms;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),fn=[2,Math.E,3,4,5,6,7,8,9,10],ys=[[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]],ws=[[-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 nn=function(t,n){const r=n+1,i=Math.ceil(Math.log10(Math.abs(t))),a=Math.round(t*Math.pow(10,r-i))*Math.pow(10,i-r);return parseFloat(a.toFixed(Math.max(r-i,0)))},Pr=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},_s=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},Ii=.5671432904097838,di=function(e,t=1e-10){let n,r;if(!Number.isFinite(e)||e===0)return e;if(e===1)return Ii;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).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 a=t.add(r.mul(n)).sub(n.div(2)),u=a.pow(2);return a.neg().add(u.add(n.mul(e).mul(2)).sqrt()).div(n).floor()}static sumArithmeticSeries_core(e,t,n,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=ps)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=_.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]),T=r[1].split(";");let $=1;if(T.length===2&&($=parseFloat(T[1]),isFinite($)||($=1)),isFinite(k)&&isFinite(C)){const I=_.pentate(k,C,$);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]),T=i[1].split(";");let $=1;if(T.length===2&&($=parseFloat(T[1]),isFinite($)||($=1)),isFinite(k)&&isFinite(C)){const I=_.tetrate(k,C,$);return this.sign=I.sign,this.layer=I.layer,this.mag=I.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const k=parseFloat(a[0]),C=parseFloat(a[1]);if(isFinite(k)&&isFinite(C)){const T=_.pow(k,C);return this.sign=T.sign,this.layer=T.layer,this.mag=T.mag,_.fromStringCache.maxSize>=1&&_.fromStringCache.set(t,_.fromDecimal(this)),this}}e=e.trim().toLowerCase();let u,l,c=e.split("pt");if(c.length===2){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(u)&&isFinite(l)){const C=_.tetrate(u,l,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){u=10,l=parseFloat(c[0]),c[1]=c[1].replace("(",""),c[1]=c[1].replace(")","");let k=parseFloat(c[1]);if(isFinite(k)||(k=1),isFinite(u)&&isFinite(l)){const C=_.tetrate(u,l,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=43&&T<=57||T===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+=Pr(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:nn(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:nn(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<=ci?(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):nn(this.m,e)+"e"+nn(this.e,e):this.layer===1?nn(this.m,e)+"e"+nn(this.e,e):this.layer<=ci?(this.sign===-1?"-":"")+"e".repeat(this.layer)+nn(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+nn(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),a=r.layer*Math.sign(r.mag);if(i-a>=2)return n;if(i===0&&a===-1){if(Math.abs(r.mag-Math.log10(n.mag))>Tr)return n;{const u=Math.pow(10,Math.log10(n.mag)-r.mag),l=r.sign+n.sign*u;return Q(Math.sign(l),1,r.mag+Math.log10(Math.abs(l)))}}if(i===1&&a===0){if(Math.abs(n.mag-Math.log10(r.mag))>Tr)return n;{const u=Math.pow(10,n.mag-Math.log10(r.mag)),l=r.sign+n.sign*u;return Q(Math.sign(l),1,Math.log10(r.mag)+Math.log10(Math.abs(l)))}}if(Math.abs(n.mag-r.mag)>Tr)return n;{const u=Math.pow(10,n.mag-r.mag),l=r.sign+n.sign*u;return Q(Math.sign(l),1,r.mag+Math.log10(Math.abs(l)))}}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.sign0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:nt.mag?1:this.mag0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=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=Pr(i)),this.layer0?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(_s(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,a=1/i,u=t+a;if(u===t||(t=u,r=r*n,i=360*r,a=1/i,u=t-a,u===t))return _.exp(t);t=u,r=r*n,i=1260*r;let l=1/i;return t=t+l,r=r*n,i=1680*r,l=1/i,t=t-l,_.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 a=_.ln(this).neg();return a.lambertw().div(a)}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;i3)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 a=Math.min(t,n.layer-e.layer-3);t-=a,n.layer-=a}for(let a=0;a1e4)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,a=this.slog_internal(e).toNumber();for(let u=1;u1&&i!=c&&(r=!0),i=c,r?n/=2:n*=2,n=Math.abs(n)*(c?-1:1),a+=n,n===0)break}return _.fromNumber(a)}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,ws)}static tetrate_critical(e,t){return _.critical_section(e,t,ys)}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 u=0;ue){const l=(e-fn[u])/(fn[u+1]-fn[u]);r=n[u][Math.floor(t)]*(1-l)+n[u+1][Math.floor(t)]*l,i=n[u][Math.ceil(t)]*(1-l)+n[u+1][Math.ceil(t)]*l;break}const a=t-Math.floor(t);return r<=0||i<=0?r*(1-a)+i*a:Math.pow(e,Math.log(r)/Math.log(e)*(1-a)+Math.log(i)/Math.log(e)*a)}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(di(this.toNumber()));if(this.layer===0)return _.fromNumber(di(this.sign*this.mag));if(this.layer===1)return pi(this);if(this.layer===2)return pi(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;i10)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 cs(hs);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 Ns=new o(1);function Ln(e,t,n=!0){let r=o.log10(e).floor(),i=o.div(e,o.pow(10,r));i.toStringWithDecimalPlaces(t)==="10"&&(i=Ns,r=r.add(1));const a=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"+a:"e"+a}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 xi(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 Cs=new o("eeee1000"),ks=new o("e100000"),fi=new o("e1000"),$i=new o(1e9),Ss=new o(1e6),Ms=new o(1e3),Is=new o(.98),xs=new o(.001),Di=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(Cs)){const r=e.slog();return r.gte(Ss)?"F"+Nt(r.floor()):o.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+pr(r.floor(),0)}else{if(e.gte(ks))return Ln(e,0,!1);if(e.gte(fi))return Ln(e,0);if(e.gte($i))return Ln(e,t);if(e.gte(Ms))return pr(e,0);if(e.gte(xs)||!n)return xi(e,t);if(e.eq(Di))return 0 .toFixed(t)}return e=Pi(e),e.lt(fi)?Ln(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):Nt(e,t)+"\u207B\xB9"}function He(e){return e=new o(e),e.sign<0?"-"+He(e.neg()):e.gte($i)||e.lte(Is)&&!e.eq(Di)?Nt(e):Nt(e,0)}function Ti(e){return o.lt(e,0)?"-"+Ti(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?He(Math.floor(e/60))+"m "+Nt(e%60)+"s":e<86400?He(Math.floor(e/3600))+"h "+He(Math.floor(e/60)%60)+"m "+He(e%60)+"s":e<31536e3?He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h "+He(Math.floor(e/60)%60)+"m":He(Math.floor(e/31536e3))+"y "+He(Math.floor(e/84600)%365)+"d "+He(Math.floor(e/3600)%24)+"h")}function $s(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 Ds(e,t){return Nt(e,t,!0)}function Pi(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 Ts=Object.freeze(Object.defineProperty({__proto__:null,default:o,exponentialFormat:Ln,commaFormat:pr,regularFormat:xi,format:Nt,formatWhole:He,formatTime:Ti,toPlaces:$s,formatSmall:Ds,invertOOM:Pi},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Gr,commaFormat:Ps,regularFormat:As,format:xe,formatWhole:st,formatTime:yr,toPlaces:Rs,formatSmall:Ht,invertOOM:Es}=Ts;window.Decimal=o;window.exponentialFormat=Gr;window.commaFormat=Ps;window.regularFormat=As;window.format=xe;window.formatWhole=st;window.formatTime=yr;window.toPlaces=Rs;window.formatSmall=Ht;window.invertOOM=Es;function it(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Hn(e){return typeof e=="function"}var U=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(U||{});const Yn=Symbol("DoNotCache");function R(e,t){const n=e[t];Hn(n)&&n.length===0&&!n[Yn]?e[t]=w(n.bind(e)):Hn(n)&&(e[t]=n.bind(e),e[t][Yn]=!0)}function _e(e){return Hn(e)&&!e[Yn]&&(e=w(e)),e}const ft=Symbol("Component"),ut=Symbol("GatherProps");let Fs=0;function Jt(e="feature-"){return e+Fs++}var Se=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(Se||{});function Ye(e){const t=s(e);return t!==2&&t!==!1}function wn(e){return s(e)===1}function j(e){return e[Yn]=!0,e}function le(e,t,n){e[t]===void 0&&n!=null&&(e[t]=n)}function Zn(e,...t){const n=[],r=i=>{Object.keys(i).forEach(a=>{const u=i[a];u!=null&&typeof u=="object"&&(t.includes(u.type)?n.push(u):!(u instanceof o)&&!Ve(u)&&r(u))})};return r(e),n}var Ee=window.state=Br({lastTenTicks:[],hasNaN:!1,NaNPath:[],errors:on([])});const gn={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 Ur=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Ur||{}),It={classic:gn,paper:{...gn,variables:{...gn.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:{...gn,variables:{...gn.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:{...gn,variables:{...gn.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}};const Ke=Si();"fonts"in document&&(document.fonts.onloadingdone=()=>Ke.emit("fontsLoaded"));var Os=Object.freeze(Object.defineProperty({__proto__:null,globalBus:Ke},Symbol.toStringTag,{value:"Module"}));function Ai(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=Wt.compressToUTF16(jr(e!=null?e:Y));return localStorage.setItem((e!=null?e:Y).id,t),t}async function qs(){Ls();try{let e=localStorage.getItem(ie.active);if(e==null){await hn($n());return}if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Wt.decompressFromUTF16(e);else throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==ve.id){await hn($n());return}t.id=ie.active,await hn(t)}catch(e){console.error(`Failed to load save. Falling back to new save. -`,e),await hn($n())}}function $n(){const e=cr(),t=Ai({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 Vs=G(!1);async function hn(e){console.info("Loading save",e),Vs.value=!0;const{layers:t,removeLayer:n,addLayer:r}=await Wn(()=>Promise.resolve().then(function(){return Fl}),void 0),{fixOldSave:i,getInitialLayers:a}=await Wn(()=>Promise.resolve().then(function(){return Hp}),void 0);for(const u in t){const l=t[u];l&&n(l)}a(e).forEach(u=>r(u,e)),e=Ai(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,Ke.emit("onLoad")}setInterval(()=>{Y.autosave&&bt()},1e3);window.onbeforeunload=()=>{Y.autosave&&bt()};window.save=bt;const Bs=window.hardReset=async()=>{await hn($n())};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 Xn=on({active:"",saves:[],showTPS:!0,theme:Ur.Nordic,unthrottled:!1,alignUnits:!1});wt(Xn,e=>{const t=Wt.compressToUTF16(JSON.stringify(e));localStorage.setItem(ve.id,t)},{deep:!0});var ie=window.settings=Xn;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Ur.Nordic,alignUnits:!1};Ke.emit("loadSettings",e),Object.assign(Xn,e),Bs()};function Ls(){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=Wt.decompressFromUTF16(e);else{console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(Xn,t)}Ke.emit("loadSettings",Xn)}catch{}}const Ri=on([]);function Ei(e){Ri.push(e)}const js=on([]),zs=on([]),Gs={class:"table"},Us=Z({__name:"Column",setup(e){const t=w(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),P("div",Gs,[N("div",{class:Ne(["col",{mergeAdjacent:s(t)}])},[qt(n.$slots,"default")],2)]))}}),Ws={class:"table"},Hs=Z({__name:"Row",setup(e){const t=w(()=>It[ie.theme].mergeAdjacent);return(n,r)=>(S(),P("div",Ws,[N("div",{class:Ne(["row",{mergeAdjacent:s(t)}])},[qt(n.$slots,"default")],2)]))}});function Fi(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!oa(e)}function ge(e,t="span"){return typeof e=="function"?Z({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}`),Z({template:e})):Z({render:()=>({})}):e}function ot(e){if(At(e))return typeof e=="function"?e():ge(e);const t=e[ft];return d(t,e[ut](),null)}function Ar(...e){let t;return d(Hs,null,Fi(t=e.map(ot))?t:{default:()=>[t]})}function Ys(...e){let t;return d(Us,null,Fi(t=e.map(ot))?t:{default:()=>[t]})}function gt(e){if(At(e))return typeof e=="function"?e():typeof e=="string"?d(ne,null,[e]):d(e,null,null);const t=e[ft];return d(t,e[ut](),null)}function gi(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[Yn]===!0}function Oi(e,t){const n=G(null),r=G(void 0);function i(l){n.value||(n.value=setInterval(u,250)),r.value=l}function a(){n.value&&(clearInterval(n.value),n.value=null)}function u(){t&&t.value?t.value():e&&e.value&&e.value(r.value)}return ki(a),{start:i,stop:a,handleHolding:u}}function Wr(e,t="div"){const n=_t();return Pt(()=>{n.value=ge(Te(e),t)}),n}function Pn(e,t="div"){const n=_t(null);return Pt(()=>{const r=Te(e);n.value=r==""||r==null?null:ge(r,t)}),n}function Te(e){return s(s(e))}function q(...e){return e.includes(Object)||e.push(Object),e}function mi(e){const t=G(!1),n=e[ut].bind(e);return e[ut]=()=>({...n(),onPointerenter:()=>t.value=!0,onPointerleave:()=>t.value=!1}),t}const Zs=Z({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var h;const n=G({}),r=new ResizeObserver(l),i=G(null);Kn(()=>{const g=i.value;g!=null&&r.observe(g)});let a=!0,u=G((h=i.value)==null?void 0:h.getBoundingClientRect());function l(){a&&(a=!1,Yt(()=>{var g;u.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),a=!0}))}Ke.on("fontsLoaded",l);const c={attributes:!1,childList:!0,subtree:!1};sr(Hr,(g,b)=>{const m=new MutationObserver(()=>p(g));m.observe(b,c),n.value[g]={element:b,observer:m,rect:b.getBoundingClientRect()},l()}),sr(Yr,g=>{var b;(b=n.value[g])==null||b.observer.disconnect(),n.value[g]=void 0,l()}),sr(Zr,n),sr(Xr,u);function p(g){const b=n.value[g];b!=null&&(b.rect=b.element.getBoundingClientRect(),t("updateNodes",n.value))}return(g,b)=>(S(),P(ne,null,[qt(g.$slots,"default",{},void 0,!0),N("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var qi=be(Zs,[["__scopeId","data-v-2b1dc1bc"]]);const Xs=["onPointerdown"],Js={class:"modal-wrapper"},Ks={class:"modal-container"},Qs={class:"modal-header"},eo={class:"modal-body"},to={class:"modal-footer"},no=N("div",{class:"modal-default-flex-grow"},null,-1),Lt=Z({__name:"Modal",props:{modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const i=Pe(e),a=w(()=>s(i.modelValue)||l.value);function u(){n("update:modelValue",!1)}const l=G(!1),c=G(null),p=w(()=>{var h,g;return(g=(h=c.value)==null?void 0:h.nodes)!=null?g:null});return t({isOpen:a,nodes:p}),(h,g)=>(S(),re(ua,{to:"#modal-root"},[d(Un,{name:"modal",onBeforeEnter:g[0]||(g[0]=b=>l.value=!0),onAfterLeave:g[1]||(g[1]=b=>l.value=!1)},{default:H(()=>[Lr(N("div",Vt({class:"modal-mask",onPointerdown:Dn(u,["self"])},h.$attrs),[N("div",Js,[N("div",Ks,[N("div",Qs,[qt(h.$slots,"header",{shown:s(a)},()=>[y(" default header ")])]),N("div",eo,[d(qi,{ref_key:"contextRef",ref:c},{default:H(()=>[qt(h.$slots,"body",{shown:s(a)},()=>[y(" default body ")])]),_:3},512)]),N("div",to,[qt(h.$slots,"footer",{shown:s(a)},()=>[N("div",{class:"modal-default-footer"},[no,N("button",{class:"button modal-default-button",onClick:u}," Close ")])])])])])],16,Xs),[[la,e.modelValue]])]),_:3})]))}}),rn=Symbol("ProxyState");function Qe(e,t={}){const n=t;let r=!1,i=!1;function a(){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(u,l){if(l===rn)return a();const c=a()[l];return c!=null&&typeof c=="object"&&Ot in c?c[Ot]:c},set(u,l,c){return a()[l]=c,!0},has(u,l){return l===rn?!0:Reflect.has(a(),l)},ownKeys(){return Reflect.ownKeys(a())},getOwnPropertyDescriptor(u,l){return r||(Object.assign(n,e.call(n,n)),r=!0),Object.getOwnPropertyDescriptor(u,l)}})}const Vi=o.ln(10);function jn(e){return e}function ro(e,t){return F(t)?t.invert(o.neg(e)):(console.error("Could not invert due to no input being a variable"),0)}function io(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 ao(e){return f.neg(e)}function so(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 oo(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 a=t.getIntegralFormula(e);return f.times(n,(r=t.innermostVariable)!=null?r:0).add(a)}else if(F(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),f.constant(0);const a=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).add(a)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function lo(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 uo(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 co(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 a=t.getIntegralFormula(e);return f.sub(a,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 a=n.getIntegralFormula(e);return f.times(t,(i=n.innermostVariable)!=null?i:0).sub(a)}return console.error("Could not integrate due to no input being a variable"),f.constant(0)}function po(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 fo(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 go(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 mo(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 vo(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 ho(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 bo(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 yo(e,t){return F(t)?t.invert(o.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function wo(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 _o(e,t){return F(t)?t.invert(o.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function No(e){return o.ln(e).sub(1).times(e).div(Vi)}function Co(e,t){if(F(t)){const n=Vi.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 ko(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],evaluate:No,invert:Co}):(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 So(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 Mo(e,t){return o.ln(e).sub(1).times(e).div(o.ln(t))}function Io(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 xo(e,t,n){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e),n],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){return F(t)?t.invert(o.pow(2,e)):(console.error("Could not invert due to no input being a variable"),0)}function Do(e){return o.ln(e).sub(1).times(e).div(o.ln(2))}function To(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 Po(e,t){return F(t)?t.isIntegrable()?new f({inputs:[t.getIntegralFormula(e)],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.exp(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)}function Eo(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 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,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 qo(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 Vo(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 Bo(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 Lo(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 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);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 zo(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 Go(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 Uo(e,t){return F(t)?t.invert(o.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function Wo(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 Ho(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){const r=o.minabs(t,1e308).toNumber();return o.tetrate(e,r,n)}function Yo(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 Zo(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 Xo(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 Jo(e,t=10,n=2){const r=o.minabs(n,1e308).toNumber();return o.iteratedlog(e,t,r)}function Ko(e,t=10){const n=o.minabs(t,1e308).toNumber();return o.slog(e,n)}function Qo(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 el(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.layeradd(e,r,n)}function tl(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 nl(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 rl(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 il(e,t,n){const r=o.minabs(t,1e308).toNumber();return o.pentate(e,r,n)}function al(e,t){return F(t)?t.invert(o.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function sl(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 ol(e,t){return F(t)?t.invert(o.acos(e)):(console.error("Could not invert due to no input being a variable"),0)}function ll(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 ul(e,t){return F(t)?t.invert(o.atan(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).ln().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.sin(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.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 fl(e,t){return F(t)?t.invert(o.cos(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.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 ml(e,t){return F(t)?t.invert(o.tan(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.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 hl(e,t){return F(t)?t.invert(o.asinh(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.cosh(n)}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.acosh(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.sinh(n)}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.atanh(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).ln()}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.sinh(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.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 Sl(e,t){return F(t)?t.invert(o.cosh(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.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 Il(e,t){return F(t)?t.invert(o.tanh(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.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 An(e){return(t,n)=>new f({inputs:[t,n],evaluate:e,invert:jn})}function F(e){return e instanceof Ae&&e.hasVariable()}function Me(e,t){return e instanceof Ae?e.evaluate(t):s(e)}function $l(){return f.pow(this,2).div(2)}function Dl(){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:$l,internalIntegrateInner:Dl,applySubstitution:jn}}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:a,applySubstitution:u}=e,l=t.reduce((k,C)=>k+(C instanceof Be?C.internalVariables:0),0),c=t.find(k=>k instanceof Be&&k.hasVariable()),p=l===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:a,applySubstitution:u,innermostVariable:p,internalVariables:l}}isInvertible(){return this.hasVariable()&&(this.internalInvert!=null||this.internalEvaluate==null)}isIntegrable(){return this.hasVariable()&&this.internalIntegrate!=null}isIntegralInvertible(){return this.isIntegrable()?this.getIntegralFormula().isInvertible():!1}hasVariable(){return this.internalVariables===1}evaluate(e){var t,n,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(s(t),s(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new 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 a(l){return o.lt(l,s(i))?l:o.add(r.evaluate(o.sub(l,s(i))),s(i))}function u(l,c){return F(c)&&r.isInvertible()?(o.gt(l,s(i))&&(l=o.add(r.invert(o.sub(l,s(i))),s(i))),c.invert(l)):(console.error("Could not invert due to no input being a variable"),0)}return new f({inputs:[e],evaluate:a,invert:r.isInvertible()&&r.hasVariable()?u:void 0})}static if(e,t,n,r){const i=G(0),a=f.variable(i),u=n(a),l=r==null?void 0:r(a),c=_e(t);function p(g){return s(c)?(i.value=g,u.evaluate()):l?(i.value=g,l.evaluate()):g}function h(g,b){return!F(b)||!u.isInvertible()||l!=null&&!l.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):s(c)?b.invert(u.invert(g)):l?b.invert(l.invert(g)):b.invert(g)}return new f({inputs:[e],evaluate:p,invert:u.isInvertible()&&u.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:ro,applySubstitution:ao,integrate:io})}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:so,integrate:oo,integrateInner:lo,applySubstitution:jn})}static sub(e,t){return new f({inputs:[e,t],evaluate:o.sub,invert:uo,integrate:co,integrateInner:po,applySubstitution:jn})}static mul(e,t){return new f({inputs:[e,t],evaluate:o.mul,invert:fo,integrate:go,applySubstitution:mo})}static div(e,t){return new f({inputs:[e,t],evaluate:o.div,invert:vo,integrate:ho,applySubstitution:bo})}static recip(e){return new f({inputs:[e],evaluate:o.recip,invert:yo,integrate:wo})}static clamp(e,t,n){return new f({inputs:[e,t,n],evaluate:o.clamp,invert:jn})}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:_o,integrate:ko})}static log(e,t){return new f({inputs:[e,t],evaluate:o.log,invert:So,integrate:xo})}static log2(e){return new f({inputs:[e],evaluate:o.log2,invert:$o,integrate:Po})}static ln(e){return new f({inputs:[e],evaluate:o.ln,invert:Ao,integrate:Fo})}static pow(e,t){return new f({inputs:[e,t],evaluate:o.pow,invert:Oo,integrate:qo})}static pow10(e){return new f({inputs:[e],evaluate:o.pow10,invert:Vo,integrate:Bo})}static pow_base(e,t){return new f({inputs:[e,t],evaluate:o.pow_base,invert:Lo,integrate:jo})}static root(e,t){return new f({inputs:[e,t],evaluate:o.root,invert:zo,integrate:Go})}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:Uo,integrate:Wo})}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:Ho,invert:Yo})}static iteratedexp(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:Zo,invert:Xo})}static iteratedlog(e,t=10,n=1){return new f({inputs:[e,t,n],evaluate:Jo})}static slog(e,t=10){return new f({inputs:[e,t],evaluate:Ko,invert:Qo})}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:el,invert:tl})}static lambertw(e){return new f({inputs:[e],evaluate:o.lambertw,invert:nl})}static ssqrt(e){return new f({inputs:[e],evaluate:o.ssqrt,invert:rl})}static pentate(e,t=2,n=o.fromComponents_noNormalize(1,0,1)){return new f({inputs:[e,t,n],evaluate:il})}static sin(e){return new f({inputs:[e],evaluate:o.sin,invert:dl,integrate:sl})}static cos(e){return new f({inputs:[e],evaluate:o.cos,invert:fl,integrate:ll})}static tan(e){return new f({inputs:[e],evaluate:o.tan,invert:ml,integrate:cl})}static asin(e){return new f({inputs:[e],evaluate:o.asin,invert:al,integrate:pl})}static acos(e){return new f({inputs:[e],evaluate:o.acos,invert:ol,integrate:gl})}static atan(e){return new f({inputs:[e],evaluate:o.atan,invert:ul,integrate:vl})}static sinh(e){return new f({inputs:[e],evaluate:o.sinh,invert:Cl,integrate:bl})}static cosh(e){return new f({inputs:[e],evaluate:o.cosh,invert:Sl,integrate:wl})}static tanh(e){return new f({inputs:[e],evaluate:o.tanh,invert:Il,integrate:Nl})}static asinh(e){return new f({inputs:[e],evaluate:o.asinh,invert:hl,integrate:kl})}static acosh(e){return new f({inputs:[e],evaluate:o.acosh,invert:yl,integrate:Ml})}static atanh(e){return new f({inputs:[e],evaluate:o.atanh,invert:_l,integrate:xl})}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 Ae=Be;Ae.negate=Be.neg;Ae.negated=Be.neg;Ae.sgn=Be.sign;Ae.plus=Be.add;Ae.subtract=Be.sub;Ae.minus=Be.sub;Ae.multiply=Be.mul;Ae.times=Be.mul;Ae.divide=Be.div;Ae.divideBy=Be.div;Ae.dividedBy=Be.div;Ae.reciprocal=Be.recip;Ae.reciprocate=Be.recip;Ae.max=An(o.max);Ae.min=An(o.min);Ae.minabs=An(o.minabs);Ae.maxabs=An(o.maxabs);Ae.clampMin=An(o.clampMin);Ae.clampMax=An(o.clampMax);Ae.logarithm=Be.log;class f extends Ae{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 Bi(e,t,n=!0,r,i=o.dInf){const a=_e(n),u=_e(r),l=_e(i);return w(()=>{var b,m,k,C;const c=s(l);if(o.eq(c,1))return o.gte(t.value,e.evaluate())?o.dOne:o.dZero;const p=s(a),h=(b=s(u))!=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=s(e.innermostVariable))!=null?m:0)}else g=o.floor(e.invert(t.value))}if(g=o.clampMax(g,c),h>0){const T=g;g=o.sub(g,h).clampMin(0);let $;for(p?$=an(e,g,!0,0):$=e.evaluate(o.add((k=s(e.innermostVariable))!=null?k:0,g));o.lt(g,c)&&o.lt(g,Number.MAX_SAFE_INTEGER)&&o.add(T,1).gte(g);){const I=e.evaluate(g.add((C=s(e.innermostVariable))!=null?C:0));if(o.add($,I).lte(t.value))g=g.add(1),$=o.add($,I);else break}}return g})}function an(e,t,n=!0,r){var c;if(o.eq(t,1))return e.evaluate();const i=(c=s(e.innermostVariable))!=null?c:0;let a=o.add(t,i);const u=a;r!=null||(r=n?10:0),a=a.sub(r).clampMin(i);let l=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(l=o.sub(e.evaluateIntegral(a),e.evaluateIntegral()),u.gt(1e308))return o.add(l,o.sub(u,a).times(e.evaluate(a)))}else if(l=e.evaluate(a),a=a.add(1),u.gt(1e308))return o.sub(u,a).add(1).times(l)}for(let p=a.toNumber();pn.trim()).join(` -`))!=null?t:""}function vi(e,t){var n;o.isNaN(t)&&(Ee.hasNaN||(Y.autosave=!1,Ee.hasNaN=!0,Ee.NaNPath=e[bn],Ee.NaNPersistent=e),console.error(`Attempted to save NaN value to ${(n=e[bn])==null?void 0:n.join(".")}`)),e[sn].value=t}function lt(e,t=!0){const n=Ve(e)?e:G(e);Ve(e)&&(e=e.value);const r=w({get(){return n.value},set(a){t?vi(i,a):i[sn].value=a}});r[Xt]=e;const i={get value(){return n.value},set value(a){t?vi(i,a):i[sn].value=a},__v_isRef:!0,[sn]:n,[Xt]:e,[fr]:Tl(),[gr]:!1,[Ot]:r,[bn]:void 0};return pt.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",i,` -Created at: -`+i[fr]):yn[pt[pt.length-1]].add(i),i}function Pl(e){return e!=null&&typeof e=="object"&&sn in e}function Sn(e){return!(rn in e)&&Ot in e?e[Ot]:new Proxy(e,{get(t,n){if(n!==sn)return n===Jn?!0:t[n]},set(t,n,r){return t[n]=r,!0},has(t,n){return n===sn?!1:n==Jn?!0:Reflect.has(t,n)}})}function Li(e){pt.length===0?console.warn("Deleting a persistent ref outside of a layer. Ignoring...",e):yn[pt[pt.length-1]].delete(e),e[gr]=!0}Ke.on("addLayer",(e,t)=>{const n=[],r=(i,a=[])=>{let u=!1;return Object.keys(i).forEach(l=>{let c=i[l];if(c!=null&&typeof c=="object"){if(c[Jn]===!0)return;if(rn in c&&(c=c[rn]),Pl(c)){if(u=!0,c[gr]){console.warn("Deleted persistent ref present in returned object. Ignoring...",c,` -Created at: -`+c[fr]);return}yn[e.id].delete(c);const p=[e.id,...a,l];c[bn]!=null&&JSON.stringify(p)!==JSON.stringify(c[bn])&&console.error(`Persistent ref is being saved to \`${p.join(".")}\` when it's already present at \`${c[bn].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),c[bn]=p;const h=a.reduce((b,m)=>(m in b||(b[m]={}),b[m]),t),g=h[l];h[l]=c[sn],ca(h)?g!=null?h[l]=g:h[l]=c[Xt]:g!=null?h[l].value=g:h[l].value=c[Xt]}else!(c instanceof o)&&!(c instanceof f)&&!Ve(c)&&!n.includes(c)&&(typeof c.type=="symbol"&&n.push(c),r(c,[...a,l])&&(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.",rn in i?i[rn]:i,l):u=!0))}}),u};r(e[rn]),yn[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])}),yn[e.id].clear()});const Hr=Symbol("RegisterNode"),Yr=Symbol("UnregisterNode"),Zr=Symbol("Nodes"),Xr=Symbol("Bounds"),me=Br({});window.layers=me;const yn={},pt=[];function Jr(e,t){return Qe(()=>{const n={},r=n.emitter=Si();if(n.on=r.on.bind(r),n.emit=r.emit.bind(r),n.nodes=G({}),n.id=e,pt.push(e),yn[e]=new Set,n.minimized=lt(!1,!1),Object.assign(n,t.call(n,n)),pt[pt.length-1]==null||pt[pt.length-1]!==e)throw new Error(`Adding layers stack in invalid state. This should not happen -Stack: ${pt} -Trying to pop ${n.id}`);pt.pop(),R(n,"color"),R(n,"display"),R(n,"classes"),R(n,"style"),R(n,"name"),le(n,"name",n.id),R(n,"minWidth"),le(n,"minWidth",600),R(n,"minimizable"),le(n,"minimizable",!0),R(n,"minimizedDisplay");const i=n.style;return n.style=w(()=>{var u,l;let a=s(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(u=s(i))!=null?u:"",(l=n.minimized)!=null&&l.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Kr(e,t){if(console.info("Adding layer",e.id),me[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,me[e.id]);return}le(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),me[e.id]=e,Ke.emit("addLayer",e,t.layers[e.id])}function Al(e){return me[e]}function Qr(e){console.info("Removing layer",e.id),Ke.emit("removeLayer",e),me[e.id]=void 0}function Rl(e){Qr(e),Kr(e,Y)}function El(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,[s(e.name)]),body:s(e.display)}))}}Ke.on("update",function(t){Object.values(me).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(me).forEach(n=>{n==null||n.emit("update",t)}),Object.values(me).forEach(n=>{n==null||n.emit("postUpdate",t)})});var Fl=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:Hr,UnregisterNodeInjectionKey:Yr,NodesInjectionKey:Zr,BoundsInjectionKey:Xr,layers:me,persistentRefs:yn,addingLayers:pt,createLayer:Jr,addLayer:Kr,getLayer:Al,removeLayer:Qr,reloadLayer:Rl,setupLayerModal:El},Symbol.toStringTag,{value:"Module"}));const Ol=Z({components:{Context:qi,ErrorVue:Mi},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}=Pe(e),a=Wr(t),u=Pn(i),l=w(()=>ve.allowGoBack&&n.value>0&&!Te(r));function c(){Y.tabs.splice(s(e.index),1/0)}function p(g){e.nodes.value=g}const h=G([]);return da((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:a,minimizedComponent:u,showGoBack:l,updateNodes:p,unref:s,goBack:c,errors:h}}}),ql={key:1};function Vl(e,t,n,r,i,a){const u=Ct("ErrorVue"),l=Ct("Context");return e.errors.length>0?(S(),re(u,{key:0,errors:e.errors},null,8,["errors"])):(S(),P("div",Vt({key:1,class:"layer-container",style:{"--layer-color":e.unref(e.color)}},e.$attrs),[e.showGoBack?(S(),P("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...c)=>e.goBack&&e.goBack(...c))},"\u274C")):B("",!0),e.unref(e.minimized)?(S(),P("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=c=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(S(),re(Je(e.minimizedComponent),{key:0})):(S(),P("div",ql,ee(e.unref(e.name)),1))])):(S(),P("div",{key:2,class:Ne(["layer-tab",{showGoBack:e.showGoBack}])},[d(l,{onUpdateNodes:e.updateNodes},{default:H(()=>[(S(),re(Je(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(S(),P("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=c=>e.$emit("setMinimized",!0))}," \u25BC ")):B("",!0)],16))}var Bl=be(Ol,[["render",Vl],["__scopeId","data-v-a9f5b1da"]]);const ji=e=>(un("data-v-4b4bda40"),e=e(),cn(),e),Ll=ji(()=>N("h2",null,"Changelog",-1)),jl=ji(()=>N("details",{open:""},[N("summary",null,[y("v0.0 Initial Commit - "),N("time",null,"2021-09-04")]),y(" 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)),zl=Z({__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]=a=>n.value=a)},{header:H(()=>[Ll]),body:H(()=>[jl]),_:1},8,["modelValue"]))}});var Gl=be(zl,[["__scopeId","data-v-4b4bda40"]]),Ul=Z({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}=Pe(e),i=G(!1),a=w(()=>(Te(r)||i.value)&&u.value),u=Pn(n),l=_t(ge(j(()=>{const h=Te(t);return h==null?"":gt(h)})));function c(h){const g=r;h.shiftKey&&g&&(g.value=!g.value,h.stopPropagation(),h.preventDefault())}const p=w(()=>Te(r)&&It[ie.theme].showPin);return{Direction:U,isHovered:i,isShown:a,comp:u,elementComp:l,unref:s,togglePinned:c,showPin:p}}});const Wl={key:0,class:"material-icons pinned"};function Hl(e,t,n,r,i,a){return S(),P("div",{class:Ne(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=u=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=u=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...u)=>e.togglePinned&&e.togglePinned(...u))},[qt(e.$slots,"default",{},void 0,!0),e.elementComp?(S(),re(Je(e.elementComp),{key:0})):B("",!0),d(Un,{name:"fade"},{default:H(()=>{var u;return[e.isShown?(S(),P("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"},(u=e.unref(e.style))!=null?u:{}])},[e.showPin?(S(),P("span",Wl,"push_pin")):B("",!0),e.comp?(S(),re(Je(e.comp),{key:1})):B("",!0)],6)):B("",!0)]}),_:1})],34)}var qe=be(Ul,[["render",Hl],["__scopeId","data-v-6102fa3a"]]);const _n=e=>(un("data-v-4f97aa40"),e=e(),cn(),e),Yl={class:"info-modal-header"},Zl=["src","alt"],Xl={class:"info-modal-title"},Jl={key:0},Kl={key:0},Ql={key:0},eu=_n(()=>N("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),tu=_n(()=>N("br",null,null,-1)),nu=_n(()=>N("br",null,null,-1)),ru=["href"],iu=_n(()=>N("span",{class:"material-icons info-modal-discord"},"discord",-1)),au=_n(()=>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"),y(" The Paper Pilot Community ")])],-1)),su=_n(()=>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"),y(" The Modding Tree ")])],-1)),ou=_n(()=>N("br",null,null,-1));var lu=Z({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:a,discordName:u,discordLink:l,versionNumber:c,versionTitle:p}=ve,h=Pe(n),g=G(!1),b=w(()=>yr(Y.timePlayed)),m=w(()=>ge(j(()=>d(ne,null,[js.map(ot)]))));t({open(){g.value=!0}});function k(){var C;(C=s(h.changelog))==null||C.open()}return(C,T)=>(S(),re(Lt,{modelValue:g.value,"onUpdate:modelValue":T[0]||(T[0]=$=>g.value=$)},{header:H(()=>[N("div",Yl,[s(i)?(S(),P("img",{key:0,class:"info-modal-logo",src:s(i),alt:s(r)},null,8,Zl)):B("",!0),N("div",Xl,[N("h2",null,ee(s(r)),1),N("h4",null,[y(" v"+ee(s(c)),1),s(p)?(S(),P("span",Jl,": "+ee(s(p)),1)):B("",!0)])])])]),body:H(({shown:$})=>[$?(S(),P("div",Kl,[s(a)?(S(),P("div",Ql,"By "+ee(s(a)),1)):B("",!0),eu,tu,N("div",{class:"link",onClick:k},"Changelog"),nu,N("div",null,[s(l)?(S(),P("a",{key:0,href:s(l),class:"info-modal-discord-link",target:"_blank"},[iu,y(" "+ee(s(u)),1)],8,ru)):B("",!0)]),au,su,ou,N("div",null,"Time Played: "+ee(s(b)),1),(S(),re(Je(s(m))))])):B("",!0)]),_:1},8,["modelValue"]))}});var uu=be(lu,[["__scopeId","data-v-4f97aa40"]]);const cu={class:"field"},du={key:0,class:"field-title"},ei=Z({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var u;const n=e,r=Pn(Zt(n,"title"),"span"),i=G((u=n.options.find(l=>l.value===n.modelValue))!=null?u:null);wt(Zt(n,"modelValue"),l=>{var c;Te(i)!==l&&(i.value=(c=n.options.find(p=>p.value===l))!=null?c:null)});function a(l){t("update:modelValue",l.value)}return(l,c)=>(S(),P("div",cu,[s(r)?(S(),P("span",du,[(S(),re(Je(s(r))))])):B("",!0),d(s(ha),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[c[0]||(c[0]=p=>i.value=p),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const pu={class:"field"},fu=Z({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=w(()=>{var a;return ge((a=s(n.title))!=null?a:"","span")}),i=w({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,u)=>(S(),P("label",pu,[Lr(N("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":u[0]||(u[0]=l=>Ve(i)?i.value=l:null)},null,512),[[pa,s(i)]]),(S(),re(Je(s(r))))]))}});var $t=be(fu,[["__scopeId","data-v-11046116"]]);const gu={class:"header"},mu=N("h2",null,"Settings",-1),vu={class:"option-tabs"},hu={key:0},bu={key:1};var yu=Z({__name:"Options",setup(e,{expose:t}){const n=G(!1),r=G("behaviour");function i(ue){return ue==r.value}function a(ue){r.value=ue}t({isTab:i,setTab:a,save:bt,open(){n.value=!0}});const u=Object.keys(It).map(ue=>({label:it(ue),value:ue})),l=w(()=>ge(j(()=>d(ne,null,[Ri.map(ot)])))),{showTPS:c,theme:p,unthrottled:h,alignUnits:g}=Pe(ie),{autosave:b,offlineProd:m}=Pe(Y),k=w({get(){return Y.devSpeed===0},set(ue){Y.devSpeed=ue?0:null}}),C=j(()=>d("span",{class:"option-title"},[y("Unthrottled"),d("desc",null,[y("Allow the game to run as fast as possible. Not battery friendly.")])])),T=j(()=>d("span",{class:"option-title"},[y("Offline Production"),d(qe,{display:"Save-specific",direction:U.Right},{default:()=>[y("*")]}),d("desc",null,[y("Simulate production that occurs while the game is closed.")])])),$=j(()=>d("span",{class:"option-title"},[y("Autosave"),d(qe,{display:"Save-specific",direction:U.Right},{default:()=>[y("*")]}),d("desc",null,[y("Automatically save the game every second or when the game is closed.")])])),I=j(()=>d("span",{class:"option-title"},[y("Pause game"),d(qe,{display:"Save-specific",direction:U.Right},{default:()=>[y("*")]}),d("desc",null,[y("Stop everything from moving.")])])),E=j(()=>d("span",{class:"option-title"},[y("Theme"),d("desc",null,[y("How the game looks.")])])),L=j(()=>d("span",{class:"option-title"},[y("Show TPS"),d("desc",null,[y("Show TPS meter at the bottom-left corner of the page.")])])),de=j(()=>d("span",{class:"option-title"},[y("Align modifier units"),d("desc",null,[y("Align numbers to the beginning of the unit in modifier view.")])]));return(ue,ae)=>(S(),re(Lt,{modelValue:n.value,"onUpdate:modelValue":ae[10]||(ae[10]=X=>n.value=X)},{header:H(()=>[N("div",gu,[mu,N("div",vu,[N("button",{class:Ne({selected:i("behaviour")}),onClick:ae[0]||(ae[0]=X=>a("behaviour"))},"Behaviour",2),N("button",{class:Ne({selected:i("appearance")}),onClick:ae[1]||(ae[1]=X=>a("appearance"))},"Appearance",2)])])]),body:H(()=>[i("behaviour")?(S(),P("div",hu,[d($t,{title:s(C),modelValue:s(h),"onUpdate:modelValue":ae[2]||(ae[2]=X=>Ve(h)?h.value=X:null)},null,8,["title","modelValue"]),s(ve).enablePausing?(S(),re($t,{key:0,title:s(I),modelValue:s(k),"onUpdate:modelValue":ae[3]||(ae[3]=X=>Ve(k)?k.value=X:null)},null,8,["title","modelValue"])):B("",!0),d($t,{title:s(T),modelValue:s(m),"onUpdate:modelValue":ae[4]||(ae[4]=X=>Ve(m)?m.value=X:null)},null,8,["title","modelValue"]),d($t,{title:s($),modelValue:s(b),"onUpdate:modelValue":ae[5]||(ae[5]=X=>Ve(b)?b.value=X:null)},null,8,["title","modelValue"]),s(b)?B("",!0):(S(),re(zr,{key:1,class:"button save-button",onClick:ae[6]||(ae[6]=X=>s(bt)())},{default:H(()=>[y("Manually save")]),_:1}))])):B("",!0),i("appearance")?(S(),P("div",bu,[d(ei,{title:s(E),options:s(u),modelValue:s(p),"onUpdate:modelValue":ae[7]||(ae[7]=X=>Ve(p)?p.value=X:null)},null,8,["title","options","modelValue"]),(S(),re(Je(s(l)))),d($t,{title:s(L),modelValue:s(c),"onUpdate:modelValue":ae[8]||(ae[8]=X=>Ve(c)?c.value=X:null)},null,8,["title","modelValue"]),d($t,{title:s(de),modelValue:s(g),"onUpdate:modelValue":ae[9]||(ae[9]=X=>Ve(g)?g.value=X:null)},null,8,["title","modelValue"])])):B("",!0)]),_:1},8,["modelValue"]))}});const wu=["onSubmit"],_u={class:"field"},Nu={key:0,class:"field-title"},Cu=["placeholder"],ku=Z({__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=Pn(Zt(n,"title"),"span"),i=_t(null);Kn(()=>{var c;(c=i.value)==null||c.focus()});const a=w({get(){var c;return(c=s(n.modelValue))!=null?c:""},set(c){t("update:modelValue",c)}});function u(){t("submit")}function l(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(c,p)=>(S(),P("form",{onSubmit:Dn(u,["prevent"])},[N("div",_u,[s(r)?(S(),P("span",Nu,[(S(),re(Je(s(r))))])):B("",!0),e.textArea?(S(),re(s(ya),{key:1,modelValue:s(a),"onUpdate:modelValue":p[0]||(p[0]=h=>Ve(a)?a.value=h:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:l,ref_key:"field",ref:i},null,8,["modelValue","placeholder","maxHeight"])):Lr((S(),P("input",{key:2,type:"text","onUpdate:modelValue":p[1]||(p[1]=h=>Ve(a)?a.value=h:null),placeholder:e.placeholder,class:Ne({fullWidth:!e.title}),onBlur:l,ref_key:"field",ref:i},null,42,Cu)),[[fa,s(a)]])])],40,wu))}});var zi=be(ku,[["__scopeId","data-v-90bd4994"]]);const Su={key:0},Mu=["onClick","disabled"],Iu={key:0},xu=["onClick"],$u=Z({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const r=Pe(e),i=G(!1);wt(i,l=>{t("confirmingChanged",l)});function a(){if(s(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function u(){i.value=!1}return(l,c)=>(S(),P("span",{class:Ne(["container",{confirming:i.value}])},[i.value?(S(),P("span",Su,"Are you sure?")):B("",!0),N("button",{onClick:Dn(a,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(S(),P("span",Iu,"Yes")):qt(l.$slots,"default",{key:1},void 0,!0)],8,Mu),i.value?(S(),P("button",{key:1,class:"button",onClick:Dn(u,["stop"])},"No",8,xu)):B("",!0)],2))}});var Du=be($u,[["__scopeId","data-v-2f8ef34c"]]);const Kt=e=>(un("data-v-32313015"),e=e(),cn(),e),Tu=Kt(()=>N("div",{class:"handle material-icons"},"drag_handle",-1)),Pu={key:0,class:"actions"},Au=Kt(()=>N("span",{class:"material-icons"},"content_paste",-1)),Ru=Kt(()=>N("span",{class:"material-icons"},"content_copy",-1)),Eu=Kt(()=>N("span",{class:"material-icons"},"edit",-1)),Fu=Kt(()=>N("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),Ou={key:1,class:"actions"},qu=Kt(()=>N("span",{class:"material-icons"},"check",-1)),Vu=Kt(()=>N("span",{class:"material-icons"},"close",-1)),Bu={key:2,class:"details"},Lu={class:"save-version"},ju=Kt(()=>N("br",null,null,-1)),zu={key:0},Gu={key:3,class:"details"},Uu={key:4,class:"details error"},Wu=Kt(()=>N("br",null,null,-1)),Hu=Z({__name:"Save",props:{save:null},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:r}=Pe(n),i=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),a=G(!1),u=G(!1),l=G("");wt(a,()=>{var g;return l.value=(g=r.value.name)!=null?g:""});const c=w(()=>r.value!=null&&r.value.id===Y.id),p=w(()=>{var g;return c.value?Y.time:(g=r.value!=null&&r.value.time)!=null?g:0});function h(){t("editName",l.value),a.value=!1}return(g,b)=>(S(),P("div",{class:Ne(["save",{active:s(c)}])},[Tu,a.value?(S(),P("div",Ou,[N("button",{onClick:h,class:"button"},[d(qe,{display:"Save",direction:s(U).Left,class:"info"},{default:H(()=>[qu]),_:1},8,["direction"])]),N("button",{onClick:b[5]||(b[5]=m=>a.value=!a.value),class:"button"},[d(qe,{display:"Cancel",direction:s(U).Left,class:"info"},{default:H(()=>[Vu]),_:1},8,["direction"])])])):(S(),P("div",Pu,[s(r).error==null&&!u.value?(S(),re(zr,{key:0,onClick:b[0]||(b[0]=m=>t("export")),class:"button",left:""},{default:H(()=>[d(qe,{display:"Export",direction:s(U).Left,class:"info"},{default:H(()=>[Au]),_:1},8,["direction"])]),_:1})):B("",!0),s(r).error==null&&!u.value?(S(),P("button",{key:1,onClick:b[1]||(b[1]=m=>t("duplicate")),class:"button"},[d(qe,{display:"Duplicate",direction:s(U).Left,class:"info"},{default:H(()=>[Ru]),_:1},8,["direction"])])):B("",!0),s(r).error==null&&!u.value?(S(),P("button",{key:2,onClick:b[2]||(b[2]=m=>a.value=!a.value),class:"button"},[d(qe,{display:"Edit Name",direction:s(U).Left,class:"info"},{default:H(()=>[Eu]),_:1},8,["direction"])])):B("",!0),d(Du,{disabled:s(c),onClick:b[3]||(b[3]=m=>t("delete")),onConfirmingChanged:b[4]||(b[4]=m=>u.value=m)},{default:H(()=>[d(qe,{display:"Delete",direction:s(U).Left,class:"info"},{default:H(()=>[Fu]),_:1},8,["direction"])]),_:1},8,["disabled"])])),s(r).error==null&&!a.value?(S(),P("div",Bu,[N("button",{class:"button open",onClick:b[6]||(b[6]=m=>t("open"))},[N("h3",null,ee(s(r).name),1)]),N("span",Lu,"v"+ee(s(r).modVersion),1),ju,s(p)?(S(),P("div",zu,"Last played "+ee(s(i).format(s(p))),1)):B("",!0)])):s(r).error==null&&a.value?(S(),P("div",Gu,[d(zi,{modelValue:l.value,"onUpdate:modelValue":b[7]||(b[7]=m=>l.value=m),class:"editname",onSubmit:h},null,8,["modelValue"])])):(S(),P("div",Uu,[y(" Error: Failed to load save with id "+ee(s(r).id),1),Wu,y(ee(s(r).error),1)]))],2))}});var Yu=be(Hu,[["__scopeId","data-v-32313015"]]);const ti=e=>(un("data-v-2a4275be"),e=e(),cn(),e),Zu=ti(()=>N("h2",null,"Saves Manager",-1)),Xu={class:"modal-footer"},Ju={class:"field"},Ku=ti(()=>N("span",{class:"field-title"},"Create Save",-1)),Qu={class:"field-buttons"},ec={class:"footer"},tc=ti(()=>N("div",{style:{"flex-grow":"1"}},null,-1)),nc=Z({__name:"SavesManager",setup(e,{expose:t}){const n=G(!1),r=G(null);t({open(){n.value=!0}});const i=G(!1),a=G(""),u=G(null);wt(a,I=>{I?Yt(()=>{try{if(I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=Wt.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I),i.value=!0;return}const E=JSON.parse(I);if(typeof E!="object"){i.value=!0;return}const L=cr();E.id=L,bt(E),a.value="",i.value=!1,ie.saves.push(L)}catch{i.value=!0}}):i.value=!1});let l={},c=G(Object.keys(l).reduce((I,E)=>(I.push({label:E.split("/").slice(-1)[0].slice(0,-4),value:l[E]}),I),[]));const p=Br({});function h(I){if(p[I]==null){let E=localStorage.getItem(I);if(E==null)p[I]={error:"Save doesn't exist in localStorage",id:I};else if(E==="dW5kZWZpbmVk")p[I]={error:"Save is undefined",id:I};else try{if(E[0]!=="{")if(E[0]==="e")E=decodeURIComponent(escape(atob(E)));else if(E[0]==="\u1BE1")E=Wt.decompressFromUTF16(E);else return console.warn("Unable to determine preset encoding",E),i.value=!0,p[I]={error:"Unable to determine preset encoding",id:I},p[I];p[I]={...JSON.parse(E),id:I}}catch(L){p[I]={error:L,id:I},console.warn(`SavesManager: Failed to load info about save with id ${I}: -${L} -${E}`)}}return p[I]}wt(n,I=>{I&&Object.keys(p).forEach(E=>delete p[E])});const g=w(()=>ie.saves.reduce((I,E)=>(I[E]=h(E),I),{}));function b(I){let E;switch(Y.id===I?E=jr(Y):E=JSON.stringify(g.value[I]),ve.exportEncoding){default:console.warn(`Unknown save encoding: ${ve.exportEncoding}. Defaulting to lz`);case"lz":E=Wt.compressToUTF16(E);break;case"base64":E=btoa(unescape(encodeURIComponent(E)));break;case"plain":break}const L=document.createElement("textarea");L.value=E,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 E={...g.value[I],id:cr()};bt(E),ie.saves.push(E.id)}function k(I){ie.saves=ie.saves.filter(E=>E!==I),localStorage.removeItem(I),p[I]=void 0}function C(I){g.value[Y.id].time=Y.time,bt(),p[Y.id]=void 0,hn(g.value[I]),p[I]=void 0}function T(I){if(u.value=I,Yt(()=>{u.value=null}),I[0]!=="{")if(I[0]==="e")I=decodeURIComponent(escape(atob(I)));else if(I[0]==="\u1BE1")I=Wt.decompressFromUTF16(I);else{console.warn("Unable to determine preset encoding",I);return}const E=JSON.parse(I);E.id=cr(),bt(E),ie.saves.push(E.id),C(E.id)}function $(I,E){const L=g.value[I];L!=null&&(L.name=E,Y.id===I?(Y.name=E,bt()):(bt(L),p[I]=void 0))}return(I,E)=>(S(),re(Lt,{modelValue:n.value,"onUpdate:modelValue":E[4]||(E[4]=L=>n.value=L),ref_key:"modal",ref:r},{header:H(()=>[Zu]),body:H(({shown:L})=>[L?(S(),re(s(ba),{key:0,list:s(ie).saves,handle:".handle",itemKey:de=>de},{item:H(({element:de})=>[d(Yu,{save:s(g)[de],onOpen:ue=>C(de),onExport:ue=>b(de),onEditName:ue=>$(de,ue),onDuplicate:ue=>m(de),onDelete:ue=>k(de)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):B("",!0)]),footer:H(()=>[N("div",Xu,[d(zi,{modelValue:a.value,"onUpdate:modelValue":E[0]||(E[0]=L=>a.value=L),title:"Import Save",placeholder:"Paste your save here!",class:Ne({importingFailed:i.value})},null,8,["modelValue","class"]),N("div",Ju,[Ku,N("div",Qu,[N("button",{class:"button",onClick:E[1]||(E[1]=L=>C(s($n)().id))},"New Game"),Object.keys(s(c)).length>0?(S(),re(ei,{key:0,options:s(c),modelValue:u.value,"onUpdate:modelValue":E[2]||(E[2]=L=>T(L)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):B("",!0)])]),N("div",ec,[tc,N("button",{class:"button modal-default-button",onClick:E[3]||(E[3]=L=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Gi=be(nc,[["__scopeId","data-v-2a4275be"]]);const kt=e=>(un("data-v-318a1c31"),e=e(),cn(),e),rc=["src","alt"],ic={key:1,class:"title"},ac=kt(()=>N("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),sc={class:"discord"},oc={class:"discord-links"},lc={key:0},uc=["href"],cc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),dc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),pc={href:"https://forums.moddingtree.com/",target:"_blank"},fc=kt(()=>N("span",{class:"material-icons"},"forum",-1)),gc=kt(()=>N("span",{class:"material-icons"},"info",-1)),mc=kt(()=>N("span",{class:"material-icons"},"library_books",-1)),vc=kt(()=>N("span",{class:"material-icons"},"settings",-1)),hc=kt(()=>N("span",{class:"material-icons"},"library_books",-1)),bc=kt(()=>N("span",{class:"material-icons"},"settings",-1)),yc=kt(()=>N("span",{class:"material-icons"},"info",-1)),wc={href:"https://forums.moddingtree.com/",target:"_blank"},_c=kt(()=>N("span",{class:"material-icons"},"forum",-1)),Nc={class:"discord"},Cc={class:"discord-links"},kc={key:0},Sc=["href"],Mc=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"The Paper Pilot Community")],-1)),Ic=kt(()=>N("li",null,[N("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),xc=Z({__name:"Nav",setup(e){const t=G(null),n=G(null),r=G(null),i=G(null),{useHeader:a,banner:u,title:l,discordName:c,discordLink:p,versionNumber:h}=ve;function g(){window.open(p,"mywindow")}return(b,m)=>(S(),P(ne,null,[s(a)?(S(),P("div",Vt({key:0,class:"nav"},b.$attrs),[s(u)?(S(),P("img",{key:0,src:s(u),class:"banner",alt:s(l)},null,8,rc)):(S(),P("div",ic,ee(s(l)),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:s(U).Down,class:"version"},{default:H(()=>[N("span",null,"v"+ee(s(h)),1)]),_:1},8,["direction"])]),ac,N("div",sc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",oc,[s(p)?(S(),P("li",lc,[N("a",{href:s(p),target:"_blank"},ee(s(c)),9,uc)])):B("",!0),cc,dc])]),N("div",null,[N("a",pc,[d(qe,{display:"Forums",direction:s(U).Down,yoffset:"5px"},{default:H(()=>[fc]),_: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:s(U).Down,class:"info"},{default:H(()=>[gc]),_: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:s(U).Down,xoffset:"-20px"},{default:H(()=>[mc]),_: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:s(U).Down,xoffset:"-66px"},{default:H(()=>[vc]),_:1},8,["direction"])])],16)):(S(),P("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:s(U).Right,xoffset:"25%",class:"version"},{default:H(()=>[N("span",null,"v"+ee(s(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:s(U).Right},{default:H(()=>[hc]),_: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:s(U).Right},{default:H(()=>[bc]),_: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:s(U).Right},{default:H(()=>[yc]),_:1},8,["direction"])]),N("div",null,[N("a",wc,[d(qe,{display:"Forums",direction:s(U).Right,xoffset:"7px"},{default:H(()=>[_c]),_:1},8,["direction"])])]),N("div",Nc,[N("span",{onClick:g,class:"material-icons"},"discord"),N("ul",Cc,[s(p)?(S(),P("li",kc,[N("a",{href:s(p),target:"_blank"},ee(s(c)),9,Sc)])):B("",!0),Mc,Ic])])],16)),d(uu,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),d(Gi,{ref_key:"savesManager",ref:n},null,512),d(yu,{ref_key:"options",ref:r},null,512),d(Gl,{ref_key:"changelog",ref:i},null,512)],64))}});var Ui=be(xc,[["__scopeId","data-v-318a1c31"]]);const $c={class:"inner-tab"},Dc=Z({__name:"Game",setup(e){const t=Zt(Y,"tabs"),n=w(()=>Object.keys(me)),r=ve.useHeader;function i(a){const{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}=a;return{display:u,minimized:l,name:c,color:p,minimizable:h,nodes:g,minimizedDisplay:b}}return(a,u)=>(S(),P("div",{class:Ne(["tabs-container",{useHeader:s(r)}])},[(S(!0),P(ne,null,Dt(s(t),(l,c)=>{var p,h;return S(),P("div",{key:c,class:Ne(["tab",s((p=s(me)[l])==null?void 0:p.classes)]),style:Le(s((h=s(me)[l])==null?void 0:h.style))},[c===0&&!s(r)?(S(),re(Ui,{key:0})):B("",!0),N("div",$c,[s(n).includes(l)?(S(),re(Bl,Vt({key:0},i(s(me)[l]),{index:c,onSetMinimized:g=>s(me)[l].minimized.value=g}),null,16,["index","onSetMinimized"])):(S(),re(Je(l),{key:1,index:c},null,8,["index"]))])],6)}),128))],2))}});var Tc=be(Dc,[["__scopeId","data-v-dcd207b4"]]);const Pc=Z({__name:"Sticky",setup(e){const t=G("0"),n=new ResizeObserver(i),r=_t(null);function i(){let a=r.value;if(a==null)return;let u=0;for(;a.previousSibling;){const l=a.previousSibling;l.dataset&&"vSticky"in l.dataset&&(u+=l.offsetHeight),a=l}t.value=u+"px"}return Yt(i),document.fonts.ready.then(i),Kn(()=>{var u;const a=(u=r.value)==null?void 0:u.parentElement;a&&n.observe(a)}),(a,u)=>(S(),P("div",{class:"sticky",style:Le({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[qt(a.$slots,"default",{},void 0,!0)],4))}});var mr=be(Pc,[["__scopeId","data-v-cccac690"]]);const Ac=["x1","y1","x2","y2"],Rc=Z({__name:"BoardLink",props:{link:null,dragging:null,dragged:null},setup(e){const n=Pe(e),r=w(()=>{var u,l,c,p,h,g,b;const a={...n.link.value.startNode.position};return n.link.value.offsetStart&&(a.x+=s(n.link.value.offsetStart).x,a.y+=s(n.link.value.offsetStart).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.startNode&&(a.x+=(p=(c=(l=n.dragged)==null?void 0:l.value)==null?void 0:c.x)!=null?p:0,a.y+=(b=(g=(h=n.dragged)==null?void 0:h.value)==null?void 0:g.y)!=null?b:0),a}),i=w(()=>{var u,l,c,p,h,g,b;const a={...n.link.value.endNode.position};return n.link.value.offsetEnd&&(a.x+=s(n.link.value.offsetEnd).x,a.y+=s(n.link.value.offsetEnd).y),((u=n.dragging)==null?void 0:u.value)===n.link.value.endNode&&(a.x+=(p=(c=(l=n.dragged)==null?void 0:l.value)==null?void 0:c.x)!=null?p:0,a.y+=(b=(g=(h=n.dragged)==null?void 0:h.value)==null?void 0:g.y)!=null?b:0),a});return(a,u)=>(S(),P("line",Vt({class:"link"},e.link,{class:{pulsing:e.link.pulsing},x1:s(r).x,y1:s(r).y,x2:s(i).x,y2:s(i).y}),null,16,Ac))}});var Ec=be(Rc,[["__scopeId","data-v-58e8d695"]]);const Fc={key:0},Oc=["transform","onMousedown","onTouchstart","onMouseup","onTouchend"],qc=["fill","stroke-width","stroke"],Vc=["fill"],Bc=Z({__name:"BoardNodeAction",props:{node:null,nodeType:null,actions:null,isSelected:{type:Boolean},selectedAction:null},emits:["clickAction"],setup(e,{emit:t}){const r=Pe(e),i=w(()=>fe(r.nodeType.value.size,s(r.node))),a=w(()=>{var h;return(h=fe(r.nodeType.value.outlineColor,s(r.node)))!=null?h:It[ie.theme].variables["--outline"]}),u=w(()=>{var h;return(h=fe(r.nodeType.value.titleColor,s(r.node)))!=null?h:It[ie.theme].variables["--foreground"]}),l=w(()=>fe(r.nodeType.value.actionDistance,s(r.node)));function c(h,g){t("clickAction",g.id),h.preventDefault(),h.stopPropagation()}function p(h,g){var b;((b=s(r.selectedAction))==null?void 0:b.id)===g.id&&(h.preventDefault(),h.stopPropagation())}return(h,g)=>(S(),re(Un,{name:"actions",appear:""},{default:H(()=>[e.isSelected&&e.actions?(S(),P("g",Fc,[(S(!0),P(ne,null,Dt(e.actions,(b,m)=>{var k,C;return S(),P("g",{key:b.id,class:Ne(["action",{selected:((k=e.selectedAction)==null?void 0:k.id)===b.id}]),transform:`translate( - ${(-s(i)-30)*Math.sin(((e.actions.length-1)/2-m)*s(l))}, - ${(s(i)+30)*Math.cos(((e.actions.length-1)/2-m)*s(l))} - )`,onMousedown:T=>c(T,b),onTouchstart:T=>c(T,b),onMouseup:T=>p(T,b),onTouchend:Dn(T=>p(T,b),["stop"])},[N("circle",{fill:s(fe)(b.fillColor,e.node),r:"20","stroke-width":((C=e.selectedAction)==null?void 0:C.id)===b.id?4:0,stroke:s(a)},null,8,qc),N("text",{fill:s(u),class:"material-icons"},ee(s(fe)(b.icon,e.node)),9,Vc)],42,Oc)}),128))])):B("",!0)]),_:1}))}});var Lc=be(Bc,[["__scopeId","data-v-9efb2a56"]]);const jc=["transform"],zc={key:0},Gc=["r","fill","stroke"],Uc=["r","fill","stroke"],Wc=["r","fill"],Hc=["r","stroke-dasharray","stroke-dashoffset","stroke"],Yc=["fill","transform"],Zc={key:1,transform:"rotate(45, 0, 0)"},Xc=["width","height","transform","fill","stroke"],Jc=["width","height","transform","fill","stroke"],Kc=["width","height","transform","fill"],Qc=["width","height","transform","stroke-dasharray","stroke-dashoffset","stroke"],ed=["fill","y"],td=["fill"],nd=["fill","y"],rd={key:0},id=["fill","y"],ad=["fill","y"],sd=Z({__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=Pe(n),a=w(()=>fe(i.nodeType.value.draggable,s(i.node)));wt(a,J=>{const $e=s(i.node);s(i.dragging)===$e&&!J&&t("endDragging",$e)});const u=w(()=>{var $e;const J=s(i.node);return($e=fe(i.nodeType.value.actions,J))==null?void 0:$e.filter(tt=>Ye(fe(tt.visibility,J)))}),l=w(()=>{var $e;const J=s(i.node);if(fe(i.nodeType.value.draggable,J)&&(($e=s(i.dragging))==null?void 0:$e.id)===J.id&&s(i.dragged)!=null){const{x:tt,y:vt}=s(i.dragged);return{x:J.position.x+Math.round(tt/25)*25,y:J.position.y+Math.round(vt/25)*25}}return J.position}),c=w(()=>fe(i.nodeType.value.shape,s(i.node))),p=w(()=>fe(i.nodeType.value.title,s(i.node))),h=w(()=>fe(i.nodeType.value.otherSubtitle,s(i.node))),g=w(()=>{var J;return(J=i.isSelected.value?s(i.selectedAction)&&fe(s(i.selectedAction).tooltip,s(i.node)):null)!=null?J:fe(i.nodeType.value.label,s(i.node))}),b=w(()=>{var J,$e;return fe(($e=(J=s(i.selectedAction))==null?void 0:J.confirmationLabel)!=null?$e:{text:"Tap again to confirm"},s(i.node))}),m=w(()=>fe(i.nodeType.value.size,s(i.node))),k=w(()=>{var J;return(J=fe(i.nodeType.value.progress,s(i.node)))!=null?J:0}),C=w(()=>It[ie.theme].variables["--background"]),T=w(()=>{var J;return(J=fe(i.nodeType.value.outlineColor,s(i.node)))!=null?J:It[ie.theme].variables["--outline"]}),$=w(()=>{var J;return(J=fe(i.nodeType.value.fillColor,s(i.node)))!=null?J:It[ie.theme].variables["--raised-background"]}),I=w(()=>fe(i.nodeType.value.progressColor,s(i.node))),E=w(()=>{var J;return(J=fe(i.nodeType.value.titleColor,s(i.node)))!=null?J:It[ie.theme].variables["--foreground"]}),L=w(()=>fe(i.nodeType.value.progressDisplay,s(i.node))),de=w(()=>i.dragging.value!=null&&s(i.hasDragged)&&fe(i.nodeType.value.canAccept,s(i.node),i.dragging.value)),ue=w(()=>fe(i.nodeType.value.style,s(i.node))),ae=w(()=>fe(i.nodeType.value.classes,s(i.node)));function X(J){t("mouseDown",J,i.node.value,a.value)}function Ie(J){var $e,tt,vt;($e=i.hasDragged)!=null&&$e.value||(t("endDragging",i.node.value),(vt=(tt=i.nodeType.value).onClick)==null||vt.call(tt,i.node.value),J.stopPropagation())}const he=w(()=>fe(i.nodeType.value.subtitle,s(i.node))),Ge=w(()=>fe(i.nodeType.value.showStar,s(i.node))),mt=w(()=>fe(i.nodeType.value.fillStar,s(i.node)));return(J,$e)=>{var tt,vt,ct;return S(),P("g",{class:Ne(["boardnode",{[e.node.type]:!0,isSelected:e.isSelected,isDraggable:s(a),...s(ae)}]),style:Le([{opacity:((tt=e.dragging)==null?void 0:tt.id)===e.node.id&&e.hasDragged?.5:1},(vt=s(ue))!=null?vt:[]]),transform:`translate(${s(l).x},${s(l).y})${e.isSelected?" scale(1.2)":""}`},[d(Lc,{actions:(ct=s(u))!=null?ct:[],"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:X,onTouchstartPassive:X,onMouseup:Ie,onTouchendPassive:Ie},[s(c)===s(ze).Circle?(S(),P("g",zc,[s(de)?(S(),P("circle",{key:0,class:"receiver",r:s(m)+8,fill:s(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Gc)):B("",!0),N("circle",{class:"body",r:s(m),fill:s($),stroke:s(T),"stroke-width":4},null,8,Uc),s(L)===s(ln).Fill?(S(),P("circle",{key:1,class:"progress progressFill",r:Math.max(s(m)*s(k)-2,0),fill:s(I)},null,8,Wc)):(S(),P("circle",{key:2,r:s(m)+4.5,class:"progress progressRing",fill:"transparent","stroke-dasharray":(s(m)+4.5)*2*Math.PI,"stroke-width":5,"stroke-dashoffset":(s(m)+4.5)*2*Math.PI-s(k)*(s(m)+4.5)*2*Math.PI,stroke:s(I)},null,8,Hc)),s(Ge)?(S(),P("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:s(mt)?"var(--bought)":"none",transform:`translate(${-s(m)/4}, ${-s(m)-10}), scale(0.5)`},null,8,Yc)):B("",!0)])):s(c)===s(ze).Diamond?(S(),P("g",Zc,[s(de)?(S(),P("rect",{key:0,class:"receiver",width:s(m)*s(r)+16,height:s(m)*s(r)+16,transform:`translate(${-(s(m)*s(r)+16)/2}, ${-(s(m)*s(r)+16)/2})`,fill:s(C),stroke:e.receivingNode?"#0F0":"#0F03","stroke-width":2},null,8,Xc)):B("",!0),N("rect",{class:"body",width:s(m)*s(r),height:s(m)*s(r),transform:`translate(${-s(m)*s(r)/2}, ${-s(m)*s(r)/2})`,fill:s($),stroke:s(T),"stroke-width":4},null,8,Jc),s(L)===s(ln).Fill?(S(),P("rect",{key:1,class:"progress progressFill",width:Math.max(s(m)*s(r)*s(k)-2,0),height:Math.max(s(m)*s(r)*s(k)-2,0),transform:`translate(${-Math.max(s(m)*s(r)*s(k)-2,0)/2}, ${-Math.max(s(m)*s(r)*s(k)-2,0)/2})`,fill:s(I)},null,8,Kc)):(S(),P("rect",{key:2,class:"progress progressDiamond",width:s(m)*s(r)+9,height:s(m)*s(r)+9,transform:`translate(${-(s(m)*s(r)+9)/2}, ${-(s(m)*s(r)+9)/2})`,fill:"transparent","stroke-dasharray":(s(m)*s(r)+9)*4,"stroke-width":5,"stroke-dashoffset":(s(m)*s(r)+9)*4-s(k)*(s(m)*s(r)+9)*4,stroke:s(I)},null,8,Qc))])):B("",!0),N("text",{fill:s(E),class:"node-title",y:s(h)&&!s(he)?-10:0},ee(s(p)),9,ed),s(he)?(S(),P("text",{key:2,fill:s(E),class:"node-subtitle",y:"-25"},ee(s(he)),9,td)):B("",!0),s(h)?(S(),P("text",{key:3,fill:s(E),class:"node-subtitle",y:s(he)?25:15},ee(s(h)),9,nd)):B("",!0)],32),d(Un,{name:"fade",appear:""},{default:H(()=>{var St;return[s(g)?(S(),P("g",rd,[N("text",{fill:(St=s(g).color)!=null?St:s(E),class:Ne(["node-title",{pulsing:s(g).pulsing}]),y:-s(m)-20},ee(s(g).text),11,id)])):B("",!0)]}),_:1}),d(Un,{name:"fade",appear:""},{default:H(()=>{var St;return[e.isSelected&&e.selectedAction?(S(),P("text",{key:0,fill:(St=s(b).color)!=null?St:s(E),class:Ne(["node-title",{pulsing:s(b).pulsing}]),y:s(m)+75},ee(s(b).text),11,ad)):B("",!0)]}),_:1})],14,jc)}}});var od=be(sd,[["__scopeId","data-v-85b0e9a6"]]);const ld={class:"stage",width:"100%",height:"100%"},ud={class:"g1"},cd=Z({__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=Pe(e),r=G({x:0,y:0}),i=G({x:0,y:0}),a=G(!1),u=G(null),l=w(()=>{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((T,$)=>{if($.id===m.id)return T;const I=n.types.value[$.type];if(!fe(I.canAccept,$,m))return T;const L=Math.pow(k.x-$.position.x,2)+Math.pow(k.y-$.position.y,2);let de=fe(I.size,$);return L>C||L>de*de?T:(C=L,$)},null))});function c(m){m.setTransformOrigin(null),m.moveTo(u.value.$el.clientWidth/2,u.value.$el.clientHeight/2)}function p(m,k=null,C=!1){if(n.draggingNode.value==null){m.preventDefault(),m.stopPropagation();let T,$;if("touches"in m)if(m.touches.length===1)T=m.touches[0].clientX,$=m.touches[0].clientY;else return;else T=m.clientX,$=m.clientY;r.value={x:T,y:$},i.value={x:0,y:0},a.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:T}=u.value.panZoomInstance.getTransform();let $,I;if("touches"in m)if(m.touches.length===1)$=m.touches[0].clientX,I=m.touches[0].clientY;else{g(n.draggingNode.value),n.mousePosition.value=null;return}else $=m.clientX,I=m.clientY;n.mousePosition.value={x:($-k)/T,y:(I-C)/T},i.value={x:i.value.x+($-r.value.x)/T,y:i.value.y+(I-r.value.y)/T},r.value={x:$,y:I},(Math.abs(i.value.x)>10||Math.abs(i.value.y)>10)&&(a.value=!0),n.draggingNode.value!=null&&(m.preventDefault(),m.stopPropagation())}function g(m,k=!1){var C,T;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 $=n.nodes.value;$.push($.splice($.indexOf(n.draggingNode.value),1)[0]),n.receivingNode.value&&((T=(C=n.types.value[n.receivingNode.value.type]).onDrop)==null||T.call(C,n.receivingNode.value,n.draggingNode.value)),n.setDraggingNode.value(null)}else!a.value&&!k&&(n.state.value.selectedNode=null,n.state.value.selectedAction=null)}function b(m,k){var T,$;const C=n.types.value[m.type];fe(($=(T=C.actions)==null?void 0:T.find(I=>I.id===k))==null?void 0:$.confirmationLabel,m)==null&&(n.state.value.selectedAction=k),n.state.value.selectedAction===k?s(n.selectedAction).onClick(s(n.selectedNode)):n.state.value={...n.state.value,selectedAction:k}}return(m,k)=>{const C=Ct("panZoom");return s(Ye)(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:u,onInit:c,onMousemove:h,onTouchmove:h,onMousedown:k[0]||(k[0]=T=>p(T)),onTouchstart:k[1]||(k[1]=T=>p(T)),onMouseup:k[2]||(k[2]=()=>g(s(e.draggingNode))),onTouchendPassive:k[3]||(k[3]=()=>g(s(e.draggingNode))),onMouseleave:k[4]||(k[4]=()=>g(s(e.draggingNode),!0))},{default:H(()=>[(S(),P("svg",ld,[N("g",ud,[d(li,{name:"link",appear:""},{default:H(()=>[(S(!0),P(ne,null,Dt(s(e.links)||[],T=>(S(),P("g",{key:`${T.startNode.id}-${T.endNode.id}`},[d(Ec,{link:T,dragging:s(e.draggingNode),dragged:T.startNode===s(e.draggingNode)||T.endNode===s(e.draggingNode)?i.value:void 0},null,8,["link","dragging","dragged"])]))),128))]),_:1}),d(li,{name:"grow",duration:500,appear:""},{default:H(()=>[(S(!0),P(ne,null,Dt(s(l),T=>(S(),P("g",{key:T.id,style:{"transition-duration":"0s"}},[d(od,{node:T,nodeType:e.types[T.type],dragging:s(e.draggingNode),dragged:s(e.draggingNode)===T?i.value:void 0,hasDragged:s(e.draggingNode)==null?!1:a.value,receivingNode:s(e.receivingNode)===T,isSelected:s(e.selectedNode)===T,selectedAction:s(e.selectedNode)===T?s(e.selectedAction):null,onMouseDown:p,onEndDragging:g,onClickAction:$=>b(T,$)},null,8,["node","nodeType","dragging","dragged","hasDragged","receivingNode","isSelected","selectedAction","onClickAction"])]))),128))]),_:1})])]))]),_:1},8,["style","class","options"])):B("",!0)}}});Ke.on("setupVue",e=>wa.install(e));const Wi=Symbol("Board");var ln=(e=>(e.Outline="Outline",e.Fill="Fill",e))(ln||{}),ze=(e=>(e.Circle="Circle",e.Diamond="Triangle",e))(ze||{});function dd(e){const t=lt({nodes:[],selectedNode:null,selectedAction:null},!1);return Qe(n=>{const r=e.call(n,n);r.id=Jt("board-"),r.type=Wi,r[ft]=cd,r.state?(Li(t),R(r,"state")):(t[Xt]={nodes:r.startNodes().map((l,c)=>(l.id=c,l)),selectedNode:null,selectedAction:null},r.state=t),r.nodes=w(()=>s(u.state).nodes),r.selectedNode=w({get(){return u.nodes.value.find(l=>l.id===s(u.state).selectedNode)||null},set(l){var c,p;Ve(u.state)?u.state.value={...u.state.value,selectedNode:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedNode=(p=l==null?void 0:l.id)!=null?p:null}}),r.selectedAction=w({get(){const l=u.selectedNode.value;if(l==null)return null;const c=u.types[l.type];return c.actions==null?null:c.actions.find(p=>p.id===s(u.state).selectedAction)||null},set(l){var c,p;Ve(u.state)?u.state.value={...u.state.value,selectedAction:(c=l==null?void 0:l.id)!=null?c:null}:u.state.selectedAction=(p=l==null?void 0:l.id)!=null?p:null}}),r.mousePosition=G(null),r.links?R(r,"links"):r.links=w(()=>u.selectedAction.value==null?null:u.selectedAction.value.links&&u.selectedNode.value?fe(u.selectedAction.value.links,u.selectedNode.value):null),r.draggingNode=G(null),r.receivingNode=G(null),R(r,"visibility"),le(r,"visibility",Se.Visible),R(r,"width"),le(r,"width","100%"),R(r,"height"),le(r,"height","100%"),R(r,"classes"),R(r,"style");for(const l in r.types){const c=r.types[l];if(R(c,"title"),R(c,"subtitle"),R(c,"label"),R(c,"size"),le(c,"size",50),R(c,"style"),R(c,"classes"),R(c,"draggable"),le(c,"draggable",!1),R(c,"shape"),le(c,"shape","Circle"),R(c,"canAccept"),le(c,"canAccept",!1),R(c,"progress"),R(c,"progressDisplay"),le(c,"progressDisplay","Fill"),R(c,"progressColor"),le(c,"progressColor","none"),R(c,"fillColor"),R(c,"outlineColor"),R(c,"titleColor"),R(c,"actionDistance"),le(c,"actionDistance",Math.PI/6),R(c,"otherSubtitle"),R(c,"showStar"),R(c,"fillStar"),c.nodes=w(()=>s(u.state).nodes.filter(p=>p.type===l)),le(c,"onClick",function(p){s(u.state).selectedNode=p.id}),c.actions)for(const p of c.actions)R(p,"visibility"),le(p,"visibility",Se.Visible),R(p,"icon"),R(p,"fillColor"),R(p,"tooltip"),R(p,"confirmationLabel"),le(p,"confirmationLabel",{text:"Tap again to confirm"}),R(p,"links")}function i(l){r.draggingNode.value=l}function a(l){r.receivingNode.value=l}r.placeInAvailableSpace=function(l,c=100,p=U.Right){const h=u.nodes.value.slice().filter(g=>g===l||(p===U.Down||p===U.Up)&&Math.abs(g.position.x-l.position.x)>c||(p===U.Left||p===U.Right)&&Math.abs(g.position.y-l.position.y)>c?!1:!(p===U.Right&&g.position.xl.position.x+c||p===U.Up&&g.position.y>l.position.y+c||p===U.Down&&g.position.yg.position.x-b.position.x:p===U.Left?(g,b)=>b.position.x-g.position.x:p===U.Up?(g,b)=>b.position.y-g.position.y:(g,b)=>g.position.y-b.position.y);for(let g=0;g0&&m>c)break}},r[ut]=function(){const{nodes:l,types:c,state:p,visibility:h,width:g,height:b,style:m,classes:k,links:C,selectedAction:T,selectedNode:$,mousePosition:I,draggingNode:E,receivingNode:L}=this;return{nodes:l,types:c,state:p,visibility:h,width:g,height:b,style:s(m),classes:k,links:C,selectedAction:T,selectedNode:$,mousePosition:I,draggingNode:E,receivingNode:L,setDraggingNode:i,setReceivingNode:a}};const u=r;return u})}function fe(e,t,...n){return Hn(e)?e(t,...n):s(e)}function Tn(e){let t=0;return e.nodes.value.forEach(n=>{n.id>=t&&(t=n.id+1)}),t}const zn={};Ke.on("addLayer",e=>{const t=Zn(e,Wi);zn[e.id]=e.on("postUpdate",n=>{t.forEach(r=>{Object.values(r.types).forEach(i=>i.nodes.value.forEach(a=>{var u;return(u=i.update)==null?void 0:u.call(i,a,n)}))})})});Ke.on("removeLayer",e=>{var t;(t=zn[e.id])==null||t.call(zn),zn[e.id]=void 0});function In(e,t="points",n=0,r=void 0){const i=Ve(e)?e:lt(e);if(i.displayName=t,i.precision=n,i.small=r,!Ve(e)){const a=i[Ot];a.displayName=t,a.precision=n,a.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)?st(e.small?n:o.floor(n)):xe(n,e.precision,e.small)}Ke.on("setupVue",e=>e.use(_a));function pd(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 fd=Z({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}=Pe(e),a=Wr(n),u=w(()=>{const c=Te(r);return c==null||c===""?{}:s(i)?pd(c):{boxShadow:`0px 9px 5px -6px ${c}`}});function l(){t("selectTab")}return{selectTab:l,component:a,glowColorStyle:u,unref:s,Visibility:Se,isVisible:Ye,isHidden:wn}}});function gd(e,t,n,r,i,a){var u;return e.isVisible(e.visibility)?(S(),P("button",{key:0,onClick:t[0]||(t[0]=(...l)=>e.selectTab&&e.selectTab(...l)),class:Ne(["tabButton",{active:e.active,...e.unref(e.classes)}]),style:Le([{visibility:e.isHidden(e.visibility)?"hidden":void 0},e.glowColorStyle,(u=e.unref(e.style))!=null?u:{}])},[(S(),re(Je(e.component)))],6)):B("",!0)}var Hi=be(fd,[["render",gd],["__scopeId","data-v-21427abb"]]);const md=Z({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:Hi},setup(e){const{activeTab:t}=Pe(e),n=w(()=>It[ie.theme].floatingTabs),r=_t("");Pt(()=>{const l=Te(t);if(l==null){r.value="";return}if(At(l)){r.value=ge(l);return}r.value=ge(s(l.display))});const i=w(()=>{const l=Te(t);return At(l)||!l?void 0:s(l.classes)}),a=w(()=>{const l=Te(t);return At(l)||!l?void 0:s(l.style)});function u(l){const{display:c,style:p,classes:h,glowColor:g,visibility:b}=l;return{display:c,style:s(p),classes:h,glowColor:g,visibility:b}}return{floating:n,tabClasses:i,tabStyle:a,Visibility:Se,component:r,gatherButtonProps:u,unref:s,isVisible:Ye,isHidden:wn}}});function vd(e,t,n,r,i,a){var c,p;const u=Ct("TabButton"),l=Ct("Sticky");return e.isVisible(e.visibility)?(S(),P("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(l,{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),P(ne,null,Dt(e.unref(e.tabs),(h,g)=>(S(),re(u,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(Je(e.unref(e.component)),{key:0})):B("",!0)],6)):B("",!0)}var hd=be(md,[["render",vd],["__scopeId","data-v-58dbf83a"]]);const bd=Symbol("TabButton"),yd=Symbol("TabFamily");function Yi(e,t){Object.keys(e).length===0&&console.error("Cannot create tab family with 0 tabs");const n=lt(Object.keys(e)[0],!1);return Qe(r=>{var u;const i=(u=t==null?void 0:t.call(r,r))!=null?u:{};i.id=Jt("tabFamily-"),i.type=yd,i[ft]=hd,i.tabs=Object.keys(e).reduce((l,c)=>{const p=e[c]();return p.type=bd,p[ft]=Hi,R(p,"visibility"),le(p,"visibility",Se.Visible),R(p,"tab"),R(p,"display"),R(p,"classes"),R(p,"style"),R(p,"glowColor"),l[c]=p,l},{}),i.selected=n,i.activeTab=w(()=>{const l=s(a.tabs);if(n.value in l&&Ye(l[n.value].visibility))return s(l[n.value].tab);const c=Object.values(l).find(p=>Ye(p.visibility));return c?s(c.tab):null}),R(i,"visibility"),le(i,"visibility",Se.Visible),R(i,"classes"),R(i,"style"),R(i,"buttonContainerClasses"),R(i,"buttonContainerStyle"),i[ut]=function(){const{visibility:l,activeTab:c,selected:p,tabs:h,style:g,classes:b,buttonContainerClasses:m,buttonContainerStyle:k}=this;return{visibility:l,activeTab:c,selected:p,tabs:h,style:s(g),classes:b,buttonContainerClasses:m,buttonContainerStyle:k}};const a=i;return a})}function Ut(e){return Qe(t=>{const{addend:n,description:r,enabled:i,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.add(p,s(u)),invert:p=>o.sub(p,s(u)),getFormula:p=>f.add(p,u),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[gt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),0):o.lt(s(u),0))?"color: var(--danger)":""},[o.gte(s(u),0)?"+":"",Ht(s(u))])]))}})}function Ce(e){return Qe(t=>{const{multiplier:n,description:r,enabled:i,smallerIsBetter:a}=e.call(t,t),u=_e(n),l=_e(r),c=i==null?void 0:_e(i);return{apply:p=>o.times(p,s(u)),invert:p=>o.div(p,s(u)),getFormula:p=>f.times(p,u),enabled:c,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(l)!=null?d("span",{class:"modifier-description"},[gt(s(l))]):null,d("span",{class:"modifier-amount",style:(a===!0?o.gt(s(u),1):o.lt(s(u),1))?"color: var(--danger)":""},[y("\xD7"),Ht(s(u))])]))}})}function wd(e){return Qe(t=>{const{exponent:n,description:r,enabled:i,supportLowNumbers:a,smallerIsBetter:u}=e.call(t,t),l=_e(n),c=_e(r),p=i==null?void 0:_e(i);return{apply:h=>{let g=h;return a&&(g=o.add(g,1)),g=o.pow(g,s(l)),a&&(g=o.sub(g,1)),g},invert:h=>{let g=h;return a&&(g=o.add(g,1)),g=o.root(g,s(l)),a&&(g=o.sub(g,1)),g},getFormula:h=>a?f.add(h,1).pow(l).sub(1):f.pow(h,l),enabled:p,description:r==null?void 0:j(()=>d("div",{class:"modifier-container"},[s(c)!=null?d("span",{class:"modifier-description"},[gt(s(c)),a?" (+1 effective)":null]):null,d("span",{class:"modifier-amount",style:(u===!0?o.gt(s(l),1):o.lt(s(l),1))?"color: var(--danger)":""},[y("^"),Ht(s(l))])]))}})}function Mt(e){return Qe(()=>{const t=e();return{apply:n=>t.filter(r=>s(r.enabled)!==!1).reduce((r,i)=>i.apply(r),n),invert:t.every(n=>n.invert!=null)?n=>t.filter(r=>s(r.enabled)!==!1).reduceRight((r,i)=>i.invert(r),n):void 0,getFormula:t.every(n=>n.getFormula!=null)?n=>t.filter(r=>s(r.enabled)!==!1).reduce((r,i)=>i.getFormula(r),n):void 0,enabled:t.some(n=>n.enabled!=null)?w(()=>t.filter(n=>s(n.enabled)!==!1).length>0):void 0,description:t.some(n=>n.description!=null)?j(()=>d(ne,null,[t.filter(n=>s(n.enabled)!==!1).map(n=>s(n.description)).filter(n=>n).map(gt)])):void 0}})}const Vr=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),dn={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 ${st(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 Nn(e,t=1/0){const n=e(f.variable(0));return{id:"moreConnections",icon:"hub",formula:n,tooltip(r){return{text:`Increase Connections - ${st(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 Zi(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:a,resources:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,v.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function _d(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:a,tools:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,v.computedBonusConnectionsModifier.value).lte(u.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:a,portals:u}=e.state;return u.includes(i)?{text:"Disconnect",color:"var(--accent2)"}:o.add(a,v.computedBonusConnectionsModifier.value).lte(u.length)?{text:"Max connections",color:"var(--danger)"}:{text:t(i),color:"var(--accent2)"}}return null}function Xi(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 Ji(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 Nd(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 Cd(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 kd(e){var a,u,l;const t=(l=(u=(a=v.resourceNodes.value[e])==null?void 0:a.state)==null?void 0:u.amount)!=null?l:0,n=v.resourceLevels.value[e],r=Vr.evaluate(n),i=Vr.evaluate(o.add(n,1));return o.sub(t,r).max(0).div(o.sub(i,r)).toNumber()}function mn(e,t,n){if(t.value){const r=t.value.state,i=r[n],a=r.maxConnections;o.gt(i.length,o.add(a,e))&&(t.value.state={...t.value.state,[n]:i.slice(0,o.add(a,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 hi(e){return t=>ie.lineVisibility||e===v.board.selectedNode.value||e===v.board.draggingNode.value||v.resourceNodes.value[t]===v.board.draggingNode.value}const Sd={key:0},Md={key:0,class:"mark star"},Id=["src"],xd=Z({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(S(),P("div",Sd,[e.mark===!0?(S(),P("div",Md)):(S(),P("img",{key:1,class:"mark",src:e.mark},null,8,Id))])):B("",!0)}});var Qn=be(xd,[["__scopeId","data-v-2207999f"]]);const $d=Z({__name:"Node",props:{id:null},setup(e){const n=Pe(e),r=dr(Hr,()=>{}),i=dr(Yr,()=>{}),a=_t(null),u=w(()=>a.value&&a.value.parentElement);return wt([u,n.id],([l,c],[p,h])=>{p&&i(s(h)),l&&r(c,l)}),ki(()=>i(s(n.id))),(l,c)=>(S(),P("div",{class:"node",ref_key:"node",ref:a},null,512))}});var er=be($d,[["__scopeId","data-v-a48cb382"]]),Dd=Z({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:er,MarkNode:Qn},setup(e){const{display:t,onClick:n,onHold:r}=Pe(e),i=_t("");Pt(()=>{var h;const l=Te(t);if(l==null){i.value="";return}if(At(l)){i.value=ge(l);return}const c=ge((h=l.title)!=null?h:"","h3"),p=ge(l.description,"div");i.value=ge(j(()=>d("span",null,[l.title!=null?d("div",null,[d(c,null,null)]):null,d(p,null,null)])))});const{start:a,stop:u}=Oi(n,r);return{start:a,stop:u,comp:i,Visibility:Se,isVisible:Ye,isHidden:wn,unref:s}}});function Td(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=Ct("Node");return e.isVisible(e.visibility)?(S(),P("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(Je(e.unref(e.comp)),{key:0})):B("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],38)):B("",!0)}var Ki=be(Dd,[["render",Td],["__scopeId","data-v-211328c0"]]);const Qi=Symbol("Clickable");function Pd(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return Qe(r=>{var u,l,c;const i=(u=e==null?void 0:e.call(r,r))!=null?u:{};i.id=Jt("clickable-"),i.type=Qi,i[ft]=Ki;for(const p of t)(l=p.preConstruct)==null||l.call(p,i);if(Object.assign(i,n),R(i,"visibility"),le(i,"visibility",Se.Visible),R(i,"canClick"),le(i,"canClick",!0),R(i,"classes"),R(i,"style"),R(i,"mark"),R(i,"display"),i.onClick){const p=i.onClick.bind(i);i.onClick=function(h){s(i.canClick)!==!1&&p(h)}}if(i.onHold){const p=i.onHold.bind(i);i.onHold=function(){s(i.canClick)!==!1&&p()}}for(const p of t)(c=p.postConstruct)==null||c.call(p,i);const a=t.reduce((p,h)=>{var g;return Object.assign(p,(g=h.getGatheredProps)==null?void 0:g.call(h,i))},{});return i[ut]=function(){const{display:p,visibility:h,style:g,classes:b,onClick:m,onHold:k,canClick:C,small:T,mark:$,id:I}=this;return{display:p,visibility:h,style:s(g),classes:b,onClick:m,onHold:k,canClick:C,small:T,mark:$,id:I,...a}},i})}function Ad(e,t,n=[]){n=n.length===0?Zn(e,Qi):n;const r=typeof t=="function"?w(t):t;return e.on("update",()=>{s(r)&&n.filter(i=>s(i.canClick)).forEach(i=>{var a;return(a=i.onClick)==null?void 0:a.call(i)})})}const Rd=["x1","y1","x2","y2"],Ed=Z({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const n=Pe(e),r=w(()=>{const a=n.startNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetStart&&(l.x+=n.link.value.offsetStart.x,l.y+=n.link.value.offsetStart.y),l}),i=w(()=>{const a=n.endNode.value.rect,u=n.boundingRect.value,l=u?{x:a.x+a.width/2-u.x,y:a.y+a.height/2-u.y}:{x:0,y:0};return n.link.value.offsetEnd&&(l.x+=n.link.value.offsetEnd.x,l.y+=n.link.value.offsetEnd.y),l});return(a,u)=>(S(),P("line",Vt({"stroke-width":"15px",stroke:"white"},e.link,{x1:s(r).x,y1:s(r).y,x2:s(i).x,y2:s(i).y}),null,16,Rd))}});const Fd=Z({__name:"Links",props:{links:null},setup(e){var c;const n=Zt(e,"links"),r=G(null),i=dr(Zr,G({})),a=dr(Xr,G(void 0)),u=G((c=r.value)==null?void 0:c.getBoundingClientRect());wt(a,()=>{var p;return u.value=(p=r.value)==null?void 0:p.getBoundingClientRect()}),Kn(()=>{var p;return u.value=(p=r.value)==null?void 0:p.getBoundingClientRect()});const l=w(()=>{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(),P(ne,null,[s(l)?(S(),P("svg",ga(Vt({key:0},p.$attrs)),[(S(!0),P(ne,null,Dt(s(l),(g,b)=>(S(),re(Ed,{key:b,link:g,boundingRect:u.value,startNode:s(i)[g.startNode.id],endNode:s(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 Od=be(Fd,[["__scopeId","data-v-063f6d6b"]]);Z({props:{nodes:{type:q(Array),required:!0},leftSideNodes:q(Array),rightSideNodes:q(Array),branches:q(Array)},components:{Links:Od},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:r}=Pe(e),i=_t();Pt(()=>{const l=Te(t);i.value=ge(j(()=>d(ne,null,[l.map(c=>d("span",{class:"row tree-row",style:"margin: 50px auto;"},[c.map(gt)]))])))});const a=_t();Pt(()=>{const l=Te(n);a.value=l?ge(j(()=>d("span",{class:"left-side-nodes small"},[l.map(gt)]))):""});const u=_t();return Pt(()=>{const l=Te(r);u.value=l?ge(j(()=>d("span",{class:"side-nodes small"},[l.map(gt)]))):""}),{unref:s,nodesComp:i,leftNodesComp:a,rightNodesComp:u}}});Z({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:Qn,Node:er},setup(e){const{onClick:t,onHold:n,display:r}=Pe(e),i=Pn(r),{start:a,stop:u}=Oi(t,n);return{start:a,stop:u,comp:i,unref:s,Visibility:Se,isCoercableComponent:At,isVisible:Ye,isHidden:wn}}});function Gn(e){const t=[],n={};let r=!1;function i(){return r||(t.push(...e()),n.base=t.map(l=>_e(l.base)),n.baseText=t.map(l=>_e(l.baseText)),n.visible=t.map(l=>_e(l.visible)),n.title=t.map(l=>_e(l.title)),n.subtitle=t.map(l=>_e(l.subtitle)),r=!0),t}const a=lt({},!1);return[j(()=>{const l=i();let c=!0;const p=l.map((h,g)=>{var $,I,E;if(s(n.visible[g])===!1)return null;const b=d("h3",{onClick:()=>a.value[g]=!a.value[g],style:"cursor: pointer"},[d("span",{class:"modifier-toggle"+(s(a.value[g])?" collapsed":"")},[y("\u25BC")]),s(n.title[g]),s(n.subtitle[g])!=null?d("span",{class:"subtitle"},[y(" ("),s(n.subtitle[g]),y(")")]):null]),m=s(a.value[g])?null:d(ne,null,[d("div",{class:"modifier-container"},[d("span",{class:"modifier-description"},[gt(($=s(n.baseText[g]))!=null?$:"Base")]),d("span",{class:"modifier-amount"},[xe((I=s(n.base[g]))!=null?I:1),h.unit])]),h.modifier.description==null?null:gt(s(h.modifier.description))]),k=!c;c=!1;const C=(E=s(n.base[g]))!=null?E:1,T=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"},[y("Total")]),d("span",{class:"modifier-amount",style:(h.smallerIsBetter===!0?o.gt(T,C!=null?C:1):o.lt(T,C!=null?C:1))?"color: var(--danger)":""},[Ht(T),h.unit])])])])});return d(ne,null,[p])}),a]}function Rr(e,t,n){const r=_e(t),i=_e(n);return w(()=>{const a=s(r),u=s(i);return o.gte(e.value,u)?"Now":o.lte(a,0)?"Never":yr(o.sub(u,e.value).div(a))})}function vn(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 a;if(s(r)){const u=Ht(e.evaluate()),l=Ht(e.evaluate(o.add(s((a=e.innermostVariable)!=null?a:0),s(i))));return d(ne,null,[d("b",null,[d("i",null,[u,y(" \u2192 "),l])])])}return d(ne,null,[Ht(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),je={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"},qd={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(),Vd=Z({__name:"Tab",props:{display:null},setup(e){const t=e,{display:n}=Pe(t),r=Wr(n);return(i,a)=>(S(),re(Je(s(r))))}}),Bd=Symbol("Tab");function Er(e){return Qe(t=>{const n=e.call(t,t);return n.id=Jt("tab-"),n.type=Bd,n[ft]=Vd,n[ut]=function(){const{display:r}=this;return{display:r}},n})}function Gt(e,t,n={}){const r=lt(!1);return{modal:j(()=>d(Lt,{modelValue:r.value,"onUpdate:modelValue":a=>r.value=a},{header:()=>d("h2",null,[e]),body:t})),showModal:r,...n}}function Ld(){return Gt("Getting Started",j(()=>d("div",null,[d("p",null,[y(`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,[y(`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,[y("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 jd(){return Gt("Forging",j(()=>d("div",null,[d("p",null,[y("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,[y("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 zd(){return Gt("Dowsing",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Gd(){return Gt("Quarry",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Ud(){return Gt("Tool Empowerer",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Wd(){const e=Yi({general:()=>({display:"General",glowColor(){return e.activeTab.value===this.tab?"white":""},tab:Er(()=>({display:j(()=>d("div",null,[d("p",null,[y("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,[y("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,[y("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"},[y("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:Er(()=>({display:j(()=>d("div",null,[y("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)"},[y("Caches")]),y(": 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)"},[y("Gen")]),y(": 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)"},[y("Resource Mult")]),y(": 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)"},[y("Energy Mult")]),y(": 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)"},[y("Influences")]),y(": 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)"},[y("Relic")]),y(": 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:Er(()=>({display:j(()=>d("div",null,[d("p",null,[y("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,[y("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)"},[y("+resource")]),y(": 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)"},[y("-resource")]),y(": 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)"},[y("+length")]),y(": 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)"},[y("+caches")]),y(": 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)"},[y("+gens")]),y(": 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)"},[y("+resource mults")]),y(": 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)"},[y("+energy mults")]),y(": 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)"},[y("+influences")]),y(": 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)"},[y("+relic")]),y(": 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)"},[y("+difficulty")]),y(": 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)"},[y("-difficulty")]),y(": 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)"},[y("+rewards")]),y(": Causes the quality of treasures to be 1 tier higher. Does not affect influences or relics treasures.")])])]):d("div",null,[y("Once you discover influences, summaries will appear here describing their effects.")])]))}))})});return Gt("Portal Generator",j(()=>gt(e)),{tabFamily:e})}function Hd(){return Gt("Booster",j(()=>d("div",null,[d("p",null,[y("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,[y("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,[y("Initially the booster will double the rate of time, but that can be increased using an action.")])])))}function Yd(){return Gt("Upgrader",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Zd(){return Gt("Automator",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Xd(){return Gt("Investments",j(()=>d("div",null,[d("p",null,[y("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,[y("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 Jd=Z({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(S(),P("div",{style:Le({width:e.width,height:e.height})},null,4))}});function Vn(e){return Qe(t=>{var r;const n=e.call(t,t);return n.partialDisplay=i=>d("span",{style:s(n.requirementMet)?"":"color: var(--danger)"},[vr(n.resource,n.cost instanceof f?an(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),n.display=i=>d("div",null,[s(n.requiresPay)?"Costs: ":"Requires: ",vr(n.resource,n.cost instanceof f?an(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost))," ",n.resource.displayName]),R(n,"visibility"),le(n,"visibility",Se.Visible),R(n,"cost"),R(n,"requiresPay"),le(n,"requiresPay",!0),R(n,"cumulativeCost"),le(n,"cumulativeCost",!0),R(n,"maxBulkAmount"),le(n,"maxBulkAmount",1),R(n,"directSum"),le(n,"pay",function(i){const a=n.cost instanceof f?an(n.cost,i!=null?i:1,s(n.cumulativeCost),s(n.directSum)):s(n.cost);n.resource.value=o.sub(n.resource.value,a).max(0)}),n.canMaximize=w(()=>{var l;if(!(n.cost instanceof f))return!1;const i=s(n.maxBulkAmount);if(o.lte(i,1))return!1;const a=s(n.cumulativeCost),u=(l=s(n.directSum))!=null?l:a?10:0;return o.lte(i,u)?!0:!(!n.cost.isInvertible()||a===!0&&!n.cost.isIntegrable())}),n.cost instanceof f?n.requirementMet=Bi(n.cost,n.resource,(r=n.cumulativeCost)!=null?r:!0,n.directSum,n.maxBulkAmount):n.requirementMet=w(()=>o.gte(n.resource.value,s(n.cost))),n})}function ni(e){return Qe(()=>({requirementMet:w(()=>Ye(e.visibility)),visibility:Se.None,requiresPay:!1}))}function Kd(e,t){return Qe(()=>({requirementMet:_e(e),partialDisplay:t==null?void 0:j(()=>gt(t)),display:t==null?void 0:j(()=>d(ne,null,[y("Req: "),gt(t)])),visibility:t==null?Se.None:Se.Visible,requiresPay:!1}))}function Cr(e){if(Bt(e))return e.every(Cr);const t=s(e.requirementMet);return typeof t=="boolean"?t:o.gt(t,0)}function ea(e){if(Bt(e))return e.map(ea).reduce(o.min);const t=s(e.requirementMet);return typeof t=="boolean"?t?o.dInf:0:o.gt(t,1)&&s(e.canMaximize)!==!0?1:t}function kr(e,t=1){var n,r;if(Bt(e)&&(e=e.filter(i=>Ye(i.visibility)),e.length===1&&(e=e[0])),Bt(e)){e=e.filter(u=>"partialDisplay"in u);const i=e.filter(u=>s(u.requiresPay)),a=e.filter(u=>!s(u.requiresPay));return d(ne,null,[i.length>0?d("div",null,[y("Costs:")," ",gi(i.map(u=>u.partialDisplay(t)),d(ne,null,[y(", ")]))]):null,a.length>0?d("div",null,[y("Requires:")," ",gi(a.map(u=>u.partialDisplay(t)),d(ne,null,[y(", ")]))]):null])}return(r=(n=e.display)==null?void 0:n.call(e))!=null?r:d(ne,null,null)}function ta(e,t=1){var n;Bt(e)?e.filter(r=>s(r.requiresPay)).forEach(r=>{var i;return(i=r.pay)==null?void 0:i.call(r,t)}):s(e.requiresPay)&&((n=e.pay)==null||n.call(e,t))}var Qd=Z({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:er,MarkNode:Qn},setup(e){const{display:t,requirements:n,earned:r}=Pe(e),i=_t("");return Pt(()=>{const a=Te(t);if(a==null){i.value="";return}if(At(a)){i.value=ge(a);return}const u=ge(a.requirement?a.requirement:j(()=>{var p;return kr((p=Te(n))!=null?p:[])}),"h3"),l=ge(a.effectDisplay||"","b"),c=Te(r)?ge(a.optionsDisplay||"","span"):"";i.value=ge(j(()=>d("span",null,[d(u,null,null),a.effectDisplay!=null?d("div",null,[d(l,null,null)]):null,a.optionsDisplay!=null?d("div",{class:"equal-spaced"},[d(c,null,null)]):null])))}),{comp:i,unref:s,Visibility:Se,isVisible:Ye,isHidden:wn}}});function ep(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=Ct("Node");return e.isVisible(e.visibility)?(S(),P("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(Je(e.comp),{key:0})):B("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):B("",!0)}var tp=be(Qd,[["render",ep],["__scopeId","data-v-5673325a"]]);const np=hr(),rp=Symbol("Achievement");let xn=function(e){return e.All="all",e.Configurable="configurable",e.Incomplete="incomplete",e.None="none",e}({});function ip(e,...t){const n=lt(!1,!1),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(i=>{var c,p,h;const a=(c=e==null?void 0:e.call(i,i))!=null?c:{};a.id=Jt("achievement-"),a.type=rp,a[ft]=tp;for(const g of t)(p=g.preConstruct)==null||p.call(g,a);a.earned=n,a.complete=function(){var b,m;if(n.value)return;n.value=!0;const g=a;if((b=g.onComplete)==null||b.call(g),g.display!=null&&s(g.showPopups)===!0){const k=s(g.display);let C;At(k)?C=ge(k):k.requirement!=null?C=ge(k.requirement):C=kr((m=g.requirements)!=null?m:[]),np.info(d("div",null,[d("h3",null,[y("Treasure earned!")]),d("div",null,[d(C,null,null)])]))}},Object.assign(a,r),R(a,"visibility"),le(a,"visibility",Se.Visible);const u=a.visibility;a.visibility=ma(()=>{const g=s(a.display);switch(ie.msDisplay){default:case xn.All:return s(u);case xn.Configurable:return s(a.earned)&&!(g!=null&&typeof g=="object"&&"optionsDisplay"in g)?Se.None:s(u);case xn.Incomplete:return s(a.earned)?Se.None:s(u);case xn.None:return Se.None}}),R(a,"display"),R(a,"mark"),R(a,"small"),R(a,"image"),R(a,"style"),R(a,"classes"),R(a,"showPopups"),le(a,"showPopups",!0);for(const g of t)(h=g.postConstruct)==null||h.call(g,a);const l=t.reduce((g,b)=>{var m;return Object.assign(g,(m=b.getGatheredProps)==null?void 0:m.call(b,a))},{});if(a[ut]=function(){const{visibility:g,display:b,requirements:m,earned:k,image:C,style:T,classes:$,mark:I,small:E,id:L}=this;return{visibility:g,display:b,requirements:m,earned:k,image:C,style:s(T),classes:$,mark:I,small:E,id:L,...l}},a.requirements){const g=a,b=[ni(g),Kd(()=>!g.earned.value),...Bt(a.requirements)?a.requirements:[a.requirements]];Pt(()=>{ie.active===Y.id&&Cr(b)&&g.complete()})}return a})}Ke.on("loadSettings",e=>{le(e,"msDisplay",xn.All)});const ap=Object.values(xn).map(e=>({label:it(e),value:e}));Ei(j(()=>d(ei,{title:j(()=>d("span",{class:"option-title"},[y("Show achievements"),d("desc",null,[y("Select which achievements to display based on criterias.")])])),options:ap,"onUpdate:modelValue":e=>ie.msDisplay=e,modelValue:ie.msDisplay},null)));const sp=Z({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:Qn,Node:er},setup(e){const{progress:t,width:n,height:r,direction:i,display:a}=Pe(e),u=w(()=>{let p=t.value instanceof o?t.value.toNumber():Number(t.value);return(1-Math.min(Math.max(p,0),1))*100}),l=w(()=>{const p={width:Te(n)+.5+"px",height:Te(r)+.5+"px"};switch(s(i)){case U.Up:p.clipPath=`inset(${u.value}% 0% 0% 0%)`,p.width=Te(n)+1+"px";break;case U.Down:p.clipPath=`inset(0% 0% ${u.value}% 0%)`,p.width=Te(n)+1+"px";break;case U.Right:p.clipPath=`inset(0% ${u.value}% 0% 0%)`;break;case U.Left:p.clipPath=`inset(0% 0% 0% ${u.value} + '%)`;break;case U.Default:p.clipPath="inset(0% 50% 0% 0%)";break}return p}),c=Pn(a);return{normalizedProgress:u,barStyle:l,component:c,unref:s,Visibility:Se,isVisible:Ye,isHidden:wn}}});function op(e,t,n,r,i,a){var c,p,h,g,b,m,k;const u=Ct("MarkNode"),l=Ct("Node");return e.isVisible(e.visibility)?(S(),P("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(),P("span",{key:0,class:"overlayText",style:Le(e.unref(e.textStyle))},[(S(),re(Je(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(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],6)):B("",!0)}var lp=be(sp,[["render",op],["__scopeId","data-v-6bd06b56"]]);const up=Symbol("Bar");function cp(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return Qe(r=>{var u,l;const i=e.call(r,r);i.id=Jt("bar-"),i.type=up,i[ft]=lp;for(const c of t)(u=c.preConstruct)==null||u.call(c,i);Object.assign(i,n),R(i,"visibility"),le(i,"visibility",Se.Visible),R(i,"width"),R(i,"height"),R(i,"direction"),R(i,"style"),R(i,"classes"),R(i,"borderStyle"),R(i,"baseStyle"),R(i,"textStyle"),R(i,"fillStyle"),R(i,"progress"),R(i,"display"),R(i,"mark");for(const c of t)(l=c.postConstruct)==null||l.call(c,i);const a=t.reduce((c,p)=>{var h;return Object.assign(c,(h=p.getGatheredProps)==null?void 0:h.call(p,i))},{});return i[ut]=function(){const{progress:c,width:p,height:h,direction:g,display:b,visibility:m,style:k,classes:C,borderStyle:T,textStyle:$,baseStyle:I,fillStyle:E,mark:L,id:de}=this;return{progress:c,width:p,height:h,direction:g,display:b,visibility:m,style:s(k),classes:C,borderStyle:T,textStyle:$,baseStyle:I,fillStyle:E,mark:L,id:de,...a}},i})}function dp(e,...t){return Qe(n=>{var i,a;const r=e.call(n,n);for(const u of t)(i=u.preConstruct)==null||i.call(u,r);r.formula=r.formula(f.variable(r.baseResource)),r.currentGain==null&&(r.currentGain=w(()=>{let u=o.floor(r.formula.evaluate(r.baseResource.value)).max(0);return s(r.buyMax)===!1&&(u=u.min(1)),u})),r.actualGain==null&&(r.actualGain=r.currentGain),r.currentAt==null&&(r.currentAt=w(()=>r.formula.invert(o.floor(s(r.currentGain))))),r.nextAt==null&&(r.nextAt=w(()=>r.formula.invert(o.floor(s(r.currentGain)).add(1)))),r.convert==null&&(r.convert=function(){var l;const u=s(r.currentGain);r.gainResource.value=o.add(r.gainResource.value,u),r.spend(u),(l=r.onConvert)==null||l.call(r,u)}),r.spend==null&&(r.spend=function(){r.baseResource.value=0}),R(r,"currentGain"),R(r,"actualGain"),R(r,"currentAt"),R(r,"nextAt"),R(r,"buyMax"),le(r,"buyMax",!0);for(const u of t)(a=u.postConstruct)==null||a.call(u,r);return r})}function pp(e){return dp(e)}function fp(e,t,n=1,r=o.dInf){const i=_e(n),a=_e(r);e.on("preUpdate",u=>{const l=s(i);o.neq(l,0)&&(t.gainResource.value=o.add(t.gainResource.value,o.times(l,u).times(o.ceil(s(t.actualGain)))).min(s(a)).max(t.gainResource.value))})}const gp={postConstruct(e){e.amount===void 0&&console.error(`Decorated feature ${e.id} does not contain the required 'amount' property"`),R(e,"bonusAmount"),e.totalAmount===void 0&&(e.totalAmount=w(()=>{var t;return o.add(s((t=e.amount)!=null?t:0),s(e.bonusAmount))}))}},na=Symbol("Repeatable");function bi(e,...t){const n=lt(0),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(i=>{var b,m,k;const a=e.call(i,i);a.id=Jt("repeatable-"),a.type=na,a[ft]=Ki;for(const C of t)(b=C.preConstruct)==null||b.call(C,a);a.amount=n,a.amount[Xt]=(m=a.initialAmount)!=null?m:0,Object.assign(a,r);const u={requirementMet:w(()=>o.sub(s(a.limit),a.amount.value)),requiresPay:!1,visibility:Se.None,canMaximize:!0},l=ni(a);Bt(a.requirements)?(a.requirements.unshift(l),a.requirements.push(u)):a.requirements=[l,a.requirements,u],a.maxed=w(()=>o.gte(a.amount.value,s(a.limit))),R(a,"classes");const c=a.classes;a.classes=w(()=>{const C=s(c)||{};return a.maxed.value&&(C.bought=!0),C}),a.amountToIncrease=w(()=>o.clampMin(ea(a.requirements),1)),a.canClick=w(()=>Cr(a.requirements));const p=a.onClick;a.onClick=function(C){var I;const T=a;if(!s(T.canClick))return;const $=(I=s(a.amountToIncrease))!=null?I:1;ta(a.requirements,$),T.amount.value=o.add(T.amount.value,$),p==null||p(C)},R(a,"display");const h=a.display;a.display=j(()=>{var T,$,I;const C=s(h);if(At(C)){const E=ge(C);return d(E,null,null)}if(C!=null){const E=a,L=ge((T=C.title)!=null?T:"","h3"),de=ge(($=C.description)!=null?$:""),ue=ge((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(de,null,null),C.showAmount===!1?null:d("div",null,[d("br",null,null),d(ne,null,[y("Amount: "),st(E.amount.value)]),o.isFinite(s(E.limit))?d(ne,null,[y(" / "),st(s(E.limit))]):void 0]),C.effectDisplay==null?null:d("div",null,[d("br",null,null),y("Currently: "),d(ue,null,null)]),E.maxed.value?null:d("div",null,[d("br",null,null),kr(E.requirements,s(a.amountToIncrease))])])}return""}),R(a,"visibility"),le(a,"visibility",Se.Visible),R(a,"limit"),le(a,"limit",o.dInf),R(a,"style"),R(a,"mark"),R(a,"small");for(const C of t)(k=C.postConstruct)==null||k.call(C,a);const g=t.reduce((C,T)=>{var $;return Object.assign(C,($=T.getGatheredProps)==null?void 0:$.call(T,a))},{});return a[ut]=function(){const{display:C,visibility:T,style:$,classes:I,onClick:E,canClick:L,small:de,mark:ue,id:ae}=this;return{display:C,visibility:T,style:s($),classes:I,onClick:E,canClick:L,small:de,mark:ue,id:ae,...g}},a})}const mp=Symbol("Reset");function vp(e){return Qe(t=>{const n=e.call(t,t);return n.id=Jt("reset-"),n.type=mp,n.reset=function(){var i;const r=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof o)&&!(a instanceof f)){if(Jn in a&&a[Jn]===!0)return;if(Xt in a){const u=a;u.value=u[Xt]}else!(a instanceof o)&&!Ve(a)&&Object.values(a).forEach(u=>r(u))}};s(n.thingsToReset).forEach(r),Ke.emit("reset",n),(i=n.onReset)==null||i.call(n)},R(n,"thingsToReset"),n})}const lr={};Ke.on("removeLayer",e=>{var t;(t=lr[e.id])==null||t.call(lr),lr[e.id]=void 0});function Fr(e,t){return R(t,"display"),R(t,"classes"),R(t,"style"),R(t,"direction"),le(t,"direction",U.Up),R(t,"xoffset"),R(t,"yoffset"),t.pinnable&&(t.pinned=lt(!1,!1)),Yt(()=>{t.pinnable&&("pinned"in e?(console.error("Cannot add pinnable tooltip to element that already has a property called 'pinned'"),t.pinnable=!1,Li(t.pinned)):e.pinned=t.pinned);const n=e[ft];e[ft]=qe;const r=e[ut].bind(e);e[ut]=function(){const{display:a,classes:u,style:l,direction:c,xoffset:p,yoffset:h,pinned:g}=this;return{element:{[ft]:n,[ut]:r},display:a,classes:u,style:s(l),direction:c,xoffset:p,yoffset:h,pinned:g}}.bind(t)}),t}var hp=Z({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:er,MarkNode:Qn},setup(e){const{display:t,requirements:n,bought:r}=Pe(e),i=_t("");return Pt(()=>{const a=Te(t);if(a==null){i.value="";return}if(At(a)){i.value=ge(a);return}const u=ge(a.title||"","h3"),l=ge(a.description,"div"),c=ge(a.effectDisplay||"");i.value=ge(j(()=>d("span",null,[a.title!=null?d("div",null,[d(u,null,null)]):null,d(l,null,null),a.effectDisplay!=null?d("div",null,[y("Currently: "),d(c,null,null)]):null,r.value?null:d(ne,null,[d("br",null,null),kr(n.value)])])))}),{component:i,unref:s,Visibility:Se,isVisible:Ye,isHidden:wn}}});const bp=["disabled"];function yp(e,t,n,r,i,a){var c;const u=Ct("MarkNode"),l=Ct("Node");return e.isVisible(e.visibility)?(S(),P("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(Je(e.unref(e.component)),{key:0})):B("",!0),d(u,{mark:e.unref(e.mark)},null,8,["mark"]),d(l,{id:e.id},null,8,["id"])],14,bp)):B("",!0)}var wp=be(hp,[["render",yp],["__scopeId","data-v-9be6bac0"]]);const ri=Symbol("Upgrade");function yi(e,...t){const n=lt(!1,!1),r=t.reduce((i,a)=>{var u;return Object.assign(i,(u=a.getPersistentData)==null?void 0:u.call(a))},{});return Qe(i=>{var c,p;const a=e.call(i,i);a.id=Jt("upgrade-"),a.type=ri,a[ft]=wp;for(const h of t)(c=h.preConstruct)==null||c.call(h,a);a.bought=n,Object.assign(a,r),a.canPurchase=w(()=>!n.value&&Cr(a.requirements)),a.purchase=function(){var g;const h=a;!s(h.canPurchase)||(ta(a.requirements),n.value=!0,(g=h.onPurchase)==null||g.call(h))};const u=ni(a);Bt(a.requirements)?a.requirements.unshift(u):a.requirements=[u,a.requirements],R(a,"visibility"),le(a,"visibility",Se.Visible),R(a,"classes"),R(a,"style"),R(a,"display"),R(a,"mark");for(const h of t)(p=h.postConstruct)==null||p.call(h,a);const l=t.reduce((h,g)=>{var b;return Object.assign(h,(b=g.getGatheredProps)==null?void 0:b.call(g,a))},{});return a[ut]=function(){const{display:h,visibility:g,style:b,classes:m,requirements:k,canPurchase:C,bought:T,mark:$,id:I,purchase:E}=this;return{display:h,visibility:g,style:s(b),classes:m,requirements:k,canPurchase:C,bought:T,mark:$,id:I,purchase:E,...l}},a})}function _p(e,t,n=[]){n=n.length===0?Zn(e,ri):n;const r=Hn(t)?w(t):t;e.on("update",()=>{s(r)&&n.forEach(i=>i.purchase())})}function Np(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 Cp={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"]},wi=[[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 Or(e){const t=wi[Math.floor(e()*wi.length)];let n="";for(let r=0;rn-20&&(a+=40);const[u,l,c]=Mp(a,r,i);return`rgb(${u*255}, ${l*255}, ${c*255})`}function Sp(e,t,n){const r=Math.max(e,t,n),i=r-Math.min(e,t,n),a=i&&(r==e?(t-n)/i:r==t?2+(n-e)/i:4+(e-t)/i);return[60*(a<0?a+6:a),r&&i/r,r]}function Mp(e,t,n){const r=(i,a=(i+e/60)%6)=>n-n*t*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}const Ni=hr();function ra(e,t,n,r){return Jr(e,function(){const i=Np(0,n>>0,n>>32,1);for(let V=0;V<12;V++)i();const a=Or(i),u=Bn([.56,.74,.73],i),l=Bn([.18,.2,.25],i),c=In(0,Or(i)),p=lt(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=lt(k),T=w(()=>("increaseRewards"in b?m+1:m)+C.value);let $="relic"in b?h+2:Math.ceil(i()*(h+2));"increaseLength"in b&&$++;const I=[],E=Mt(()=>I),L=w(()=>E.apply(0)),de=[],ue={};function ae({feature:V,canClick:z,modifier:De,cost:nt,previewModifier:kn,showETA:dt,previewCost:ht}){z=_e(z),dt=_e(dt);const xt=mi(V);de.push({shouldShowPreview:w(()=>s(z)&&xt.value),modifier:Mt(()=>{const Rt=I.slice();return Rt.splice(Rt.indexOf(De),1,kn),Rt}),cost:ht!=null?ht:nt}),I.push(De);const en=Rr(c,L,()=>Me(nt)),Ze=Fr(V,{display:dt==null?en:()=>s(dt)?en.value:"",direction:U.Down});return{isHovering:xt,eta:en,tooltip:Ze}}const X=[],Ie=G(0);let he=f.variable(Ie).times(0),Ge=0,mt=!0;const J=w(()=>o.add(m,i()-.5).pow_base(2).times(10).times(he.evaluate()));for(let V=0;V<$;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>=$-1?0:4};switch(ur(z,i)){case"upgrades":const x=[];for(let D=0;D<4;D++){const W=ur({add:1,mult:V===0&&D===0?0:1},i),K=J.value,Fe=Mn(i);let Ue="",Oe,oe;switch(W){case"add":{const pe=o.add(K,10).pow(i()/4+1);Ue=`Gain ${xe(pe)} ${c.displayName}/s`,he=he.add(pe),Oe=rt=>Ut(()=>({addend:pe,description:Fe,enabled:rt==null?we.bought:()=>rt()&&we.bought.value})),oe=Ut(()=>({addend:pe}));break}case"mult":{const pe=i()*5+1;Ue=`Multiply previous ${c.displayName} gain by x${xe(pe)}.`;const rt=Ge;he=he.add(o.sub(pe,1).times(rt)),Oe=Xe=>Ce(()=>({multiplier:pe,description:Fe,enabled:Xe==null?we.bought:()=>Xe()&&we.bought.value})),oe=Ce(()=>({multiplier:pe}));break}}Ge=he.evaluate(),Ie.value++;const Re=mt,we=yi(()=>({requirements:Vn(()=>({resource:Sn(c),cost:K,requiresPay:()=>v.toolNodes.value.unobtainiumRelic==null})),display:{title:Fe,description:Ue},visibility:w(()=>ye.value.length!==$&&s(Re))}));ae({feature:we,canClick:()=>we.canPurchase.value,modifier:Oe(),cost:K,previewCost:w(()=>v.toolNodes.value.unobtainiumRelic==null?K:0),showETA:()=>!we.bought.value,previewModifier:oe}),I.push(Oe(()=>W==="add"?v.toolNodes.value.stoneRelic!=null:te("stoneRelic"))),x.push(we)}X.push(x);break;case"repeatables":const A=[];for(let D=0;D<3;D++){const W=ur({add:1.5,mult:3},i),K=Ie.value,Fe=J.value,Ue=Mn(i);let Oe="",oe,Re,we,pe;const rt=f.variable(w(()=>ce.amount.value)).times(2);switch(W){case"add":{const We=o.add(Fe,10).times(i()+.5);Oe=`Gain ${xe(We)} ${c.displayName}/s`,pe=rt.add(1).times(Fe),he=he.add(w(()=>o.sub(Ie.value,K).times(2).add(1).pow(2).clampMax(100).times(We))),oe=w(()=>xe(o.times(We,s(ce.totalAmount)))+"/s"),Re=Ut(()=>({addend:()=>o.times(We,s(ce.totalAmount)),description:Ue,enabled:()=>o.gt(s(ce.totalAmount),0)})),we=Ut(()=>({addend:()=>o.add(s(ce.totalAmount),ce.amountToIncrease.value).times(We)}));break}case"mult":{const We=i()*.75+1.25;Oe=`Multiply previous ${c.displayName} gain by x${xe(We)}.`,pe=rt.add(1).pow_base(We).times(Fe);const at=Ge;he=he.add(w(()=>o.sub(Ie.value,K).times(2).add(1).pow(2).clampMax(100).pow_base(We).sub(1).times(at))),oe=w(()=>"x"+xe(o.pow(We,s(ce.totalAmount)))),Re=Ce(()=>({multiplier:()=>o.pow(We,s(ce.totalAmount)),description:Ue,enabled:()=>o.gt(s(ce.totalAmount),0)})),we=Ce(()=>({multiplier:()=>o.add(s(ce.totalAmount),ce.amountToIncrease.value).pow_base(We)}));break}}Ge=he.evaluate(),Ie.value++;const Xe=mt,ce=bi(()=>({requirements:Vn(()=>({resource:Sn(c),cost:pe,maxBulkAmount:()=>v.toolNodes.value.diamondRelic!=null?o.dInf:1,requiresPay:()=>v.toolNodes.value.unobtainiumRelic==null})),display:()=>({title:Ue,description:`${Oe}

Amount: ${st(ce.amount.value)}${o.gt(s(ce.bonusAmount),0)?` [+${st(s(ce.bonusAmount))}]`:""}`,effectDisplay:s(oe),showAmount:!1}),visibility:w(()=>ye.value.length!==$&&s(Xe)),limit:100,bonusAmount:()=>o.gt(ce.amount.value,0)?te("dirtRelic")?2:v.toolNodes.value.dirtRelic!=null?1:0:0}),gp);ae({feature:ce,canClick:()=>s(ce.canClick),modifier:Re,cost:pe,previewModifier:we,previewCost:w(()=>v.toolNodes.value.unobtainiumRelic==null?an(pe,ce.amountToIncrease.value):0),showETA:()=>!ce.maxed.value}),A.push(ce)}X.push(A);break;case"conversion":{const D=In(0,Or(i)),O=Bn([.56,.74,.73],i),W=J.value,K=i()/2+.25,Fe=i()/2+.25,Ue=Ie.value,Oe=Ge;he=he.add(w(()=>o.sub(Ie.value,Ue).add(1).pow10().times(Oe)));const oe=pp(()=>({baseResource:Sn(c),gainResource:D,formula:Dr=>Dr.div(W).pow(K).times(w(()=>v.toolNodes.value.ironRelic!=null?te("ironRelic")?4:2:1)),spend(){c.value=0}}));Ge=he.evaluate(),Ie.value+=2;const Re=mt,we=Mn(i),pe=f.variable(D).pow(Fe).add(1),rt=Ce(()=>({multiplier:()=>pe.evaluate(),description:we,enabled:()=>o.gt(D.value,0)})),Xe=Ce(()=>({multiplier:()=>pe.evaluate(o.add(D.value,oe.actualGain.value))})),ce=Pd(()=>({display:{title:we,description:j(()=>d("span",null,[y("Reset "),c.displayName,y(" for")," ",vr(D,o.clampMin(oe.actualGain.value,1))," ",D.displayName,d("br",null,null),d("div",null,[y("Next:")," ",vr(c,o.lt(oe.actualGain.value,1)?oe.currentAt.value:oe.nextAt.value)," ",c.displayName])]))},style:{width:"200px",minHeight:"100px"},canClick:()=>o.gte(oe.actualGain.value,1),prestigeResource:D,onClick:oe.convert,visibility:w(()=>ye.value.length!==$&&s(Re))})),{isHovering:We}=ae({feature:ce,canClick:()=>s(ce.canClick),modifier:rt,cost:W,previewCost:c,previewModifier:Xe}),at=w(()=>We.value&&ce.canClick.value);X.push([ce]);const qn=vn(f.variable(D),at,oe.actualGain),et=vn(pe,at,oe.actualGain);ue[V*2]=j(()=>d(ne,null,[Ye(ce.visibility)?d("div",{style:"margin: 10px"},[y("You have")," ",d("h2",{style:{color:O,textShadow:`0px 0px 10px ${O}`}},[qn()])," ",D.displayName,y(","),d("br",null,null),y("providing a "),et(),y("x multiplier to previous")," ",c.displayName,y(" gain")]):null,Ar(ce)])),fp(this,oe,()=>ye.value.length<$&&v.investments.value!=null&&ke(v.investments.value)&&v.investments.value.state.portals.includes(e)?o.div(ct.value,100):0);break}case"xp":{const D=In(0),O=mt,W=Ie.value,K=Mn(i),Fe=o.add(m,i()-.5).pow_base(1.25).times(10),Ue=i()/4+1.125,Oe=i()/2+1.25,oe=f.variable(0).pow(Ue).times(Fe),Re=Bi(oe,D,!0,10,o.dInf),we=w(()=>an(oe,Re.value,!0,10)),pe=w(()=>an(oe,o.add(Re.value,1),!0,10)),rt=w(()=>o.pow(Oe,Re.value)),Xe=Ce(()=>({multiplier:rt,description:K,enabled:()=>Ye(at.visibility)})),ce=Ge;he=he.add(w(()=>o.sub(Ie.value,W).add(1).times(3).pow(Oe).times(ce))),Ge=he.evaluate(),Ie.value+=2;const We=Bn([.56,.74,.73],i),at=cp(()=>({direction:U.Right,width:300,height:20,progress:()=>o.sub(D.value,we.value).div(o.sub(pe.value,we.value)).toNumber(),visibility:w(()=>ye.value.length!==$&&s(O)),xp:D,display:j(()=>d("span",null,[xe(D.value),y("/"),xe(pe.value)])),fillStyle:`background-color: ${We}`,textStyle:"text-shadow: 5px 0 10px black"}));this.on("preUpdate",qn=>{if(ye.value.length<$&&v.activePortals.value.some(et=>et.state.id===e)&&Ye(at.visibility)){let et=o.times(ct.value,qn);v.toolNodes.value.goldRelic!=null&&(et=o.times(te("goldRelic")?.5:.25,ye.value.length).add(1).times(et)),D.value=o.add(et,D.value)}}),I.push(Xe),X.push([at]),ue[V*2]=j(()=>d(ne,null,[Ye(at.visibility)?d("div",{style:"margin: 10px"},[y("You have "),d("h3",null,[K]),y(" Lv. "),st(Re.value),y(","),d("br",null,null),y("providing a "),xe(rt.value),y("x multiplier to previous")," ",c.displayName,y(" gain"),d("br",null,null)]):null,Ar(at)]));break}case"dimensions":{const D=Mn(i),O=In(0,D+" energy"),W=Bn([.56,.74,.73],i),K=Ie.value,Fe=Ge;he=he.add(w(()=>o.sub(Ie.value,K).add(1).pow_base(32).add(1).log2().add(1).times(Fe)));const Ue=w(()=>o.add(O.value,1).log2().add(1)),Oe=Ce(()=>({multiplier:Ue,description:D,enabled:()=>o.gt(O.value,0)}));I.push(Oe);const oe=mt,Re=[];for(let we=0;we<4;we++){const pe=o.add(m,i()-.5).pow_base(2).times(10).recip(),rt=J.value,Xe=f.variable(w(()=>et.amount.value)),ce=Xe.pow_base(o.pow10(we+1)).times(rt),We=["First","Second","Third","Fourth"][we]+" "+D+" Dimension",at=In(0,We),qn=Xe.sub(1).pow_base(2).times(pe).times(w(()=>o.add(et.amount.value,at.value))),et=bi(()=>({display:{title:We,description:j(()=>d("div",null,[d("div",null,[y("Amount:")," ",xe(o.add(at.value,et.amount.value))," ",y("["),st(et.amount.value),y("]")])])),effectDisplay:j(()=>d("span",null,[aa()," ",we===0?O.displayName:["First","Second","Third","Fourth"][we-1]+" "+D+" Dimension",y("/s")])),showAmount:!1},style:{width:"400px"},effect:qn,dimensions:at,limit:100,energy:we===0?O:void 0,requirements:Vn(()=>({resource:Sn(c),cost:ce,maxBulkAmount:()=>te("diamondRelic")!=null?o.dInf:1,requiresPay:()=>!te("unobtainiumRelic")})),visibility:w(()=>ye.value.length!==$&&s(oe))}));Re.push(et);const Dr=mi(et),si=w(()=>s(et.canClick)&&Dr.value),ia=new f({inputs:[Xe],evaluate(oi){return o.sub(oi,1).pow_base(2).times(pe).times(o.add(oi,at.value))}}),aa=vn(ia,si);de.push({shouldShowPreview:si,cost:w(()=>te("unobtainiumRelic")?0:an(ce,et.amountToIncrease.value))});const sa=Rr(c,L,()=>Me(ce));Fr(et,{display:sa,direction:U.Down}),Ge=he.evaluate(),Ie.value++}this.on("preUpdate",we=>{if(ye.value.length<$&&v.activePortals.value.some(pe=>pe.state.id===e)&&Ye(oe)){let pe=o.times(ct.value,we);v.toolNodes.value.platinumRelic!=null&&(pe=o.times(te("platinumRelic")?4:2,pe));const rt=Re[0].effect.evaluate();O.value=o.times(rt,pe).add(O.value);for(let Xe=1;Xe<4;Xe++){const ce=Re[Xe].effect.evaluate();Re[Xe-1].dimensions.value=o.times(ce,pe).add(Re[Xe-1].dimensions.value)}}}),X.push(Re),ue[V*2]=j(()=>d(ne,null,[Ye(ye.value.length!==$&&s(oe))?d("div",{style:"margin: 10px"},[y("You have")," ",d("h2",{style:{color:W,textShadow:`0px 0px 10px ${W}`}},[xe(O.value)])," ",O.displayName,y(","),d("br",null,null),y("providing a "),xe(Ue.value),y("x multiplier to previous")," ",c.displayName,y(" gain")]):null,Ys(...Re)]));break}case"prestige":{const D=Mn(i),O=mt,W=i()/10+1.1,K=J.value;he=he.pow(W);const Fe=wd(()=>({exponent:W,description:D,enabled:oe.bought}));Ge=he.evaluate(),Ie.value+=20;const Ue=X.filter((we,pe)=>pe%2===0),Oe=vp(()=>({thingsToReset:Ue,onReset(){c.value=0}})),oe=yi(()=>({display:{title:D,description:`Reset all previous ${a} content to raise all previous ${c.displayName} gain to the ^${xe(W)}`},style:{width:"200px",minHeight:"100px"},onPurchase:()=>{te("unobtainiumRelic")||Oe.reset()},visibility:w(()=>ye.value.length!==$&&s(O)),requirements:Vn(()=>({resource:Sn(c),cost:K,requiresPay:!1}))})),Re=Ce(()=>({multiplier:0}));ae({feature:oe,canClick:()=>s(oe.canPurchase),modifier:Fe,cost:K,previewCost:w(()=>te("unobtainiumRelic")?0:c.value),previewModifier:Re,showETA:()=>!s(oe.bought)}),X.push([oe]);break}}const nt={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 kn=ur(nt,i);V===$-1&&"relic"in b&&(kn="relic");let dt="",ht,xt,en,Ze,Rt,pn;switch(kn){case"cache":Ze=qr(i,r),dt=`Cache: Gain ${xe(o.div(T.value,12))}x your current ${Ze} (no modifiers).`,xt=()=>{var D,O,W;return v.grantResource(Ze,o.times((W=(O=(D=v.resourceNodes.value[Ze])==null?void 0:D.state)==null?void 0:O.amount)!=null?W:0,o.div(T.value,12)))};break;case"generation":Ze=qr(i,r);const x=o.pow(T.value,2).div(40).times(Tt[Ze]);dt=`Gen: Gain ${xe(x)} ${Ze}/s while plane is active.`,ht=D=>v.grantResource(Ze,o.times(D,x)),en=Ze;break;case"resourceMulti":Rt=Ze=qr(i,r),pn=o.pow(T.value,2).div(10).pow_base(1.5),dt=`Resource Mult: Gain ${xe(pn)}x ${Ze} while plane is active.`;break;case"energyMulti":Rt="energy",pn=o.div(T.value,8).add(1),dt=`Energy Mult: Gain ${xe(pn)}x energy while plane is active.`;break;case"influences":const A=Object.keys(yt)[Math.floor(i()*Object.keys(yt).length)];dt=`Influence: Gain a portal influence (${yt[A].display})`,xt=()=>{if(A in v.influenceNodes.value){Ni.warning(`You already have a ${yt[A].display} influence, skipping treasure`);return}const D={id:Tn(v.board),position:{...v.board.types.portal.nodes.value.find(O=>O.state.id===e).position},type:"influence",state:{type:A,data:yt[A].initialData}};v.board.placeInAvailableSpace(D),v.board.nodes.value.push(D)};break;case"relic":dt=t==="ultimatum"?"Win the game!":`Relic: Gain the ${t}-tier planar relic (${Ft[t]})`,xt=()=>{if(t==="ultimatum"){ii.value=!0;return}if(`${t}Relic`in v.toolNodes.value)Ni.warning(`You already have a ${Ft[t]} relic, skipping treasure`);else{const D={id:Tn(v.board),position:{...v.board.types.portal.nodes.value.find(O=>O.state.id===e).position},type:"passive",state:`${t}Relic`};v.board.placeInAvailableSpace(D),v.board.nodes.value.push(D)}}}const ar=mt,On=J.value,tn=ip(()=>({requirements:Vn(()=>({resource:Sn(c),cost:On})),visibility:w(()=>s(ar)),display:{requirement:`${xe(On)} ${c.displayName}`,effectDisplay:dt},style:"width: 100%",classes:{final:V===$-1},update:ht,onComplete:xt,link:en,effectedResource:Rt,resourceMulti:pn})),$r=Rr(c,L,On);Fr(tn,{display:()=>tn.earned.value?"":$r.value,direction:U.Down}),X.push([tn]),mt=tn.earned,ue[V*2+1]=j(()=>gt(tn))}const $e=Zn(X,ri),tt=Zn(X,na);I.push(Ce(()=>({multiplier:()=>te("silver")?4:2,description:()=>(te("silver")?"Empowered ":"")+je.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 ":"")+je.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 ":"")+je.emerald.name,enabled:()=>v.toolNodes.value.emerald!=null})),Ce(()=>({multiplier:()=>o.div(tt.reduce((V,z)=>V.add(s(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 vt=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}))]),ct=w(()=>vt.apply(1)),[St,Mr]=Gn(()=>[{title:`${it(c.displayName)} Gain`,modifier:E,base:0,unit:"/s"},{title:`${it(c.displayName)} Time Speed`,modifier:vt,base:1,visible:()=>o.gt(ct.value,1)}]),Cn=G(!1),nr=j(()=>d(Lt,{modelValue:Cn.value,"onUpdate:modelValue":V=>Cn.value=V},{header:()=>d("h2",null,[y("Modifiers")]),body:()=>ot(St)}));this.on("preUpdate",V=>{if(!v.activePortals.value.some(De=>De.state.id===e))return;const z=o.times(ct.value,V);p.value=o.add(p.value,z),ye.value.length<$&&(c.value=o.times(L.value,z).add(c.value)),ye.value.forEach(De=>{var nt;(nt=De.update)==null||nt.call(De,z)})}),_p(this,()=>ye.value.length<$&&v.upgrader.value!=null&&ke(v.upgrader.value)&&v.upgrader.value.state.portals.includes(e),$e),Ad(this,()=>ye.value.length<$&&v.automator.value!=null&&ke(v.automator.value)&&v.automator.value.state.portals.includes(e),tt);const Rn=w(()=>{const V=de.find(z=>z.shouldShowPreview.value);return V?o.neg(Me(V.cost)):0}),En=w(()=>{const V=de.find(z=>z.shouldShowPreview.value);return V&&V.modifier?o.sub(V.modifier.apply(0),L.value):0}),Qt=vn(f.variable(0).add(c),()=>o.neq(Rn.value,0),Rn),Fn=vn(f.variable(0).add(L),()=>o.neq(En.value,0),En),rr=w(()=>{const V=[];return ye.value.forEach(z=>{z.link&&V.push(z.link)}),V}),ir=w(()=>{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=w(()=>{const V=[];for(let z=1;zo.lt(ye.value.length,$)&&X.some(V=>V.some(z=>"earned"in z&&s(z.earned)||"bought"in z&&s(z.bought)?!1:("canClick"in z&&s(z.canClick)||"canPurchase"in z&&s(z.canPurchase),!0)))),xr=w(()=>{const V=X.findIndex((De,nt)=>nt>0&&nt%2===0&&!X[nt-1][0].earned.value);let z;return V===-1?z=X:z=X.slice(0,V),z.map((De,nt)=>nt in ue?ot(ue[nt]):Ar(...De))});return{tier:lt(t),seed:lt(n),influences:lt(r),name:a,color:u,resource:c,background:l,style:{background:l,"--background":l},classes:{plane:!0},features:X,resourceTabCollapsed:Mr,links:rr,resourceMultis:ir,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,[a])]),d("span",{class:"nav-segment"},[d("h3",null,[t,y("-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("
"),direction:U.Down,style:"width: 300px"},{default:()=>[d("h3",null,[r.length,y(" influence"),r.length===1?"":"s"])]})]),d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>Cn.value=!0},[y("modifiers")])])]}),ye.value.length===$?null:d(mr,{class:"nav-container"},{default:()=>[d("span",{class:"nav-segment"},[d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[ot(Qt)])," ",c.displayName]),d("span",{class:"nav-segment"},[y("("),d("h3",{style:`color: ${u}; text-shadow: 0px 0px 10px ${u};`},[o.gt(L.value,0)?"+":"",ot(Fn)]),y("/s)")]),o.neq(ct.value,1)?d("span",{class:"nav-segment"},[y("Speed: "),xe(ct.value),y("x")]):null]}),d(Jd,{height:ye.value.length===$?"30px":"60px"},null),ye.value.length===$?d("div",null,[d("h1",{style:"color: var(--layer-color)"},[y("Plane Complete!")])]):null,xr.value,ye.value.length+1<$?d("div",null,[y("+"),st($-ye.value.length-1),y(" remaining treasures")]):null,ot(nr)])),minimizedDisplay:j(()=>d("div",null,[d("span",null,[a]),d("span",{style:"font-size: large; vertical-align: sub;"},[" ",t,y("-tier |")," ",ye.value.length===$?d("span",null,[y("Plane Complete")]):d("span",null,[ye.value.length,y("/"),$,y(" treasures")])])]))}})}function qr(e,t){t=t.filter(l=>l.type==="increaseResources"||l.type==="decreaseResources");const n=Object.keys(Tt).reduce((l,c)=>{let p=Tt[c];return t.filter(h=>h.data===c).forEach(h=>{h.type==="increaseResources"?p*=1e3:p/=1e3}),l+p},0),r=Object.keys(Tt),i=Math.floor(e()*n);let a=0,u;for(let l=0;ll+c),r=Object.keys(e);let i=0,a=null;const u=t()*n;for(let l=0;le===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:ln.Outline,progressColor:"var(--accent2)",classes:e=>({running:ke(e)}),draggable:!0},xp={shape:ze.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},$p={shape:ze.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 ${je[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?je[r].name:"Already crafted",a=e.state===r||v.toolNodes.value[r]==null?"var(--accent2)":"var(--danger)";return{text:i,color:a}}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 ${je[e.state].name} - ${He(je[e.state].cost)} energy`}),onClick(e){const t=je[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:Tn(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:Tn(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,je[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,je[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(je[e.state].cost)).clampMax(1).toNumber(),progressDisplay:ln.Fill,progressColor:e=>e.state!=null&&o.gte(v.energy.value,je[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},Dp=["I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI"],Tp={shape:ze.Circle,size:50,title:e=>it(e.state.type),subtitle:e=>He(e.state.amount),otherSubtitle:e=>Dp[Et.indexOf(e.state.type)],progress:e=>kd(e.state.type),onClick(){},progressDisplay:ln.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=>e.state.type in v.toolNodes.value,fillStar:e=>`${e.state.type}Relic`in v.toolNodes.value},Pp={shape:ze.Circle,size:50,title:e=>{const t=e.state;return t.includes("Relic")?Ft[t.slice(0,-5)]:je[t].name},label:e=>e===v.board.selectedNode.value?{text:qd[e.state].description(te(e.state))}:null,outlineColor:"var(--bought)",classes:e=>({"affected-node":te(e.state)}),draggable:!0},Ap={shape:ze.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)})`}:Zi(e,t=>`Double ${t} odds`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(2).pow_base(100),16),jt,zt("dowsing")],classes:e=>({running:ke(e)}),canAccept:Xi,onDrop:Ji,draggable:!0},Rp={shape:ze.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)})`}:Zi(e,t=>`Gather ${Nt(o.div(v.dropRates[t].computedModifier.value,100))} ${t}/s`),actionDistance:Math.PI/4,actions:[dn,Nn(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:ln.Outline,progressColor:"var(--accent2)",canAccept:Xi,onDrop:Ji,classes:e=>({running:ke(e)}),draggable:!0},Ep={shape:ze.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)})`}:_d(e,t=>t.includes("Relic")?`Double ${Ft[t.slice(0,-5)]}'s effect`:`Double ${je[t].name}'s effect`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(3).pow_base(1e3),24),jt,zt("empowerer")],canAccept:Nd,onDrop:Cd,classes:e=>({running:ke(e)}),draggable:!0},Fp={shape:ze.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":`${it(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 a;return o.lt(i,1e3)?a=He(i):a=Gr(i,0),{text:`Add influence (${a}x cost)`,color:"var(--accent2)"}}else if((t==null?void 0:t.type)==="portal")return{text:`Copy tier/influences from ${me[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 - ${He(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 me;)t++;v.energy.value=o.sub(v.energy.value,v.computedPortalCost.value);const{tier:n,influences:r}=e.state;Kr(ra(`portal-${t}`,n,Math.floor(Math.random()*4294967296),r.map(a=>v.influenceNodes.value[a].state)),Y);const i={id:Tn(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=me[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:ln.Fill,progressColor:e=>e.state.tier!=null&&o.gte(v.energy.value,v.computedPortalCost.value)?"var(--accent2)":"var(--foreground)",draggable:!0},Op={shape:ze.Diamond,size:50,title:"\u{1F300}",label:e=>e===v.board.selectedNode.value?{text:`Portal to ${me[e.state.id].name}`,color:me[e.state.id].color}:null,actionDistance:Math.PI/4,actions:[jt],classes:e=>({running:ke(e),showNotif:me[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=>me[e.state.id].background,draggable:!0},qp={shape:e=>e.state.type==="increaseResources"||e.state.type==="decreaseResources"?ze.Diamond:ze.Circle,size:50,title:e=>yt[e.state.type].display,otherSubtitle:e=>{const t=yt[e.state.type].cost;return o.lt(t,1e3)?`${He(t)}x cost`:`${Gr(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 a;if(Array.isArray(i)&&i.includes(n))a="Disconnect";else if(r==="increaseResources")a=`Increase ${it(n)} odds`;else if(r==="decreaseResources")a=`Decrease ${it(n)} odds`;else return null;return{text:a,color:"var(--accent2)"}}return null},actionDistance:Math.PI/4,actions:[dn],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},Vp={shape:ze.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 ${He(o.add(1,e.state.level))}x (${e.state.portals.length}/${o.add(e.state.maxConnections,v.computedBonusConnectionsModifier.value)})`}:wr(e,t=>`Boost ${me[t].name}'s speed`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(6).pow_base(1e3)),{id:"increaseBoost",icon:"arrow_upward",tooltip(e){return{text:`Increase boost - ${He(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},Bp={shape:ze.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 ${me[t].name}'s upgrades and prestiges`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(4).pow_base(1e6)),jt,zt("upgrader")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},Lp={shape:ze.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 ${me[t].name}'s repeatables and dimensions`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(4).pow_base(1e6)),jt,zt("automator")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},jp={shape:ze.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 ${me[t].name}'s conversions`),actionDistance:Math.PI/4,actions:[dn,Nn(e=>e.add(3).pow_base(1e8)),jt,zt("investments")],canAccept:_r,onDrop:Nr,classes:e=>({running:ke(e)}),draggable:!0},zp={shape:ze.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 ${me[n].name}!`,color:"var(--danger)"}}return null},canAccept:(e,t)=>t.type==="portal",onDrop:(e,t)=>{const n=t.state.id;Qr(me[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},Ci=hr(),Gp={mine:Ip,brokenFactory:xp,factory:$p,resource:Tp,passive:Pp,dowsing:Ap,quarry:Rp,empowerer:Ep,portalGenerator:Fp,portal:Op,influence:qp,booster:Vp,upgrader:Bp,automator:Lp,investments:jp,trashCan:zp},v=Jr("main",function(){const e=In(0,"energy"),t=w(()=>m.types.resource.nodes.value.reduce((x,A)=>(x[A.state.type]=A,x),{})),n=w(()=>({...m.types.passive.nodes.value.reduce((x,A)=>(x[A.state]=A,x),{}),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=w(()=>Object.keys(Ft).filter(x=>`${x}Relic`in n.value).length),i=w(()=>({...m.types.influence.nodes.value.reduce((x,A)=>(x[A.state.type]=A,x),{})})),a=w(()=>({...m.types.portal.nodes.value.reduce((x,A)=>(x[A.state.id]=A,x),{})})),u=w(()=>Et.reduce((x,A)=>{var O,W,K;const D=(K=(W=(O=t.value[A])==null?void 0:O.state)==null?void 0:W.amount)!=null?K:0;return x[A]=o.floor(Vr.invert(D)),x},{})),l=on({}),c=on({});Yt(()=>{Et.forEach(x=>{wt(()=>u.value[x],(A,D)=>{const O=o.sub(A,D);o.gt(O,1)&&ie.active===Y.id&&Ci.info(d("div",null,[d("h3",null,[o.eq(A,1)?`${it(x)} discovered`:`${it(x)} is now Level ${st(A)}`,y("!")]),o.gt(O,1)?d("div",null,[y("Gained "),st(O),y(" levels")]):null]))})})});const p=w(()=>X.filter(x=>{var A,D;return(D=(A=x.value)==null?void 0:A.state)==null?void 0:D.powered}).length+m.types.portal.nodes.value.filter(x=>x.state.powered).length),h=w(()=>{let x=p.value;return n.value.copperRelic!=null&&(x--,te("copperRelic")&&x--),x}),g=w(()=>{const x=h.value;return o.lt(x,0)?0:o.eq(x,0)?10:o.add(x,1).pow_base(100).div(10).times(.99)}),b=w(()=>{if($.value==null)return 0;let A=$.value.state.resources.reduce((D,O)=>o.div(100,Qt[O].computedModifier.value).add(D),o.dZero);return n.value.silverRelic!=null&&(A=o.div(A,o.add(p.value,1)),te("silverRelic")&&(A=o.div(A,o.add(p.value,1)))),A}),m=dd(x=>({startNodes:()=>[{position:{x:0,y:0},type:"mine",state:{progress:0,powered:!1}},{position:{x:0,y:-200},type:"brokenFactory"}],types:Gp,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"hidden"},links(){const A=[];if(A.push(...Object.keys(l).filter(hi(k.value)).map(D=>({startNode:k.value,endNode:t.value[D],stroke:"var(--accent3)",strokeWidth:5}))),C.value!=null&&C.value.state!=null&&A.push({startNode:C.value,endNode:t.value[C.value.state],stroke:"var(--foreground)",strokeWidth:4}),T.value!=null&&T.value.state.resources.forEach(D=>{A.push({startNode:T.value,endNode:t.value[D],stroke:ke(T.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),$.value!=null&&$.value.state.resources.forEach(D=>{A.push({startNode:$.value,endNode:t.value[D],stroke:D in c?"var(--accent3)":"var(--foreground)",strokeWidth:4})}),I.value!=null&&I.value.state.tools.forEach(D=>{A.push({startNode:I.value,endNode:n.value[D],stroke:ke(I.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),E.value!=null){const D=E.value.state;D.tier!=null&&A.push({startNode:E.value,endNode:t.value[D.tier],stroke:"var(--foreground)",strokeWidth:4}),D.influences.forEach(O=>{A.push({startNode:E.value,endNode:i.value[O],stroke:"var(--foreground)",strokeWidth:4})}),x.types.portal.nodes.value.forEach(O=>{const W=me[O.state.id];return Et.filter(hi(O)).forEach(K=>{let Fe;if(W.links.value.includes(K))Fe="var(--accent3)";else if(K in W.resourceMultis.value)Fe="var(--accent1)";else return;A.push({startNode:O,endNode:t.value[K],stroke:ke(O)?Fe:"var(--foreground)",strokeWidth:4})}),A})}return L.value!=null&&L.value.state.portals.filter(D=>a.value[D]!=null).forEach(D=>{A.push({startNode:L.value,endNode:a.value[D],stroke:ke(L.value)?"var(--accent1)":"var(--foreground)",strokeWidth:4})}),de.value!=null&&de.value.state.portals.filter(D=>a.value[D]!=null).forEach(D=>{A.push({startNode:de.value,endNode:a.value[D],stroke:"var(--foreground)",strokeWidth:4})}),ue.value!=null&&ue.value.state.portals.filter(D=>a.value[D]!=null).forEach(D=>{A.push({startNode:ue.value,endNode:a.value[D],stroke:"var(--foreground)",strokeWidth:4})}),ae.value!=null&&ae.value.state.portals.filter(D=>a.value[D]!=null).forEach(D=>{A.push({startNode:ae.value,endNode:a.value[D],stroke:"var(--foreground)",strokeWidth:4})}),Object.values(i.value).forEach(D=>{const O=D.state;(O.type==="increaseResources"||O.type==="decreaseResources")&&O.data.forEach(W=>{A.push({startNode:D,endNode:t.value[W],stroke:"var(--foreground)",strokeWidth:4})})}),A}})),k=w(()=>m.types.mine.nodes.value[0]),C=w(()=>m.types.factory.nodes.value[0]),T=w(()=>n.value.sand),$=w(()=>n.value.wood),I=w(()=>n.value.coal),E=w(()=>n.value.iron),L=w(()=>n.value.gold),de=w(()=>n.value.platinum),ue=w(()=>n.value.berylium),ae=w(()=>n.value.ultimatum),X=[k,T,$,I,L,de,ue,ae];function Ie(x,A){let D=t.value[x];if(A=o.times(A,Fn[x].computedModifier.value),D==null)D={id:Tn(m),position:{...k.value.position},type:"resource",state:{type:x,amount:A}},m.placeInAvailableSpace(D),m.nodes.value.push(D);else{const O=D.state;D.state={...O,amount:o.add(O.amount,A)}}}const he=w(()=>Object.keys(Tt).reduce((x,A)=>x+new o(Qt[A].computedModifier.value).toNumber(),0)),Ge=w(()=>{const x={};return m.types.portal.nodes.value.forEach(A=>{if(!ke(A))return;const O=me[A.state.id].resourceMultis.value;Object.keys(O).forEach(W=>{x[W]!=null?x[W]=o.times(x[W],O[W]):x[W]=O[W]})}),x}),mt=Mt(()=>Et.map(x=>Ut(()=>({description:()=>it(x),addend:()=>u.value[x],enabled:()=>o.gt(u.value[x],0)})))),J=w(()=>mt.apply(0)),$e=Mt(()=>[Ut(()=>({addend:J,description:"Resource Levels"})),Ce(()=>({multiplier:()=>o.pow(En.value,J.value),description:()=>`${Ht(En.value,3)}x per Resource Level`})),Ce(()=>({multiplier:()=>te("stone")?4:2,description:()=>(te("stone")?"Empowered ":"")+je.stone.name,enabled:()=>n.value.stone!=null})),Ce(()=>({multiplier:()=>{var x;return(x=Ge.value.energy)!=null?x:1},description:"Planar Treasures",enabled:()=>{var x;return o.neq((x=Ge.value.energy)!=null?x:1,1)}})),Ut(()=>({addend:()=>o.pow(100,h.value).div(10).neg(),description:"Powered Machines (100^n/10 energy/s)",enabled:()=>o.gt(h.value,0)}))]),tt=w(()=>$e.apply(0)),vt=Mt(()=>[Ut(()=>({addend:()=>te("unobtainium")?2:1,description:()=>(te("unobtainium")?"Empowered ":"")+je.unobtainium.name,enabled:()=>n.value.unobtainium!=null}))]),ct=w(()=>vt.apply(0)),St=Mt(()=>[Ce(()=>({multiplier:()=>te("dirt")?4:2,description:()=>(te("dirt")?"Empowered ":"")+je.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=w(()=>St.apply(1)),Cn=Mt(()=>[Ce(()=>({multiplier:()=>te("gravel")?4:2,description:()=>(te("gravel")?"Empowered ":"")+je.gravel.name,enabled:()=>n.value.gravel!=null}))]),nr=w(()=>Cn.apply(1)),Rn=Mt(()=>[Ut(()=>({addend:()=>te("copper")?.004:.002,description:()=>(te("copper")?"Empowered ":"")+je.copper.name,enabled:()=>n.value.copper!=null}))]),En=w(()=>Rn.apply(1.01)),Qt=Object.keys(Tt).reduce((x,A)=>{const D=Mt(()=>[Ce(()=>({multiplier:2,description:"Dowsing",enabled:()=>T.value!=null&&ke(T.value)&&T.value.state.resources.includes(A)}))]),O=w(()=>D.apply(Tt[A])),W={title:`${it(A)} Drop Rate`,modifier:D,base:Tt[A]};return x[A]={modifier:D,computedModifier:O,section:W},x},{}),Fn=Object.keys(Tt).reduce((x,A)=>{const D=Mt(()=>[Ce(()=>({multiplier:()=>{var K;return(K=Ge.value[A])!=null?K:1},description:"Planar Treasures",enabled:()=>{var K;return o.neq((K=Ge.value[A])!=null?K:1,1)}}))]),O=w(()=>D.apply(1)),W={title:`${it(A)} Gain`,modifier:D};return x[A]={modifier:D,computedModifier:O,section:W},x},{}),rr=w(()=>{var A,D,O;const x=Et.indexOf((O=(D=(A=E.value)==null?void 0:A.state)==null?void 0:D.tier)!=null?O:"dirt");return o.add(x,1).times(x).div(2).add(9).pow10()}),ir=Mt(()=>[...Object.keys(yt).map(x=>Ce(()=>({multiplier:yt[x].cost,description:yt[x].display,enabled:()=>{var A,D,O;return(O=(D=(A=E.value)==null?void 0:A.state)==null?void 0:D.influences.includes(x))!=null?O:!1},smallerIsBetter:!0}))),Ce(()=>({multiplier:()=>te("emeraldRelic")?.05:.1,description:()=>(te("emeraldRelic")?"Empowered ":"")+Ft.emerald,enabled:()=>n.value.emeraldRelic!=null,smallerIsBetter:!0}))]),ye=w(()=>ir.apply(rr.value)),[Ir,xr]=Gn(()=>[{title:"Resource Levels",modifier:mt,base:0},{title:"Energy Gain",modifier:$e,base:0,unit:"/s"},{title:"Portal Cost",modifier:ir,base:rr,unit:" energy",baseText:()=>{var x,A,D;return`${it((D=(A=(x=E.value)==null?void 0:x.state)==null?void 0:A.tier)!=null?D:"dirt")}-tier Base Cost`},visible:()=>E.value!=null,smallerIsBetter:!0},{title:"Bonus Connections",modifier:vt,base:0,visible:()=>o.gt(ct.value,0)}]),[V,z]=Gn(()=>[{title:"Mining Speed",modifier:St,base:1,unit:"/s",visible:()=>n.value.dirt!=null},{title:"Ore Dropped",modifier:Cn,base:1,visible:()=>n.value.gravel!=null},{title:"Material Level Effect",modifier:Rn,base:1.01,visible:()=>n.value.copper!=null}]),[De,nt]=Gn(()=>Object.values(Qt).map(x=>x.section)),[kn,dt]=Gn(()=>Object.values(Fn).map(x=>x.section)),ht=Yi({general:()=>({display:"General",glowColor(){return ht.activeTab.value===this.tab?"white":""},tab:Ir,energyTabCollapsed:xr}),mining:()=>({display:"Mine",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(n.value).filter(x=>x!=null).length>0,tab:V,miningTabCollapsed:z}),resources:()=>({display:"Ore Rates",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>T.value!=null,tab:De,resourcesCollapsed:nt}),resourcesGain:()=>({display:"Ore Gain",glowColor(){return ht.activeTab.value===this.tab?"white":""},visibility:()=>Object.values(Fn).some(x=>o.neq(x.computedModifier.value,1)),tab:kn,resourceGainCollapsed:dt})}),xt=G(!1),en=j(()=>d(Lt,{modelValue:xt.value,"onUpdate:modelValue":x=>xt.value=x},{header:()=>d("h2",null,[y("Modifiers")]),body:()=>ot(ht)})),Ze={mine:Ld(),factory:jd(),dowsing:zd(),quarry:Gd(),empowerer:Ud(),portalGenerator:Wd(),booster:Hd(),upgrader:Yd(),automator:Zd(),investments:Xd()};Ze.mine.showModal[Xt]=!0,Ze.mine.showModal.value=!0,this.on("preUpdate",x=>{if(Object.keys(l).forEach(A=>{l[A]-=x,l[A]<=0&&delete l[A]}),Object.keys(c).forEach(A=>{c[A]-=x,c[A]<=0&&delete c[A]}),ke(k.value)){const A=o.add(k.value.state.progress,o.times(Mr.value,x)),D=A.floor();k.value.state={...k.value.state,progress:o.sub(A,D)};const O=D.div(he.value).floor();O.gt(0)&&Et.forEach(K=>{Ie(K,o.times(new o(Qt[K].computedModifier.value).toNumber(),O).times(nr.value)),l[K]=.3});const W=o.sub(D,O).toNumber();for(let K=0;K0){let O=o.add(A,x);const W=o.div(A,b.value).floor();O=o.sub(O,o.times(W,b.value)),$.value.state={...$.value.state,progress:O},o.gt(W,0)&&D.forEach(K=>{Ie(K,W),c[K]=.3})}}e.value=o.add(e.value,o.times(tt.value,x)),o.lt(e.value,0)&&(e.value=0,X.map(A=>A.value).filter(A=>A!=null).forEach(A=>{(A==null?void 0:A.state).powered=!1}),Object.values(a.value).forEach(A=>{A.state.powered=!1}),k.value.state={...k.value.state,powered:!1},Ci.warning(d("div",null,[d("h3",null,[y("Ran out of energy!")]),d("div",null,[y("All machines have been turned off.")])])))});const Rt=w(()=>{var x,A;return m.selectedAction.value===m.types.brokenFactory.actions[0]?-100:m.selectedAction.value===m.types.factory.actions[1]?o.neg(je[m.selectedNode.value.state].cost):((x=m.selectedAction.value)==null?void 0:x.id)==="moreConnections"?o.neg(m.selectedAction.value.formula.evaluate(((A=m.selectedNode.value)==null?void 0:A.state).maxConnections)):0}),pn=vn(f.variable(0).add(e),()=>o.neq(Rt.value,0),Rt),ar=w(()=>{var x;return m.selectedAction.value===jt?((x=m.selectedNode.value)==null?void 0:x.state).powered?o.eq(p.value,1)?10:o.pow(100,p.value).div(10).times(.99):o.neg(g.value):0}),On=vn(f.variable(0).add(tt),()=>o.neq(ar.value,0),ar),tn=w(()=>m.types.portal.nodes.value.filter(x=>ke(x))),$r=w(()=>tn.value.sort((x,A)=>{var W,K;const D=(W=me[x.state.id])!=null&&W.minimized.value?1:0,O=(K=me[A.state.id])!=null&&K.minimized.value?1:0;return D-O}).map(x=>x.state.id));return wt($r,x=>{Yt(()=>{Y.tabs=["main",...x]})}),wt(ct,(x,A)=>{o.lt(x,A)&&(mn(x,T,"resources"),mn(x,$,"resources"),mn(x,I,"tools"),mn(x,L,"portals"),mn(x,de,"portals"),mn(x,ue,"portals"),mn(x,ae,"portals"))}),{name:"World",board:m,energy:e,modifierTabs:ht,resourceNodes:t,toolNodes:n,influenceNodes:i,grantResource:Ie,activePortals:tn,nextPowerCost:g,computedBonusConnectionsModifier:ct,quarryProgressRequired:b,dropRates:Qt,dowsing:T,empowerer:I,booster:L,upgrader:de,automator:ue,investments:ae,resourceLevels:u,planarMultis:Ge,computedPortalCost:ye,helpModals:Ze,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(pn)])," ",y("energy")]),d("span",{class:"nav-segment"},[y("("),d("h3",{style:"color: white; text-shadow: 0px 0px 10px white;"},[o.gt(tt.value,0)?"+":"",ot(On)]),y("/s)")]),o.gt(p.value,0)?d("span",{class:"nav-segment"},[d("h3",{style:"color: var(--accent1); text-shadow: 0px 0px 10px var(--accent1);"},[st(p.value)])," ",o.eq(p.value,1)?"machine":"machines"," ",y("powered")]):null,d("span",{class:"nav-segment"},[d("button",{class:"button",style:"display: inline",onClick:()=>xt.value=!0},[y("modifiers")])]),Y.devSpeed===0?d("span",{class:"nav-segment"},[y("Game Paused")]):Y.devSpeed!=null&&Y.devSpeed!==1?d("span",{class:"nav-segment"},[y("Dev Speed: "),xe(Y.devSpeed),y("x")]):null]}),ot(m),ot(en),Object.values(Ze).map(({modal:x})=>x())]))}});Ke.on("loadSettings",e=>{le(e,"lineVisibility",!0)});Ei(j(()=>d($t,{title:j(()=>d("span",{class:"option-title"},[y("Always show lines to resource nodes"),d("desc",null,[y("Otherwise, will only be visible when either end of the line is selected.")])])),modelValue:ie.lineVisibility,"onUpdate:modelValue":e=>ie.lineVisibility=e},null)));const Up=e=>{var n,r,i,a,u;const t=[v];return(u=(a=(i=(r=(n=e.layers)==null?void 0:n.main)==null?void 0:r.board)==null?void 0:i.state)==null?void 0:a.nodes)==null||u.filter(l=>(l==null?void 0:l.type)==="portal").map(l=>{var c,p;return(p=(c=l==null?void 0:l.state)==null?void 0:c.id)!=null?p:""}).forEach(l=>{var p,h,g,b;const c=(p=e.layers)==null?void 0:p[l];t.push(ra(l,(h=c.tier)!=null?h:"dirt",(g=c.seed)!=null?g:Math.floor(Math.random()*4294967296),(b=c.influences)!=null?b:[]))}),t},ii=G(!1);function Wp(e,t){}var Hp=Object.freeze(Object.defineProperty({__proto__:null,main:v,getInitialLayers:Up,hasWon:ii,fixOldSave:Wp},Symbol.toStringTag,{value:"Module"}));const tr=e=>(un("data-v-4a50ce42"),e=e(),cn(),e),Yp={class:"game-over-modal-header"},Zp=["src","alt"],Xp={class:"game-over-modal-title"},Jp=tr(()=>N("h2",null,"Congratulations!",-1)),Kp={key:0},Qp=tr(()=>N("br",null,null,-1)),ef=tr(()=>N("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),tf=tr(()=>N("br",null,null,-1)),nf=["href"],rf=tr(()=>N("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),af=Z({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:a,versionTitle:u}=ve,l=w(()=>yr(Y.timePlayed)),c=w(()=>ii.value&&!Y.keepGoing),p=Zt(Y,"autosave");function h(){Y.keepGoing=!0}function g(){hn($n())}return(b,m)=>(S(),re(Lt,{"model-value":s(c)},{header:H(()=>[N("div",Yp,[s(n)?(S(),P("img",{key:0,class:"game-over-modal-logo",src:s(n),alt:s(t)},null,8,Zp)):B("",!0),N("div",Xp,[Jp,N("h4",null,"You've beaten "+ee(s(t))+" v"+ee(s(a))+": "+ee(s(u)),1)])])]),body:H(({shown:k})=>[k?(S(),P("div",Kp,[N("div",null,"It took you "+ee(s(l))+" to beat the game.",1),Qp,ef,tf,N("div",null,[N("a",{href:s(i),class:"game-over-modal-discord-link"},[rf,y(" "+ee(s(r)),1)],8,nf)]),d($t,{title:"Autosave",modelValue:s(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 sf=be(af,[["__scopeId","data-v-4a50ce42"]]);const Sr=e=>(un("data-v-2776d67d"),e=e(),cn(),e),of=Sr(()=>N("div",{class:"nan-modal-header"},[N("h2",null,"NaN value detected!")],-1)),lf={key:0},uf=Sr(()=>N("br",null,null,-1)),cf=["href"],df=Sr(()=>N("span",{class:"material-icons nan-modal-discord"},"discord",-1)),pf=Sr(()=>N("br",null,null,-1)),ff={class:"nan-footer"},gf=Z({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=ve,r=G(!0),i=G(!0),a=Zt(Ee,"hasNaN"),u=G(null);wt(a,b=>{b?(r.value=Y.autosave,i.value=Y.devSpeed===0):(Y.autosave=r.value,Y.devSpeed=i.value?0:null)});const l=w(()=>{var b;return(b=Ee.NaNPath)==null?void 0:b.join(".")}),c=w(()=>Ee.NaNPersistent!=null?Ee.NaNPersistent.value:null);function p(){Ee.NaNPersistent!=null&&(Ee.NaNPersistent.value=new o(0),Ee.hasNaN=!1)}function h(){Ee.NaNPersistent&&(Ee.NaNPersistent.value=new o(1),Ee.hasNaN=!1)}function g(){Ee.NaNPersistent&&(Ee.NaNPersistent.value=new o(NaN),Ee.hasNaN=!1)}return(b,m)=>(S(),P(ne,null,[d(Lt,Vt({modelValue:s(a),"onUpdate:modelValue":m[4]||(m[4]=k=>Ve(a)?a.value=k:null)},b.$attrs),{header:H(()=>[of]),body:H(()=>[N("div",null,[y(' Attempted to assign "'+ee(s(l))+'" to NaN',1),s(c)?(S(),P("span",lf,ee(" ")+"(previously "+ee(s(xe)(s(c)))+")",1)):B("",!0),y(". 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)]),uf,N("div",null,[N("a",{href:s(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[df,y(" "+ee(s(t)||"The Paper Pilot Community"),1)],8,cf)]),pf,d($t,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=k=>r.value=k)},null,8,["modelValue"]),s(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",ff,[N("button",{onClick:m[2]||(m[2]=k=>{var C;return(C=u.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"),s(c)&&s(o).neq(s(c),0)&&s(o).neq(s(c),1)?(S(),P("button",{key:0,onClick:m[3]||(m[3]=k=>a.value=!1),class:"button"}," Set to previous ")):B("",!0),N("button",{onClick:g,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),d(Gi,{ref_key:"savesManager",ref:u},null,512)],64))}});var mf=be(gf,[["__scopeId","data-v-2776d67d"]]);const vf={key:0,class:"tpsDisplay"},hf=Z({__name:"TPS",setup(e){const t=w(()=>o.div(Ee.lastTenTicks.length,Ee.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>s(t).isNan()?B("",!0):(S(),P("div",vf,"TPS: "+ee(s(st)(s(t))),1))}});var bf=be(hf,[["__scopeId","data-v-89b89152"]]);var yf=Z({__name:"App",setup(e){const t=ve.useHeader,n=w(()=>It[ie.theme].variables),r=Zt(ie,"showTPS"),i=Zt(Ee,"errors"),a=w(()=>ge(j(()=>d(ne,null,[zs.map(ot)]))));return(u,l)=>s(i).length>0?(S(),P("div",{key:0,class:"error-container",style:Le(s(n))},[d(Mi,{errors:s(i)},null,8,["errors"])],4)):(S(),P(ne,{key:1},[N("div",{id:"modal-root",style:Le(s(n))},null,4),N("div",{class:Ne(["app",{useHeader:s(t)}]),style:Le(s(n))},[s(t)?(S(),re(Ui,{key:0})):B("",!0),d(Tc),s(s(r))?(S(),re(bf,{key:1})):B("",!0),d(sf),d(mf),(S(),re(Je(s(a))))],6)],64))}});var wf=be(yf,[["__scopeId","data-v-bf4e22ac"]]);function _f(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:u}=e;let l,c,p,h;const g=async(m=!0)=>{await p,m&&(l==null||l.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 Wn(()=>import("./workbox-window.4a8794bb.js"),[]);h=async()=>{c&&c.waiting&&await k(c.waiting,{type:"SKIP_WAITING"})},l=new m("./sw.js",{scope:"./",type:"classic"}),l.addEventListener("activated",C=>{C.isUpdate||r==null||r()});{const C=()=>{n==null||n()};l.addEventListener("waiting",C),l.addEventListener("externalwaiting",C)}l.register({immediate:t}).then(C=>{c=C,a?a("./sw.js",C):i==null||i(C)}).catch(C=>{u==null||u(C)})}}return p=b(),g}function Nf(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:u}=e,l=G(!1),c=G(!1);return{updateServiceWorker:_f({immediate:t,onNeedRefresh(){l.value=!0,n==null||n()},onOfflineReady(){c.value=!0,r==null||r()},onRegistered:i,onRegisteredSW:a,onRegisterError:u}),offlineReady:c,needRefresh:l}}const ai=console.error;console.error=function(...e){ai(...e)};window.onerror=function(e,t,n,r,i){return Ee.errors.push(i instanceof Error?i:new Error(JSON.stringify(i))),ai(i),!0};window.onunhandledrejection=function(e){Ee.errors.push(e.reason instanceof Error?e.reason:new Error(JSON.stringify(e.reason))),ai(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 qs();const{globalBus:e}=await Wn(()=>Promise.resolve().then(function(){return Os}),void 0),{startGameLoop:t}=await Wn(()=>import("./gameLoop.48d12127.js"),["assets/gameLoop.48d12127.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=va(wf);n.config.errorHandler=function(r,i,a){console.error(r,a,i)},e.emit("setupVue",n),n.mount("#app"),Yt(()=>{const r=hr(),{updateServiceWorker:i}=Nf({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(a){a&&setInterval(()=>a.update(),60*60*1e3)}})}),t()});export{o as D,Wn as _,Ee as a,ve as b,Hp as c,Ke as g,Vs as l,Y as p,ie as s}; diff --git a/index.html b/index.html index 4cc073d..d5e2668 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ Planar Pioneers - + diff --git a/sw.js b/sw.js index 81005af..46fbd40 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const o=e=>i(e,r),u={module:{uri:r},exports:a,require:o};s[r]=Promise.all(n.map((e=>u[e]||o(e)))).then((e=>(l(...e),a)))}}define(["./workbox-7369c0e1"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@vue.6b211d3c.js",revision:null},{url:"assets/amator.1e5a40c8.js",revision:null},{url:"assets/bezier-easing.a990b400.js",revision:null},{url:"assets/gameLoop.48d12127.js",revision:null},{url:"assets/index.8a0a226e.css",revision:null},{url:"assets/index.a00e3eeb.js",revision:null},{url:"assets/lz-string.dccec454.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/ngraph.events.083734c6.js",revision:null},{url:"assets/panzoom.30c56ba6.js",revision:null},{url:"assets/sortablejs.a0f68e5e.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.ded54c4a.js",revision:null},{url:"assets/vue-panzoom.8ce6f9b1.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.9c2dad53.js",revision:null},{url:"assets/vue.c16a309b.js",revision:null},{url:"assets/vuedraggable.1879de79.js",revision:null},{url:"assets/wheel.f2ae740f.js",revision:null},{url:"assets/workbox-window.4a8794bb.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"b2177afae09ae14ea1333cc5296370f9"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"e1e419fec40e2d042566c11fe4bce322"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()})).then((()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e})));self.define=(n,l)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let a={};const o=e=>i(e,r),u={module:{uri:r},exports:a,require:o};s[r]=Promise.all(n.map((e=>u[e]||o(e)))).then((e=>(l(...e),a)))}}define(["./workbox-7369c0e1"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"assets/@fontsource.f66d05e7.css",revision:null},{url:"assets/@vue.6b211d3c.js",revision:null},{url:"assets/amator.1e5a40c8.js",revision:null},{url:"assets/bezier-easing.a990b400.js",revision:null},{url:"assets/gameLoop.a8abe3ac.js",revision:null},{url:"assets/index.3f4ba557.js",revision:null},{url:"assets/index.8a0a226e.css",revision:null},{url:"assets/lz-string.dccec454.js",revision:null},{url:"assets/nanoevents.1080beb7.js",revision:null},{url:"assets/ngraph.events.083734c6.js",revision:null},{url:"assets/panzoom.30c56ba6.js",revision:null},{url:"assets/sortablejs.a0f68e5e.js",revision:null},{url:"assets/vue-next-select.9e6f4164.css",revision:null},{url:"assets/vue-next-select.ded54c4a.js",revision:null},{url:"assets/vue-panzoom.8ce6f9b1.js",revision:null},{url:"assets/vue-textarea-autosize.35804eaf.js",revision:null},{url:"assets/vue-toastification.4b5f8ac8.css",revision:null},{url:"assets/vue-toastification.9c2dad53.js",revision:null},{url:"assets/vue.c16a309b.js",revision:null},{url:"assets/vuedraggable.1879de79.js",revision:null},{url:"assets/wheel.f2ae740f.js",revision:null},{url:"assets/workbox-window.4a8794bb.js",revision:null},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"favicon.svg",revision:"c8dd2748f1fedd25449164d7dda6aecb"},{url:"index.html",revision:"186be6449aa3f90bf90a7356e5cb32b6"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"favicon.ico",revision:"eead31eb5b19fa3bdc34af83d898c0b7"},{url:"robots.txt",revision:"5e0bd1c281a62a380d7a948085bfe2d1"},{url:"apple-touch-icon.png",revision:"26e53bb981d06c8069ffd9d2a14fce0e"},{url:"pwa-192x192.png",revision:"a16785d9e890858c5b508e0ef6954aaf"},{url:"pwa-512x512.png",revision:"b84004b93fd62ef6599ff179372861a1"},{url:"manifest.webmanifest",revision:"e1e419fec40e2d042566c11fe4bce322"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));