-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEasyMod.min.js
12 lines (8 loc) · 48.6 KB
/
EasyMod.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/*Uglified by https://www.uglifyjs.net/*/
var config={keycompress:false,isNode:false,allowsetint:true};var EasyObj={info:{version:"9",createdBy:"BonesYT",modders:["BinaryCrown"],lastBy:"BonesYT",a:{proto:{},"static":{},changed:["Number","Boolean","String","BigInt","Function","Array","Object","Date","ImageData","Math"],totalAdds:undefined,newfuncts:undefined},from:"https://github.com/BonesYT/EasyMod.js",issues:"https://github.com/BonesYT/EasyMod.js/issues",isMin:true,lines:2960},define:(t,e)=>{this[t]=e},undefine:t=>{delete this[t]},isDefined:t=>{return this[t]!==undefined},get:t=>{return this[t]},createMethod:(t,e,r)=>{var n=t;if(typeof n!="function")n=this[t];n.prototype[e]=r},isConst(varname){var zzzz;try{eval(varname.toString());try{eval(`zzzz = ${varname}`);eval(`${varname} = 'Replaced'`);eval(`${varname} = zzzz`);return false}catch{return true}}catch{throw ReferenceError("[EasyMod.js] 0: "+varname+" is not defined")}},protoOf:t=>{this[t].prototype},waitUntil(t=()=>{},e=()=>{},r=10){var n=0,i,s=()=>{if(t(n)){e(n);clearInterval(i)}n++},i=setInterval(s,r)},repeatUntil(t=()=>{},e=()=>{},r=()=>{},n=10){var i=0;while(!t(i)){e(i)}r()},key:{id:{code:{},key:{},num:{},any:false},press:t=>{if(t=="any"|t==-1)return EasyObj.key.id.any;return EasyObj.key.id.code[t]|EasyObj.key.id.key[t]|EasyObj.key.id.num[t]},compressed:config.keycompress},mouse:{ldown:false,mdown:false,rdown:false,down:false,sdown:false,scr:0,scrs:0},addEL(t,e,...r){var n=[t,e];n.push.apply(n,r);document.addEventListener.apply(document,n)},setDef(...t){return t.reduce((t,e)=>{return t==undefined?e:t},undefined)},stc:{abseq:(t,e)=>{if(typeof t==typeof e){switch(typeof t){case"number":return t==e;break;case"string":return t==e;break;case"boolean":return t==e;break;case"bigint":return t==e;break;case"undefined":return true;break;case"object":return t.stringify()==e.stringify();break;case"function":return t.toString()==e.toString();break;case"symbol":return t.toString()==e.toString();break}}else{return false}},gt(t,e){return typeof t==typeof e?t>e:false},gte(t,e){return typeof t==typeof e?t>=e:false},lt(t,e){return typeof t==typeof e?t<e:false},lte(t,e){return typeof t==typeof e?t<=e:false}},doc:{msePos:{x:0,y:0},lmsePos:{x:0,y:0},buttonClick(t,e=()=>{}){if(t.localName!="button")throw TypeError("[EasyMod.js] Element tag is not button");if(!(typeof e=="function"))throw TypeError("[EasyMod.js] onclick needs to be an function");t.addEventListener("click",e)},setGetElementById(t="$"){this[t]=function(t){return document.getElementById(t)}},canv:{canvasMsePos(t,e){if(t.localName!="canvas")throw TypeError("[EasyMod.js] Element tag is not canvas");if(!typeof e=="object")throw TypeError("[EasyMod.js] Target needs to be an object");e.mouse={m:{x:0,y:0},l:{x:0,y:0}};t.addEventListener("mousemove",t=>{e.mouse.m.x=t.offsetX,e.mouse.m.y=t.offsetY});t.addEventListener("mousedown",t=>{e.mouse.l.x=t.offsetX,e.mouse.l.y=t.offsetY})},progbar(t,e=0,r=4,n=4,i=128,s=32,o=4,a="#ffffff",u="#999999",h="#444444",f=0){if(t.localName!="canvas")throw TypeError("[EasyMod.js] Element tag is not canvas");var c=t.getContext("2d");c.fillStyle=h;c.fillRect(r-o,n-o,i+o*2,s+o*2);c.fillStyle=u;c.fillRect(r,n,i,s);c.fillStyle=a;switch(f){case 0:c.fillRect(r,n,i*e,s);break;case 1:c.fillRect(r,n,i,s*e);break;case 2:c.fillRect(r+i*(1-e),n,i*e,s);break;case 3:c.fillRect(r,n+s*(1-e),i,s*e);break}},rect(t,e=0,r=0,n=128,i=128,s="#000000",o=0,a="#222222"){if(t.localName!="canvas")throw TypeError("[EasyMod.js] Element tag is not canvas");var u=t.getContext("2d");u.fillStyle=s;u.strokeStyle=a;u.lineWidth=o;u.fillRect(e,r,n,i);if(o)u.strokeRect(e,r,n,i)},circle(t,e=0,r=0,n=16,i="#000000",s=0,o="#222222"){if(t.localName!="canvas")throw TypeError("[EasyMod.js] Element tag is not canvas");var a=t.getContext("2d");a.fillStyle=i;a.strokeStyle=o;a.lineWidth=s;a.beginPath();a.arc(e,r,n,0,Math.PI*2);a.fill();if(s)a.stroke();a.closePath()}},effect(t,e=1,r=document.querySelector("html")){r.style.filter=`${t}(${e})`},setinner(t,e){if(!(typeof t=="object"&t.toString().includes("HTML")))throw TypeError("[EasyMod.js] Target has to be an HTML element");t.innerHTML=e},reload(){document.location.reload()},getCSS(){var t=document.querySelectorAll('html>head>link[rel="stylesheet"]'),e=[];t.forEach(t=>{e.push(t.href)});return e},getJS(){var t=document.querySelectorAll("html>head>script[src]"),e=[];t.forEach(t=>{e.push(t.src)});return e},readfile(t){var e=t.files[0],r,n;n=e.text();n.then(t=>r=t);return r},zoom(t){document.querySelector("html").style.zoom=t}},eval(t,e=true){return new Function("thisObj",(e?"return ":"")+t)(this)},playaudio(t,e=1,r=1,n=()=>{}){var i=new Audio(t);i.volume=e;i.playbackRate=r;i.onload=n;i.play()},set:{"var"(t,e,r){r[t]=e},"const"(t,e,r){Object.defineProperty(r,t,{value:e,writable:false,enumerable:true,configurable:true})}},time:0,toReadme:{part(t){return`# ${t}\n${EasyObj.info.a.proto[t].length==0?"":"* "+EasyObj.info.a.proto[t].sort().join(", ")+"\n"}${EasyObj.info.a["static"][t].length==0?"":"* static: "+EasyObj.info.a["static"][t].sort().join(", ")+"\n"}`},full(){var r="# Extra Methods and statics\n",n=EasyObj.toReadme.part;EasyObj.info.a.proto.forEach((t,e)=>{r+=n(e)});r+="\n"+EasyObj.toReadme.easyobj();return r},easyobj(){return`# EasyObj\n* EasyObj is an object with abilities.\n* ${Object.keys(EasyObj).join(", ")}`},absfull(){return`# EasyMod.js
EasyMod.js by BonesYT, a library that adds a variety methods into JS!
This adds a lot of methods to: strings, numbers, booleans, bigint, functions, arrays, objects and date!
Version: VU${EasyObj.info.version}
VU = Version Update
Helpers/credits (2 users): ${[EasyObj.info.createdBy].concat(EasyObj.info.modders).join(", ")}
${EasyObj.toReadme.full()}`}},clipb:{info:"",get(){try{var t;navigator.clipboard.read().then(async t=>{try{await t[0].getType("text/plain").then(t=>{t.text().then(t=>EasyObj.clipb.info=t)})}catch{EasyObj.clipb.info=null;return false}});return true}catch{return false}}},type(t,...e){switch(t){case"number":return Number(e[0]);case"boolean":return Boolean(e[0]);case"string":return String(e[0]);case"bigint":return BigInt(e[0]);case"object":return Object(e[0]);case"symbol":return Symbol(e[0]);case"function":return Function.apply(null,e);case"array":return Array.apply(null,e);case"undefined":return undefined}},errors:["Error","RangeError","ReferenceError","SyntaxErrror","TypeError","URIError","EvalError"],prt:{s:["{","[","(",'"',"'","`"],e:["}","]",")",'"',"'","`"]},random:undefined,isNode:config.isNode,setint:config.allowsetint,dc:{title:undefined,icon:undefined,setTitle(t){document.querySelector("html>head>title").innerHTML=t;EasyObj.dc.title=t.toString()},setIcon(t){document.querySelector('html>head>link[rel="shortcut icon"]').href=t;EasyObj.dc.icon=t.toString()}},fractal(t=0,e=(t,e)=>{},r=(t,e)=>{},n=Infinity,i=false){var s=t,o=[s];for(var a=0;!e(s,a)&a<n;a++){s=r(s,a);if(i)o.push(s)}return i?o:s},scrLine(){return Number(Error("test error").stack.substr(81).until(0,":",1))},repeat(t,e=(t,e)=>{},r=(t,e)=>{}){var n=[];for(var i=0;i<t;i++){n.push(e(i,n))}r(i,n);return n},"switch"(r,t=[],e=[]){if(t.length!=e.length)throw Error("[EasyMod.js] both cases and functs arrays has to have the same length");var n=-1,i;t=t.map(t=>{if(!t.isArray)return[t]});t.forEach((t,e)=>{if(t.includes(r)&n==-1)n=e});if(n!=-1)return e[n](n,r)},saveWarn:false};delete config;(function(){var add=EasyObj.info.a;function AddObj(t,e={},r={},n){EasyObj.info.a.proto[n]=Object.keys(e);EasyObj.info.a["static"][n]=Object.keys(r);if(t.prototype)Object.assign(t.prototype,e);Object.assign(t,r)}add.changed.forEach(t=>{add.proto[t]=[];add["static"][t]=[]});var P={};var S={};P.add=function(t){return this+t};P.sub=function(t){return this-t};P.inc=function(){return this+1};P.dec=function(){return this-1};P.mul=function(t){return this*t};P.div=function(t){return this/t};P.pow=function(t){return this**t};P.and=function(t){return this&t};P.or=function(t){return this|t};P.xor=function(t){return this^t};P.mod=function(t){return this%t};P.inv=function(t=1){return t/this};P.doub=function(){return this*2};P.half=function(){return this/2};P.trip=function(){return this*3};P.thir=function(){return this/3};P.sqr=function(){return this**2};P.sqrt=function(){return this**.5};P.cb=function(){return this**3};P.cbrt=function(){return this**(1/3)};P.bas=function(t){return t**this};P.nrot=function(t){return this**(1/t)};P.nrotr=function(t){return t**(1/this)};P.neg=function(t=0){return t-this};P.log=function(){return Math.log(this)};P.log10=function(){return Math.log10(this)};P.log2=function(){return Math.log2(this)};P.logb=function(t){return Math.log(this)/Math.log(t)};P.logbr=function(t){return Math.log(t)/Math.log(this)};P.floor=function(t=1){return Math.floor(this/t)*t};P.round=function(t=1){return Math.round(this/t)*t};P.ceil=function(t=1){return Math.ceil(this/t)*t};P.random=function(t=0){return Math.random()*(this-t)+t};P.randomn=function(){return this.random(-this)};P.clz32=function(){return Math.clz32(this)};P.max=function(...t){t.unshift(this);return Math.max.apply(null,t)};P.min=function(...t){t.unshift(this);return Math.min.apply(null,t)};P.sin=function(t=false){return Math.sin(this/(t?Math.degrad:1))};P.cos=function(t=false){return Math.cos(this/(t?Math.degrad:1))};P.tan=function(t=false){return Math.tan(this/(t?Math.degrad:1))};P.asin=function(){return Math.asin(this)};P.acos=function(){return Math.acos(this)};P.atan=function(){return Math.atan(this)};P.atan2=function(){return Math.atan2(this)};P.sinh=function(){return Math.sinh(this)};P.cosh=function(){return Math.cosh(this)};P.tanh=function(){return Math.tanh(this)};P.asinh=function(){return Math.asinh(this)};P.acosh=function(){return Math.acosh(this)};P.atanh=function(){return Math.atanh(this)};P.sign=function(){return Math.sign(this)};P.abs=function(){return Math.abs(this)};P.absn=function(){return Math.abs(this)*-1};P.trunc=function(){return Math.trunc(this)};P.log1p=function(){return Math.log1p(this)};P.fround=function(){return Math.fround(this)};P.hypot=function(...t){t.unshift(this);return Math.hypot.apply(null,t)};P.imul=function(t){return Math.imul(this,t)};P.gt=function(t){return this>t};P.gte=function(t){return this>=t};P.lt=function(t){return this<t};P.lte=function(t){return this<=t};P.comp=function(t=0){return(this-t).sign()};P.isNaN=function(){return isNaN(this)};P.bool=function(){return Boolean(this)};P.floatFix=function(t=12){return Math.round(this*10**t)/10**t};P.lfloor=function(t=10){return this.logb(t).floatFix().floor().bas(t)};P.lround=function(t=10){return this.logb(t).floatFix().round().bas(t)};P.lceil=function(t=10){return this.logb(t).floatFix().ceil().bas(t)};P.isInf=function(){return this==Infinity|this==-Infinity};P.isFin=function(){return this!=Infinity};P.isz=function(){return this==0};P.isPos=function(t){return t?this>=0:this>0};P.isNeg=function(t){return t?this<=0:this<0};P.isalt=function(t=1){return this.abs().lt(t)};P.dti=function(t){var e=this%1;while(e%1>(t||1e-5)){e*=10}return e};P.dtil=function(){return this.dti().log10().floor().add(1)};P.join=function(t){if(this%1!=0&t%1!=0){t=t.dti().add(t.floor().mul(10**t.dtil()))}return String(this)+String(t)};P.low=function(t=0){var e=this.floor();var r=e%1;while(!(Math.floor(e%10)!=0|e<10)){e/=10}return e+(t?r:0)};P.infs=function(){return Math.log10(this)/Math.log10(Number.MAX_VALUE)};P.toDate=function(){return new Date(this)};P.toTimeStr=function(t=false){var e=this%1e3,r=Math.floor(this/1e3)%60,n=Math.floor(this/6e4)%60,i=Math.floor(this/36e5)%24,s=Math.floor(this/864e5)%365,o=Math.floor(this/31536e6),a=[];e=e==1?e+" millisecond ":e+" milliseconds";r=r==1?r+" second":r+" seconds";n=n==1?n+" minute":n+" minutes";i=i==1?i+" hour":i+" hours";s=s==1?s+" day":s+" days";o=o==1?o+" year":o+" years";if(t)a.push(e);if(this>=1e3|!t)a.push(r);if(this>=6e4)a.push(n);if(this>=36e5)a.push(i);if(this>=864e5)a.push(s);if(this>=31536e6)a.push(o);a[a.length-1]=a[a.length-1].trim();return a.join(", ")};P.toTimeStr2=function(t=false,e=false){if(isNaN(this))return null;var r=this%1e3,n=Math.floor(this/1e3)%60,i=Math.floor(this/6e4)%60,s=Math.floor(this/36e5)%(e?24:Infinity),o=Math.floor(this/864e5)%365,a=Math.floor(this/31536e6);var u="";if(t)u+="."+r.toString().padStart(3,"0");u=":"+n.toString().padStart(2,"0")+u;u=":"+i.toString().padStart(2,"0")+u;u=(e?":":"")+s.toString().padStart(2,"0")+u;if(e){u=":"+o.toString().padStart(3,"0")+u;u=a+u}return u};P.reverse=function(){var t=this.toString();t=t.reverse();t=t.number();return isNaN(t)?null:t};P.fitDim=function(t=2){return this.nrot(t).floor().pow(t)};P.signMul=function(t=1){return this.sign().mul(t)};P.sfloor=function(t=1){return t==0?this+0:this.div(t).floatFix().floor().mul(t)};P.sround=function(t=1){return t==0?this+0:this.div(t).floatFix().round().mul(t)};P.sceil=function(t=1){return t==0?this+0:this.div(t).floatFix().ceil().mul(t)};P.toRGB=function(t=false){var e=[this.div(65536).floor()%256,this.div(256).floor()%256,this.floor()%256];if(t)e.push(this.div(16777216).floor()%256);return e};P.dist=function(t){return(this-t).abs()};P.split=function(t=""){var e=this.toString().split(t);return e.map(t=>{return isNaN(Number(t))?t:Number(t)})};P.reverseGroups=function(t){var e=this.split();e=e.reverseGroups(t);return e.joinNum()};P.radtodeg=function(){return this*Math.degrad};P.degtorad=function(){return this/Math.degrad};P.hasDec=function(){return this%1!=0};P.limz=function(){return this.max(0)};P.location=function(t,e){return(this-t)/(e-t)};P.ellip2=function(){return Math.PI*this**2};P.ellip3=function(){return 4/3*Math.PI*this**3};P.divabs=function(t){var e=[this,t];if(t>this)e.reverse();return e[0]/e[1]};P.getdec=function(){return this%1};P.separate=function(t=false){var e=[Math.floor(this),this%1];if(t)e.reverse();return e};P.loga=function(){var t=this.abs(),e=t<1?t:t/t.lfloor(10),r=t.log10().floor();c=r.log10().floor(),o=[this.sign()];r=r/r.lfloor(10);e=e>=10?e/10:e;r=r>=10?r/10:r;o.push(e);if(t>=10)o.push(r);if(t>=1e10)o.push(c);return o};P.toStringFix=function(t=.01,e=6,r=-6){if(this.isNeg()&this.isInf())return"-Infinity";if(this.isInf())return"Infinity";if(this.isNaN())return"NaN";if(this.isz())return"0";var n=this.abs(),i=this.abs().min(1).lfloor(10),s;if(n>=10**e|n<=10**r){s=n.div(n.lfloor(10)).sfloor(t).floatFix()+"e"+n.log10().floor()}else{s=n.sfloor(t*i).floatFix()}return(this.isNeg()?"-":"")+s};P.modabs=function(t){var e=this.abs().mod(t);return(this.isNeg()?t-e:e)%t};P.toLocaleString2=function(){return this.toLocaleString().split("").exclude(",").join("")};P.divf=function(t){return(this/t).floor()};P.mix=function(t){return(this+t)/2};P.divisors=function(){var t=[];for(var e=0;e<this/2+1;e++){if(this/e%1==0)t.push(this/e)}t.push(1);return t};P.thres=function(t=1,e=true){var r=this.floor();b=this.modabs(1);return(e?b>=t:b>t)?r+1:r};P.sthres=function(t=1,e=1,r=true){return this.div(t).thres(e,r)*t};P.lthres=function(t=10,e=1,r=true){return this.logb(t).floatFix().thres(e,r).bas(t)};P.fromCharCode=function(){return String.fromCharCode(this)};P.triareaIsos=function(t,e){return t*e/2};P.triareaEqui=function(t){return.75.sqrt()*t**2};P.rs=function(t){return this>>t};P.ls=function(t){return this<<t};P.rsu=function(t){return this>>>t};P.digitAt=function(t){return(this.abs()%10**(t+1)/10**t).floatFix(7).floor()%10};P.toStringWrite=function(t=true,e=false){if(this.isNeg()&this.isInf())return"-∞";if(this.isInf())return"∞";var r=this.isNeg(),n=this.abs().log10().floor(),i=this.abs().dti();f=i.log10().floor();var s="0".repeat(n.max(0)+1).map((t,e)=>{return this.abs().toNumber().digitAt(n-e).toString()});if(t)s=s.putevery(e?".":",",4,s.length%3,0);var o="0".repeat(f.max(0)+1).map((t,e)=>{return i.toNumber().digitAt(f.max(0)-e).toString()});return(r?"-":"")+s+(o=="0"?"":(e?",":".")+o)};P.sdi=function(t=true){return[this.sign(),t?this.modabs(1):(this%1).abs(),this.floor()]};P.to0x=function(){return"0x"+this.toString(16)};P.reverse=function(t=0,e=1){return e-(this-t)};S.DIST=Math.log10(Number.MAX_SAFE_INTEGER)/Math.log10(Number.MAX_VALUE);S.BIT32=2**31-1;S.BIT64=2**63-1;AddObj(Number,P,S,"Number");P={},S={};P.ifelse=function(t,e){return this?t:e};P.not=function(){return!this};P.and=function(t){return Boolean(this&t)};P.or=function(t){return Boolean(this|t)};P.xor=function(t){return Boolean(this^t)};P.pon=function(){return this?1:-1};S.muland=(...t)=>{var e=true;t.forEach(t=>{e=e.and(t)});return e};S.mulor=(...t)=>{var e=false;t.forEach(t=>{e=e.or(t)});return e};AddObj(Boolean,P,S,"Boolean");P={},S={};P.replaceAt=function(t,e){return this.substr(0,t)+e+this.substr(t+e.length)};P.befj=function(...t){t.push(this);t=t.join("");return t};P.html=function(t,e){return`<${t}${e==undefined?"":" "+e}>${this}</${t}>`};P.html2=function(t,e){return`<${this}${e==undefined?"":" "+e}>${t}</${this}>`};P.reverse=function(){var t=this;t=t.split("");t.reverse();return t.join("")};P.del=function(t){return this.substr(0,t)+this.substr(t+1,this.length-t-1)};P.fitEnd=function(t,e=""){t=Math.max(t,0);var r=this;if(r.length<t){if(e!=""){while(r.length!=t){r+=e}}}else if(r.length>t){while(r.length!=t){r=r.slice(0,-1)}}return r+""};P.fitStart=function(t,e=""){t=Math.max(t,0);var r=this;if(r.length<t){if(e!=""){while(r.length!=t){r=e+r}}}else if(r.length>t){while(r.length!=t){r=r.slice(1)}}return r+""};P.loopIncludes=function(t,e=2){return this.repeat(e).includes(t)};P.heading=function(t,e="",r=""){t=Number(t||1).min(6).max(1).floor();return`<h${t}${e==""?"":` id="${e}"`}${r==""?"":` class="${r}"`}>${this}</h${t}>`};P.change=function(t){var e=this;for(var r=0;r<e.length;r++){e=e.replaceAt(r,t[r%t.length])}return e};P.toClipboard=function(){var t=document.createElement("textarea");t.value=this;t.setAttribute("readonly","");t.style={position:"absolute",left:"-9999px"};document.body.appendChild(t);t.select();document.execCommand("copy");document.body.removeChild(t)};P.func=function(isEval){return isEval?eval(this):new Function(this)};P.autoCase=function(){var t=this.split(" ");t=t.map(t=>{return t.replaceAt(0,t[0].toUpperCase())});return t.join(" ")};P.argSplit=function(t,e,r,n){var i=[],s="",o=false,a=false,u=this;for(var h=0;h<u.length+1;h++){if((u[h]==t|u[h]==undefined)&!o){i.push(s);s=""}else{a=false;if(u[h]==e&!o){o=true;a=true;n?h++:0}if(u[h]==r&o&!a){o=false;n?h++:0;if((u[h]==t|u[h]==undefined)&n){i.push(s);s="";h++}}s+=u[h]}}return i};P.isHTML=function(){var t=document.createElement("div");t.innerHTML=this;for(var e=t.childNodes,r=e.length;r--;){if(e[r].nodeType==1)return true}return false};P.atob=function(){return atob(this)};P.btoa=function(){return btoa(this)};P.parse=function(){return JSON.parse(this)};P.forEach=function(t,e=false){if(e){this.split("").forEach(t)}else{for(var r=0;r<this.length;r++){t(this[r],r,this)}}};P.map=function(t,e=false){if(e){var r=this.split("");r.map(t);return r.join("")}else{var r=this;for(var n=0;n<this.length;n++){r=r.replaceAt(n,t(this[n],n,this))}return r}};P.shiftChar=function(r){return this.map((t,e)=>{return String.fromCharCode(t.charCodeAt()+r)})};P.bigintFix=function(){if(this.last()=="n"){a=this.removeside(true)}else a=this;return BigInt(a)};P.trimSplit=function(t){var e=this.split(t);return e.map(t=>{return t.trim()})};P.trimSplitJoin=function(t){var e=this.trimSplit(t);return e.join(t)};P.reverseGroups=function(t){return this.split("").reverseGroups(t).join("")};P.removeSplit=function(t,e,r,n=false){var i=this.split(t);if(n){return i.splice(e,r).join(t)}else{i.splice(e,r);return i.join(t)}};P.last=function(){return this[this.length-1]};P.unstreq=function(t){return this.toLowerCase()==t.toLowerCase()};P.removeside=function(t=true){return t?this.del(this.length-1):this.del(0)};P.fractal=function(t,e){var r=this.replaceAll("$r",e);for(var n=0;n<t;n++){r=this.replaceAll("$r",r)}return r};P.repeatDec=function(t=1){var e=this.repeat(Number(t+1).limz());return e.substr(0,e.length-this.length*(1-t%1))};P.findFirst=function(t,e=false){if(Array.isArray(t)){var r=[],n;t.forEach(t=>{n=this.split("").indexOf(t);r.push(e?n==-1?this.length:n:n)});return r.min()}else{var r=this.split("").indexOf(t);return e?r==-1?this.length:r:r}};P.findLast=function(t,e=false){if(Array.isArray(t)){var r=[],n;t.forEach(t=>{n=this.split("").reverse().indexOf(t).neg(this.length).sub(1);r.push(e?n==-1?this.length:n:n)});return r.max()}else{var r=this.split("").reverse().indexOf(t).neg(this.length).sub(1);return e?r==-1?this.length:r:r}};P.cutFirst=function(t,e=0){if(typeof t=="string"|Array.isArray(t)){t=e?this.findLast(t,1):this.findFirst(t,1)}return this.substr(t,this.length-t)};P.cutLast=function(t,e=0){if(typeof t=="string"|Array.isArray(t)){t=this.length-(e?this.findLast(t,1):this.findFirst(t,1))}return this.substr(0,this.length-t)};P.until=function(t=0,e="",r=0,n=0){if(typeof t=="string"){t=this.findFirst(t)}var i=this.substr(t+(n>=2?1:0)),s=this.length-i.length;c=i.findFirst(e,1)+s,d=i.substr(0,i.findFirst(e,1)+(n==1?1:0));return r?d:c};P.untilPrt=function(t=0,e="{",r="}",n,i=0,s=true,o="\\"){if(typeof t=="string"){t=this.findFirst(t)}if(e!=r&!Array.isArray(e)&!Array.isArray(r)){e=[e];r=[r]}var a="",u=t;while(!e.includes(this[u])&this[u]!=undefined){a+=this[u];u++}var h=u;var f=[0].repeat(e.length),c="";while(!(f.sum()==0&u!=h|this[u]==undefined)){if(e==r&this[u]==e){if(f[0]==0)f[0]=1;else if(this.detectRepeats(o,u,true)%2==0)f[0]=0}else{if(e.includes(this[u])&r.includes(this[u])){if(s){if(c==this[u]){if(this.detectRepeats(o,u,true)%2==0){c="";f[e.indexOf(this[u])]=0}}else{if(c=="")c=this[u];f[e.indexOf(this[u])]=1}}else{f[e.indexOf(this[u])]=1-f[e.indexOf(this[u])]}}else{if(e.includes(this[u])&c=="")f[e.indexOf(this[u])]++;if(r.includes(this[u])&c=="")f[r.indexOf(this[u])]--}}a+=this[u];u++}if(i!=1)a=a.cutLast(1);if(i==2)a=a.substr(1);return n?a:u-1};P.untilStrav=function(t='"',e="\\"){var r=t;if(!t.isArray)t=[t];t=this.findFirst(t,1);var n=this.whichFirst.apply(this,[0].concat(r));var i=t,s="";while(!(this[i]==n&this.detectRepeats(e,i,true)%2==0&i!=t)&this[i]!=undefined){s+=this[i];i++}return s};P.hasFirst=function(t,e=0,r){if(!Array.isArray(t))t=[t];var n=false,i="",s=this.cutFirst(e);t.forEach(t=>{if(s.substr(0,t.length)==t){n=true;if(i=="")i=t}});return r?[n,i]:n};P.untilSplit=function(t,e='"',r='"'){if(!Array.isArray(e))e=[e];if(!Array.isArray(r))r=[r];var n="",i=[],s=true;for(var o=0;o<this.length;o++){if(this.substr(o).hasFirst(t,1)[0]&s){i.push(n);n="";o+=this.substr(o).hasFirst(t,1)[1].length}if(e.includes(this[o])&r.includes(this[o])){s=!s}else{if(e.includes(this[o]))s=false;if(r.includes(this[o]))s=true}n+=this[o]}i.push(n);return i};P.untilSplitPrt=function(t,e="{",r="}",n=true,i="\\"){if(!Array.isArray(e))e=[e];if(!Array.isArray(r))r=[r];if(e.length!=r.length)throw RangeError("[EasyMod.js] both start and end needs to have equal length");var s="",o=[],a=[0].repeat(e.length),u="";for(var h=0;h<this.length;h++){if(this.hasFirst(t,h)&a.sum()==0){o.push(s);s="";h+=this.hasFirst(t,h,1)[1].length}if(e.includes(this[h])&r.includes(this[h])){if(n){if(u==this[h]){if(this.detectRepeats(i,h,true)%2==0){u="";a[e.indexOf(this[h])]=0}}else{u=this[h];a[e.indexOf(this[h])]=1}}else{a[e.indexOf(this[h])]=1-a[e.indexOf(this[h])]}}else{if(e.includes(this[h])&u=="")a[e.indexOf(this[h])]++;if(r.includes(this[h])&u=="")a[r.indexOf(this[h])]--}s+=this[h]}o.push(s);return o};P.shift=function(t,...e){t=t.floor();var r=this.concat.arrayCall(this,e)+this,n=e.map(t=>{return t.length}).sum()+this.length;return r.substr(t.modabs(n),this.length)};P.exclude=function(...e){var r=this;e.forEach(t=>{r=r.replaceAll(e,"")});return r};P.put=function(t=0,e){return this.substr(0,t)+e+this.substr(t)};P.delmul=function(t=0,e=1){return this.substr(0,t)+this.substr(t+e)};P.detectRepeats=function(t,e,r=false){if(t=="")return 0;var n=0,i=e;if(r)i-=t.length;while(this.hasFirst(t,i)){i+=t.length*(r?-1:1);n++}return n};P.merge=function(...t){var e=t.map(t=>{return t.length}).sum()+this.length,r="",n=[this].concat(t);for(var i=0;i<e;i++){r+=n[i%n.length][(i/n.length).floor()]||""}return r};P.replaceMul=function(e,t){var r=this;t.forEach(t=>{r=r.replaceAt(t,e)});return r};P.allowIf=function(r=()=>{}){var n="";this.forEach((t,e)=>{if(r(t,e))n+=t});return n};P.findCount=function(t,e=false,r=false){if(t=="")return r?[]:0;var n=r?[]:0;for(var i=0;i<this.length-(t.length-1);i++){if(this.hasFirst(t,i)){if(r)n.push(i);else n++;if(!e)i+=t.length-1}}return n};P.corrupt=function(e=.2,r=2){return this.map(t=>{return Math.random()<e?(t.charCodeAt()+r.randomn()).fromCharCode():t})};P.isUpperCase=function(t=0){var e=this[t];return e.toLowerCase()!=e};P.isLowerCase=function(t=0){var e=this[t];return e.toUpperCase()!=e};P.switchCase=function(){return this.map(t=>{return t.isUpperCase()?t.toLowerCase():t.toUpperCase()})};P.isLetter=function(t=0){return!(!this.isUpperCase(t)&!this.isLowerCase(t))};P.whichFirst=function(e=0,...t){var r;for(var n=0;n<this.length;n++){t.forEach(t=>{if(this.hasFirst(t,n))r=e?[t,n]:t});if(r)return r}return-1};P.toSymbol=function(t=false){if(this.hasFirst("Symbol(")&this.last()==")"){return Symbol(this.substr(7).cutLast(1))}else{return t?null:Symbol()}};P.detectType=function(t=false){var e;if(this=="NaN")e=NaN;else if(this=="undefined")e=undefined;else if(this=="null")e=null;else if(this=="false")e=false;else if(this=="true")e=true;else{e=Number(this);if(isNaN(e)){try{e=this.bigintFix()}catch{e=this.toSymbol(true);if(!e)try{e=this.parse()}catch{e=this+""}}}}return t?e.type:e};P.isSymbol=function(){return!!(this.substr(0,7)=="Symbol("&this[this.length-1]==")")};P.evalWorks=function(){try{Function(this);return true}catch{return false}};P.error=function(t=0,e=true){if(typeof t=="string"&EasyObj.errors.includes(t))t=EasyObj.errors.indexOf(t);var r;switch(t){case 0:r=Error(this);break;case 1:r=RangeError(this);break;case 2:r=ReferenceError(this);break;case 3:r=SyntaxError(this);break;case 4:r=TypeError(this);break;case 5:r=URIError(this);break;case 6:r=EvalError(this);break}if(typeof t=="string"&!EasyObj.errors.includes(t)){r=t+=new Error(this).stack}if(e){throw r}else{return r}};P.eqlength=function(t){return this.length==t.length};P.putevery=function(t,e,r,n=true){var i=this+"",s=r;while(s<i.length){if(n?true:s!=0)i=i.put(s,t);if(n?false:s==0)s--;s+=e}return i};P.splitMul=function(t){if(!Array.isArray(t))t=[t];var r=[this+""];t.forEach(e=>{r=r.map(t=>{return t.split(e)}).flat()});return r.flat()};P.setLocStr=function(t){localStorage.setItem(t,this)};P.setCookie=function(t,e,r=false){var n=e?"; expires="+(new Date).add(e).toUTCString():"",i=t+"="+(this.toString()||"")+n+"; path=/";if(r)return i;else document.cookie=i};P.toHTML=function(t=true){var e=new DOMParser;var r=e.parseFromString(this,"text/html");var n=r.body;if(t)return n.querySelector("*");return n};P.toHexCode=function(e=8,t=""){if(e!==8&e!==16)"[EasyMod.js] Incorrect UTF type".error(4);return this.split("").map(t=>{return t.charCodeAt().toString(16).padStart(e/4,"0")}).join(t)};P.splitEvery=function(t=1,e=0){var r=[],n="";for(var i=0;i<this.length;i++){if((i+e)%t==0){r.push(n);n=""}n+=this[i]}if(r[0]=="")r.shift();r.push(n);return r};P.baseSwt=function(t=10,e=2){var r=parseInt(this,t);return r.toString(e)},P.parseInt=function(t=16){return parseInt(this,t)};P.hexToString=function(t=8,e=""){if(t!==8&t!==16)"[EasyMod.js] Incorrect UTF type".error(4);return(e==""?this.splitEvery(t/4):this.split(e)).map(t=>{return t.parseInt().fromCharCode()}).join("")};P.reverseGroups2=function(t){return this.reverseGroups().reverse()};P.stringify=function(t='"',e="\\"){return t+this.replaceAll(t,e+t)+t};P.unstringify=function(t='"',e="\\"){if(this[0]==t&this.last()==t){return this.removeside().removeside(0).replaceAll(e+t,t)}else return this};P.comp64=function(){var t=btoa(this),e,r,n="";for(var i of t){e=i.charCodeAt();if(e>=65&e<=90)r=e-65;else if(e>=97&e<=122)r=e-71;else if(e>=48&e<=57)r=e+4;else if(e==43)r=62;else if(e==47)r=63;else if(e==61)r=64;n+=r.fromCharCode()}return n};P.deco64=function(){var t=this,e,r,n="";for(var i of t){e=i.charCodeAt();if(e<26)r=e+65;else if(e>=26&e<52)r=e+71;else if(e>=52&e<62)r=e-4;else if(e==62)r=43;else if(e==63)r=47;else if(e==64)r=61;n+=r.fromCharCode()}return atob(n)};P.log=function(t=""){if(t){console.log("%c"+this,t)}else{console.log(this.unnew())}};P.trimLines=function(){return this.split("\n").map(t=>{return t.trim()}).join("\n")};P.syntaxComp=function(t=false){try{new Function(this.unnew());return t?undefined:true}catch(e){return t?e:false}};S.progress=(t,e,r="|",n=".")=>{var i=(t*e).floor().max(0).min(t),s=t-i,o="";for(var a=0;a<i;a++){o+=r}for(var a=0;a<s;a++){o+=n}return o};S.blank="";AddObj(String,P,S,"String");P={},S={};P.add=function(t){return this+BigInt(t)};P.sub=function(t){return this-BigInt(t)};P.inc=function(){return this+1n};P.dec=function(){return this-1n};P.mul=function(t){return this*BigInt(t)};P.div=function(t){return this/BigInt(t)};P.pow=function(t){return this**BigInt(t)};P.bas=function(t){return BigInt(t)**this};P.neg=function(t){return BigInt(t)-this};P.abs=function(t){var e=this+0n;if(e.isNeg())e*=-1n;return e};P.sign=function(t){var e=Number(this);e=e.sign();return BigInt(e)};P.gt=function(t){return this>t};P.gte=function(t){return this>=t};P.lt=function(t){return this<t};P.lte=function(t){return this<=t};P.isz=function(t){return this===0n};P.isPos=function(t){return t?this>=0:this>0};P.isNeg=function(t){return t?this<=0:this<0};P.comp=function(t){return(this-BigInt(t)).sign()};P.log10=function(){return this.toNumber().log10()};P.log10a=function(t=true){if(this==0n)return-Infinity;var e=t?0:Number(this.toString().put(1,".")).log10();return this.abs().toString().length-1+e};P.sfloor=function(t=10){return this.toNumber().sfloor(t).toBigInt()};P.sround=function(t=10){return this.toNumber().sround(t).toBigInt()};P.sceil=function(t=10){return this.toNumber().sceil(t).toBigInt()};P.toStringFix=function(t=2,e=6){var r=this.abs().toString(),n=r.substr(0,t+1).put(1,".");if(this.log10a()>=e){var i=n+"e"+this.log10a();return this.isNeg()?"-"+i:i}else{return this.isNeg()?"-"+r:r}};AddObj(BigInt,P,S,"BigInt");P={},S={};P.iterate=function(t,e){if(t==0){return e}else{return this(this.iterate(t-1,e))}};P.getArgs=function(){if(this.toString()[0]!="f"&this.toString()[0]!="(")return this.toString().cutLast([" ","="]);return this.toString().untilPrt("(","(",")",1,2).untilSplitPrt(",",EasyObj.prt.s,EasyObj.prt.e).mapTrim().map(t=>{return t.cutLast([" ","="])})};P.getArgsAll=function(){if(this.toString()[0]!="f"&this.toString()[0]!="(")return this.toString().cutLast([" ","="]);return this.toString().untilPrt("(","(",")",1,2).untilSplitPrt(",",EasyObj.prt.s,EasyObj.prt.e).mapTrim()};P.getCmd=function(t){if(this.toString()[0]!="f"&this.toString()[0]!="("){var e=this.toString().substr(this.toString().untilPrt(0,"(",")",1,1)+1).cutFirst(["=","{"]),r=false;while([" ","=",">"].includes(e[0])){e=e.cutFirst(1)}if(e[0]!="{")r=true;var n=e.untilPrt(0,EasyObj.prt.s,EasyObj.prt.e,1,r?1:2);if(t>=1)n=n.split("\n");if(t>=2&t<4)n=n.mapTrim();if(t>=3)i=i.exclude("");return n}else{var n=this.toString().untilPrt(0,"(",")",1,1),r=false,e=this.toString().cutFirst(n.length);while([" ","=",">"].includes(e[0])){e=e.cutFirst(1)}if(e[0]!="{")r=true;var i=e.untilPrt(0,EasyObj.prt.s,EasyObj.prt.e,1,r?1:2);if(t>=1)i=i.split("\n");if(t>=2&t<4)i=i.mapTrim();if(t>=3)i=i.exclude("");return i}};P.addLine=function(...t){var e=this.getCommand();e=e.concat.apply(e,t);e=e.join("\n");return e.func()};P.arrayCall=function(t){return this.apply(this,t)};P.reverseCall=function(...t){t.reverse();return this.arrayCall(t)};P.iteration=function(t,e,r=true){var n=[],i=t;for(var s=0;s<e;s++){i=this(i,s,n);n.push(i)}return r?n.last():n};P.lagrun=function(t){var e=Date.now();for(var r=0;r<t;r++){this(r)}return Date.now()-e};P.setArgs=function(t=[]){t.push(this.getCommand(4).join("\n"));return Function.apply(null,t)};P.setCmd=function(t=""){var e=this.getArgsAll();e.push(t);return Function.apply(null,e)};P.evalrun=function(...args){args=args.map(v=>{return eval(v)});return this.apply(this,args)};P["void"]=function(){return void this()};P.trycatch=function(t,e=false){try{if(e){this();return true}else{return this()}}catch(r){t(r);return e?undefined:false}};AddObj(Function,P,S,"Function");P={},S={};P.pus=function(t){return this.push(t)};P.con=function(e){for(let t in e){this.push(t)}return this};P.befj=function(...t){t.push.apply(t,this);return t};P.fitEnd=function(t,e="",r){t=Math.max(t,0);var n=this;if(n.length<t){if(e!=""){while(n.length!=t){n.push(e)}}}else if(n.length>t&!r){while(n.length!=t){n.pop()}}return n};P.fitStart=function(t,e="",r){t=Math.max(t,0);var n=this;if(n.length<t){if(e!=""){while(n.length!=t){n.befj(e)}}}else if(n.length>t&!r){while(n.length!=t){n.shift()}}return n};P.valueMap=function(n){var i=r=>{Object.keys(r).forEach((t,e)=>{if(typeof r[t]=="object"){i(r[t])}else{r[t]=n(r[t],t)}})};var t=this;i(t);return t};P.sum=function(t=0){return this.reduce((t,e)=>{return t+e},0)+t};P.sub=function(t=0,e=false){var r=e?this.reverse():this;b=r.spliceReturn(0,1);return b.reduce((t,e)=>{return t-e},r[0])-t};P.prod=function(t=1){return this.reduce((t,e)=>{return t*e},1)*t};P.quot=function(t=1,e=false){var r=e?this.reverse():this;b=r.spliceReturn(0,1);return b.reduce((t,e)=>{return t/e},r[0])/t};P.pow=function(t=1,e=false){var r=e?this.reverse():this;b=r.spliceReturn(0,1);return b.reduce((t,e)=>{return t**e},r[0])**t};P.gate=function(){var e=0;var r=false;this.forEach(t=>{if(t){if(!r)e++}else{r=true}});return e};P.onlyAllow=function(e=false,...t){var r=[];t.forEach(t=>{if(e){if(this.includes(t))r.push(t)}else{r.push(this[t])}});return r};P.stringify=function(){return JSON.stringify(this)};P.detectRepeats=function(r=false,n=false){var i=[],s=0,o=0,a=this[0];this.forEach((t,e)=>{if(t!=a){if(n&r){i.push(e-1)}else{i.push(r?o:s)}s=0;o=e;a=t}s++});if(n&r){i.push(this.length-1)}else{i.push(r?o:s)}return i};P.getIndexes=function(...t){var e=[];t.forEach(t=>{e.push(this.indexOf(t))});return e};P.max=function(t=false){var e=Math.max.apply(null,this);if(t){e=this.indexOf(e)}return e};P.min=function(t=false){var e=Math.min.apply(null,this);if(t){e=this.indexOf(e)}return e};P.split=function(n,t=true,r=true){var i=[],s=[],o=false;if(t){this.forEach((t,e)=>{o=false;if(r?t===n:t==n){i.push(s);s=[];o=true}if(!o)s.push(t)})}else{this.forEach((t,e,r)=>{if(e%n==0&!(e==0)){i.push(s);s=[]}s.push(t)})}i.push(s);return i};P.joinArray=function(r=[]){var t=this.reduce((t,e)=>{return t.concat(e,r)},[]);if(!(r.length==0&Array.isArray(r)))t.pop();return t};P.reverseGroups=function(t){var e=this.split(t,false);e=e.reverse();return e.joinArray()};P.lastIndexOf=function(t){return this.length-1-this.reverse().indexOf(t)};P.detect=function(r,n=true){var i=[];this.forEach((t,e)=>{if(n?t===r:t==r)i.push(e)});return i};P.spliceReturn=function(t,e){var r=this.stringify().parse();r.splice(t,e);return r};P.toRGB=function(){var t=t.flat(),e=t[0].floor()*65536+t[1].floor()*256+t[2].floor()};P.compare=function(r,n=false){if(this.length==r.length){var i=true;this.forEach((t,e)=>{if(n?t!==r[e]:t!=r[e])i=false});return i}else{return false}};P.repeat=function(t){var e=this;for(var r=0;r<t-1;r++){e=e.concat(this)}return t==0?[]:e};P.toObject=function(t=false){var r={};if(t){this.forEach((t,e)=>{r[e.toString()]=t})}else{r=Object.assign({},this)}return r};P.joinNum=function(t=""){return Number(this.join(t))};P.mapSum=function(r){return this.map((t,e)=>{return t+r[e]})};P.mapProd=function(r){return this.map((t,e)=>{return t*r[e]})};P.mapSub=function(r){return this.map((t,e)=>{return t-r[e]})};P.mapQuot=function(r){return this.map((t,e)=>{return t/r[e]})};P.toSave=function(){return this.stringify().btoa()};P.toFunctCmd=function(t="anonymous",e=false,...r){var n=`function ${t}(${r.join(",")}) {${this.map(t=>{return"\t"+t}).join(";\n")}}`;if(e){return n}else{return new Function}};P.toFunctArgs=function(t="anonymous",e,r=false){var n=`function ${t}(${this.join(",")}) {\n${e}\n}`;if(r){return n}else{return new Function}};P.joinFunct=function(){return new Function(`[${this.toString()}].forEach((v,i)=>{v(i)})`)};P.onchange=function(t,e){var r=this();setInterval(()=>{if(r!=this()){t(this,r,this());r=this()}},e||1e3/30)};P.loga=function(){var t=this[1],e=this[2]||0,r=this[3]||0,n=e*10**r,i=t*10**n;return i*this[0]};P.joinb=function(){return this.join("")};P.numToStr=function(){return this.map(t=>{return String.fromCharCode(t)}).join("")};P.mapTrim=function(e=0){return this.map(t=>{switch(e){case 0:return t.trim();case 1:return t.trimStart();case 2:return t.trimEnd()}})};P.last=function(){return this[this.length-1]};P.indexOfAll=function(r){var n=[];this.forEach((t,e)=>{if(t===r)n.push(e)});return n};P.exclude=function(...e){var r=[];this.forEach(t=>{if(!e.includes(t))r.push(t)});return r};P.defaultAll=function(){return this.map(t=>{return t["default"]()})};P.allowIf=function(r=()=>{}){var n=[];this.forEach((t,e)=>{if(r(t,e))n.push(t)});return n};P.sortNum=function(t=false){this.sort((t,e)=>{return t-e});if(t)this.reverse();return this};P.allowProb=function(r,n=false,t=false){if(t){var i=n?this.getKeys().map(t=>{return Number(t)}):this.clone(),e=Math.ceil(this.length*(1-r));for(var s=0;s<e;s++){i.splice(i.length.random().floor(),1)}}else{var i=[];this.forEach((t,e)=>{if(Math.random()<r)i.push(n?e:t)})}return i};P.ruleFrac=function(t){t=t.floor();if(t<=0)return[0];if(t==1)return this;var e,r=this;for(var n=0;n<t-1;n++){e=[];for(var i=0;i<this.length;i++){e=e.concat(r.map(t=>{return t+this[i]}))}r=e}return e};P.removeRepeats=function(){return this.onlyAllow.apply(this,[0].concat(this.detectRepeats(1)))};P.grad=function(t){if(t==this.length)return this[this.length];var e=t%1,r=t.floor();return this[r]*(1-e)+this[r+1]*e};P.reverseGroups2=function(t){return this.reverseGroups().reverse()};P.chng=function(t=(t,e,r,n)=>{return Math.abs(t-e)}){var e=[];for(var r=0;r<this.length-1;r++){e.push(t(this[r],this[r+1],r,this))}return e};P.next=function(e=0,r=true){var n;return this.map(t=>{n=t-e;return(r?n<=0:n<0)?Infinity:n}).min()+e};P.prev=function(e=0,r=true){var n;return this.map(t=>{n=-(t-e);return(r?n<=0:n<0)?Infinity:n}).min().neg()+e};S.fromto=(t=1,e=10,r=1)=>{var n=[];for(var i=t;i<e+r;i+=r){n.push(i)}return n};S.fromwidth=(t=1,e=10,r=1)=>{var n=[],i;for(var s=0;s<e;s++){i=s*r+t;n.push(i)}return n};S.formula=(t=()=>{},e=1,r=16,n=1,i=1,s=[])=>{var o;switch(e){case 1:o=[0].repeat(r);break;case 2:o=[[0].repeat(n)].repeat(r).clone();break;case 3:o=[[[0].repeat(i)].repeat(n)].repeat(r).clone();break}for(var a=0;a<(e<3?1:i);a++){for(var u=0;u<(e<2?1:n);u++){for(var h=0;h<r;h++){switch(e){case 1:o[h]=t(h,0,0,r,1,1,s);break;case 2:o[h][u]=t(h,u,0,r,n,1,s);break;case 3:o[h][u][a]=t(h,u,a,r,n,i,s);break}}}}return o};P.isArray=true;AddObj(Array,P,S,"Array");P={},S={};P.define=function(t,e){this[t]=e};P["delete"]=function(t){return delete this[t]};P.get=function(t){return this[t]};P.valueMap=function(n){var i=r=>{Object.keys(r).forEach((t,e)=>{if(typeof r[t]=="object"){i(r[t])}else{r[t]=n(r[t],t)}})};var t=this;i(t);return t};P.gate=function(){var e=0;var r=false;Object.keys(this).forEach(t=>{if(this[t]){if(!r)e++}else{r=true}});return e};P.onlyAllow=function(...t){var e={};t.forEach(t=>{e[t]=this[t]});return e};P.propNames=function(t=true){return t?Object.keys(this):keys(this)};P.stringify=function(){return JSON.stringify(this)};P.path=function(...t){var e=this;t.forEach(t=>{e=e[t]});return e};P.sharechd=function(e){Object.keys(this).forEach(t=>{e[t]=this[t]})};P.removechd=function(...t){if(t.compare([])){t=Object.keys(this)}t.forEach(t=>{delete this[t]})};P.toSave=function(){return this.stringify().btoa()};P.getLength=function(){return Object.keys(this).length};P.forEach=function(t){for(var e=0;e<this.getLength();e++){t(this[Object.keys(this)[e]],Object.keys(this)[e],e,this)}};P.map=function(t){var e=this.stringify().parse();for(var r=0;r<this.getLength();r++){e[Object.keys(this)[r]]=t(e[Object.keys(this)[r]],Object.keys(this)[r],r,this)}return e};P.entries=function(t=false){return Object.entries(this)};P.toArray=function(t=false){if(t){return Object.assign([],this)}else{var e=[];Object.keys(this).forEach(t=>{e.push(this[t])});return e}};P.reverse=function(){var e={};Object.keys(this).reverse().forEach(t=>{e[t]=this[t]});return e};P.sort=function(){var e={};Object.keys(this).sort().forEach(t=>{e[t]=this[t]});return e};P.allowSyntax=function(e=0){var t=Object.keys(this),r;if(e==0){r={}}else{r=[]}t.forEach(t=>{try{new Function(`z.${t}`);switch(e){case 0:r[t]=this[t];break;case 1:r.push(t);break;case 2:r.push(this[t]);break;case 3:r.push(true)}}catch{if(e==3){r.push(false)}}});return r};P.rename=function(t,e){if(t!==e){this[e]=this[t];delete this[t]}};P.mapName=function(n){var t=Object.keys(this),e=this.stringify().parse();t.forEach((t,e,r)=>{r.rename(t,n(t,e,r,this))});return e};P.getKeys=function(){return Object.keys(this)};P.includes=function(t,e=false){if(e){return this.toArray().includes(t)}else{return this.keys().includes(t)}};P.hasProp=function(r,t=-1){t=t==-1?r.getLength():t;var n=0;this.forEach((t,e)=>{if(r.includes(e))n++});return n>=t};P.merge=function(t){return Object.assign(this,t)};P.assignTo=function(t){return Object.assign(t,this)};P.clone=function(t=0){switch(t){case 0:return this.stringify().parse();case 1:return{...this};case 2:return Object.assign({},this)}};P.dupli=function(t,e){this[e]=this[t]};P.allowIf=function(r=()=>{}){var n={};this.propNames().forEach((t,e)=>{if(r(this[t],t,e))n[t]=this[t]});return n};P.clonepr=function(t,e){this[e]=this[t]};P.switchType=function(t,e,r=true){if(e){if(self[t]==undefined){throw TypeError("[EasyMod.js] 1: type is invalid")}else{try{if(!r)throw Error(" is not a constructor");return new self[t](this)}catch(n){n=n.toString();if(n.includes(" is not a constructor")){try{return self[t](this)}catch(n){throw Error(n)}}else{throw Error(n)}}}}else{switch(t){case"number":return Number(this);break;case"string":return String(this);break;case"boolean":return Boolean(this);break;case"bigint":return BigInt(this);break;case"object":return Object(this);break;case"array":return Array(this);break;case"symbol":return Symbol(this);break;case"undefined":return undefined;break}throw TypeError("[EasyMod.js] 1: type is invalid")}};P.getType=function(){return typeof this};P.truefy=function(){if(this.type=="object"){this.__proto__.sharechd(this)}else{var t={index:this};this.__proto__.sharechd(t);return t}};P.effect=function(t){return t(this,typeof this)};P.isType=function(t){return t==this.type};P.toNumber=function(){return Number(this)};P.toBigInt=function(){if(typeof this=="number")return BigInt(this.floor());return BigInt(this)};P["default"]=function(){switch(this.type){case"number":return 0;case"string":return"";case"bigint":return 0n;case"boolean":return false;case"function":return function(){};case"object":if(Array.isArray(this)){return[]}else return{}}};P.isArray=function(){return Array.isArray(this)};P.unnew=function(t=true){switch(this.type){case"number":return this+0;case"string":return this+"";case"bigint":return this+0n;case"boolean":return Number(this)?true:false;case"object":return t?this.clone(1):this}return this};P.newfy=function(){return Object(this)};P.effect=function(t){return t(this)};P.ciu=function(t=0){return this??t};P.eq=function(t){return this.unnew()==t.unnew()};P.ex=function(t){return this.unnew()===t.unnew()};P.eqn=function(t){return this.unnew()!=t.unnew()};P.exn=function(t){return this.unnew()!==t.unnew()};P.isArray=false;P.methodIter=function(t,e=1,...r){var n=this.unnew();for(var i=0;i<e;i++){n=n[t].apply(n,r)}return n};P.deletable=function(t){var e=this[t],r;r=delete this[t];if(r)this[t]=e;return r};P.isThis=false;P.objectType=function(){switch(this.type){case"number":return"Number";case"string":return"String";case"boolean":return"Boolean";case"bigint":return"BigInt";case"symbol":return"Symbol"}if(this.isArray)return"Array";if(!this.toString().hasFirst("[object "))throw Error("[EasyMod.js] Object does not have the original toString function");return this.toString().substr(8).cutLast(1)};AddObj(Object,P,S,"Object");P={},S={};P.since=function(t){t=new Date(t);return this.getTime()-t.getTime()};P.daysSinceYear=function(t){return(this.getTime()-new Date("year "+t).getTime())/864e5};P.add=function(t){t=new Date(t);return new Date(this.getTime()+t.getTime())};P.sub=function(t){t=new Date(t);return new Date(this.getTime()-t.getTime())};P.getAbsDay=function(){var t=this.getDate(),e=this.getMonth(),r=[31,28,31,30,31,30,31,31,30,31,30,31];m=r.splice(0,e).sum();return t+m-1};P.toTimeStr=function(t=false){var e=this.getMilliseconds(),r=this.getSeconds(),n=this.getMinutes(),i=this.getHours(),s=this.getAbsDay(),o=this.getFullYear(),a=[];if((e!=0|r==0)&t)a.push(e+" milliseconds");if(r!=0)a.push(r+" seconds");if(n!=0)a.push(n+" minutes");if(i!=0)a.push(i+" hours");if(s!=0)a.push(s+" days");if(o!=0)a.push(o+" years");return a.join(", ")};AddObj(Date,P,S,"Date");P={},S={};P.arrayfy=function(){var t=this.data;var e=Array(4),r=[e].repeat(this.height),n=[r].repeat(this.width);t.forEach((t,e)=>{n[(e/(4*this.height)).floor()][(e/4%this.height).floor()][e%4]=t});return n};P.editpx=function(t=0,e=0,r=[0,0,0,0],n){var i=this.data;var s=typeof r=="number"?[r.div(65536).floor()%256,r.div(256).floor()%256,r.floor()%256,n?r.div(16777216).floor()%256:255]:[r[0].floor().max(0).min(255),r[1].floor().max(0).min(255),r[2].floor().max(0).min(255),r[3].floor().max(0).min(255)];i[(t+e*this.width)*4+0]=s[0];i[(t+e*this.width)*4+1]=s[1];i[(t+e*this.width)*4+2]=s[2];i[(t+e*this.width)*4+3]=s[3]};P.getpx=function(t,e,r=true){var n=[data[(t+e*this.width)*4+0],data[(t+e*this.width)*4+1],data[(t+e*this.width)*4+2]];if(r)n.push(data[(t+e*this.width)*4+3]);return n};P.formula=function(t=()=>{},e){var r=this.data;for(var n=0;n<this.width;n++){for(var i=0;i<this.height;i++){this.editpx(n,i,t(n,i,n+i*this.width,[this.getpx(n,i,e)[0],this.getpx(n,i,e)[1],this.getpx(n,i,e)[2],e?this.getpx(n,i,true)[3]:255]),e)}}return this};if(!EasyObj.isNode){AddObj(ImageData,P,S,"ImageData");P={},S={}}S.degrad=360/(Math.PI*2);S.distance=(t,r)=>{if(typeof t!="object"|typeof r!="object")throw TypeError("[EasyMod.js] Both X and Y values needs to be object or array");if(t.length==r.length){var n=[];t.forEach((t,e)=>{n.push([t,r[e]])});n=n.map(t=>{return(t[0]-t[1])**2});return n.sum().sqrt()}else{return NaN}};S.chanceTotal=(...t)=>{return t.reduce((t,e)=>{return t+1/e},0)};S.average=(...t)=>{return t.sum()/t.length};S.averagelog=(...t)=>{return t.prod().nrot(t.length)};S.maxuntil=(t,e)=>{var r=e/t.max();return t.map(t=>{return t*r})};S.minuntil=(t,e)=>{var r=e/t.min();return t.map(t=>{return t*r})};S.maxindex=(...t)=>{return t.indexOf(Math.max.apply(null,t))};S.minindex=(...t)=>{return t.indexOf(Math.min.apply(null,t))};S.closest=(t,e,r)=>{var n=t.map(t=>(t-e).abs());return r?Math.minindex.apply(null,n):t[Math.minindex.apply(null,n)]};S.farthest=(t,e,r)=>{var n=t.map(t=>(t-e).abs());return r?Math.maxindex.apply(null,n):t[Math.maxindex.apply(null,n)]};S.isIns1=(t,e=0,r=1)=>{return!!(t>=e&t<e+r)};S.isIns2=(t,e,r=0,n=0,i=1,s=1)=>{return!!(t>=r&e>=n&t<r+i&e<n+s)};S.isIns3=(t,e,r,n=0,i=0,s=0,o=1,a=1,u=1)=>{return!!(t>=n&e>=i&r>=s&t<n+o&e<i+a&r<s+u)};S.isBetw=(t,e,r,n=0)=>{return!!((n%2==0?t>=e:t>e)&(n/2<1?t<=e:t<e))};S.findNext=(t,e)=>{return e-t+e};S.findNext3=(t,e,r)=>{return r*3-e*3+t};S.TAU=Math.PI*2;S.aver=(...t)=>{return t.sum()/t.length},AddObj(Math,P,S,"Math");if(!EasyObj.isNode){document.addEventListener("keydown",t=>{EasyObj.key.id.code[t.code]=true;EasyObj.key.id.key[t.key]=true;EasyObj.key.id.num[t.keyCode]=true;EasyObj.key.id.any=true});document.addEventListener("keyup",t=>{if(EasyObj.key.compressed){delete EasyObj.key.id.code[t.code];delete EasyObj.key.id.key[t.key];delete EasyObj.key.id.num[t.keyCode]}else{EasyObj.key.id.code[t.code]=false;EasyObj.key.id.key[t.key]=false;EasyObj.key.id.num[t.keyCode]=false}EasyObj.key.id.any=false});document.addEventListener("mousedown",()=>EasyObj.mouseDown=true);document.addEventListener("mouseup",()=>EasyObj.mouseDown=false);document.addEventListener("mousemove",t=>{EasyObj.doc.msePos.x=t.x;EasyObj.doc.msePos.y=t.y});document.addEventListener("mousedown",t=>{EasyObj.doc.lmsePos.x=t.x;EasyObj.doc.lmsePos.y=t.y});document.addEventListener("wheel",t=>{EasyObj.mouse.scr=t.deltaY;y=EasyObj.mouse.scrs=EasyObj.mouse.scr.sign()});document.addEventListener("mousedown",t=>{switch(t.which){case 1:EasyObj.mouse.ldown=true;EasyObj.mouse.sdown=true;break;case 2:EasyObj.mouse.mdown=true;break;case 3:EasyObj.mouse.rdown=true;EasyObj.mouse.sdown=true;break}EasyObj.mouse.down=true});document.addEventListener("mouseup",t=>{switch(t.which){case 1:EasyObj.mouse.ldown=false;EasyObj.mouse.sdown=false;break;case 2:EasyObj.mouse.mdown=false;break;case 3:EasyObj.mouse.rdown=false;EasyObj.mouse.sdown=false;break}EasyObj.mouse.down=false})}if(EasyObj.setint){setInterval(()=>{EasyObj.random=Math.random()},10)}if(EasyObj.setint&!EasyObj.isNode){setTimeout(()=>{EasyObj.dc.title=(document.querySelector("html>head>title")||{}).innerHTML;EasyObj.dc.icon=(document.querySelector('html>head>link[rel="shortcut icon"]')||{}).href},10)}if(!EasyObj.isNode)window.addEventListener("beforeunload",function(t){if(EasyObj.saveWarn){t.preventDefault();t.returnValue=""}});var addm=0;var addm2=0,q;add.proto.forEach(t=>{addm+=t.length;addm2+=t.length});add["static"].forEach((t,e)=>{addm+=t.length;addm2+=t.allowIf(t=>{return typeof this[e][t]=="function"}).length});add.totalAdds=addm;EasyObj.info.a.newfuncts=addm2;var time=Date.now();if(EasyObj.setint)setInterval(()=>{EasyObj.time=Date.now()-time},10);Number.prototype.type="number";Boolean.prototype.type="boolean";String.prototype.type="string";BigInt.prototype.type="bigint";Object.prototype.type="object";Symbol.prototype.type="symbol";isThis=true})();