Profectus/assets/index.9b24a867.js

18 lines
144 KiB
JavaScript

/* empty css */import"./vue.359c6955.js";import{q as it,C as l,ab as q,t as x,aF as h,a1 as N,aL as Re,bv as gt,G as te,as as Ke,_ as E,az as yt,a2 as g,J as V,O as W,aK as Le,a0 as $,I as me,a8 as T,a9 as y,b7 as O,aI as Ce,aG as ke,u as Ot,b2 as he,l as re,j as Zn,bw as fn,aH as Ct,A as de,$ as R,b9 as Yt,bt as Xn,ar as Pe,bc as Nn,T as Qn,b3 as Ae,aM as ze,aD as Cn,w as _e,aO as se,z as Fe,bs as er,am as Mt,H as tr,y as gn,bo as nr,ay as rr,bf as ir}from"./@vue.6f8187b0.js";import{L as Ge}from"./lz-string.bfbf8ec3.js";import{c as kn}from"./nanoevents.1080beb7.js";import{i as ar}from"./unofficial-galaxy-sdk.21372393.js";import{p as sr}from"./vue-textarea-autosize.35804eaf.js";import{D as or}from"./vuedraggable.055200e5.js";import{Y as lr}from"./vue-next-select.68e0c605.js";import{s as ur,u as cr}from"./vue-toastification.45d39007.js";import"./sortablejs.20039f18.js";const dr=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 s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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)}};dr();const fr="modulepreload",mn={},gr="./",mt=function(t,n){return!n||n.length===0?t():Promise.all(n.map(r=>{if(r=`${gr}${r}`,r in mn)return;mn[r]=!0;const i=r.endsWith(".css"),a=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${a}`))return;const s=document.createElement("link");if(s.rel=i?"stylesheet":fr,i||(s.as="script",s.crossOrigin=""),s.href=r,document.head.appendChild(s),i)return new Promise((c,d)=>{s.addEventListener("load",c),s.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())},mr="./projInfo-schema.json",hr="Profectus",pr="A project made in Profectus",vr="",br="",yr="",_r="",wr="0.0",Nr="Initial Commit",Cr=!0,kr=!1,Sr=2,Ir=!0,$r=null,Mr="",xr=["main"],Tr=3600,Pr=1,Fr=!0,Er="base64",Or=!1;var U={$schema:mr,title:hr,description:pr,id:vr,author:br,discordName:yr,discordLink:_r,versionNumber:wr,versionTitle:Nr,allowGoBack:Cr,defaultShowSmall:kr,defaultDecimalsShown:Sr,useHeader:Ir,banner:$r,logo:Mr,initialTabs:xr,maxTickLength:Tr,offlineLimit:Pr,enablePausing:Fr,exportEncoding:Er,disableHealthWarning:Or};const Vr=it({id:"",devSpeed:null,name:"",tabs:[],time:-1,autosave:!0,offlineProd:!0,offlineTime:null,timePlayed:0,keepGoing:!1,modID:"",modVersion:"",layers:{}});var F=window.player=Vr;function rt(e){return JSON.stringify(e,(t,n)=>{var r;return(r=l(n))!=null?r:null})}var H=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const Lr=["onClick"],Dr=q({__name:"FeedbackButton",props:{left:{type:Boolean}},emits:["click"],setup(e,{emit:t}){const n=x(!1),r=x(null);function i(){t("click"),r.value&&clearTimeout(r.value),n.value=!1,Ke(()=>{n.value=!0,r.value=setTimeout(()=>n.value=!1,500)})}return(a,s)=>(h(),N("button",{onClick:gt(i,["stop"]),class:te(["feedback",{activated:n.value,left:e.left}])},[Re(a.$slots,"default",{},void 0,!0)],10,Lr))}});var Zt=H(Dr,[["__scopeId","data-v-01a1b95c"]]);const Vt=e=>(Ce("data-v-ac351c02"),e=e(),ke(),e),Rr={class:"error"},Ar={class:"error-title"},qr={class:"error-details",style:{"margin-top":"-10px"}},Br={key:0},Ur={class:"instructions"},zr=["href"],Gr=Vt(()=>g("span",{class:"material-icons",style:{"font-size":"16px"}},"content_paste",-1)),Hr=Vt(()=>g("span",{style:{"margin-left":"8px","font-size":"medium"}},"Copy Save",-1)),jr=Vt(()=>g("br",null,null,-1)),Wr={key:0,style:{"margin-top":"20px"}},Jr=Vt(()=>g("h3",null,"Other errors",-1)),Kr=[Jr],Yr={class:"error-details"},Zr={key:0,style:{"margin-top":"10px"}},Xr={key:1,style:{"margin-top":"10px"}},Qr=q({__name:"Error",props:{errors:null},setup(e){const t=e,n=E(()=>t.errors[0]),r=E(()=>t.errors.map(s=>s.stack==null?[]:s.stack.split(`
`))),i=E(()=>t.errors.map(s=>s.cause==null?[]:(typeof s.cause=="string"?s.cause:JSON.stringify(s.cause)).split(`
`)));function a(){let s=rt(F);switch(U.exportEncoding){default:console.warn(`Unknown save encoding: ${U.exportEncoding}. Defaulting to lz`);case"lz":s=Ge.compressToUTF16(s);break;case"base64":s=btoa(unescape(encodeURIComponent(s)));break;case"plain":break}console.log(s);const c=document.createElement("textarea");c.value=s,document.body.appendChild(c),c.select(),c.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(c)}return yt(()=>{F.autosave=!1,F.devSpeed=0}),(s,c)=>(h(),N("div",Rr,[g("h1",Ar,V(l(n).name)+": "+V(l(n).message),1),g("div",qr,[l(n).cause?(h(),N("div",Br,[(h(!0),N(W,null,Le(l(i)[0],d=>(h(),N("div",{key:d},V(d),1))),128))])):$("",!0),l(n).stack?(h(),N("div",{key:1,style:me(l(n).cause?"margin-top: 10px":"")},[(h(!0),N(W,null,Le(l(r)[0],d=>(h(),N("div",{key:d},V(d),1))),128))],4)):$("",!0)]),g("div",Ur,[T(" Check the console for more details, and consider sharing it with the developers on "),g("a",{href:l(U).discordLink||"https://discord.gg/yJ4fjnjU54",class:"discord-link"},"discord",8,zr),T("! "),y(Zt,{onClick:a,class:"button",style:{display:"inline-flex"}},{default:O(()=>[Gr,Hr]),_:1}),jr,e.errors.length>1?(h(),N("div",Wr,Kr)):$("",!0),(h(!0),N(W,null,Le(e.errors.slice(1),(d,f)=>(h(),N("div",{key:f,style:{"margin-top":"20px"}},[g("details",Yr,[g("summary",null,V(d.name)+": "+V(d.message),1),d.cause?(h(),N("div",Zr,[(h(!0),N(W,null,Le(l(i)[f+1],b=>(h(),N("div",{key:b},V(b),1))),128))])):$("",!0),d.stack?(h(),N("div",Xr,[(h(!0),N(W,null,Le(l(r)[f+1],b=>(h(),N("div",{key:b},V(b),1))),128))])):$("",!0)])]))),128))])]))}});var Sn=H(Qr,[["__scopeId","data-v-ac351c02"]]);const He={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 Xt=(e=>(e.Classic="classic",e.Paper="paper",e.Nordic="nordic",e.Aqua="aqua",e))(Xt||{}),Qt={classic:He,paper:{...He,variables:{...He.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:{...He,variables:{...He.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:{...He,variables:{...He.variables,"--foreground":"#bfdfff","--background":"#001f3f","--tooltip-background":"rgba(0, 15, 31, 0.75)","--raised-background":"#001f3f","--points":"#dfefff","--locked":"#c4a7b3","--outline":"#bfdfff"}}},j=window.state=Ot({lastTenTicks:[],mouseActivity:[!1],hasNaN:!1,NaNPath:[],errors:it([])});const oe=kn();"fonts"in document&&(document.fonts.onloadingdone=()=>oe.emit("fontsLoaded"));document.onmousemove=function(){j.mouseActivity[j.mouseActivity.length-1]=!0};var ei=Object.freeze(Object.defineProperty({__proto__:null,globalBus:oe},Symbol.toStringTag,{value:"Module"}));function xe(e={}){return Object.assign({id:`${U.id}-0`,name:"Default Save",tabs:U.initialTabs.slice(),time:Date.now(),autosave:!0,offlineProd:!0,offlineTime:0,timePlayed:0,keepGoing:!1,modID:U.id,modVersion:U.versionNumber,layers:{}},e)}function ae(e){const t=Ge.compressToUTF16(rt(e!=null?e:F));return localStorage.setItem((e!=null?e:F).id,t),t}async function ti(){ai();try{let e=localStorage.getItem(G.active);if(e==null){await Te(et());return}if(e=qe(e),e==null)throw"Unable to determine save encoding";const t=JSON.parse(e);if(t.modID!==U.id){await Te(et());return}t.id=G.active,await Te(t)}catch(e){console.error(`Failed to load save. Falling back to new save.
`,e),await Te(et())}}function qe(e){if(e[0]!=="{")if(e[0]==="e")e=decodeURIComponent(escape(atob(e)));else if(e[0]==="\u1BE1")e=Ge.decompressFromUTF16(e);else return console.warn("Unable to determine preset encoding",e),null;return e}function et(){const e=ft(),t=xe({id:e});return ae(t),G.saves.push(e),t}function ft(){let e,t=0;do e=`${U.id}-${t++}`;while(localStorage.getItem(e)!=null);return e}const en=x(!1);async function Te(e){console.info("Loading save",e),en.value=!0;const{layers:t,removeLayer:n,addLayer:r}=await mt(()=>Promise.resolve().then(function(){return vs}),void 0),{fixOldSave:i,getInitialLayers:a}=await mt(()=>Promise.resolve().then(function(){return Tl}),void 0);for(const s in t){const c=t[s];c&&n(c)}a(e).forEach(s=>r(s,e)),e=xe(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,U.offlineLimit*3600)),e.time=Date.now(),e.modVersion!==U.versionNumber&&(i(e.modVersion,e),e.modVersion=U.versionNumber),Object.assign(F,e),G.active=F.id,oe.emit("onLoad")}const be=Ot({});function ni(e){if(be[e]==null){let t=localStorage.getItem(e);if(t==null)be[e]={error:"Save doesn't exist in localStorage",id:e};else if(t==="dW5kZWZpbmVk")be[e]={error:"Save is undefined",id:e};else try{if(t=qe(t),t==null)return console.warn("Unable to determine preset encoding",t),be[e]={error:"Unable to determine preset encoding",id:e},be[e];be[e]={...JSON.parse(t),id:e}}catch(n){be[e]={error:n,id:e},console.warn(`Failed to load info about save with id ${e}:
${n}
${t}`)}}return be[e]}function ri(){Object.keys(be).forEach(e=>delete be[e])}function kt(e){be[e]=void 0}setInterval(()=>{F.autosave&&ae()},1e3);window.onbeforeunload=()=>{F.autosave&&ae()};window.save=ae;const ii=window.hardReset=async()=>{await Te(et())};window.deleteLowerSaves=()=>{const e=Object.values(G.saves).indexOf(F.id)+1;Object.values(G.saves).slice(e).forEach(t=>localStorage.removeItem(t)),G.saves=G.saves.slice(0,e)};const ht=it({active:"",saves:[],showTPS:!0,theme:Xt.Nordic,unthrottled:!1,alignUnits:!1,showHealthWarning:!0});he(ht,e=>{const t=Ge.compressToUTF16(JSON.stringify(e));localStorage.setItem(U.id,t)},{deep:!0});var G=window.settings=ht;window.hardResetSettings=()=>{const e={active:"",saves:[],showTPS:!0,theme:Xt.Nordic,unthrottled:!1,alignUnits:!1,showHealthWarning:!0};oe.emit("loadSettings",e),Object.assign(ht,e),ii()};function ai(){try{let e=localStorage.getItem(U.id);if(e!=null&&e!==""){if(e=qe(e),e==null){console.warn("Unable to determine settings encoding",e);return}const t=JSON.parse(e);typeof t=="object"&&Object.assign(ht,t)}oe.emit("loadSettings",ht)}catch{}}const si=it([]),In=it([]);function oi(e){In.push(e)}const li=it([]);class ui{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 ci(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 ci{constructor(t,n){this.next=void 0,this.prev=void 0,this.key=t,this.value=n}}const zt=17,di=9e15,fi=Math.log10(9e15),gi=1/9e15,mi=308,hi=-324,hn=5,pi=(1<<10)-1,vi=function(){const e=[];for(let n=hi+1;n<=mi;n++)e.push(Number("1e"+n));const t=323;return function(n){return e[n+t]}}(),je=[2,Math.E,3,4,5,6,7,8,9,10],bi=[[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]],yi=[[-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 p=function(t){return u.fromValue_noAlloc(t)},D=function(e,t,n){return u.fromComponents(e,t,n)},B=function(t,n,r){return u.fromComponents_noNormalize(t,n,r)};const Ve=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)))},Gt=function(e){return Math.sign(e)*Math.log10(Math.abs(e))},_i=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},$n=.5671432904097838,pn=function(e,t=1e-10){let n,r;if(!Number.isFinite(e)||e===0)return e;if(e===1)return $n;e<10?n=0:n=Math.log(e)-Math.log(Math.log(e));for(let i=0;i<100;++i){if(r=(e*Math.exp(-n)+n*n)/(n+1),Math.abs(r-n)<t*Math.abs(r))return r;n=r}throw Error(`Iteration failed to converge: ${e.toString()}`)};function vn(e,t=1e-10){let n,r,i,a;if(!Number.isFinite(e.mag)||e.eq(u.dZero))return e;if(e.eq(u.dOne))return u.fromNumber($n);n=u.ln(e);for(let s=0;s<100;++s){if(r=n.neg().exp(),i=n.sub(e.mul(r)),a=n.sub(i.div(n.add(1).sub(n.add(2).mul(i).div(u.mul(2,n).add(2))))),u.abs(a.sub(n)).lt(u.abs(a).mul(t)))return a;n=a}throw Error(`Iteration failed to converge: ${e.toString()}`)}const m=class{constructor(e){this.sign=0,this.mag=0,this.layer=0,e instanceof m?this.fromDecimal(e):typeof e=="number"?this.fromNumber(e):typeof e=="string"&&this.fromString(e)}get m(){if(this.sign===0)return 0;if(this.layer===0){const e=Math.floor(Math.log10(this.mag));let t;return this.mag===5e-324?t=5:t=this.mag/vi(e),this.sign*t}else if(this.layer===1){const e=this.mag-Math.floor(this.mag);return this.sign*Math.pow(10,e)}else return this.sign}set m(e){this.layer<=2?this.fromMantissaExponent(e,this.e):(this.sign=Math.sign(e),this.sign===0&&(this.layer=0,this.exponent=0))}get e(){return this.sign===0?0:this.layer===0?Math.floor(Math.log10(this.mag)):this.layer===1?Math.floor(this.mag):this.layer===2?Math.floor(Math.sign(this.mag)*Math.pow(10,Math.abs(this.mag))):this.mag*Number.POSITIVE_INFINITY}set e(e){this.fromMantissaExponent(this.m,e)}get s(){return this.sign}set s(e){e===0?(this.sign=0,this.layer=0,this.mag=0):this.sign=e}get mantissa(){return this.m}set mantissa(e){this.m=e}get exponent(){return this.e}set exponent(e){this.e=e}static fromComponents(e,t,n){return new m().fromComponents(e,t,n)}static fromComponents_noNormalize(e,t,n){return new m().fromComponents_noNormalize(e,t,n)}static fromMantissaExponent(e,t){return new m().fromMantissaExponent(e,t)}static fromMantissaExponent_noNormalize(e,t){return new m().fromMantissaExponent_noNormalize(e,t)}static fromDecimal(e){return new m().fromDecimal(e)}static fromNumber(e){return new m().fromNumber(e)}static fromString(e){return new m().fromString(e)}static fromValue(e){return new m().fromValue(e)}static fromValue_noAlloc(e){if(e instanceof m)return e;if(typeof e=="string"){const t=m.fromStringCache.get(e);return t!==void 0?t:m.fromString(e)}else return typeof e=="number"?m.fromNumber(e):m.dZero}static abs(e){return p(e).abs()}static neg(e){return p(e).neg()}static negate(e){return p(e).neg()}static negated(e){return p(e).neg()}static sign(e){return p(e).sign}static sgn(e){return p(e).sign}static round(e){return p(e).round()}static floor(e){return p(e).floor()}static ceil(e){return p(e).ceil()}static trunc(e){return p(e).trunc()}static add(e,t){return p(e).add(t)}static plus(e,t){return p(e).add(t)}static sub(e,t){return p(e).sub(t)}static subtract(e,t){return p(e).sub(t)}static minus(e,t){return p(e).sub(t)}static mul(e,t){return p(e).mul(t)}static multiply(e,t){return p(e).mul(t)}static times(e,t){return p(e).mul(t)}static div(e,t){return p(e).div(t)}static divide(e,t){return p(e).div(t)}static recip(e){return p(e).recip()}static reciprocal(e){return p(e).recip()}static reciprocate(e){return p(e).reciprocate()}static cmp(e,t){return p(e).cmp(t)}static cmpabs(e,t){return p(e).cmpabs(t)}static compare(e,t){return p(e).cmp(t)}static isNaN(e){return e=p(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag)}static isFinite(e){return e=p(e),isFinite(e.sign)&&isFinite(e.layer)&&isFinite(e.mag)}static eq(e,t){return p(e).eq(t)}static equals(e,t){return p(e).eq(t)}static neq(e,t){return p(e).neq(t)}static notEquals(e,t){return p(e).notEquals(t)}static lt(e,t){return p(e).lt(t)}static lte(e,t){return p(e).lte(t)}static gt(e,t){return p(e).gt(t)}static gte(e,t){return p(e).gte(t)}static max(e,t){return p(e).max(t)}static min(e,t){return p(e).min(t)}static minabs(e,t){return p(e).minabs(t)}static maxabs(e,t){return p(e).maxabs(t)}static clamp(e,t,n){return p(e).clamp(t,n)}static clampMin(e,t){return p(e).clampMin(t)}static clampMax(e,t){return p(e).clampMax(t)}static cmp_tolerance(e,t,n){return p(e).cmp_tolerance(t,n)}static compare_tolerance(e,t,n){return p(e).cmp_tolerance(t,n)}static eq_tolerance(e,t,n){return p(e).eq_tolerance(t,n)}static equals_tolerance(e,t,n){return p(e).eq_tolerance(t,n)}static neq_tolerance(e,t,n){return p(e).neq_tolerance(t,n)}static notEquals_tolerance(e,t,n){return p(e).notEquals_tolerance(t,n)}static lt_tolerance(e,t,n){return p(e).lt_tolerance(t,n)}static lte_tolerance(e,t,n){return p(e).lte_tolerance(t,n)}static gt_tolerance(e,t,n){return p(e).gt_tolerance(t,n)}static gte_tolerance(e,t,n){return p(e).gte_tolerance(t,n)}static pLog10(e){return p(e).pLog10()}static absLog10(e){return p(e).absLog10()}static log10(e){return p(e).log10()}static log(e,t){return p(e).log(t)}static log2(e){return p(e).log2()}static ln(e){return p(e).ln()}static logarithm(e,t){return p(e).logarithm(t)}static pow(e,t){return p(e).pow(t)}static pow10(e){return p(e).pow10()}static pow_base(e,t){return p(e).pow_base(t)}static root(e,t){return p(e).root(t)}static factorial(e,t){return p(e).factorial()}static gamma(e,t){return p(e).gamma()}static lngamma(e,t){return p(e).lngamma()}static exp(e){return p(e).exp()}static sqr(e){return p(e).sqr()}static sqrt(e){return p(e).sqrt()}static cube(e){return p(e).cube()}static cbrt(e){return p(e).cbrt()}static tetrate(e,t=2,n=B(1,0,1)){return p(e).tetrate(t,n)}static iteratedexp(e,t=2,n=B(1,0,1)){return p(e).iteratedexp(t,n)}static iteratedlog(e,t=10,n=1){return p(e).iteratedlog(t,n)}static layeradd10(e,t){return p(e).layeradd10(t)}static layeradd(e,t,n=10){return p(e).layeradd(t,n)}static slog(e,t=10){return p(e).slog(t)}static lambertw(e){return p(e).lambertw()}static ssqrt(e){return p(e).ssqrt()}static pentate(e,t=2,n=B(1,0,1)){return p(e).pentate(t,n)}static sin(e){return p(e).sin()}static cos(e){return p(e).cos()}static tan(e){return p(e).tan()}static asin(e){return p(e).asin()}static acos(e){return p(e).acos()}static atan(e){return p(e).atan()}static sinh(e){return p(e).sinh()}static cosh(e){return p(e).cosh()}static tanh(e){return p(e).tanh()}static asinh(e){return p(e).asinh()}static acosh(e){return p(e).acosh()}static atanh(e){return p(e).atanh()}static affordGeometricSeries(e,t,n,r){return this.affordGeometricSeries_core(p(e),p(t),p(n),r)}static sumGeometricSeries(e,t,n,r){return this.sumGeometricSeries_core(e,p(t),p(n),r)}static affordArithmeticSeries(e,t,n,r){return this.affordArithmeticSeries_core(p(e),p(t),p(n),p(r))}static sumArithmeticSeries(e,t,n,r){return this.sumArithmeticSeries_core(p(e),p(t),p(n),p(r))}static efficiencyOfPurchase(e,t,n){return this.efficiencyOfPurchase_core(p(e),p(t),p(n))}static randomDecimalForTesting(e){if(Math.random()*20<1)return B(0,0,0);const t=Math.random()>.5?1:-1;if(Math.random()*20<1)return B(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)),D(t,n,i)}static affordGeometricSeries_core(e,t,n,r){const i=t.mul(n.pow(r));return m.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(m.sub(1,n.pow(e))).div(m.sub(1,n))}static affordArithmeticSeries_core(e,t,n,r){const a=t.add(r.mul(n)).sub(n.div(2)),s=a.pow(2);return a.neg().add(s.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<gi)return this.layer+=1,this.mag=Math.log10(this.mag),this;let e=Math.abs(this.mag),t=Math.sign(this.mag);if(e>=di)return this.layer+=1,this.mag=t*Math.log10(e),this;for(;e<fi&&this.layer>0;)this.layer-=1,this.layer===0?this.mag=Math.pow(10,this.mag):(this.mag=t*Math.pow(10,e),e=Math.abs(this.mag),t=Math.sign(this.mag));return this.layer===0&&(this.mag<0?(this.mag=-this.mag,this.sign=-this.sign):this.mag===0&&(this.sign=0)),this}fromComponents(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this.normalize(),this}fromComponents_noNormalize(e,t,n){return this.sign=e,this.layer=t,this.mag=n,this}fromMantissaExponent(e,t){return this.layer=1,this.sign=Math.sign(e),e=Math.abs(e),this.mag=t+Math.log10(e),this.normalize(),this}fromMantissaExponent_noNormalize(e,t){return this.fromMantissaExponent(e,t),this}fromDecimal(e){return this.sign=e.sign,this.layer=e.layer,this.mag=e.mag,this}fromNumber(e){return this.mag=Math.abs(e),this.sign=Math.sign(e),this.layer=0,this.normalize(),this}fromString(e){const t=e,n=m.fromStringCache.get(t);if(n!==void 0)return this.fromDecimal(n);e=e.replace(",","");const r=e.split("^^^");if(r.length===2){const _=parseFloat(r[0]),S=parseFloat(r[1]),P=r[1].split(";");let I=1;if(P.length===2&&(I=parseFloat(P[1]),isFinite(I)||(I=1)),isFinite(_)&&isFinite(S)){const M=m.pentate(_,S,I);return this.sign=M.sign,this.layer=M.layer,this.mag=M.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const i=e.split("^^");if(i.length===2){const _=parseFloat(i[0]),S=parseFloat(i[1]),P=i[1].split(";");let I=1;if(P.length===2&&(I=parseFloat(P[1]),isFinite(I)||(I=1)),isFinite(_)&&isFinite(S)){const M=m.tetrate(_,S,I);return this.sign=M.sign,this.layer=M.layer,this.mag=M.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const a=e.split("^");if(a.length===2){const _=parseFloat(a[0]),S=parseFloat(a[1]);if(isFinite(_)&&isFinite(S)){const P=m.pow(_,S);return this.sign=P.sign,this.layer=P.layer,this.mag=P.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}e=e.trim().toLowerCase();let s,c,d=e.split("pt");if(d.length===2){s=10,c=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let _=parseFloat(d[1]);if(isFinite(_)||(_=1),isFinite(s)&&isFinite(c)){const S=m.tetrate(s,c,_);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(d=e.split("p"),d.length===2){s=10,c=parseFloat(d[0]),d[1]=d[1].replace("(",""),d[1]=d[1].replace(")","");let _=parseFloat(d[1]);if(isFinite(_)||(_=1),isFinite(s)&&isFinite(c)){const S=m.tetrate(s,c,_);return this.sign=S.sign,this.layer=S.layer,this.mag=S.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}const f=e.split("e"),b=f.length-1;if(b===0){const _=parseFloat(e);if(isFinite(_))return this.fromNumber(_),m.fromStringCache.size>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else if(b===1){const _=parseFloat(e);if(isFinite(_)&&_!==0)return this.fromNumber(_),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}const v=e.split("e^");if(v.length===2){this.sign=1,v[0].charAt(0)=="-"&&(this.sign=-1);let _="";for(let S=0;S<v[1].length;++S){const P=v[1].charCodeAt(S);if(P>=43&&P<=57||P===101)_+=v[1].charAt(S);else return this.layer=parseFloat(_),this.mag=parseFloat(v[1].substr(S+1)),this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}}if(b<1)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;const w=parseFloat(f[0]);if(w===0)return this.sign=0,this.layer=0,this.mag=0,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this;let k=parseFloat(f[f.length-1]);if(b>=2){const _=parseFloat(f[f.length-2]);isFinite(_)&&(k*=Math.sign(_),k+=Gt(_))}if(!isFinite(w))this.sign=f[0]==="-"?-1:1,this.layer=b,this.mag=k;else if(b===1)this.sign=Math.sign(w),this.layer=1,this.mag=k+Math.log10(Math.abs(w));else if(this.sign=Math.sign(w),this.layer=b,b===2){const _=m.mul(D(1,2,k),p(w));return this.sign=_.sign,this.layer=_.layer,this.mag=_.mag,m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}else this.mag=k;return this.normalize(),m.fromStringCache.maxSize>=1&&m.fromStringCache.set(t,m.fromDecimal(this)),this}fromValue(e){return e instanceof m?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:Ve(this.m,e)}magnitudeWithDecimalPlaces(e){return isNaN(this.mag)?Number.NaN:this.mag===0?0:Ve(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<=hn?(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):Ve(this.m,e)+"e"+Ve(this.e,e):this.layer===1?Ve(this.m,e)+"e"+Ve(this.e,e):this.layer<=hn?(this.sign===-1?"-":"")+"e".repeat(this.layer)+Ve(this.mag,e):(this.sign===-1?"-":"")+"(e^"+this.layer+")"+Ve(this.mag,e)}abs(){return B(this.sign===0?0:1,this.layer,this.mag)}neg(){return B(-this.sign,this.layer,this.mag)}negate(){return this.neg()}negated(){return this.neg()}sgn(){return this.sign}round(){return this.mag<0?m.dZero:this.layer===0?D(this.sign,0,Math.round(this.mag)):this}floor(){return this.mag<0?m.dZero:this.layer===0?D(this.sign,0,Math.floor(this.mag)):this}ceil(){return this.mag<0?m.dZero:this.layer===0?D(this.sign,0,Math.ceil(this.mag)):this}trunc(){return this.mag<0?m.dZero:this.layer===0?D(this.sign,0,Math.trunc(this.mag)):this}add(e){const t=p(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 B(0,0,0);let n,r;if(this.layer>=2||t.layer>=2)return this.maxabs(t);if(m.cmpabs(this,t)>0?(n=this,r=t):(n=t,r=this),n.layer===0&&r.layer===0)return m.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))>zt)return n;{const s=Math.pow(10,Math.log10(n.mag)-r.mag),c=r.sign+n.sign*s;return D(Math.sign(c),1,r.mag+Math.log10(Math.abs(c)))}}if(i===1&&a===0){if(Math.abs(n.mag-Math.log10(r.mag))>zt)return n;{const s=Math.pow(10,n.mag-Math.log10(r.mag)),c=r.sign+n.sign*s;return D(Math.sign(c),1,Math.log10(r.mag)+Math.log10(Math.abs(c)))}}if(Math.abs(n.mag-r.mag)>zt)return n;{const s=Math.pow(10,n.mag-r.mag),c=r.sign+n.sign*s;return D(Math.sign(c),1,r.mag+Math.log10(Math.abs(c)))}}plus(e){return this.add(e)}sub(e){return this.add(p(e).neg())}subtract(e){return this.sub(e)}minus(e){return this.sub(e)}mul(e){const t=p(e);if(!Number.isFinite(this.layer))return this;if(!Number.isFinite(t.layer))return t;if(this.sign===0||t.sign===0)return B(0,0,0);if(this.layer===t.layer&&this.mag===-t.mag)return B(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 m.fromNumber(n.sign*r.sign*n.mag*r.mag);if(n.layer>=3||n.layer-r.layer>=2)return D(n.sign*r.sign,n.layer,n.mag);if(n.layer===1&&r.layer===0)return D(n.sign*r.sign,1,n.mag+Math.log10(r.mag));if(n.layer===1&&r.layer===1)return D(n.sign*r.sign,1,n.mag+r.mag);if(n.layer===2&&r.layer===1){const i=D(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(D(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return D(n.sign*r.sign,i.layer+1,i.sign*i.mag)}if(n.layer===2&&r.layer===2){const i=D(Math.sign(n.mag),n.layer-1,Math.abs(n.mag)).add(D(Math.sign(r.mag),r.layer-1,Math.abs(r.mag)));return D(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=p(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?m.dNaN:this.layer===0?D(this.sign,0,1/this.mag):D(this.sign,this.layer,-this.mag)}reciprocal(){return this.recip()}reciprocate(){return this.recip()}cmp(e){const t=p(e);return this.sign>t.sign?1:this.sign<t.sign?-1:this.sign*this.cmpabs(e)}cmpabs(e){const t=p(e),n=this.mag>0?this.layer:-this.layer,r=t.mag>0?t.layer:-t.layer;return n>r?1:n<r?-1:this.mag>t.mag?1:this.mag<t.mag?-1:0}compare(e){return this.cmp(e)}isNan(){return isNaN(this.sign)||isNaN(this.layer)||isNaN(this.mag)}isFinite(){return isFinite(this.sign)&&isFinite(this.layer)&&isFinite(this.mag)}eq(e){const t=p(e);return this.sign===t.sign&&this.layer===t.layer&&this.mag===t.mag}equals(e){return this.eq(e)}neq(e){return!this.eq(e)}notEquals(e){return this.neq(e)}lt(e){return this.cmp(e)===-1}lte(e){return!this.gt(e)}gt(e){return this.cmp(e)===1}gte(e){return!this.lt(e)}max(e){const t=p(e);return this.lt(t)?t:this}min(e){const t=p(e);return this.gt(t)?t:this}maxabs(e){const t=p(e);return this.cmpabs(t)<0?t:this}minabs(e){const t=p(e);return this.cmpabs(t)>0?t:this}clamp(e,t){return this.max(e).min(t)}clampMin(e){return this.max(e)}clampMax(e){return this.min(e)}cmp_tolerance(e,t){const n=p(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=p(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=Gt(i)),this.layer<n.layer&&(r=Gt(r)),Math.abs(r-i)<=t*Math.max(Math.abs(r),Math.abs(i))}equals_tolerance(e,t){return this.eq_tolerance(e,t)}neq_tolerance(e,t){return!this.eq_tolerance(e,t)}notEquals_tolerance(e,t){return this.neq_tolerance(e,t)}lt_tolerance(e,t){const n=p(e);return!this.eq_tolerance(n,t)&&this.lt(n)}lte_tolerance(e,t){const n=p(e);return this.eq_tolerance(n,t)||this.lt(n)}gt_tolerance(e,t){const n=p(e);return!this.eq_tolerance(n,t)&&this.gt(n)}gte_tolerance(e,t){const n=p(e);return this.eq_tolerance(n,t)||this.gt(n)}pLog10(){return this.lt(m.dZero)?m.dZero:this.log10()}absLog10(){return this.sign===0?m.dNaN:this.layer>0?D(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):D(1,0,Math.log10(this.mag))}log10(){return this.sign<=0?m.dNaN:this.layer>0?D(Math.sign(this.mag),this.layer-1,Math.abs(this.mag)):D(this.sign,0,Math.log10(this.mag))}log(e){return e=p(e),this.sign<=0||e.sign<=0||e.sign===1&&e.layer===0&&e.mag===1?m.dNaN:this.layer===0&&e.layer===0?D(this.sign,0,Math.log(this.mag)/Math.log(e.mag)):m.div(this.log10(),e.log10())}log2(){return this.sign<=0?m.dNaN:this.layer===0?D(this.sign,0,Math.log2(this.mag)):this.layer===1?D(Math.sign(this.mag),0,Math.abs(this.mag)*3.321928094887362):this.layer===2?D(Math.sign(this.mag),1,Math.abs(this.mag)+.5213902276543247):D(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}ln(){return this.sign<=0?m.dNaN:this.layer===0?D(this.sign,0,Math.log(this.mag)):this.layer===1?D(Math.sign(this.mag),0,Math.abs(this.mag)*2.302585092994046):this.layer===2?D(Math.sign(this.mag),1,Math.abs(this.mag)+.36221568869946325):D(Math.sign(this.mag),this.layer-1,Math.abs(this.mag))}logarithm(e){return this.log(e)}pow(e){const t=p(e),n=this,r=t;if(n.sign===0)return r.eq(0)?B(1,0,1):n;if(n.sign===1&&n.layer===0&&n.mag===1)return n;if(r.sign===0)return B(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:m.dNaN:i}pow10(){if(!Number.isFinite(this.layer)||!Number.isFinite(this.mag))return m.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 D(1,0,t);if(e.sign===0)return m.dOne;e=B(e.sign,e.layer+1,Math.log10(e.mag))}return e.sign>0&&e.mag>=0?D(e.sign,e.layer+1,e.mag):e.sign<0&&e.mag>=0?D(-e.sign,e.layer+1,-e.mag):m.dOne}pow_base(e){return p(e).pow(this)}root(e){const t=p(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?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}gamma(){if(this.mag<0)return this.recip();if(this.layer===0){if(this.lt(B(1,0,24)))return m.fromNumber(_i(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,s=t+a;if(s===t||(t=s,r=r*n,i=360*r,a=1/i,s=t-a,s===t))return m.exp(t);t=s,r=r*n,i=1260*r;let c=1/i;return t=t+c,r=r*n,i=1680*r,c=1/i,t=t-c,m.exp(t)}else return this.layer===1?m.exp(m.mul(this,m.ln(this).sub(1))):m.exp(this)}lngamma(){return this.gamma().ln()}exp(){return this.mag<0?m.dOne:this.layer===0&&this.mag<=709.7?m.fromNumber(Math.exp(this.sign*this.mag)):this.layer===0?D(1,1,this.sign*Math.log10(Math.E)*this.mag):this.layer===1?D(1,2,this.sign*(Math.log10(.4342944819032518)+this.mag)):D(1,this.layer+1,this.sign*this.mag)}sqr(){return this.pow(2)}sqrt(){if(this.layer===0)return m.fromNumber(Math.sqrt(this.sign*this.mag));if(this.layer===1)return D(1,2,Math.log10(this.mag)-.3010299956639812);{const e=m.div(B(this.sign,this.layer-1,this.mag),B(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=B(1,0,1)){if(e===1)return m.pow(this,t);if(e===0)return new m(t);if(this.eq(m.dOne))return m.dOne;if(this.eq(-1))return m.pow(this,t);if(e===Number.POSITIVE_INFINITY){const i=this.toNumber();if(i<=1.444667861009766&&i>=.06598803584531254){if(i>1.444667861009099)return m.fromNumber(Math.E);const a=m.ln(this).neg();return a.lambertw().div(a)}else return i>1.444667861009766?m.fromNumber(Number.POSITIVE_INFINITY):m.dNaN}if(this.eq(m.dZero)){let i=Math.abs((e+1)%2);return i>1&&(i=2-i),m.fromNumber(i)}if(e<0)return m.iteratedlog(t,this,-e);t=p(t);const n=e;e=Math.trunc(e);const r=n-e;if(this.gt(m.dZero)&&this.lte(1.444667861009766)){e=Math.min(1e4,e);for(let i=0;i<e;++i){const a=t;if(t=this.pow(t),a.eq(t))return t}if(r!=0){const i=this.pow(t);return t.mul(1-r).add(i.mul(r))}return t}r!==0&&(t.eq(m.dOne)?this.gt(10)?t=this.pow(r):(t=m.fromNumber(m.tetrate_critical(this.toNumber(),r)),this.lt(2)&&(t=t.sub(1).mul(this.minus(1)).plus(1))):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i<e;++i){if(t=this.pow(t),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(t.layer-this.layer>3)return B(t.sign,t.layer+(e-i-1),t.mag);if(i>1e4)return t}return t}iteratedexp(e=2,t=B(1,0,1)){return this.tetrate(e,t)}iteratedlog(e=10,t=1){if(t<0)return m.tetrate(e,-t,this);e=p(e);let n=m.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;a<t;++a){if(n=n.log(e),!isFinite(n.layer)||!isFinite(n.mag))return n.normalize();if(a>1e4)return n}return i>0&&i<1&&(e.eq(10)?n=n.layeradd10(-i):n=n.layeradd(-i,e)),n}slog(e=10,t=100){let n=.001,r=!1,i=!1,a=this.slog_internal(e).toNumber();for(let s=1;s<t;++s){const d=new m(e).tetrate(a).gt(this);if(s>1&&i!=d&&(r=!0),i=d,r?n/=2:n*=2,n=Math.abs(n)*(d?-1:1),a+=n,n===0)break}return m.fromNumber(a)}slog_internal(e=10){if(e=p(e),e.lte(m.dZero)||e.eq(m.dOne))return m.dNaN;if(e.lt(m.dOne))return this.eq(m.dOne)?m.dZero:this.eq(m.dZero)?m.dNegOne:m.dNaN;if(this.mag<0||this.eq(m.dZero))return m.dNegOne;let t=0,n=m.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(m.dZero))n=m.pow(e,n),t-=1;else{if(n.lte(m.dOne))return m.fromNumber(t+m.slog_critical(e.toNumber(),n.toNumber()));t+=1,n=m.log(n,e)}return m.fromNumber(t)}static slog_critical(e,t){return e>10?t-1:m.critical_section(e,t,yi)}static tetrate_critical(e,t){return m.critical_section(e,t,bi)}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 s=0;s<je.length;++s)if(je[s]==e){r=n[s][Math.floor(t)],i=n[s][Math.ceil(t)];break}else if(je[s]<e&&je[s+1]>e){const c=(e-je[s])/(je[s+1]-je[s]);r=n[s][Math.floor(t)]*(1-c)+n[s+1][Math.floor(t)]*c,i=n[s][Math.ceil(t)]*(1-c)+n[s+1][Math.ceil(t)]*c;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=m.fromValue_noAlloc(e).toNumber();const t=m.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?m.tetrate(t,r):Number.isFinite(r)?r>=-1?m.log(m.tetrate(t,r+1),t):m.log(m.log(m.tetrate(t,r+2),t),t):m.dNaN}lambertw(){if(this.lt(-.3678794411710499))throw Error("lambertw is unimplemented for results less than -1, sorry!");if(this.mag<0)return m.fromNumber(pn(this.toNumber()));if(this.layer===0)return m.fromNumber(pn(this.sign*this.mag));if(this.layer===1)return vn(this);if(this.layer===2)return vn(this);if(this.layer>=3)return B(this.sign,this.layer-1,this.mag);throw new Error("Unhandled behavior in lambertw()")}ssqrt(){if(this.sign==1&&this.layer>=3)return B(this.sign,this.layer-1,this.mag);const e=this.ln();return e.div(e.lambertw())}pentate(e=2,t=B(1,0,1)){t=p(t);const n=e;e=Math.trunc(e);const r=n-e;r!==0&&(t.eq(m.dOne)?(++e,t=m.fromNumber(r)):this.eq(10)?t=t.layeradd10(r):t=t.layeradd(r,this));for(let i=0;i<e;++i){if(t=this.tetrate(t.toNumber()),!isFinite(t.layer)||!isFinite(t.mag))return t.normalize();if(i>10)return t}return t}sin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.sin(this.sign*this.mag)):B(0,0,0)}cos(){return this.mag<0?m.dOne:this.layer===0?m.fromNumber(Math.cos(this.sign*this.mag)):B(0,0,0)}tan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.tan(this.sign*this.mag)):B(0,0,0)}asin(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.asin(this.sign*this.mag)):B(Number.NaN,Number.NaN,Number.NaN)}acos(){return this.mag<0?m.fromNumber(Math.acos(this.toNumber())):this.layer===0?m.fromNumber(Math.acos(this.sign*this.mag)):B(Number.NaN,Number.NaN,Number.NaN)}atan(){return this.mag<0?this:this.layer===0?m.fromNumber(Math.atan(this.sign*this.mag)):m.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 m.ln(this.add(this.sqr().add(1).sqrt()))}acosh(){return m.ln(this.add(this.sqr().sub(1).sqrt()))}atanh(){return this.abs().gte(1)?B(Number.NaN,Number.NaN,Number.NaN):m.ln(this.add(1).div(m.fromNumber(1).sub(this))).div(2)}ascensionPenalty(e){return e===0?this:this.root(m.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 u=m;u.fromStringCache=new ui(pi);u.dZero=B(0,0,0);u.dOne=B(1,0,1);u.dNegOne=B(-1,0,1);u.dTwo=B(1,0,2);u.dTen=B(1,0,10);u.dNaN=B(Number.NaN,Number.NaN,Number.NaN);u.dInf=B(1,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);u.dNegInf=B(-1,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);u.dNumberMax=D(1,0,Number.MAX_VALUE);u.dNumberMin=D(1,0,Number.MIN_VALUE);p=u.fromValue_noAlloc;D=u.fromComponents;B=u.fromComponents_noNormalize;u.fromMantissaExponent;u.fromMantissaExponent_noNormalize;const wi=new u(1);function dt(e,t,n=!0){let r=u.log10(e).floor(),i=u.div(e,u.pow(10,r));i.toStringWithDecimalPlaces(t)==="10"&&(i=wi,r=r.add(1));const a=r.gte(1e9)?ve(r,Math.max(Math.max(t,3),U.defaultDecimalsShown)):r.gte(1e4)?xt(r,0):r.toStringWithDecimalPlaces(0);return n?i.toStringWithDecimalPlaces(t)+"e"+a:"e"+a}function xt(e,t){if(e==null)return"NaN";if(e=new u(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 Mn(e,t){return e==null?"NaN":(e=new u(e),e.mag<1e-4?0 .toFixed(t):(e.mag<.1&&t!==0&&(t=Math.max(Math.max(t,e.log10().negate().ceil().toNumber()),U.defaultDecimalsShown)),e.toStringWithDecimalPlaces(t)))}const Ni=new u("eeee1000"),Ci=new u("e100000"),bn=new u("e1000"),xn=new u(1e9),ki=new u(1e6),Si=new u(1e3),Ii=new u(.98),$i=new u(.001),Tn=new u(0);function ve(e,t,n){if(t==null&&(t=U.defaultDecimalsShown),n=n!=null?n:U.defaultShowSmall,e=new u(e),isNaN(e.sign)||isNaN(e.layer)||isNaN(e.mag))return"NaN";if(e.sign<0)return"-"+ve(e.neg(),t);if(e.mag===Number.POSITIVE_INFINITY)return"Infinity";if(e.gte(Ni)){const r=e.slog();return r.gte(ki)?"F"+ve(r.floor()):u.pow(10,r.sub(r.floor())).toStringWithDecimalPlaces(3)+"F"+xt(r.floor(),0)}else{if(e.gte(Ci))return dt(e,0,!1);if(e.gte(bn))return dt(e,0);if(e.gte(xn))return dt(e,t);if(e.gte(Si))return xt(e,0);if(e.gte($i)||!n)return Mn(e,t);if(e.eq(Tn))return 0 .toFixed(t)}return e=Fn(e),e.lt(bn)?dt(e,t).replace(/([^(?:e|F)]*)$/,"-$1"):ve(e,t)+"\u207B\xB9"}function pe(e){return e=new u(e),e.sign<0?"-"+pe(e.neg()):e.gte(xn)||e.lte(Ii)&&!e.eq(Tn)?ve(e):ve(e,0)}function Pn(e){return u.lt(e,0)?"-"+Pn(u.neg(e)):u.gt(e,2**51)?ve(u.div(e,31536e3))+"y":(e=new u(e).toNumber(),e<60?ve(e)+"s":e<3600?pe(Math.floor(e/60))+"m "+ve(e%60)+"s":e<86400?pe(Math.floor(e/3600))+"h "+pe(Math.floor(e/60)%60)+"m "+pe(e%60)+"s":e<31536e3?pe(Math.floor(e/84600)%365)+"d "+pe(Math.floor(e/3600)%24)+"h "+pe(Math.floor(e/60)%60)+"m":pe(Math.floor(e/31536e3))+"y "+pe(Math.floor(e/84600)%365)+"d "+pe(Math.floor(e/3600)%24)+"h")}function Mi(e,t,n){e=new u(e);let r=e.toStringWithDecimalPlaces(t);return new u(r).gte(n)&&(r=u.sub(n,Math.pow(.1,t)).toStringWithDecimalPlaces(t)),r}function xi(e,t){return ve(e,t,!0)}function Fn(e){let t=u.log10(e).ceil();const n=u.div(e,u.pow(10,t));return t=t.neg(),e=new u(10).pow(t).times(n),e}var Ti=Object.freeze(Object.defineProperty({__proto__:null,default:u,exponentialFormat:dt,commaFormat:xt,regularFormat:Mn,format:ve,formatWhole:pe,formatTime:Pn,toPlaces:Mi,formatSmall:xi,invertOOM:Fn},Symbol.toStringTag,{value:"Module"}));const{exponentialFormat:Pi,commaFormat:Fi,regularFormat:Ei,format:Ne,formatWhole:pt,formatTime:Lt,toPlaces:Oi,formatSmall:Vi,invertOOM:Li}=Ti;window.Decimal=u;window.exponentialFormat=Pi;window.commaFormat=Fi;window.regularFormat=Ei;window.format=Ne;window.formatWhole=pt;window.formatTime=Lt;window.toPlaces=Oi;window.formatSmall=Vi;window.invertOOM=Li;function En(e){let t=e.replace(/([A-Z])/g," $1");return t=t.charAt(0).toUpperCase()+t.slice(1),t}function Di(e){return(e[0]+e.slice(1).replace(/[A-Z]/g,t=>`-${t}`)).toLowerCase()}function Ht(e){return typeof e=="function"}var K=(e=>(e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right",e.Default="Up",e))(K||{});const vt=Symbol("DoNotCache");function L(e,t){const n=e[t];Ht(n)&&n.length===0&&!n[vt]?e[t]=E(n.bind(e)):Ht(n)&&(e[t]=n.bind(e),e[t][vt]=!0)}function jt(e){return Ht(e)&&!e[vt]&&(e=E(e)),e}const Be=Symbol("Component"),Ue=Symbol("GatherProps");let Ri=0;function Dt(e="feature-"){return e+Ri++}var at=(e=>(e[e.Visible=0]="Visible",e[e.Hidden=1]="Hidden",e[e.None=2]="None",e))(at||{});function On(e){const t=l(e);return t!==2&&t!==!1}function Vn(e){return l(e)===1}function ee(e){return e[vt]=!0,e}function ce(e,t,n){e[t]==null&&n!=null&&(e[t]=n)}function Ln(e,...t){const n=[],r=i=>{Object.keys(i).forEach(a=>{const s=i[a];s!=null&&typeof s=="object"&&(t.includes(s.type)?n.push(s):!(s instanceof u)&&!re(s)&&r(s))})};return r(e),n}const We=Symbol("ProxyState");function Ze(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(s,c){if(c===We)return a();const d=a()[c];return d!=null&&typeof d=="object"&&De in d?d[De]:d},set(s,c,d){return a()[c]=d,!0},has(s,c){return c===We?!0:Reflect.has(a(),c)},ownKeys(){return Reflect.ownKeys(a())},getOwnPropertyDescriptor(s,c){return r||(Object.assign(n,e.call(n,n)),r=!0),Object.getOwnPropertyDescriptor(s,c)}})}const Dn=u.ln(10);function It(e){return e}function ut(e,...t){const n=t.find(r=>C(r));return n==null?(console.error("Could not invert due to no input being a variable"),0):n.invert(e)}function Ai(e,t){return C(t)?t.invert(u.neg(e)):(console.error("Could not invert due to no input being a variable"),0)}function qi(e,t){return C(t)?t.isIntegrable()?o.neg(t.getIntegralFormula(e)):(console.error("Could not integrate due to variable not being integrable"),o.constant(0)):(console.error("Could not integrate due to no input being a variable"),o.constant(0))}function Bi(e){return o.neg(e)}function Ui(e,t,n){return C(t)?t.invert(u.sub(e,X(n))):C(n)?n.invert(u.sub(e,X(t))):(console.error("Could not invert due to no input being a variable"),0)}function zi(e,t,n){var r,i;if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const a=t.getIntegralFormula(e);return o.times(n,(r=t.innermostVariable)!=null?r:0).add(a)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const a=n.getIntegralFormula(e);return o.times(t,(i=n.innermostVariable)!=null?i:0).add(a)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Gi(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.add(r,n)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e);return o.add(r,t)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Hi(e,t,n){return C(t)?t.invert(u.add(e,X(n))):C(n)?n.invert(u.sub(X(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function ji(e,t,n){var r,i;if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const a=t.getIntegralFormula(e);return o.sub(a,o.times(n,(r=t.innermostVariable)!=null?r:0))}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const a=n.getIntegralFormula(e);return o.times(t,(i=n.innermostVariable)!=null?i:0).sub(a)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Wi(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.sub(r,n)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e);return o.sub(r,t)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ji(e,t,n){return C(t)?t.invert(u.div(e,X(n))):C(n)?n.invert(u.div(e,X(t))):(console.error("Could not invert due to no input being a variable"),0)}function Ki(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.times(r,n)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e);return o.times(r,t)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Yi(e,t,n){return C(t)?o.div(e,n):C(n)?o.div(e,t):(console.error("Could not apply substitution due to no input being a variable"),o.constant(0))}function Zi(e,t,n){return C(t)?t.invert(u.mul(e,X(n))):C(n)?n.invert(u.div(X(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Xi(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.div(r,n)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e);return o.div(t,r)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Qi(e,t,n){return C(t)?o.mul(e,n):C(n)?o.mul(e,t):(console.error("Could not apply substitution due to no input being a variable"),o.constant(0))}function ea(e,t){return C(t)?t.invert(u.recip(e)):(console.error("Could not invert due to no input being a variable"),0)}function ta(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.ln(n)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function na(e,t){return C(t)?t.invert(u.pow10(e)):(console.error("Could not invert due to no input being a variable"),0)}function ra(e){return u.ln(e).sub(1).times(e).div(Dn)}function ia(e,t){if(C(t)){const n=Dn.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 aa(e,t){return C(t)?t.isIntegrable()?new o({inputs:[t.getIntegralFormula(e)],evaluate:ra,invert:ia}):(console.error("Could not integrate due to variable not being integrable"),o.constant(0)):(console.error("Could not integrate due to no input being a variable"),o.constant(0))}function sa(e,t,n){return C(t)?t.invert(u.pow(X(n),e)):C(n)?n.invert(u.root(X(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function oa(e,t){return u.ln(e).sub(1).times(e).div(u.ln(t))}function la(e,t,n){if(C(t)){const r=u.ln(X(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 ua(e,t,n){return C(t)?t.isIntegrable()?new o({inputs:[t.getIntegralFormula(e),n],evaluate:oa,invert:la}):(console.error("Could not integrate due to variable not being integrable"),o.constant(0)):(console.error("Could not integrate due to no input being a variable"),o.constant(0))}function ca(e,t){return C(t)?t.invert(u.pow(2,e)):(console.error("Could not invert due to no input being a variable"),0)}function da(e){return u.ln(e).sub(1).times(e).div(u.ln(2))}function fa(e,t){if(C(t)){const n=u.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 ga(e,t){return C(t)?t.isIntegrable()?new o({inputs:[t.getIntegralFormula(e)],evaluate:da,invert:fa}):(console.error("Could not integrate due to variable not being integrable"),o.constant(0)):(console.error("Could not integrate due to no input being a variable"),o.constant(0))}function ma(e,t){return C(t)?t.invert(u.exp(e)):(console.error("Could not invert due to no input being a variable"),0)}function ha(e){return u.ln(e).sub(1).times(e)}function pa(e,t){return C(t)?t.invert(u.div(e,u.div(e,Math.E).lambertw())):(console.error("Could not invert due to no input being a variable"),0)}function va(e,t){return C(t)?t.isIntegrable()?new o({inputs:[t.getIntegralFormula(e)],evaluate:ha,invert:pa}):(console.error("Could not integrate due to variable not being integrable"),o.constant(0)):(console.error("Could not integrate due to no input being a variable"),o.constant(0))}function ba(e,t,n){return C(t)?t.invert(u.root(e,X(n))):C(n)?n.invert(u.ln(e).div(u.ln(X(t)))):(console.error("Could not invert due to no input being a variable"),0)}function ya(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e),i=o.add(n,1);return o.pow(r,i).div(i)}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e);return o.pow(t,r).div(o.ln(t))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function _a(e,t){return C(t)?t.invert(u.root(e,10)):(console.error("Could not invert due to no input being a variable"),0)}function wa(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.pow10(n).div(o.ln(10))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Na(e,t,n){return C(t)?t.invert(u.ln(e).div(u.ln(X(n)))):C(n)?n.invert(u.root(X(t),e)):(console.error("Could not invert due to no input being a variable"),0)}function Ca(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.pow(n,r).div(o.ln(n))}else if(C(n)){if(!n.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=n.getIntegralFormula(e),i=o.add(t,1);return o.pow(r,i).div(i)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function ka(e,t,n){return C(t)?t.invert(u.root(e,u.recip(X(n)))):C(n)?n.invert(u.ln(X(t)).div(u.ln(e))):(console.error("Could not invert due to no input being a variable"),0)}function Sa(e,t,n){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const r=t.getIntegralFormula(e);return o.pow(r,o.recip(n).add(1)).times(n).div(o.add(n,1))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ia(e,t){return C(t)?t.invert(u.ln(e)):(console.error("Could not invert due to no input being a variable"),0)}function $a(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.exp(n)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ma(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){const r=u.minabs(t,1e308).toNumber();return u.tetrate(e,r,n)}function xa(e,t,n,r){return C(t)?t.invert(u.ssqrt(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ta(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){const r=u.minabs(t,1e308).toNumber();return u.iteratedexp(e,r,new u(n))}function Pa(e,t,n,r){return C(t)?t.invert(u.iteratedlog(e,Math.E,u.minabs(1e308,X(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Fa(e,t=10,n=2){const r=u.minabs(n,1e308).toNumber();return u.iteratedlog(e,t,r)}function Ea(e,t=10){const n=u.minabs(t,1e308).toNumber();return u.slog(e,n)}function Oa(e,t,n){return C(t)?t.invert(u.tetrate(e,u.minabs(1e308,X(n)).toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Va(e,t,n){const r=u.minabs(t,1e308).toNumber();return u.layeradd(e,r,n)}function La(e,t,n,r){return C(t)?t.invert(u.layeradd(e,u.minabs(1e308,X(n)).negate().toNumber())):(console.error("Could not invert due to no input being a variable"),0)}function Da(e,t){return C(t)?t.invert(u.pow(Math.E,e).times(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ra(e,t){return C(t)?t.invert(u.tetrate(e,2)):(console.error("Could not invert due to no input being a variable"),0)}function Aa(e,t,n){const r=u.minabs(t,1e308).toNumber();return u.pentate(e,r,n)}function qa(e,t){return C(t)?t.invert(u.asin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ba(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.cos(n).neg()}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ua(e,t){return C(t)?t.invert(u.acos(e)):(console.error("Could not invert due to no input being a variable"),0)}function za(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.sin(n)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ga(e,t){return C(t)?t.invert(u.atan(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ha(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.cos(n).ln().neg()}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function ja(e,t){return C(t)?t.invert(u.sin(e)):(console.error("Could not invert due to no input being a variable"),0)}function Wa(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.asin(n).times(n).add(o.sqrt(o.sub(1,o.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ja(e,t){return C(t)?t.invert(u.cos(e)):(console.error("Could not invert due to no input being a variable"),0)}function Ka(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.acos(n).times(n).sub(o.sqrt(o.sub(1,o.pow(n,2))))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Ya(e,t){return C(t)?t.invert(u.tan(e)):(console.error("Could not invert due to no input being a variable"),0)}function Za(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.atan(n).times(n).sub(o.ln(o.pow(n,2).add(1)).div(2))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function Xa(e,t){return C(t)?t.invert(u.asinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function Qa(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.cosh(n)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function es(e,t){return C(t)?t.invert(u.acosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function ts(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.sinh(n)}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function ns(e,t){return C(t)?t.invert(u.atanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function rs(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.cosh(n).ln()}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function is(e,t){return C(t)?t.invert(u.sinh(e)):(console.error("Could not invert due to no input being a variable"),0)}function as(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.asinh(n).times(n).sub(o.pow(n,2).add(1).sqrt())}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function ss(e,t){return C(t)?t.invert(u.cosh(e)):(console.error("Could not invert due to no input being a variable"),0)}function os(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.acosh(n).times(n).sub(o.add(n,1).sqrt().times(o.sub(n,1).sqrt()))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function ls(e,t){return C(t)?t.invert(u.tanh(e)):(console.error("Could not invert due to no input being a variable"),0)}function us(e,t){if(C(t)){if(!t.isIntegrable())return console.error("Could not integrate due to variable not being integrable"),o.constant(0);const n=t.getIntegralFormula(e);return o.atanh(n).times(n).add(o.sub(1,o.pow(n,2)).ln().div(2))}return console.error("Could not integrate due to no input being a variable"),o.constant(0)}function st(e){return(t,n)=>new o({inputs:[t,n],evaluate:e,invert:It})}function C(e){return e instanceof Y&&e.hasVariable()}function X(e,t){return e instanceof Y?e.evaluate(t):l(e)}function cs(){return o.pow(this,2).div(2)}function ds(){return this}const Z=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"&&De in n?n[De]:n)),"variable"in e?(typeof e.variable=="object"&&De in e.variable&&(e.variable=e.variable[De]),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,this.description=e.description}setupVariable({variable:e}){return{inputs:[e],internalVariables:1,innermostVariable:e,internalIntegrate:cs,internalIntegrateInner:ds,applySubstitution:It}}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 w,k;const{inputs:t,evaluate:n,invert:r,integrate:i,integrateInner:a,applySubstitution:s}=e,c=t.reduce((_,S)=>_+(S instanceof Z?S.internalVariables:0),0),d=t.find(_=>_ instanceof Z&&_.hasVariable()),f=c===1?d==null?void 0:d.innermostVariable:void 0,b=(w=d==null?void 0:d.isInvertible())!=null?w:!1,v=(k=d==null?void 0:d.isIntegrable())!=null?k:!1;return{inputs:t,internalEvaluate:n,internalInvert:b?r:void 0,internalIntegrate:v?i:void 0,internalIntegrateInner:a,applySubstitution:s,innermostVariable:f,internalVariables:c}}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=>X(i,e))))!=null?n:this.hasVariable()?e:null)!=null?r:X(this.inputs[0])}equals(e){return this.inputs.length===e.inputs.length&&this.inputs.every((t,n)=>t instanceof Z&&e.inputs[n]instanceof Z?t.equals(e.inputs[n]):!(t instanceof Z)&&!(e.inputs[n]instanceof Z)&&u.eq(l(t),l(e.inputs[n])))&&this.internalEvaluate===e.internalEvaluate&&this.internalInvert===e.internalInvert&&this.internalIntegrate===e.internalIntegrate&&this.internalVariables===e.internalVariables}static constant(e){return new o({inputs:[e]})}static variable(e){return new o({variable:e})}static stringify(e){var t;return e instanceof Z?e.description!=null?e.description:e.internalEvaluate==null?e.hasVariable()?"x":Ne((t=e.inputs[0])!=null?t:0):`${e.internalEvaluate.name}(${e.inputs.map(o.stringify).join(", ")})`:Ne(l(e))}static step(e,t,n){const r=n(o.variable(0)),i=jt(t);function a(c){return u.lt(c,l(i))?c:u.add(r.evaluate(u.sub(c,l(i))),l(i))}function s(c,d){return C(d)&&r.isInvertible()?(u.gt(c,l(i))&&(c=u.add(r.invert(u.sub(c,l(i))),l(i))),d.invert(c)):(console.error("Could not invert due to no input being a variable"),0)}return new o({inputs:[e],evaluate:a,invert:r.isInvertible()&&r.hasVariable()?s:void 0,description:"indeterminate"})}static if(e,t,n,r){const i=x(0),a=o.variable(i),s=n(a),c=r==null?void 0:r(a),d=jt(t);function f(v){return l(d)?(i.value=v,s.evaluate()):c?(i.value=v,c.evaluate()):v}function b(v,w){return!C(w)||!s.isInvertible()||c!=null&&!c.isInvertible()?(console.error("Could not invert due to no input being a variable"),0):l(d)?w.invert(s.invert(v)):c?w.invert(c.invert(v)):w.invert(v)}return new o({inputs:[e],evaluate:f,invert:s.isInvertible()&&s.hasVariable()?b:void 0,description:"indeterminate"})}static conditional(e,t,n,r){return o.if(e,t,n,r)}static abs(e){return new o({inputs:[e],evaluate:u.abs})}static neg(e){return new o({inputs:[e],evaluate:u.neg,invert:Ai,applySubstitution:Bi,integrate:qi})}static sign(e){return new o({inputs:[e],evaluate:u.sign})}static round(e){return new o({inputs:[e],evaluate:u.round,invert:ut})}static floor(e){return new o({inputs:[e],evaluate:u.floor,invert:ut})}static ceil(e){return new o({inputs:[e],evaluate:u.ceil,invert:ut})}static trunc(e){return new o({inputs:[e],evaluate:u.trunc,invert:ut})}static add(e,t){return new o({inputs:[e,t],evaluate:u.add,invert:Ui,integrate:zi,integrateInner:Gi,applySubstitution:It})}static sub(e,t){return new o({inputs:[e,t],evaluate:u.sub,invert:Hi,integrate:ji,integrateInner:Wi,applySubstitution:It})}static mul(e,t){return new o({inputs:[e,t],evaluate:u.mul,invert:Ji,integrate:Ki,applySubstitution:Yi})}static div(e,t){return new o({inputs:[e,t],evaluate:u.div,invert:Zi,integrate:Xi,applySubstitution:Qi})}static recip(e){return new o({inputs:[e],evaluate:u.recip,invert:ea,integrate:ta})}static clamp(e,t,n){return new o({inputs:[e,t,n],evaluate:u.clamp,invert:ut})}static pLog10(e){return new o({inputs:[e],evaluate:u.pLog10})}static absLog10(e){return new o({inputs:[e],evaluate:u.absLog10})}static log10(e){return new o({inputs:[e],evaluate:u.log10,invert:na,integrate:aa})}static log(e,t){return new o({inputs:[e,t],evaluate:u.log,invert:sa,integrate:ua})}static log2(e){return new o({inputs:[e],evaluate:u.log2,invert:ca,integrate:ga})}static ln(e){return new o({inputs:[e],evaluate:u.ln,invert:ma,integrate:va})}static pow(e,t){return new o({inputs:[e,t],evaluate:u.pow,invert:ba,integrate:ya})}static pow10(e){return new o({inputs:[e],evaluate:u.pow10,invert:_a,integrate:wa})}static pow_base(e,t){return new o({inputs:[e,t],evaluate:u.pow_base,invert:Na,integrate:Ca})}static root(e,t){return new o({inputs:[e,t],evaluate:u.root,invert:ka,integrate:Sa})}static factorial(e){return new o({inputs:[e],evaluate:u.factorial})}static gamma(e){return new o({inputs:[e],evaluate:u.gamma})}static lngamma(e){return new o({inputs:[e],evaluate:u.lngamma})}static exp(e){return new o({inputs:[e],evaluate:u.exp,invert:Ia,integrate:$a})}static sqr(e){return o.pow(e,2)}static sqrt(e){return o.root(e,2)}static cube(e){return o.pow(e,3)}static cbrt(e){return o.root(e,3)}static tetrate(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new o({inputs:[e,t,n],evaluate:Ma,invert:xa})}static iteratedexp(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new o({inputs:[e,t,n],evaluate:Ta,invert:Pa})}static iteratedlog(e,t=10,n=1){return new o({inputs:[e,t,n],evaluate:Fa})}static slog(e,t=10){return new o({inputs:[e,t],evaluate:Ea,invert:Oa})}static layeradd10(e,t){return new o({inputs:[e,t],evaluate:u.layeradd10})}static layeradd(e,t,n=10){return new o({inputs:[e,t,n],evaluate:Va,invert:La})}static lambertw(e){return new o({inputs:[e],evaluate:u.lambertw,invert:Da})}static ssqrt(e){return new o({inputs:[e],evaluate:u.ssqrt,invert:Ra})}static pentate(e,t=2,n=u.fromComponents_noNormalize(1,0,1)){return new o({inputs:[e,t,n],evaluate:Aa})}static sin(e){return new o({inputs:[e],evaluate:u.sin,invert:ja,integrate:Ba})}static cos(e){return new o({inputs:[e],evaluate:u.cos,invert:Ja,integrate:za})}static tan(e){return new o({inputs:[e],evaluate:u.tan,invert:Ya,integrate:Ha})}static asin(e){return new o({inputs:[e],evaluate:u.asin,invert:qa,integrate:Wa})}static acos(e){return new o({inputs:[e],evaluate:u.acos,invert:Ua,integrate:Ka})}static atan(e){return new o({inputs:[e],evaluate:u.atan,invert:Ga,integrate:Za})}static sinh(e){return new o({inputs:[e],evaluate:u.sinh,invert:is,integrate:Qa})}static cosh(e){return new o({inputs:[e],evaluate:u.cosh,invert:ss,integrate:ts})}static tanh(e){return new o({inputs:[e],evaluate:u.tanh,invert:ls,integrate:rs})}static asinh(e){return new o({inputs:[e],evaluate:u.asinh,invert:Xa,integrate:as})}static acosh(e){return new o({inputs:[e],evaluate:u.acosh,invert:es,integrate:os})}static atanh(e){return new o({inputs:[e],evaluate:u.atanh,invert:ns,integrate:us})}stringify(){return o.stringify(this)}step(e,t){return o.step(this,e,t)}if(e,t){return o.if(this,e,t)}conditional(e,t){return o.if(this,e,t)}abs(){return o.abs(this)}neg(){return o.neg(this)}sign(){return o.sign(this)}round(){return o.round(this)}floor(){return o.floor(this)}ceil(){return o.ceil(this)}trunc(){return o.trunc(this)}add(e){return o.add(this,e)}sub(e){return o.sub(this,e)}mul(e){return o.mul(this,e)}div(e){return o.div(this,e)}recip(){return o.recip(this)}max(e){return o.max(this,e)}min(e){return o.min(this,e)}maxabs(e){return o.maxabs(this,e)}minabs(e){return o.minabs(this,e)}clamp(e,t){return o.clamp(this,e,t)}clampMin(e){return o.clampMin(this,e)}clampMax(e){return o.clampMax(this,e)}pLog10(){return o.pLog10(this)}absLog10(){return o.absLog10(this)}log10(){return o.log10(this)}log(e){return o.log(this,e)}log2(){return o.log2(this)}ln(){return o.ln(this)}pow(e){return o.pow(this,e)}pow10(){return o.pow10(this)}pow_base(e){return o.pow_base(this,e)}root(e){return o.root(this,e)}factorial(){return o.factorial(this)}gamma(){return o.gamma(this)}lngamma(){return o.lngamma(this)}exp(){return o.exp(this)}sqr(){return o.pow(this,2)}sqrt(){return o.root(this,2)}cube(){return o.pow(this,3)}cbrt(){return o.root(this,3)}tetrate(e=2,t=u.fromComponents_noNormalize(1,0,1)){return o.tetrate(this,e,t)}iteratedexp(e=2,t=u.fromComponents_noNormalize(1,0,1)){return o.iteratedexp(this,e,t)}iteratedlog(e=10,t=1){return o.iteratedlog(this,e,t)}slog(e=10){return o.slog(this,e)}layeradd10(e){return o.layeradd10(this,e)}layeradd(e,t){return o.layeradd(this,e,t)}lambertw(){return o.lambertw(this)}ssqrt(){return o.ssqrt(this)}pentate(e=2,t=u.fromComponents_noNormalize(1,0,1)){return o.pentate(this,e,t)}sin(){return o.sin(this)}cos(){return o.cos(this)}tan(){return o.tan(this)}asin(){return o.asin(this)}acos(){return o.acos(this)}atan(){return o.atan(this)}sinh(){return o.sinh(this)}cosh(){return o.cosh(this)}tanh(){return o.tanh(this)}asinh(){return o.asinh(this)}acosh(){return o.acosh(this)}atanh(){return o.atanh(this)}};let Y=Z;Y.negate=Z.neg;Y.negated=Z.neg;Y.sgn=Z.sign;Y.plus=Z.add;Y.subtract=Z.sub;Y.minus=Z.sub;Y.multiply=Z.mul;Y.times=Z.mul;Y.divide=Z.div;Y.divideBy=Z.div;Y.dividedBy=Z.div;Y.reciprocal=Z.recip;Y.reciprocate=Z.recip;Y.max=st(u.max);Y.min=st(u.min);Y.minabs=st(u.minabs);Y.maxabs=st(u.maxabs);Y.clampMin=st(u.clampMin);Y.clampMax=st(u.clampMax);Y.logarithm=Z.log;class o extends Y{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=u.add(this.evaluate(0),this.evaluate(1)).div(2);return u.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"),o.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"),o.constant(0);return this.integralFormula}else return this.applySubstitution==null?(console.error("Cannot have two complex operations in an integrable formula"),o.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"),o.constant(0)))}}const tt=Symbol("PersistentState"),Ye=Symbol("DefaultValue"),Tt=Symbol("StackTrace"),Wt=Symbol("Deleted"),De=Symbol("NonPersistent"),Je=Symbol("SaveDataPath"),Jt=Symbol("SkipPersistence");function fs(){var e,t;return(t=(e=new Error().stack)==null?void 0:e.split(`
`).slice(3,5).map(n=>n.trim()).join(`
`))!=null?t:""}function yn(e,t){var n;u.isNaN(t)&&(j.hasNaN||(F.autosave=!1,j.hasNaN=!0,j.NaNPath=e[Je],j.NaNPersistent=e),console.error(`Attempted to save NaN value to ${(n=e[Je])==null?void 0:n.join(".")}`)),e[tt].value=t}function _t(e,t=!0){const n=re(e)?e:x(e);re(e)&&(e=e.value);const r=E({get(){return n.value},set(a){t?yn(i,a):i[tt].value=a}});r[Ye]=e;const i={get value(){return n.value},set value(a){t?yn(i,a):i[tt].value=a},__v_isRef:!0,[tt]:n,[Ye]:e,[Tt]:fs(),[Wt]:!1,[De]:r,[Je]:void 0};return ye.length===0?console.warn("Creating a persistent ref outside of a layer. This is not officially supported",i,`
Created at:
`+i[Tt]):nt[ye[ye.length-1]].add(i),i}function gs(e){return e!=null&&typeof e=="object"&&tt in e}oe.on("addLayer",(e,t)=>{const n=[],r=(i,a=[])=>{let s=!1;return Object.keys(i).forEach(c=>{let d=i[c];if(d!=null&&typeof d=="object"){if(d[Jt]===!0)return;if(We in d&&(d=d[We]),gs(d)){if(s=!0,d[Wt]){console.warn("Deleted persistent ref present in returned object. Ignoring...",d,`
Created at:
`+d[Tt]);return}nt[e.id].delete(d);const f=[e.id,...a,c];d[Je]!=null&&JSON.stringify(f)!==JSON.stringify(d[Je])&&console.error(`Persistent ref is being saved to \`${f.join(".")}\` when it's already present at \`${d[Je].join(".")}\`.`,"This can cause unexpected behavior when loading saves between updates."),d[Je]=f;const b=a.reduce((w,k)=>(k in w||(w[k]={}),w[k]),t),v=b[c];b[c]=d[tt],Zn(b)?v!=null?b[c]=v:b[c]=d[Ye]:v!=null?b[c].value=v:b[c].value=d[Ye]}else!(d instanceof u)&&!(d instanceof o)&&!re(d)&&!n.includes(d)&&(typeof d.type=="symbol"&&n.push(d),r(d,[...a,c])&&(fn(d)&&!fn(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.",We in i?i[We]:i,c):s=!0))}}),s};r(e[We]),nt[e.id].forEach(i=>{i[Wt]||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[Tt])}),nt[e.id].clear()});const tn=Symbol("RegisterNode"),nn=Symbol("UnregisterNode"),rn=Symbol("Nodes"),an=Symbol("Bounds"),le=Ot({});window.layers=le;const nt={},ye=[];function sn(e,t){return Ze(()=>{const n={},r=n.emitter=kn();if(n.on=r.on.bind(r),n.emit=r.emit.bind(r),n.nodes=x({}),n.id=e,ye.push(e),nt[e]=new Set,n.minimized=_t(!1,!1),Object.assign(n,t.call(n,n)),ye[ye.length-1]==null||ye[ye.length-1]!==e)throw new Error(`Adding layers stack in invalid state. This should not happen
Stack: ${ye}
Trying to pop ${n.id}`);ye.pop(),L(n,"color"),L(n,"display"),L(n,"classes"),L(n,"style"),L(n,"name"),ce(n,"name",n.id),L(n,"minWidth"),ce(n,"minWidth",600),L(n,"minimizable"),ce(n,"minimizable",!0),L(n,"minimizedDisplay");const i=n.style;return n.style=E(()=>{var s,c;let a=l(n.minWidth);return(typeof a=="number"||!Number.isNaN(parseInt(a)))&&(a=a+"px"),[(s=l(i))!=null?s:"",(c=n.minimized)!=null&&c.value?{flexGrow:"0",flexShrink:"0",width:"60px",minWidth:"",flexBasis:"",margin:"0"}:{flexGrow:"",flexShrink:"",width:"",minWidth:a,flexBasis:a,margin:""}]}),n})}function Rn(e,t){if(console.info("Adding layer",e.id),le[e.id]){console.error("Attempted to add layer with same ID as existing layer",e.id,le[e.id]);return}ce(t,"layers",{}),t.layers[e.id]==null&&(t.layers[e.id]={}),le[e.id]=e,oe.emit("addLayer",e,t.layers[e.id])}function ms(e){return le[e]}function An(e){console.info("Removing layer",e.id),oe.emit("removeLayer",e),le[e.id]=void 0}function hs(e){An(e),Rn(e,F)}function ps(e){const t=x(!1);return{openModal:()=>t.value=!0,modal:ee(()=>y(Ee,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},{header:()=>y("h2",null,[l(e.name)]),body:l(e.display)}))}}oe.on("update",function(t){Object.values(le).forEach(n=>{n==null||n.emit("preUpdate",t)}),Object.values(le).forEach(n=>{n==null||n.emit("update",t)}),Object.values(le).forEach(n=>{n==null||n.emit("postUpdate",t)})});var vs=Object.freeze(Object.defineProperty({__proto__:null,RegisterNodeInjectionKey:tn,UnregisterNodeInjectionKey:nn,NodesInjectionKey:rn,BoundsInjectionKey:an,layers:le,persistentRefs:nt,addingLayers:ye,createLayer:sn,addLayer:Rn,getLayer:ms,removeLayer:An,reloadLayer:hs,setupLayerModal:ps},Symbol.toStringTag,{value:"Module"}));const bs=q({__name:"Context",emits:["updateNodes"],setup(e,{emit:t}){var b;const n=x({}),r=new ResizeObserver(c),i=x(null);yt(()=>{const v=i.value;v!=null&&r.observe(v)});let a=!0,s=x((b=i.value)==null?void 0:b.getBoundingClientRect());function c(){a&&(a=!1,Ke(()=>{var v;s.value=(v=i.value)==null?void 0:v.getBoundingClientRect(),Object.values(n.value).filter(w=>w).forEach(w=>w.rect=w.element.getBoundingClientRect()),t("updateNodes",n.value),a=!0}))}oe.on("fontsLoaded",c);const d={attributes:!1,childList:!0,subtree:!1};Ct(tn,(v,w)=>{const k=new MutationObserver(()=>f(v));k.observe(w,d),n.value[v]={element:w,observer:k,rect:w.getBoundingClientRect()},c()}),Ct(nn,v=>{var w;(w=n.value[v])==null||w.observer.disconnect(),n.value[v]=void 0,c()}),Ct(rn,n),Ct(an,s);function f(v){const w=n.value[v];w!=null&&(w.rect=w.element.getBoundingClientRect(),t("updateNodes",n.value))}return(v,w)=>(h(),N(W,null,[Re(v.$slots,"default",{},void 0,!0),g("div",{ref_key:"resizeListener",ref:i,class:"resize-listener"},null,512)],64))}});var qn=H(bs,[["__scopeId","data-v-2b1dc1bc"]]);const ys=["onPointerdown"],_s={class:"modal-wrapper"},ws=["width"],Ns={class:"modal-header"},Cs={class:"modal-body"},ks={class:"modal-footer"},Ss=g("div",{class:"modal-default-flex-grow"},null,-1),Ee=q({__name:"Modal",props:{modelValue:{type:Boolean},preventClosing:{type:Boolean},width:null},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const i=de(e),a=E(()=>l(i.modelValue)||c.value);function s(){l(i.preventClosing)!==!0&&n("update:modelValue",!1)}const c=x(!1),d=x(null),f=E(()=>{var b,v;return(v=(b=d.value)==null?void 0:b.nodes)!=null?v:null});return t({isOpen:a,nodes:f}),(b,v)=>(h(),R(Qn,{to:"#modal-root"},[y(Nn,{name:"modal",onBeforeEnter:v[0]||(v[0]=w=>c.value=!0),onAfterLeave:v[1]||(v[1]=w=>c.value=!1),appear:""},{default:O(()=>[Yt(g("div",Pe({class:"modal-mask",onPointerdown:gt(s,["self"])},b.$attrs),[g("div",_s,[g("div",{class:"modal-container",width:e.width},[g("div",Ns,[Re(b.$slots,"header",{shown:l(a)},()=>[T(" default header ")])]),g("div",Cs,[y(qn,{ref_key:"contextRef",ref:d},{default:O(()=>[Re(b.$slots,"body",{shown:l(a)},()=>[T(" default body ")])]),_:3},512)]),g("div",ks,[Re(b.$slots,"footer",{shown:l(a)},()=>[g("div",{class:"modal-default-footer"},[Ss,g("button",{class:"button modal-default-button",onClick:s}," Close ")])])])],8,ws)])],16,ys),[[Xn,e.modelValue]])]),_:3})]))}});const Rt=e=>(Ce("data-v-3da88bf8"),e=e(),ke(),e),Is=Rt(()=>g("div",{class:"vga-modal-header"},[g("h2",null,"Kindly consider taking a break.")],-1)),$s=Rt(()=>g("p",null," You've been actively enjoying this game for awhile recently - and it's great that you've been having a good time! That said, there are dangers to games like these that you should be aware of: ",-1)),Ms=Rt(()=>g("p",null," While incremental games can be fun and even healthy in certain contexts, they can exacerbate video game addiction even more than other genres. If you feel like playing incremental games is taking priority over other things in your life, or manipulating your sleep schedule, it may be prudent to seek help. ",-1)),xs=Rt(()=>g("p",null,[g("h4",null,"Resources:"),g("span",null,[g("a",{style:{display:"inline"},href:"https://www.samhsa.gov/",target:"_blank"}," SAMHSA "),T(" ("),g("a",{style:{display:"inline"},href:"tel:1-800-662-4357"},"1-800-662-HELP"),T(") ")]),g("br"),g("a",{href:"https://www.reddit.com/r/StopGaming/"},"r/StopGaming")],-1)),Ts={class:"vga-footer"},Ps=q({__name:"AddictionWarning",setup(e){const t=x(!1);Ae(()=>{U.disableHealthWarning===!1&&G.showHealthWarning&&j.mouseActivity.filter(r=>r).length>6&&(t.value=!0)});function n(){G.showHealthWarning=!1,t.value=!1}return(r,i)=>{const a=ze("SavesManager");return h(),N(W,null,[y(Ee,Pe({modelValue:t.value,"onUpdate:modelValue":i[1]||(i[1]=s=>t.value=s)},r.$attrs),{header:O(()=>[Is]),body:O(()=>[$s,Ms,xs]),footer:O(()=>[g("div",Ts,[g("button",{onClick:n,class:"button"},"Never show this again"),g("button",{onClick:i[0]||(i[0]=s=>t.value=!1),class:"button"},"Close")])]),_:1},16,["modelValue"]),y(a,{ref:"savesManager"},null,512)],64)}}});var Fs=H(Ps,[["__scopeId","data-v-3da88bf8"]]);const ge=x(),$e=x([]),ot=x([]);function Es(){var e;((e=ge.value)==null?void 0:e.loggedIn)===!0&&($e.value.length>0||ge.value.getSaveList().then(Bn).then(t=>{ot.value=t.map(n=>n.content.id)}).catch(console.error))}ar({supportsSaving:!0,supportsSaveManager:!0,onLoggedInChanged:_n}).then(e=>{ge.value=e,_n(e)}).catch(console.error);function _n(e){e.loggedIn===!0&&($e.value.length>0||(e.getSaveList().then(t=>{const n=Bn(t);if(ot.value=n.map(r=>r.content.id),F.timePlayed<120*1e3&&n.length>0){const r=n.reduce((i,a)=>i.content.time<a.content.time?a:i);Te(r.content)}}).catch(console.error),setInterval(Es,60*1e3)))}function Bn(e){const t=new Set(G.saves.slice()),n=new Set(new Array(11).fill(0).map((i,a)=>a)),r=Object.keys(e).map(i=>{var c;const{label:a,content:s}=e[i];try{return{slot:parseInt(i),label:a,content:JSON.parse((c=qe(s))!=null?c:"")}}catch{return null}}).filter(i=>i!=null&&typeof i.content.id=="string"&&typeof i.content.time=="number"&&typeof i.content.timePlayed=="number").filter(i=>{var s,c,d,f,b,v;i.label!=null&&(i.content.name=i.label),n.delete(i.slot);const a=G.saves.find(w=>w===i.content.id);if(a==null)G.saves.push(i.content.id),ae(xe(i.content));else{t.delete(a);try{const w=JSON.parse((c=qe((s=localStorage.getItem(a))!=null?s:""))!=null?c:"");if(w==null)return!1;w.id=a,w.time=(d=w.time)!=null?d:0,w.timePlayed=(f=w.timePlayed)!=null?f:0;const k=Math.abs(w.timePlayed-i.content.timePlayed),_=Math.abs(w.time-i.content.time);k<120*1e3&&_<120*1e3?w.time<i.content.time?(ae(xe(i.content)),G.active===a&&Te(i.content)):((v=ge.value)==null||v.save(i.slot,Ge.compressToUTF16(rt(xe(w))),(b=w.name)!=null?b:i.label).catch(console.error),i.content=w):$e.value.push({id:a,cloud:i.content,local:w,slot:i.slot})}catch{return!1}}return!0});return t.forEach(i=>{var a,s,c;try{if(n.size>0){const d=(a=localStorage.getItem(i))!=null?a:"",f=JSON.parse((s=qe(d))!=null?s:""),b=n.values().next().value;(c=ge.value)==null||c.save(b,d,f.name).then(()=>ot.value.push(f.id)).catch(console.error),n.delete(b)}}catch{}}),r}function ue(e,t="span"){return typeof e=="function"?q({render:e}):typeof e=="string"?e.length>0?(e=e.trim(),e.charAt(0)!=="<"&&(e=`<${t}>${e}</${t}>`),q({template:e})):q({render:()=>({})}):e}function wt(e){if(At(e))return typeof e=="function"?e():ue(e);const t=e[Be];return y(t,e[Ue](),null)}function $t(e){if(At(e))return typeof e=="function"?e():typeof e=="string"?y(W,null,[e]):y(e,null,null);const t=e[Be];return y(t,e[Ue](),null)}function At(e){return typeof e=="string"?!0:typeof e=="object"?e==null?!1:"render"in e||"component"in e:typeof e=="function"&&e[vt]===!0}function Un(e,t){const n=x(null),r=x(void 0);function i(c){n.value||(n.value=setInterval(s,250)),r.value=c}function a(){n.value&&(clearInterval(n.value),n.value=null)}function s(){t&&t.value?t.value():e&&e.value&&e.value(r.value)}return Cn(a),{start:i,stop:a,handleHolding:s}}function Os(e,t="div"){const n=_e();return Ae(()=>{n.value=ue(we(e),t)}),n}function lt(e,t="div"){const n=_e(null);return Ae(()=>{const r=we(e);n.value=r===""||r==null?null:ue(r,t)}),n}function we(e){return l(l(e))}function z(...e){return e.includes(Object)||e.push(Object),e}function Vs(e){return Object.keys(e).reduce((t,n)=>(t[Di(n)]=e[n],t),{})}var Ls=q({props:{element:Object,display:{type:z(Object,String,Function),required:!0},style:z(Object,String,Array),classes:z(Object),direction:z(String),xoffset:z(String),yoffset:z(String),pinned:Object},setup(e){const{element:t,display:n,pinned:r}=de(e),i=x(!1),a=E(()=>(we(r)||i.value)&&s.value),s=lt(n),c=_e(ue(ee(()=>{const b=we(t);return b==null?"":$t(b)})));function d(b){const v=r;b.shiftKey&&v&&(v.value=!v.value,b.stopPropagation(),b.preventDefault())}const f=E(()=>we(r)&&Qt[G.theme].showPin);return{Direction:K,isHovered:i,isShown:a,comp:s,elementComp:c,unref:l,togglePinned:d,showPin:f}}});const Ds={key:0,class:"material-icons pinned"};function Rs(e,t,n,r,i,a){return h(),N("div",{class:te(["tooltip-container",{shown:e.isShown}]),onMouseenter:t[0]||(t[0]=s=>e.isHovered=!0),onMouseleave:t[1]||(t[1]=s=>e.isHovered=!1),onClickCapture:t[2]||(t[2]=(...s)=>e.togglePinned&&e.togglePinned(...s))},[Re(e.$slots,"default",{},void 0,!0),e.elementComp?(h(),R(se(e.elementComp),{key:0})):$("",!0),y(Nn,{name:"fade"},{default:O(()=>{var s;return[e.isShown?(h(),N("div",{key:0,class:te(["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:me([{"--xoffset":e.unref(e.xoffset)||"0px","--yoffset":e.unref(e.yoffset)||"0px"},(s=e.unref(e.style))!=null?s:{}])},[e.showPin?(h(),N("span",Ds,"push_pin")):$("",!0),e.comp?(h(),R(se(e.comp),{key:1})):$("",!0)],6)):$("",!0)]}),_:1})],34)}var Q=H(Ls,[["render",Rs],["__scopeId","data-v-6102fa3a"]]);const As={key:0},qs=["onClick","disabled"],Bs={key:0},Us=["onClick"],zs=q({__name:"DangerButton",props:{disabled:{type:Boolean},skipConfirm:{type:Boolean}},emits:["click","confirmingChanged"],setup(e,{emit:t}){const r=de(e),i=x(!1);he(i,c=>{t("confirmingChanged",c)});function a(){if(l(r.skipConfirm)){t("click");return}i.value&&t("click"),i.value=!i.value}function s(){i.value=!1}return(c,d)=>(h(),N("span",{class:te(["container",{confirming:i.value}])},[i.value?(h(),N("span",As,"Are you sure?")):$("",!0),g("button",{onClick:gt(a,["stop"]),class:"button danger",disabled:e.disabled},[i.value?(h(),N("span",Bs,"Yes")):Re(c.$slots,"default",{key:1},void 0,!0)],8,qs),i.value?(h(),N("button",{key:1,class:"button",onClick:gt(s,["stop"])},"No",8,Us)):$("",!0)],2))}});var Gs=H(zs,[["__scopeId","data-v-2f8ef34c"]]);const Hs=["onSubmit"],js={class:"field"},Ws={key:0,class:"field-title"},Js=["placeholder"],Ks=q({__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=lt(Fe(n,"title"),"span"),i=_e(null);yt(()=>{var d;(d=i.value)==null||d.focus()});const a=E({get(){var d;return(d=l(n.modelValue))!=null?d:""},set(d){t("update:modelValue",d)}});function s(){t("submit")}function c(){n.submitOnBlur!==!1?t("submit"):t("cancel")}return(d,f)=>(h(),N("form",{onSubmit:gt(s,["prevent"])},[g("div",js,[l(r)?(h(),N("span",Ws,[(h(),R(se(l(r))))])):$("",!0),e.textArea?(h(),R(l(sr),{key:1,modelValue:l(a),"onUpdate:modelValue":f[0]||(f[0]=b=>re(a)?a.value=b:null),placeholder:e.placeholder,maxHeight:e.maxHeight,onBlur:c,ref_key:"field",ref:i},null,8,["modelValue","placeholder","maxHeight"])):Yt((h(),N("input",{key:2,type:"text","onUpdate:modelValue":f[1]||(f[1]=b=>re(a)?a.value=b:null),placeholder:e.placeholder,class:te({fullWidth:!e.title}),onBlur:c,ref_key:"field",ref:i},null,42,Js)),[[er,l(a)]])])],40,Hs))}});var zn=H(Ks,[["__scopeId","data-v-90bd4994"]]);const Oe=e=>(Ce("data-v-d1147dc6"),e=e(),ke(),e),Ys={key:0,class:"handle material-icons"},Zs={key:1,class:"actions"},Xs=Oe(()=>g("span",{class:"material-icons"},"content_paste",-1)),Qs=Oe(()=>g("span",{class:"material-icons"},"content_copy",-1)),eo=Oe(()=>g("span",{class:"material-icons"},"edit",-1)),to=Oe(()=>g("span",{class:"material-icons",style:{margin:"-2px"}},"delete",-1)),no={key:2,class:"actions"},ro=Oe(()=>g("span",{class:"material-icons"},"check",-1)),io=Oe(()=>g("span",{class:"material-icons"},"close",-1)),ao={key:3,class:"details"},so=Oe(()=>g("span",{class:"material-icons synced"},"cloud",-1)),oo=["disabled"],lo={class:"save-version"},uo=Oe(()=>g("br",null,null,-1)),co={key:1,class:"time"},fo={key:4,class:"details"},go={key:5,class:"details error"},mo=Oe(()=>g("br",null,null,-1)),ho=q({__name:"Save",props:{save:null,readonly:{type:Boolean}},emits:["export","open","duplicate","delete","editName"],setup(e,{emit:t}){const n=e,{save:r,readonly:i}=de(n),a=new Intl.DateTimeFormat("en-US",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),s=x(!1),c=x(!1),d=x("");he(s,()=>{var k;return d.value=(k=r.value.name)!=null?k:""});const f=E(()=>r.value!=null&&r.value.id===F.id&&!l(i)),b=E(()=>{var k;return f.value?F.time:(k=r.value!=null&&r.value.time)!=null?k:0}),v=E(()=>{var k;return!l(i)&&((k=ge.value)==null?void 0:k.loggedIn)===!0&&ot.value.includes(r.value.id)});function w(){t("editName",d.value),s.value=!1}return(k,_)=>(h(),N("div",{class:te(["save",{active:l(f),readonly:l(i)}])},[l(i)!==!0?(h(),N("div",Ys,"drag_handle")):$("",!0),!s.value&&l(i)!==!0?(h(),N("div",Zs,[l(r).error==null&&!c.value?(h(),R(Zt,{key:0,onClick:_[0]||(_[0]=S=>t("export")),class:"button",left:""},{default:O(()=>[y(Q,{display:"Export",direction:l(K).Left,class:"info"},{default:O(()=>[Xs]),_:1},8,["direction"])]),_:1})):$("",!0),l(r).error==null&&!c.value?(h(),N("button",{key:1,onClick:_[1]||(_[1]=S=>t("duplicate")),class:"button"},[y(Q,{display:"Duplicate",direction:l(K).Left,class:"info"},{default:O(()=>[Qs]),_:1},8,["direction"])])):$("",!0),l(r).error==null&&!c.value?(h(),N("button",{key:2,onClick:_[2]||(_[2]=S=>s.value=!s.value),class:"button"},[y(Q,{display:"Edit Name",direction:l(K).Left,class:"info"},{default:O(()=>[eo]),_:1},8,["direction"])])):$("",!0),y(Gs,{disabled:l(f),onClick:_[3]||(_[3]=S=>t("delete")),onConfirmingChanged:_[4]||(_[4]=S=>c.value=S)},{default:O(()=>[y(Q,{display:"Delete",direction:l(K).Left,class:"info"},{default:O(()=>[to]),_:1},8,["direction"])]),_:1},8,["disabled"])])):l(i)!==!0?(h(),N("div",no,[g("button",{onClick:w,class:"button"},[y(Q,{display:"Save",direction:l(K).Left,class:"info"},{default:O(()=>[ro]),_:1},8,["direction"])]),g("button",{onClick:_[5]||(_[5]=S=>s.value=!s.value),class:"button"},[y(Q,{display:"Cancel",direction:l(K).Left,class:"info"},{default:O(()=>[io]),_:1},8,["direction"])])])):$("",!0),l(r).error==null&&!s.value?(h(),N("div",ao,[l(v)?(h(),R(Q,{key:0,display:"Synced!",direction:l(K).Right},{default:O(()=>[so]),_:1},8,["direction"])):$("",!0),g("button",{class:"button open",onClick:_[6]||(_[6]=S=>t("open")),disabled:l(i)},[g("h3",null,V(l(r).name),1)],8,oo),g("span",lo,"v"+V(l(r).modVersion),1),uo,l(b)?(h(),N("div",co," Last played "+V(l(a).format(l(b))),1)):$("",!0)])):l(r).error==null&&s.value?(h(),N("div",fo,[y(zn,{modelValue:d.value,"onUpdate:modelValue":_[7]||(_[7]=S=>d.value=S),class:"editname",onSubmit:w},null,8,["modelValue"])])):(h(),N("div",go,[T(" Error: Failed to load save with id "+V(l(r).id),1),mo,T(V(l(r).error),1)]))],2))}});var Kt=H(ho,[["__scopeId","data-v-d1147dc6"]]);const on=e=>(Ce("data-v-0bf31c81"),e=e(),ke(),e),po={class:"cloud-saves-modal-header"},vo=on(()=>g("br",null,null,-1)),bo=["onClick"],yo={key:0,class:"note"},_o={key:1,class:"note"},wo=["onClick"],No={key:0,class:"note"},Co={key:1,class:"note"},ko=["onClick"],So=on(()=>g("h2",null,"Both",-1)),Io=on(()=>g("div",{class:"save"},"Keep Both",-1)),$o=[So,Io],Mo=q({__name:"CloudSaveResolver",setup(e){const t=x(!1),n=x([]),r=E(()=>$e.value.length>1?"saves":"save"),i=x(null);he(()=>$e.value.length>0,f=>{f&&(n.value=$e.value.map(({local:b,cloud:v})=>{var w,k;return((w=b.time)!=null?w:0)<((k=v.time)!=null?k:0)?"cloud":"local"}),t.value=!0)},{immediate:!0}),he(()=>{var f;return(f=i.value)==null?void 0:f.isOpen},f=>{f===!1&&($e.value=[])});function a(f){n.value[f]="local"}function s(f){n.value[f]="cloud"}function c(f){n.value[f]="both"}function d(){var f,b;for(let v=0;v<n.value.length;v++){const{slot:w,local:k,cloud:_}=$e.value[v];switch(n.value[v]){case"local":(f=ge.value)==null||f.save(w,Ge.compressToUTF16(rt(xe(k))),_.name).catch(console.error);break;case"cloud":ae(xe(_));break;case"both":const S=ft();ae({...xe(_),id:S}),G.saves.push(S),(b=ge.value)==null||b.save(w,Ge.compressToUTF16(rt(xe(k))),_.name).catch(console.error);break}}t.value=!1}return(f,b)=>(h(),R(Ee,{modelValue:t.value,"onUpdate:modelValue":b[0]||(b[0]=v=>t.value=v),width:"960px",ref_key:"modal",ref:i,"prevent-closing":!0},{header:O(()=>[g("div",po,[g("h2",null,"Cloud "+V(l(r))+" loaded!",1)])]),body:O(()=>[g("div",null," Upon loading, your cloud "+V(l(r))+" "+V(l($e).length>1?"appear":"appears")+" to be out of sync with your local "+V(l(r))+". Which "+V(l(r))+" do you want to keep? ",1),vo,(h(!0),N(W,null,Le(l(l($e)),(v,w)=>{var k,_,S,P,I,M,A,ie;return h(),N("div",{key:v.id,class:"conflict-container"},[g("div",{onClick:fe=>s(w),class:te({selected:n.value[w]==="cloud"})},[g("h2",null,[T(" Cloud "),((k=v.cloud.time)!=null?k:0)>((_=v.local.time)!=null?_:0)?(h(),N("span",yo,"(more recent)")):$("",!0),((S=v.cloud.timePlayed)!=null?S:0)>((P=v.local.timePlayed)!=null?P:0)?(h(),N("span",_o,"(more playtime)")):$("",!0)]),y(Kt,{save:v.cloud,readonly:!0},null,8,["save"])],10,bo),g("div",{onClick:fe=>a(w),class:te({selected:n.value[w]==="local"})},[g("h2",null,[T(" Local "),((I=v.cloud.time)!=null?I:0)<=((M=v.local.time)!=null?M:0)?(h(),N("span",No,"(more recent)")):$("",!0),((A=v.cloud.timePlayed)!=null?A:0)<=((ie=v.local.timePlayed)!=null?ie:0)?(h(),N("span",Co,"(more playtime)")):$("",!0)]),y(Kt,{save:v.local,readonly:!0},null,8,["save"])],10,wo),g("div",{onClick:fe=>c(w),class:te({selected:n.value[w]==="both"}),style:{"flex-basis":"30%"}},$o,10,ko)])}),128))]),footer:O(()=>[g("div",{class:"cloud-saves-footer"},[g("button",{onClick:d,class:"button"},"Confirm")])]),_:1},8,["modelValue"]))}});var xo=H(Mo,[["__scopeId","data-v-0bf31c81"]]);const To=q({__name:"Node",props:{id:null},setup(e){const n=de(e),r=Mt(tn,()=>{}),i=Mt(nn,()=>{}),a=_e(null),s=E(()=>a.value&&a.value.parentElement);return he([s,n.id],([c,d],[f,b])=>{f&&i(l(b)),c&&r(d,c)}),Cn(()=>i(l(n.id))),(c,d)=>(h(),N("div",{class:"node",ref_key:"node",ref:a},null,512))}});var Qe=H(To,[["__scopeId","data-v-a48cb382"]]);const Po=q({__name:"Spacer",props:{width:{default:"8px"},height:{default:"17px"}},setup(e){return(t,n)=>(h(),N("div",{style:me({width:e.width,height:e.height})},null,4))}});function Gn(e,t="points",n=0,r=void 0){const i=re(e)?e:_t(e);if(i.displayName=t,i.precision=n,i.small=r,!re(e)){const a=i[De];a.displayName=t,a.precision=n,a.small=r}return i}function Fo(e){const t=_t(e.value);return he(e,n=>{en.value||u.gt(n,t.value)&&(t.value=n)}),t}function Eo(e){const t=_t(e.value);return he(e,(n,r)=>{en.value||u.gt(n,r)&&(t.value=u.add(t.value,u.sub(n,r)))}),t}const Oo=new u("10^^8"),Vo=new u("1e100");function Lo(e,t){const n=x(0),r=x(0),i=x(0);return oe.on("update",s=>{if(r.value=0,u.lte(e.value,Vo)){i.value=e.value;return}let c=e.value,d=i.value;if(i.value=c,u.gt(c,d))if(u.gte(c,Oo))c=u.slog(c,1e10),d=u.slog(d,1e10),n.value=c.sub(d).div(s),r.value=-1;else for(;u.div(c,d).log(10).div(s).gte("100")&&r.value<=5&&u.gt(d,0);)c=u.log10(c),d=u.log10(d),n.value=c.sub(d).div(s),r.value++}),E(()=>r.value===0?t?Ne(t.value,e.precision,e.small)+" "+e.displayName+"/s":"":Ne(n.value)+" OOM"+(r.value<0?"^OOM":"^"+r.value)+"s/sec")}function Pt(e,t){const n=t!=null?t:e.value;return u.eq(e.precision,0)?pt(e.small?n:u.floor(n)):Ne(n,e.precision,e.small)}const Do=["x1","y1","x2","y2"],Ro=q({__name:"Link",props:{link:null,startNode:null,endNode:null,boundingRect:null},setup(e){const t=e,n=de(t),r=E(()=>{const s=n.startNode.value.rect,c=n.boundingRect.value,d=c?{x:s.x+s.width/2-c.x,y:s.y+s.height/2-c.y}:{x:0,y:0};return n.link.value.offsetStart&&(d.x+=n.link.value.offsetStart.x,d.y+=n.link.value.offsetStart.y),d}),i=E(()=>{const s=n.endNode.value.rect,c=n.boundingRect.value,d=c?{x:s.x+s.width/2-c.x,y:s.y+s.height/2-c.y}:{x:0,y:0};return n.link.value.offsetEnd&&(d.x+=n.link.value.offsetEnd.x,d.y+=n.link.value.offsetEnd.y),d}),a=E(()=>Vs(t.link));return(s,c)=>(h(),N("line",Pe({"stroke-width":"15px",stroke:"white"},l(a),{x1:l(r).x,y1:l(r).y,x2:l(i).x,y2:l(i).y}),null,16,Do))}});const Ao=q({__name:"Links",props:{links:null},setup(e){var d;const n=Fe(e,"links"),r=x(null),i=Mt(rn,x({})),a=Mt(an,x(void 0)),s=x((d=r.value)==null?void 0:d.getBoundingClientRect());he(a,()=>{var f;return s.value=(f=r.value)==null?void 0:f.getBoundingClientRect()}),yt(()=>{var f;return s.value=(f=r.value)==null?void 0:f.getBoundingClientRect()});const c=E(()=>{var b,v;const f=i.value;return(v=(b=n.value)==null?void 0:b.filter(w=>{var k,_;return((k=f[w.startNode.id])==null?void 0:k.rect)&&((_=f[w.startNode.id])==null?void 0:_.rect)}))!=null?v:[]});return(f,b)=>(h(),N(W,null,[l(c)?(h(),N("svg",tr(Pe({key:0},f.$attrs)),[(h(!0),N(W,null,Le(l(c),(v,w)=>(h(),R(Ro,{key:w,link:v,boundingRect:s.value,startNode:l(i)[v.startNode.id],endNode:l(i)[v.endNode.id]},null,8,["link","boundingRect","startNode","endNode"]))),128))],16)):$("",!0),g("div",{ref_key:"resizeListener",ref:r,class:"resize-listener"},null,512)],64))}});var qo=H(Ao,[["__scopeId","data-v-063f6d6b"]]),Bo=q({props:{nodes:{type:z(Array),required:!0},leftSideNodes:z(Array),rightSideNodes:z(Array),branches:z(Array)},components:{Links:qo},setup(e){const{nodes:t,leftSideNodes:n,rightSideNodes:r}=de(e),i=_e();Ae(()=>{const c=we(t);i.value=ue(ee(()=>y(W,null,[c.map(d=>y("span",{class:"row tree-row",style:"margin: 50px auto;"},[d.map($t)]))])))});const a=_e();Ae(()=>{const c=we(n);a.value=c?ue(ee(()=>y("span",{class:"left-side-nodes small"},[c.map($t)]))):""});const s=_e();return Ae(()=>{const c=we(r);s.value=c?ue(ee(()=>y("span",{class:"side-nodes small"},[c.map($t)]))):""}),{unref:l,nodesComp:i,leftNodesComp:a,rightNodesComp:s}}});function Uo(e,t,n,r,i,a){const s=ze("Links");return h(),N(W,null,[(h(),R(se(e.nodesComp))),e.leftNodesComp?(h(),R(se(e.leftNodesComp),{key:0})):$("",!0),e.rightNodesComp?(h(),R(se(e.rightNodesComp),{key:1})):$("",!0),e.branches?(h(),R(s,{key:2,links:e.unref(e.branches)},null,8,["links"])):$("",!0)],64)}var zo=H(Bo,[["render",Uo],["__scopeId","data-v-39ca96d0"]]);const Go={key:0},Ho={key:0,class:"mark star"},jo=["src"],Wo=q({__name:"MarkNode",props:{mark:{type:[Boolean,String]}},setup(e){return(t,n)=>e.mark?(h(),N("div",Go,[e.mark===!0?(h(),N("div",Ho)):(h(),N("img",{key:1,class:"mark",src:e.mark},null,8,jo))])):$("",!0)}});var Hn=H(Wo,[["__scopeId","data-v-2207999f"]]);const Jo=q({props:{display:z(Object,String,Function),visibility:{type:z(Number,Boolean),required:!0},style:z(String,Object,Array),classes:z(Object),onClick:Function,onHold:Function,color:z(String),glowColor:z(String),canClick:{type:z(Boolean),required:!0},mark:z(Boolean,String),id:{type:String,required:!0}},components:{MarkNode:Hn,Node:Qe},setup(e){const{onClick:t,onHold:n,display:r}=de(e),i=lt(r),{start:a,stop:s}=Un(t,n);return{start:a,stop:s,comp:i,unref:l,Visibility:at,isCoercableComponent:At,isVisible:On,isHidden:Vn}}});function Ko(e,t,n,r,i,a){var d;const s=ze("MarkNode"),c=ze("Node");return e.isVisible(e.visibility)?(h(),N("div",{key:0,style:me({visibility:e.isHidden(e.visibility)?"hidden":void 0}),class:te({treeNode:!0,can:e.unref(e.canClick),...e.unref(e.classes)}),onClick:t[0]||(t[0]=(...f)=>e.onClick&&e.onClick(...f)),onMousedown:t[1]||(t[1]=(...f)=>e.start&&e.start(...f)),onMouseleave:t[2]||(t[2]=(...f)=>e.stop&&e.stop(...f)),onMouseup:t[3]||(t[3]=(...f)=>e.stop&&e.stop(...f)),onTouchstartPassive:t[4]||(t[4]=(...f)=>e.start&&e.start(...f)),onTouchendPassive:t[5]||(t[5]=(...f)=>e.stop&&e.stop(...f)),onTouchcancelPassive:t[6]||(t[6]=(...f)=>e.stop&&e.stop(...f))},[g("div",{style:me([{backgroundColor:e.unref(e.color),boxShadow:`-4px -4px 4px rgba(0, 0, 0, 0.25) inset, 0 0 20px ${e.unref(e.glowColor)}`},(d=e.unref(e.style))!=null?d:[]])},[(h(),R(se(e.unref(e.comp))))],4),y(s,{mark:e.unref(e.mark)},null,8,["mark"]),y(c,{id:e.id},null,8,["id"])],38)):$("",!0)}var Yo=H(Jo,[["render",Ko],["__scopeId","data-v-727230a6"]]);const Zo=Symbol("TreeNode"),Xo=Symbol("Tree");function Qo(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return Ze(r=>{var s,c,d;const i=(s=e==null?void 0:e.call(r,r))!=null?s:{};i.id=Dt("treeNode-"),i.type=Zo,i[Be]=Yo;for(const f of t)(c=f.preConstruct)==null||c.call(f,i);Object.assign(n),L(i,"visibility"),ce(i,"visibility",at.Visible),L(i,"canClick"),ce(i,"canClick",!0),L(i,"color"),L(i,"display"),L(i,"glowColor"),L(i,"classes"),L(i,"style"),L(i,"mark");for(const f of t)(d=f.postConstruct)==null||d.call(f,i);if(i.onClick){const f=i.onClick.bind(i);i.onClick=function(b){l(i.canClick)!==!1&&f(b)}}if(i.onHold){const f=i.onHold.bind(i);i.onHold=function(){l(i.canClick)!==!1&&f()}}const a=t.reduce((f,b)=>{var v;return Object.assign(f,(v=b.getGatheredProps)==null?void 0:v.call(b,i))},{});return i[Ue]=function(){const{display:f,visibility:b,style:v,classes:w,onClick:k,onHold:_,color:S,glowColor:P,canClick:I,mark:M,id:A}=this;return{display:f,visibility:b,style:v,classes:w,onClick:k,onHold:_,color:S,glowColor:P,canClick:I,mark:M,id:A,...a}},i})}function el(e){return Ze(t=>{const n=e.call(t,t);return n.id=Dt("tree-"),n.type=Xo,n[Be]=zo,n.isResetting=x(!1),n.resettingNode=_e(null),n.reset=function(r){var a,s;const i=n;i.isResetting.value=!0,i.resettingNode.value=r,(a=i.resetPropagation)==null||a.call(i,i,r),(s=i.onReset)==null||s.call(i,r),i.isResetting.value=!1,i.resettingNode.value=null},n.links=E(()=>{var i;return(i=l(n.branches))!=null?i:[]}),L(n,"visibility"),ce(n,"visibility",at.Visible),L(n,"nodes"),L(n,"leftSideNodes"),L(n,"rightSideNodes"),L(n,"branches"),n[Ue]=function(){const{nodes:r,leftSideNodes:i,rightSideNodes:a,branches:s}=this;return{nodes:r,leftSideNodes:i,rightSideNodes:a,branches:s}},n})}const tl=function(e,t){var a;const n=l(e.branches);if(n==null)return;const r=[];let i=[t];for(;i.length!==0;){const s=[];for(const c of i)for(const d of n.filter(f=>f.startNode===c))[...r,...i].includes(d.endNode)||(s.push(d.endNode),(a=d.endNode.reset)==null||a.reset());r.push(...i),i=s}};function nl(e,t=null,n=0){const r=jt(n);return E(()=>t==null||u.gte(e.value,l(r))?Pt(e)+" "+e.displayName:`Reach ${u.eq(t.precision,0)?pt(l(r)):Ne(l(r),t.precision)} ${t.displayName} to unlock (You have ${u.eq(t.precision,0)?pt(t.value):Ne(t.value,t.precision)})`)}function rl(e,...t){return Ze(n=>{var i,a;const r=e.call(n,n);for(const s of t)(i=s.preConstruct)==null||i.call(s,r);r.formula=r.formula(o.variable(r.baseResource)),r.currentGain==null&&(r.currentGain=E(()=>{let s=u.floor(r.formula.evaluate(r.baseResource.value)).max(0);return l(r.buyMax)===!1&&(s=s.min(1)),s})),r.actualGain==null&&(r.actualGain=r.currentGain),r.currentAt==null&&(r.currentAt=E(()=>r.formula.invert(u.floor(l(r.currentGain))))),r.nextAt==null&&(r.nextAt=E(()=>r.formula.invert(u.floor(l(r.currentGain)).add(1)))),r.convert==null&&(r.convert=function(){var c;const s=l(r.currentGain);r.gainResource.value=u.add(r.gainResource.value,s),r.spend(s),(c=r.onConvert)==null||c.call(r,s)}),r.spend==null&&(r.spend=function(){r.baseResource.value=0}),L(r,"currentGain"),L(r,"actualGain"),L(r,"currentAt"),L(r,"nextAt"),L(r,"buyMax"),ce(r,"buyMax",!0);for(const s of t)(a=s.postConstruct)==null||a.call(s,r);return r})}function il(e){return rl(e)}const jn=e=>(Ce("data-v-5e2d38ce"),e=e(),ke(),e),al=jn(()=>g("div",{class:"key"},"Ctrl",-1)),sl=jn(()=>g("div",{class:"key"},"Shift",-1)),ol={class:"key"},ll=q({__name:"Hotkey",props:{hotkey:null},setup(e){const t=e;let n="",r=!1,i=!1,a=!1;return Ae(()=>{n=t.hotkey.key,r=n.startsWith("ctrl+"),r&&(n=n.slice(5)),i=n.startsWith("shift+"),i&&(n=n.slice(6)),a=n.length==1&&n.toLowerCase()!=n.toUpperCase(),a&&(n=n.toUpperCase())}),(s,c)=>(h(),N(W,null,[l(r)?(h(),N(W,{key:0},[al,T("+")],64)):$("",!0),l(i)?(h(),N(W,{key:1},[sl,T("+")],64)):$("",!0),g("div",ol,V(l(n)),1)],64))}});var ul=H(ll,[["__scopeId","data-v-5e2d38ce"]]);const bt=Ot({}),ln=Symbol("Hotkey"),ct=[")","!","@","#","$","%","^","&","*","("];function cl(e){return Ze(t=>{const n=e.call(t,t);return n.type=ln,L(n,"enabled"),ce(n,"enabled",!0),L(n,"description"),n})}oe.on("addLayer",e=>{Ln(e,ln).forEach(t=>{bt[t.key]=t})});oe.on("removeLayer",e=>{Ln(e,ln).forEach(t=>{bt[t.key]=void 0})});document.onkeydown=function(e){var r,i;if(((r=e.target)==null?void 0:r.tagName)==="INPUT"||un.value&&!F.keepGoing)return;const t=[e.key];e.shiftKey&&e.ctrlKey?(t.splice(0,1),t.push("ctrl+shift+"+e.key.toUpperCase()),t.push("shift+ctrl+"+e.key.toUpperCase()),ct.includes(e.key)?(t.push("ctrl+shift+"+ct.indexOf(e.key)),t.push("shift+ctrl+"+ct.indexOf(e.key))):(t.push("ctrl+shift+"+e.key.toLowerCase()),t.push("shift+ctrl+"+e.key.toLowerCase()))):ct.includes(e.key)?(t.push("shift+"+e.key),t.push("shift+"+ct.indexOf(e.key))):e.shiftKey?(t.push("shift+"+e.key.toUpperCase()),t.push("shift+"+e.key.toLowerCase())):e.ctrlKey&&(t.splice(0,1),t.push("ctrl+"+e.key));const n=bt[(i=t.find(a=>a in bt))!=null?i:""];n&&l(n.enabled)&&(e.preventDefault(),n.onPress())};oi(ee(()=>{const e=Object.values(bt).filter(t=>l(t==null?void 0:t.enabled));return e.length===0?"":y("div",null,[y("br",null,null),y("h4",null,[T("Hotkeys")]),y("div",{style:"column-count: 2"},[e.map(t=>y("div",null,[y(ul,{hotkey:t},null),T(" "),l(t==null?void 0:t.description)]))])])}));const dl=Symbol("Reset");function fl(e){return Ze(t=>{const n=e.call(t,t);return n.id=Dt("reset-"),n.type=dl,n.reset=function(){var i;const r=a=>{if(a!=null&&typeof a=="object"&&!(a instanceof u)&&!(a instanceof o)){if(Jt in a&&a[Jt]===!0)return;if(Ye in a){const s=a;s.value=s[Ye]}else!(a instanceof u)&&!re(a)&&Object.values(a).forEach(s=>r(s))}};l(n.thingsToReset).forEach(r),oe.emit("reset",n),(i=n.onReset)==null||i.call(n)},L(n,"thingsToReset"),n})}const St={};oe.on("removeLayer",e=>{var t;(t=St[e.id])==null||t.call(St),St[e.id]=void 0});const gl=q({__name:"Sticky",setup(e){const t=x("0"),n=new ResizeObserver(i),r=_e(null);function i(){let a=r.value;if(a==null)return;let s=0;for(;a.previousSibling;){const c=a.previousSibling;c.dataset&&"vSticky"in c.dataset&&(s+=c.offsetHeight),a=c}t.value=s+"px"}return Ke(i),document.fonts.ready.then(i),yt(()=>{var s;const a=(s=r.value)==null?void 0:s.parentElement;a&&n.observe(a)}),(a,s)=>(h(),N("div",{class:"sticky",style:me({top:t.value}),ref_key:"element",ref:r,"data-v-sticky":""},[Re(a.$slots,"default",{},void 0,!0)],4))}});var ml=H(gl,[["__scopeId","data-v-cccac690"]]);const hl=q({__name:"Resource",props:{resource:null,color:null},setup(e){const t=e,n=E(()=>Pt(t.resource));return(r,i)=>(h(),N("h2",{style:me({color:e.color,"text-shadow":"0px 0px 10px "+e.color})},V(l(n)),5))}});const pl={class:"main-display"},vl={key:0},bl={key:1},yl=q({__name:"MainDisplay",props:{resource:null,color:null,classes:null,style:null,effectDisplay:null},setup(e){const n=de(e),r=x(null),i=lt(n.effectDisplay),a=E(()=>u.lt(n.resource.value,"1e1000"));return(s,c)=>(h(),R(ml,null,{default:O(()=>{var d,f,b,v;return[g("div",{class:te(["main-display-container",(d=e.classes)!=null?d:{}]),style:me([{height:`${((b=(f=r.value)==null?void 0:f.$el.clientHeight)!=null?b:0)+50}px`},(v=e.style)!=null?v:{}])},[g("div",pl,[l(a)?(h(),N("span",vl,"You have ")):$("",!0),y(hl,{resource:e.resource,color:e.color||"white"},null,8,["resource","color"]),T(" "+V(e.resource.displayName),1),l(i)?(h(),N("span",bl,[T(", "),(h(),R(se(l(i)),{ref_key:"effectRef",ref:r},null,512))])):$("",!0)])],6)]}),_:1}))}});function _l(e,t){return L(t,"display"),L(t,"classes"),L(t,"style"),L(t,"direction"),ce(t,"direction",K.Up),L(t,"xoffset"),L(t,"yoffset"),t.pinnable&&(t.pinned=_t(!1,!1)),Ke(()=>{const n=e[Be];e[Be]=Q;const r=e[Ue].bind(e);e[Ue]=function(){const{display:a,classes:s,style:c,direction:d,xoffset:f,yoffset:b,pinned:v}=this;return{element:{[Be]:n,[Ue]:r},display:a,classes:s,style:l(c),direction:d,xoffset:f,yoffset:b,pinned:v}}.bind(t)}),t}var wl=q({props:{display:{type:z(Object,String,Function),required:!0},visibility:{type:z(Number,Boolean),required:!0},style:z(Object,String,Array),classes:z(Object),onClick:Function,onHold:Function,canClick:{type:z(Boolean),required:!0},small:Boolean,mark:z(Boolean,String),id:{type:String,required:!0}},components:{Node:Qe,MarkNode:Hn},setup(e){const{display:t,onClick:n,onHold:r}=de(e),i=_e("");Ae(()=>{var b;const c=we(t);if(c==null){i.value="";return}if(At(c)){i.value=ue(c);return}const d=ue((b=c.title)!=null?b:"","h3"),f=ue(c.description,"div");i.value=ue(ee(()=>y("span",null,[c.title!=null?y("div",null,[y(d,null,null)]):null,y(f,null,null)])))});const{start:a,stop:s}=Un(n,r);return{start:a,stop:s,comp:i,Visibility:at,isVisible:On,isHidden:Vn,unref:l}}});function Nl(e,t,n,r,i,a){var d;const s=ze("MarkNode"),c=ze("Node");return e.isVisible(e.visibility)?(h(),N("button",{key:0,style:me([{visibility:e.isHidden(e.visibility)?"hidden":void 0},(d=e.unref(e.style))!=null?d:[]]),onClick:t[0]||(t[0]=(...f)=>e.onClick&&e.onClick(...f)),onMousedown:t[1]||(t[1]=(...f)=>e.start&&e.start(...f)),onMouseleave:t[2]||(t[2]=(...f)=>e.stop&&e.stop(...f)),onMouseup:t[3]||(t[3]=(...f)=>e.stop&&e.stop(...f)),onTouchstartPassive:t[4]||(t[4]=(...f)=>e.start&&e.start(...f)),onTouchendPassive:t[5]||(t[5]=(...f)=>e.stop&&e.stop(...f)),onTouchcancelPassive:t[6]||(t[6]=(...f)=>e.stop&&e.stop(...f)),class:te({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)?(h(),R(se(e.unref(e.comp)),{key:0})):$("",!0),y(s,{mark:e.unref(e.mark)},null,8,["mark"]),y(c,{id:e.id},null,8,["id"])],38)):$("",!0)}var Cl=H(wl,[["render",Nl],["__scopeId","data-v-211328c0"]]);const kl=Symbol("Clickable");function Sl(e,...t){const n=t.reduce((r,i)=>{var a;return Object.assign(r,(a=i.getPersistentData)==null?void 0:a.call(i))},{});return Ze(r=>{var s,c,d;const i=(s=e==null?void 0:e.call(r,r))!=null?s:{};i.id=Dt("clickable-"),i.type=kl,i[Be]=Cl;for(const f of t)(c=f.preConstruct)==null||c.call(f,i);if(Object.assign(i,n),L(i,"visibility"),ce(i,"visibility",at.Visible),L(i,"canClick"),ce(i,"canClick",!0),L(i,"classes"),L(i,"style"),L(i,"mark"),L(i,"display"),i.onClick){const f=i.onClick.bind(i);i.onClick=function(b){l(i.canClick)!==!1&&f(b)}}if(i.onHold){const f=i.onHold.bind(i);i.onHold=function(){l(i.canClick)!==!1&&f()}}for(const f of t)(d=f.postConstruct)==null||d.call(f,i);const a=t.reduce((f,b)=>{var v;return Object.assign(f,(v=b.getGatheredProps)==null?void 0:v.call(b,i))},{});return i[Ue]=function(){const{display:f,visibility:b,style:v,classes:w,onClick:k,onHold:_,canClick:S,small:P,mark:I,id:M}=this;return{display:f,visibility:b,style:l(v),classes:w,onClick:k,onHold:_,canClick:S,small:P,mark:I,id:M,...a}},i})}function Il(e){return Sl(t=>{const n=e.call(t,t);L(n,"showNextAt"),ce(n,"showNextAt",!0),ce(n,"minimumGain",1),n.resetDescription==null?n.resetDescription=E(()=>u.lt(n.conversion.gainResource.value,1e3)?"Reset for ":""):L(n,"resetDescription"),n.display==null&&(n.display=ee(()=>y("span",null,[l(n.resetDescription),y("b",null,[Pt(n.conversion.gainResource,u.max(l(n.conversion.actualGain),l(n.minimumGain)))])," ",n.conversion.gainResource.displayName,l(n.showNextAt)!=null?y("div",null,[y("br",null,null),l(n.conversion.buyMax)?"Next:":"Req:"," ",Pt(n.conversion.baseResource,!l(n.conversion.buyMax)&&u.gte(l(n.conversion.actualGain),1)?l(n.conversion.currentAt):l(n.conversion.nextAt))," ",n.conversion.baseResource.displayName]):null]))),n.canClick==null&&(n.canClick=E(()=>u.gte(l(n.conversion.actualGain),l(n.minimumGain))));const r=n.onClick;return n.onClick=function(i){l(n.canClick)!==!1&&(n.conversion.convert(),n.tree.reset(n.treeNode),n.resetTime&&(n.resetTime.value=n.resetTime[Ye]),r==null||r(i))},n})}function $l(e){return Qo(t=>{const n=e.call(t,t);return ce(n,"display",En(n.layerID)),L(n,"append"),{...n,onClick:l(n.append)?function(){if(F.tabs.includes(n.layerID)){const r=F.tabs.lastIndexOf(n.layerID);F.tabs.splice(r,1)}else F.tabs.push(n.layerID)}:function(){F.tabs.splice(1,1,n.layerID)}}})}const wn="p",Ft=sn(wn,function(){const e="Prestige",t="#4BDC13",n=Gn(0,"prestige points"),r=il(()=>({formula:f=>f.div(10).sqrt(),baseResource:Et.points,gainResource:n})),i=fl(()=>({thingsToReset:()=>[Ft]})),a=$l(()=>({layerID:wn,color:t,reset:i})),s=_l(a,{display:nl(n),pinnable:!0}),c=Il(()=>({conversion:r,tree:Et.tree,treeNode:a})),d=cl(()=>({description:"Reset for prestige points",key:"p",onPress:c.onClick}));return{name:e,color:t,points:n,tooltip:s,display:ee(()=>y(W,null,[y(yl,{resource:n,color:t},null),wt(c)])),treeNode:a,hotkey:d}}),Et=sn("main",function(){const e=Gn(10),t=Fo(e),n=Eo(e),r=E(()=>new u(1));oe.on("update",s=>{e.value=u.add(e.value,u.times(r.value,s))});const i=Lo(e,r),a=el(()=>({nodes:[[Ft.treeNode]],branches:[],onReset(){e.value=gn(this.resettingNode.value)===gn(Ft.treeNode)?0:10,t.value=e.value,n.value=e.value},resetPropagation:tl}));return{name:"Tree",links:a.links,display:ee(()=>y(W,null,[F.devSpeed===0?y("div",null,[T("Game Paused"),y(Qe,{id:"paused"},null)]):null,F.devSpeed!=null&&F.devSpeed!==0&&F.devSpeed!==1?y("div",null,[T("Dev Speed: "),Ne(F.devSpeed),T("x"),y(Qe,{id:"devspeed"},null)]):null,F.offlineTime!=null&&F.offlineTime!==0?y("div",null,[T("Offline Time: "),Lt(F.offlineTime),y(Qe,{id:"offline"},null)]):null,y("div",null,[u.lt(e.value,"1e1000")?y("span",null,[T("You have ")]):null,y("h2",null,[Ne(e.value)]),u.lt(e.value,"1e1e6")?y("span",null,[T(" points")]):null]),u.gt(r.value,0)?y("div",null,[T("("),i.value,T(")"),y(Qe,{id:"oomps"},null)]):null,y(Po,null,null),wt(a)])),points:e,best:t,total:n,oomps:i,tree:a}}),Ml=e=>[Et,Ft],un=E(()=>!1);function xl(e,t){}var Tl=Object.freeze(Object.defineProperty({__proto__:null,main:Et,getInitialLayers:Ml,hasWon:un,fixOldSave:xl},Symbol.toStringTag,{value:"Module"}));const Pl={class:"field"},Fl=q({__name:"Toggle",props:{title:null,modelValue:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=E(()=>{var a;return ue((a=l(n.title))!=null?a:"<span></span>","span")}),i=E({get(){return!!n.modelValue},set(a){t("update:modelValue",a)}});return(a,s)=>(h(),N("label",Pl,[Yt(g("input",{type:"checkbox",class:"toggle","onUpdate:modelValue":s[0]||(s[0]=c=>re(i)?i.value=c:null)},null,512),[[nr,l(i)]]),(h(),R(se(l(r))))]))}});var Me=H(Fl,[["__scopeId","data-v-11046116"]]);const Nt=e=>(Ce("data-v-06de52e9"),e=e(),ke(),e),El={class:"game-over-modal-header"},Ol=["src","alt"],Vl={class:"game-over-modal-title"},Ll=Nt(()=>g("h2",null,"Congratulations!",-1)),Dl={key:0},Rl=Nt(()=>g("br",null,null,-1)),Al=Nt(()=>g("div",null," Please check the Discord to discuss the game or to check for new content updates! ",-1)),ql=Nt(()=>g("br",null,null,-1)),Bl=["href"],Ul=Nt(()=>g("span",{class:"material-icons game-over-modal-discord"},"discord",-1)),zl=q({__name:"GameOverScreen",setup(e){const{title:t,logo:n,discordName:r,discordLink:i,versionNumber:a,versionTitle:s}=U,c=E(()=>Lt(F.timePlayed)),d=E(()=>un.value&&!F.keepGoing),f=Fe(F,"autosave");function b(){F.keepGoing=!0}function v(){Te(et())}return(w,k)=>(h(),R(Ee,{"model-value":l(d)},{header:O(()=>[g("div",El,[l(n)?(h(),N("img",{key:0,class:"game-over-modal-logo",src:l(n),alt:l(t)},null,8,Ol)):$("",!0),g("div",Vl,[Ll,g("h4",null,"You've beaten "+V(l(t))+" v"+V(l(a))+": "+V(l(s)),1)])])]),body:O(({shown:_})=>[_?(h(),N("div",Dl,[g("div",null,"It took you "+V(l(c))+" to beat the game.",1),Rl,Al,ql,g("div",null,[g("a",{href:l(i),class:"game-over-modal-discord-link"},[Ul,T(" "+V(l(r)),1)],8,Bl)]),y(Me,{title:"Autosave",modelValue:l(f),"onUpdate:modelValue":k[0]||(k[0]=S=>re(f)?f.value=S:null)},null,8,["modelValue"])])):$("",!0)]),footer:O(()=>[g("div",{class:"game-over-footer"},[g("button",{onClick:b,class:"button"},"Keep Going"),g("button",{onClick:v,class:"button danger"},"Play Again")])]),_:1},8,["model-value"]))}});var Gl=H(zl,[["__scopeId","data-v-06de52e9"]]);const Hl={class:"field"},jl={key:0,class:"field-title"},Wn=q({__name:"Select",props:{title:null,modelValue:null,options:null,placeholder:null,closeOnSelect:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){var s;const n=e,r=lt(Fe(n,"title"),"span"),i=x((s=n.options.find(c=>c.value===n.modelValue))!=null?s:null);he(Fe(n,"modelValue"),c=>{var d;we(i)!==c&&(i.value=(d=n.options.find(f=>f.value===c))!=null?d:null)});function a(c){t("update:modelValue",c.value)}return(c,d)=>(h(),N("div",Hl,[l(r)?(h(),N("span",jl,[(h(),R(se(l(r))))])):$("",!0),y(l(lr),{options:e.options,modelValue:i.value,"onUpdate:modelValue":[d[0]||(d[0]=f=>i.value=f),a],min:1,"label-by":"label",placeholder:e.placeholder,"close-on-select":e.closeOnSelect},null,8,["options","modelValue","placeholder","close-on-select"])]))}});const cn=e=>(Ce("data-v-a03820c0"),e=e(),ke(),e),Wl=cn(()=>g("h2",null,"Saves Manager",-1)),Jl={key:0,style:{color:"var(--danger)"}},Kl={class:"modal-footer"},Yl={class:"field"},Zl=cn(()=>g("span",{class:"field-title"},"Create Save",-1)),Xl={class:"field-buttons"},Ql={class:"footer"},eu=cn(()=>g("div",{style:{"flex-grow":"1"}},null,-1)),tu=q({__name:"SavesManager",setup(e,{expose:t}){const n=x(!1),r=x(null);t({open(){n.value=!0}});const i=x(!1),a=x(""),s=x(null);he(a,I=>{I?Ke(()=>{var M;try{if(I=(M=qe(I))!=null?M:"",I===""){console.warn("Unable to determine preset encoding",I),i.value=!0;return}const A=JSON.parse(I);if(typeof A!="object"){i.value=!0;return}const ie=ft();A.id=ie,ae(A),a.value="",i.value=!1,G.saves.push(ie)}catch{i.value=!0}}):i.value=!1});let c={},d=x(Object.keys(c).reduce((I,M)=>(I.push({label:M.split("/").slice(-1)[0].slice(0,-4),value:c[M]}),I),[]));he(n,I=>{I&&ri()});const f=E(()=>G.saves.reduce((I,M)=>(I[M]=ni(M),I),{})),b=E(()=>{var I;return((I=ge.value)==null?void 0:I.loggedIn)===!0&&G.saves.length<ot.value.length});function v(I){let M;switch(F.id===I?M=rt(F):M=JSON.stringify(f.value[I]),U.exportEncoding){default:console.warn(`Unknown save encoding: ${U.exportEncoding}. Defaulting to lz`);case"lz":M=Ge.compressToUTF16(M);break;case"base64":M=btoa(unescape(encodeURIComponent(M)));break;case"plain":break}const A=document.createElement("textarea");A.value=M,document.body.appendChild(A),A.select(),A.setSelectionRange(0,99999),document.execCommand("copy"),document.body.removeChild(A)}function w(I){F.id===I&&ae();const M={...f.value[I],id:ft()};ae(M),G.saves.push(M.id)}function k(I){var M;((M=ge.value)==null?void 0:M.loggedIn)===!0&&ge.value.getSaveList().then(A=>{var fe;const ie=Object.keys(A).find(Bt=>{const Ut=A[Bt].content;try{if(JSON.parse(Ut).id===I)return!0}catch{return!1}});ie!=null&&((fe=ge.value)==null||fe.save(parseInt(ie),"","").catch(console.error))}),G.saves=G.saves.filter(A=>A!==I),localStorage.removeItem(I),kt(I)}function _(I){f.value[F.id].time=F.time,ae(),kt(F.id),Te(f.value[I]),kt(I)}function S(I){var A;if(s.value=I,Ke(()=>{s.value=null}),I=(A=qe(I))!=null?A:"",I===""){console.warn("Unable to determine preset encoding",I);return}const M=JSON.parse(I);M.id=ft(),ae(M),G.saves.push(M.id),_(M.id)}function P(I,M){const A=f.value[I];A!=null&&(A.name=M,F.id===I?(F.name=M,ae()):(ae(A),kt(I)))}return(I,M)=>(h(),R(Ee,{modelValue:n.value,"onUpdate:modelValue":M[4]||(M[4]=A=>n.value=A),ref_key:"modal",ref:r},{header:O(()=>[Wl]),body:O(({shown:A})=>[l(b)?(h(),N("div",Jl," Not all saves are synced! You may need to delete stale saves. ")):$("",!0),A?(h(),R(l(or),{key:1,list:l(G).saves,handle:".handle",itemKey:ie=>ie},{item:O(({element:ie})=>[y(Kt,{save:l(f)[ie],onOpen:fe=>_(ie),onExport:fe=>v(ie),onEditName:fe=>P(ie,fe),onDuplicate:fe=>w(ie),onDelete:fe=>k(ie)},null,8,["save","onOpen","onExport","onEditName","onDuplicate","onDelete"])]),_:1},8,["list","itemKey"])):$("",!0)]),footer:O(()=>[g("div",Kl,[y(zn,{modelValue:a.value,"onUpdate:modelValue":M[0]||(M[0]=A=>a.value=A),title:"Import Save",placeholder:"Paste your save here!",class:te({importingFailed:i.value})},null,8,["modelValue","class"]),g("div",Yl,[Zl,g("div",Xl,[g("button",{class:"button",onClick:M[1]||(M[1]=A=>_(l(et)().id))},"New Game"),Object.keys(l(d)).length>0?(h(),R(Wn,{key:0,options:l(d),modelValue:s.value,"onUpdate:modelValue":M[2]||(M[2]=A=>S(A)),closeOnSelect:"",placeholder:"Select preset",class:"presets"},null,8,["options","modelValue"])):$("",!0)])]),g("div",Ql,[eu,g("button",{class:"button modal-default-button",onClick:M[3]||(M[3]=A=>n.value=!1)}," Close ")])])]),_:1},8,["modelValue"]))}});var Jn=H(tu,[["__scopeId","data-v-a03820c0"]]);const qt=e=>(Ce("data-v-10d75940"),e=e(),ke(),e),nu=qt(()=>g("div",{class:"nan-modal-header"},[g("h2",null,"NaN value detected!")],-1)),ru={key:0},iu=qt(()=>g("br",null,null,-1)),au=["href"],su=qt(()=>g("span",{class:"material-icons nan-modal-discord"},"discord",-1)),ou=qt(()=>g("br",null,null,-1)),lu={class:"nan-footer"},uu=q({__name:"NaNScreen",setup(e){const{discordName:t,discordLink:n}=U,r=x(!0),i=x(!0),a=Fe(j,"hasNaN"),s=x(null);he(a,w=>{w?(r.value=F.autosave,i.value=F.devSpeed===0):(F.autosave=r.value,F.devSpeed=i.value?0:null)});const c=E(()=>{var w;return(w=j.NaNPath)==null?void 0:w.join(".")}),d=E(()=>j.NaNPersistent!=null?j.NaNPersistent.value:null);function f(){j.NaNPersistent!=null&&(j.NaNPersistent.value=new u(0),j.hasNaN=!1)}function b(){j.NaNPersistent&&(j.NaNPersistent.value=new u(1),j.hasNaN=!1)}function v(){j.NaNPersistent&&(j.NaNPersistent.value=new u(NaN),j.hasNaN=!1)}return(w,k)=>(h(),N(W,null,[y(Ee,Pe({modelValue:l(a),"onUpdate:modelValue":k[4]||(k[4]=_=>re(a)?a.value=_:null)},w.$attrs),{header:O(()=>[nu]),body:O(()=>[g("div",null,[T(' Attempted to assign "'+V(l(c))+'" to NaN',1),l(d)?(h(),N("span",ru,V(" ")+"(previously "+V(l(Ne)(l(d)))+")",1)):$("",!0),T(". Auto-saving has been "+V(r.value?"enabled":"disabled")+". Check the console for more details, and consider sharing it with the developers on discord. ",1)]),iu,g("div",null,[g("a",{href:l(n)||"https://discord.gg/yJ4fjnjU54",class:"nan-modal-discord-link"},[su,T(" "+V(l(t)||"Profectus & Friends"),1)],8,au)]),ou,y(Me,{title:"Autosave",modelValue:r.value,"onUpdate:modelValue":k[0]||(k[0]=_=>r.value=_)},null,8,["modelValue"]),l(U).enablePausing?(h(),R(Me,{key:0,title:"Pause game",modelValue:i.value,"onUpdate:modelValue":k[1]||(k[1]=_=>i.value=_)},null,8,["modelValue"])):$("",!0)]),footer:O(()=>[g("div",lu,[g("button",{onClick:k[2]||(k[2]=_=>{var S;return(S=s.value)==null?void 0:S.open()}),class:"button"},"Open Saves Manager"),g("button",{onClick:f,class:"button"},"Set to 0"),g("button",{onClick:b,class:"button"},"Set to 1"),l(d)&&l(u).neq(l(d),0)&&l(u).neq(l(d),1)?(h(),N("button",{key:0,onClick:k[3]||(k[3]=_=>a.value=!1),class:"button"}," Set to previous ")):$("",!0),g("button",{onClick:v,class:"button danger"},"Ignore")])]),_:1},16,["modelValue"]),y(Jn,{ref_key:"savesManager",ref:s},null,512)],64))}});var cu=H(uu,[["__scopeId","data-v-10d75940"]]);const du=q({components:{Context:qn,ErrorVue:Sn},props:{index:{type:Number,required:!0},display:{type:z(Object,String,Function),required:!0},minimizedDisplay:z(Object,String,Function),minimized:{type:Object,required:!0},name:{type:z(String),required:!0},color:z(String),minimizable:z(Boolean),nodes:{type:Object,required:!0}},emits:["setMinimized"],setup(e){const{display:t,index:n,minimized:r,minimizedDisplay:i}=de(e),a=Os(t),s=lt(i),c=E(()=>U.allowGoBack&&n.value>0&&!we(r));function d(){F.tabs.splice(l(e.index),1/0)}function f(v){e.nodes.value=v}const b=x([]);return rr((v,w,k)=>(console.warn(`Error caught in "${e.name}" layer`,v,w,k),b.value.push(v instanceof Error?v:new Error(JSON.stringify(v))),!1)),{component:a,minimizedComponent:s,showGoBack:c,updateNodes:f,unref:l,goBack:d,errors:b}}}),fu={key:1};function gu(e,t,n,r,i,a){const s=ze("ErrorVue"),c=ze("Context");return e.errors.length>0?(h(),R(s,{key:0,errors:e.errors},null,8,["errors"])):(h(),N("div",Pe({key:1,class:"layer-container",style:{"--layer-color":e.unref(e.color)}},e.$attrs),[e.showGoBack?(h(),N("button",{key:0,class:"goBack",onClick:t[0]||(t[0]=(...d)=>e.goBack&&e.goBack(...d))},"\u274C")):$("",!0),e.unref(e.minimized)?(h(),N("button",{key:1,class:"layer-tab minimized",onClick:t[1]||(t[1]=d=>e.$emit("setMinimized",!1))},[e.minimizedComponent?(h(),R(se(e.minimizedComponent),{key:0})):(h(),N("div",fu,V(e.unref(e.name)),1))])):(h(),N("div",{key:2,class:te(["layer-tab",{showGoBack:e.showGoBack}])},[y(c,{onUpdateNodes:e.updateNodes},{default:O(()=>[(h(),R(se(e.component)))]),_:1},8,["onUpdateNodes"])],2)),e.unref(e.minimizable)?(h(),N("button",{key:3,class:"minimize",onClick:t[2]||(t[2]=d=>e.$emit("setMinimized",!0))}," \u25BC ")):$("",!0)],16))}var mu=H(du,[["render",gu],["__scopeId","data-v-a9f5b1da"]]);const Kn=e=>(Ce("data-v-45b73486"),e=e(),ke(),e),hu=Kn(()=>g("h2",null,"Changelog",-1)),pu=Kn(()=>g("details",{open:""},[g("summary",null,[T("v0.0 Initial Commit - "),g("time",null,"2021-09-04")]),T(" This is the first release :D "),g("ul",null,[g("li",{class:"feature"},"Did everything"),g("li",{class:"fix"},"Had some fun"),g("li",{class:"breaking"},"Removed everything"),g("li",{class:"balancing"},"Created some bugs to fix later")])],-1)),vu=q({__name:"Changelog",setup(e,{expose:t}){const n=x(!1);return t({open(){n.value=!0}}),(r,i)=>(h(),R(Ee,{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=a=>n.value=a)},{header:O(()=>[hu]),body:O(()=>[pu]),_:1},8,["modelValue"]))}});var bu=H(vu,[["__scopeId","data-v-45b73486"]]);const Xe=e=>(Ce("data-v-3e5d5ff9"),e=e(),ke(),e),yu={class:"info-modal-header"},_u=["src","alt"],wu={class:"info-modal-title"},Nu={key:0},Cu={key:0},ku={key:0},Su=Xe(()=>g("div",null," Made in Profectus, by thepaperpilot with inspiration from Acameada and Jacorb ",-1)),Iu=Xe(()=>g("br",null,null,-1)),$u=Xe(()=>g("br",null,null,-1)),Mu=["href"],xu=Xe(()=>g("span",{class:"material-icons info-modal-discord"},"discord",-1)),Tu=Xe(()=>g("div",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",class:"info-modal-discord-link",target:"_blank"},[g("span",{class:"material-icons info-modal-discord"},"discord"),T(" Profectus & Friends ")])],-1)),Pu=Xe(()=>g("div",null,[g("a",{href:"https://discord.gg/F3xveHV",class:"info-modal-discord-link",target:"_blank"},[g("span",{class:"material-icons info-modal-discord"},"discord"),T(" The Modding Tree ")])],-1)),Fu=Xe(()=>g("br",null,null,-1));var Eu=q({__name:"Info",props:{changelog:null},setup(e,{expose:t}){const n=e,{title:r,logo:i,author:a,discordName:s,discordLink:c,versionNumber:d,versionTitle:f}=U,b=de(n),v=x(!1),w=E(()=>Lt(F.timePlayed)),k=E(()=>ue(ee(()=>y(W,null,[In.map(wt)]))));t({open(){v.value=!0}});function _(){var S;(S=l(b.changelog))==null||S.open()}return(S,P)=>(h(),R(Ee,{modelValue:v.value,"onUpdate:modelValue":P[0]||(P[0]=I=>v.value=I)},{header:O(()=>[g("div",yu,[l(i)?(h(),N("img",{key:0,class:"info-modal-logo",src:l(i),alt:l(r)},null,8,_u)):$("",!0),g("div",wu,[g("h2",null,V(l(r)),1),g("h4",null,[T(" v"+V(l(d)),1),l(f)?(h(),N("span",Nu,": "+V(l(f)),1)):$("",!0)])])])]),body:O(({shown:I})=>[I?(h(),N("div",Cu,[l(a)?(h(),N("div",ku,"By "+V(l(a)),1)):$("",!0),Su,Iu,g("div",{class:"link",onClick:_},"Changelog"),$u,g("div",null,[l(c)?(h(),N("a",{key:0,href:l(c),class:"info-modal-discord-link",target:"_blank"},[xu,T(" "+V(l(s)),1)],8,Mu)):$("",!0)]),Tu,Pu,Fu,g("div",null,"Time Played: "+V(l(w)),1),(h(),R(se(l(k))))])):$("",!0)]),_:1},8,["modelValue"]))}});var Ou=H(Eu,[["__scopeId","data-v-3e5d5ff9"]]);const Vu={class:"header"},Lu=g("h2",null,"Settings",-1),Du={class:"option-tabs"},Ru={key:0},Au={key:1};var qu=q({__name:"Options",setup(e,{expose:t}){const n=x(!1),r=x("behaviour");function i(Ie){return Ie==r.value}function a(Ie){r.value=Ie}t({isTab:i,setTab:a,save:ae,open(){n.value=!0}});const s=Object.keys(Qt).map(Ie=>({label:En(Ie),value:Ie})),c=E(()=>ue(ee(()=>y(W,null,[si.map(wt)])))),{showTPS:d,theme:f,unthrottled:b,alignUnits:v,showHealthWarning:w}=de(G),{autosave:k,offlineProd:_}=de(F),S=E({get(){return F.devSpeed===0},set(Ie){F.devSpeed=Ie?0:null}}),P=ee(()=>y("span",{class:"option-title"},[T("Unthrottled"),y("desc",null,[T("Allow the game to run as fast as possible. Not battery friendly.")])])),I=ee(()=>y("span",{class:"option-title"},[T("Offline production"),y(Q,{display:"Save-specific",direction:K.Right},{default:()=>[T("*")]}),y("desc",null,[T("Simulate production that occurs while the game is closed.")])])),M=ee(()=>y("span",{class:"option-title"},[T("Show videogame addiction warning"),y("desc",null,[T("Show a helpful warning after playing for a long time about video game addiction and encouraging you to take a break.")])])),A=ee(()=>y("span",{class:"option-title"},[T("Autosave"),y(Q,{display:"Save-specific",direction:K.Right},{default:()=>[T("*")]}),y("desc",null,[T("Automatically save the game every second or when the game is closed.")])])),ie=ee(()=>y("span",{class:"option-title"},[T("Pause game"),y(Q,{display:"Save-specific",direction:K.Right},{default:()=>[T("*")]}),y("desc",null,[T("Stop everything from moving.")])])),fe=ee(()=>y("span",{class:"option-title"},[T("Theme"),y("desc",null,[T("How the game looks.")])])),Bt=ee(()=>y("span",{class:"option-title"},[T("Show TPS"),y("desc",null,[T("Show TPS meter at the bottom-left corner of the page.")])])),Ut=ee(()=>y("span",{class:"option-title"},[T("Align modifier units"),y("desc",null,[T("Align numbers to the beginning of the unit in modifier view.")])]));return(Ie,J)=>(h(),R(Ee,{modelValue:n.value,"onUpdate:modelValue":J[11]||(J[11]=ne=>n.value=ne)},{header:O(()=>[g("div",Vu,[Lu,g("div",Du,[g("button",{class:te({selected:i("behaviour")}),onClick:J[0]||(J[0]=ne=>a("behaviour"))},"Behaviour",2),g("button",{class:te({selected:i("appearance")}),onClick:J[1]||(J[1]=ne=>a("appearance"))},"Appearance",2)])])]),body:O(()=>[i("behaviour")?(h(),N("div",Ru,[y(Me,{title:l(P),modelValue:l(b),"onUpdate:modelValue":J[2]||(J[2]=ne=>re(b)?b.value=ne:null)},null,8,["title","modelValue"]),l(U).enablePausing?(h(),R(Me,{key:0,title:l(ie),modelValue:l(S),"onUpdate:modelValue":J[3]||(J[3]=ne=>re(S)?S.value=ne:null)},null,8,["title","modelValue"])):$("",!0),y(Me,{title:l(I),modelValue:l(_),"onUpdate:modelValue":J[4]||(J[4]=ne=>re(_)?_.value=ne:null)},null,8,["title","modelValue"]),l(U).disableHealthWarning?$("",!0):(h(),R(Me,{key:1,title:l(M),modelValue:l(w),"onUpdate:modelValue":J[5]||(J[5]=ne=>re(w)?w.value=ne:null)},null,8,["title","modelValue"])),y(Me,{title:l(A),modelValue:l(k),"onUpdate:modelValue":J[6]||(J[6]=ne=>re(k)?k.value=ne:null)},null,8,["title","modelValue"]),l(k)?$("",!0):(h(),R(Zt,{key:2,class:"button save-button",onClick:J[7]||(J[7]=ne=>l(ae)())},{default:O(()=>[T("Manually save")]),_:1}))])):$("",!0),i("appearance")?(h(),N("div",Au,[y(Wn,{title:l(fe),options:l(s),modelValue:l(f),"onUpdate:modelValue":J[8]||(J[8]=ne=>re(f)?f.value=ne:null)},null,8,["title","options","modelValue"]),(h(),R(se(l(c)))),y(Me,{title:l(Bt),modelValue:l(d),"onUpdate:modelValue":J[9]||(J[9]=ne=>re(d)?d.value=ne:null)},null,8,["title","modelValue"]),y(Me,{title:l(Ut),modelValue:l(v),"onUpdate:modelValue":J[10]||(J[10]=ne=>re(v)?v.value=ne:null)},null,8,["title","modelValue"])])):$("",!0)]),_:1},8,["modelValue"]))}});const Se=e=>(Ce("data-v-fae09efc"),e=e(),ke(),e),Bu=["src","alt"],Uu={key:1,class:"title"},zu=Se(()=>g("div",{style:{"flex-grow":"1",cursor:"unset"}},null,-1)),Gu={class:"discord"},Hu={class:"discord-links"},ju={key:0},Wu=["href"],Ju=Se(()=>g("li",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),Ku=Se(()=>g("li",null,[g("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),Yu={href:"https://forums.moddingtree.com/",target:"_blank"},Zu=Se(()=>g("span",{class:"material-icons"},"forum",-1)),Xu=Se(()=>g("span",{class:"material-icons"},"info",-1)),Qu=Se(()=>g("span",{class:"material-icons"},"settings",-1)),ec=Se(()=>g("span",{class:"material-icons"},"settings",-1)),tc=Se(()=>g("span",{class:"material-icons"},"info",-1)),nc={href:"https://forums.moddingtree.com/",target:"_blank"},rc=Se(()=>g("span",{class:"material-icons"},"forum",-1)),ic={class:"discord"},ac={class:"discord-links"},sc={key:0},oc=["href"],lc=Se(()=>g("li",null,[g("a",{href:"https://discord.gg/yJ4fjnjU54",target:"_blank"},"Profectus & Friends")],-1)),uc=Se(()=>g("li",null,[g("a",{href:"https://discord.gg/F3xveHV",target:"_blank"},"The Modding Tree")],-1)),cc=q({__name:"Nav",setup(e){const t=x(null),n=x(null),r=x(null),i=x(null),{useHeader:a,banner:s,title:c,discordName:d,discordLink:f,versionNumber:b}=U;function v(){window.open(f,"mywindow")}const w=E(()=>{var k;return((k=ge.value)==null?void 0:k.loggedIn)===!0&&!ot.value.includes(G.active)});return(k,_)=>(h(),N(W,null,[l(a)?(h(),N("div",Pe({key:0,class:"nav"},k.$attrs),[l(s)?(h(),N("img",{key:0,src:l(s),class:"banner",alt:l(c)},null,8,Bu)):(h(),N("div",Uu,V(l(c)),1)),g("div",{onClick:_[0]||(_[0]=S=>{var P;return(P=i.value)==null?void 0:P.open()}),class:"version-container"},[y(Q,{display:"Changelog",direction:l(K).Down,class:"version"},{default:O(()=>[g("span",null,"v"+V(l(b)),1)]),_:1},8,["direction"])]),zu,g("div",Gu,[g("span",{onClick:v,class:"material-icons"},"discord"),g("ul",Hu,[l(f)?(h(),N("li",ju,[g("a",{href:l(f),target:"_blank"},V(l(d)),9,Wu)])):$("",!0),Ju,Ku])]),g("div",null,[g("a",Yu,[y(Q,{display:"Forums",direction:l(K).Down,yoffset:"5px"},{default:O(()=>[Zu]),_:1},8,["direction"])])]),g("div",{onClick:_[1]||(_[1]=S=>{var P;return(P=t.value)==null?void 0:P.open()})},[y(Q,{display:"Info",direction:l(K).Down,class:"info"},{default:O(()=>[Xu]),_:1},8,["direction"])]),g("div",{onClick:_[2]||(_[2]=S=>{var P;return(P=n.value)==null?void 0:P.open()})},[y(Q,{display:"Saves",direction:l(K).Down,xoffset:"-20px"},{default:O(()=>[g("span",{class:te(["material-icons",{needsSync:l(w)}])},"library_books",2)]),_:1},8,["direction"])]),g("div",{onClick:_[3]||(_[3]=S=>{var P;return(P=r.value)==null?void 0:P.open()})},[y(Q,{display:"Settings",direction:l(K).Down,xoffset:"-66px"},{default:O(()=>[Qu]),_:1},8,["direction"])])],16)):(h(),N("div",Pe({key:1,class:"overlay-nav"},k.$attrs),[g("div",{onClick:_[4]||(_[4]=S=>{var P;return(P=i.value)==null?void 0:P.open()}),class:"version-container"},[y(Q,{display:"Changelog",direction:l(K).Right,xoffset:"25%",class:"version"},{default:O(()=>[g("span",null,"v"+V(l(b)),1)]),_:1},8,["direction"])]),g("div",{onClick:_[5]||(_[5]=S=>{var P;return(P=n.value)==null?void 0:P.open()})},[y(Q,{display:"Saves",direction:l(K).Right},{default:O(()=>[g("span",{class:te(["material-icons",{needsSync:l(w)}])},"library_books",2)]),_:1},8,["direction"])]),g("div",{onClick:_[6]||(_[6]=S=>{var P;return(P=r.value)==null?void 0:P.open()})},[y(Q,{display:"Settings",direction:l(K).Right},{default:O(()=>[ec]),_:1},8,["direction"])]),g("div",{onClick:_[7]||(_[7]=S=>{var P;return(P=t.value)==null?void 0:P.open()})},[y(Q,{display:"Info",direction:l(K).Right},{default:O(()=>[tc]),_:1},8,["direction"])]),g("div",null,[g("a",nc,[y(Q,{display:"Forums",direction:l(K).Right,xoffset:"7px"},{default:O(()=>[rc]),_:1},8,["direction"])])]),g("div",ic,[g("span",{onClick:v,class:"material-icons"},"discord"),g("ul",ac,[l(f)?(h(),N("li",sc,[g("a",{href:l(f),target:"_blank"},V(l(d)),9,oc)])):$("",!0),lc,uc])])],16)),y(Ou,{ref_key:"info",ref:t,changelog:i.value},null,8,["changelog"]),y(Jn,{ref_key:"savesManager",ref:n},null,512),y(qu,{ref_key:"options",ref:r},null,512),y(bu,{ref_key:"changelog",ref:i},null,512)],64))}});var Yn=H(cc,[["__scopeId","data-v-fae09efc"]]);const dc={class:"inner-tab"},fc=q({__name:"Game",setup(e){const t=Fe(F,"tabs"),n=E(()=>Object.keys(le)),r=U.useHeader;function i(a){const{display:s,minimized:c,name:d,color:f,minimizable:b,nodes:v,minimizedDisplay:w}=a;return{display:s,minimized:c,name:d,color:f,minimizable:b,nodes:v,minimizedDisplay:w}}return(a,s)=>(h(),N("div",{class:te(["tabs-container",{useHeader:l(r)}])},[(h(!0),N(W,null,Le(l(t),(c,d)=>{var f,b;return h(),N("div",{key:d,class:te(["tab",l((f=l(le)[c])==null?void 0:f.classes)]),style:me(l((b=l(le)[c])==null?void 0:b.style))},[d===0&&!l(r)?(h(),R(Yn,{key:0})):$("",!0),g("div",dc,[l(n).includes(c)?(h(),R(mu,Pe({key:0},i(l(le)[c]),{index:d,onSetMinimized:v=>l(le)[c].minimized.value=v}),null,16,["index","onSetMinimized"])):(h(),R(se(c),{key:1,index:d},null,8,["index"]))])],6)}),128))],2))}});var gc=H(fc,[["__scopeId","data-v-dcd207b4"]]);const mc={key:0,class:"tpsDisplay"},hc=q({__name:"TPS",setup(e){const t=E(()=>u.div(j.lastTenTicks.length,j.lastTenTicks.reduce((n,r)=>n+r,0)));return(n,r)=>l(t).isNan()?$("",!0):(h(),N("div",mc,"TPS: "+V(l(pt)(l(t))),1))}});var pc=H(hc,[["__scopeId","data-v-89b89152"]]);var vc=q({__name:"App",setup(e){const t=U.useHeader,n=E(()=>Qt[G.theme].variables),r=Fe(G,"showTPS"),i=Fe(j,"errors"),a=E(()=>ue(ee(()=>y(W,null,[li.map(wt)]))));return(s,c)=>l(i).length>0?(h(),N("div",{key:0,class:"error-container",style:me(l(n))},[y(Sn,{errors:l(i)},null,8,["errors"])],4)):(h(),N(W,{key:1},[g("div",{id:"modal-root",style:me(l(n))},null,4),g("div",{class:te(["app",{useHeader:l(t)}]),style:me(l(n))},[l(t)?(h(),R(Yn,{key:0})):$("",!0),y(gc),l(l(r))?(h(),R(pc,{key:1})):$("",!0),y(Fs),y(Gl),y(cu),y(xo),(h(),R(se(l(a))))],6)],64))}});var bc=H(vc,[["__scopeId","data-v-1ba599d8"]]);oe.on("setupVue",e=>e.use(ur));function yc(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:s}=e;let c,d,f,b;const v=async(k=!0)=>{await f,k&&(c==null||c.addEventListener("controlling",_=>{_.isUpdate&&window.location.reload()})),await(b==null?void 0:b())};async function w(){if("serviceWorker"in navigator){const{Workbox:k,messageSW:_}=await mt(()=>import("./workbox-window.4a8794bb.js"),[]);b=async()=>{d&&d.waiting&&await _(d.waiting,{type:"SKIP_WAITING"})},c=new k("./sw.js",{scope:"./",type:"classic"}),c.addEventListener("activated",S=>{S.isUpdate||r==null||r()});{const S=()=>{n==null||n()};c.addEventListener("waiting",S),c.addEventListener("externalwaiting",S)}c.register({immediate:t}).then(S=>{d=S,a?a("./sw.js",S):i==null||i(S)}).catch(S=>{s==null||s(S)})}}return f=w(),v}function _c(e={}){const{immediate:t=!0,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:s}=e,c=x(!1),d=x(!1);return{updateServiceWorker:yc({immediate:t,onNeedRefresh(){c.value=!0,n==null||n()},onOfflineReady(){d.value=!0,r==null||r()},onRegistered:i,onRegisteredSW:a,onRegisterError:s}),offlineReady:d,needRefresh:c}}const dn=console.error;console.error=function(...e){dn(...e)};window.onerror=function(e,t,n,r,i){return j.errors.push(i instanceof Error?i:new Error(JSON.stringify(i))),dn(i),!0};window.onunhandledrejection=function(e){j.errors.push(e.reason instanceof Error?e.reason:new Error(JSON.stringify(e.reason))),dn(e.reason)};document.title=U.title;window.projInfo=U;U.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 ti();const{globalBus:e}=await mt(()=>Promise.resolve().then(function(){return ei}),void 0),{startGameLoop:t}=await mt(()=>import("./gameLoop.94f0e4f9.js"),["assets/gameLoop.94f0e4f9.js","assets/@fontsource.f66d05e7.css","assets/vue.359c6955.js","assets/lz-string.bfbf8ec3.js","assets/@vue.6f8187b0.js","assets/nanoevents.1080beb7.js","assets/unofficial-galaxy-sdk.21372393.js","assets/vue-textarea-autosize.35804eaf.js","assets/vuedraggable.055200e5.js","assets/sortablejs.20039f18.js","assets/vue-next-select.68e0c605.js","assets/vue-next-select.9e6f4164.css","assets/vue-toastification.45d39007.js","assets/vue-toastification.4b5f8ac8.css"]),n=window.vue=ir(bc);n.config.errorHandler=function(r,i,a){console.error(r,a,i)},e.emit("setupVue",n),n.mount("#app"),Ke(()=>{const r=cr(),{updateServiceWorker:i}=_c({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{u as D,mt as _,j as a,U as b,Tl as c,oe as g,en as l,F as p,G as s};