// ==UserScript==
// @name Agma Chat Command Settings
// @namespace agma-chat-command-settings
// @version 2.3.1
// @description Configure your settings using the chat.
// @author Nuke
// @match *://agma.io/
// @grant none
// ==/UserScript==
!function(){var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.ChatContext=e.createChatContext=void 0,e.createChatContext=function(e){return new n(e)};var n=function(){function e(e){this._chatElement=document.querySelector(e)}return e.prototype.value=function(e){if(void 0===e)return this._chatElement.value;this._chatElement.value=e},e.prototype.clear=function(){this.value("")},e}();e.ChatContext=n;var i={};Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_COMMAND=i.DEFAULT_OPTIONS=void 0,i.DEFAULT_OPTIONS={info:{ioScriptsVersion:"1.3.1",version:"1.0.0"},prefix:"/"},i.DEFAULT_COMMAND={clearChat:!0};var t={};Object.defineProperty(t,"__esModule",{value:!0}),t.debug=t.error=t.warn=t.log=void 0,t.log=function(e){console.log("[io-scripts (LOG)]: "+e)},t.warn=function(e){console.warn("[io-scripts (WARN)]: "+e)},t.error=function(e){console.error("[io-scripts (ERROR)]: "+e)},t.debug=function(e){console.log("[io-scripts (DEBUG)]: "+e)};var o={};Object.defineProperty(o,"__esModule",{value:!0}),o.isFunction=void 0,o.isFunction=function(e){return"function"==typeof e};var a={},r=this&&this.__createBinding||(Object.create?function(e,n,i,t){void 0===t&&(t=i),Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[i]}})}:function(e,n,i,t){void 0===t&&(t=i),e[t]=n[i]}),s=this&&this.__setModuleDefault||(Object.create?function(e,n){Object.defineProperty(e,"default",{enumerable:!0,value:n})}:function(e,n){e.default=n}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&r(n,e,i);return s(n,e),n},d=this&&this.__awaiter||function(e,n,i,t){return new(i||(i=Promise))((function(o,a){function r(e){try{l(t.next(e))}catch(n){a(n)}}function s(e){try{l(t.throw(e))}catch(n){a(n)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,s)}l((t=t.apply(e,n||[])).next())}))},c=this&&this.__generator||function(e,n){var i,t,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,t=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(o=(o=r.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){r=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(6===a[0]&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=n.call(e,r)}catch(s){a=[6,s],t=0}finally{i=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},u=this&&this.__spreadArray||function(e,n,i){if(i||2===arguments.length)for(var t,o=0,a=n.length;o<a;o++)!t&&o in n||(t||(t=Array.prototype.slice.call(n,0,o)),t[o]=n[o]);return e.concat(t||Array.prototype.slice.call(n))};Object.defineProperty(a,"__esModule",{value:!0}),a.Script=a.createScript=void 0;var m=l(t);a.createScript=function(e){return new f(e)};var f=function(){function n(e){this.commands=[],this.plugins=new Set,this._initialized=!1,this.options=Object.assign({},i.DEFAULT_OPTIONS,e),this.init(),this.options.exposeToWindowObject&&(window.$script?m.warn('Unable to expose script to "window.$script". "window.$script" is already in use by another script.'):window.$script=this)}return n.prototype.command=function(e,n){if(n)return this.options.debug&&m.debug('Registering command "'+e+'"...'),this.commands.includes(n)?this.options.silent||m.warn('Command "'+n.name+'" has already been registered'):(n=Object.assign({},i.DEFAULT_COMMAND,n,e),this.commands.push(n),this.options.debug&&m.debug('Registered command "'+e+'".')),this;this.options.debug&&m.debug('Searching for command "'+e+'"...');for(var t=0;t<this.commands.length;t++){var o=this.commands[t];if(o.name==e)return this.options.debug&&(m.debug('Command "'+e+'" found.'),console.log(o)),o;if(o.aliases){if("string"==typeof o.aliases&&o.aliases===e)return this.options.debug&&(m.debug('Command "'+e+'" found.'),console.log(o)),o;if(Array.isArray(o.aliases)&&o.aliases.includes(e))return this.options.debug&&(m.debug('Command "'+e+'" found.'),console.log(o)),o}}this.options.debug&&m.debug('Command "'+e+'" not found.')},n.prototype.use=function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return this.plugins.has(e)?!this.options.silent&&m.warn("Plugin has already been applied."):e&&(0,o.isFunction)(e)?(this.plugins.add(e),e.apply(void 0,u([this],n,!1))):this.options.silent||m.error("A plugin must be a function."),this},n.prototype.init=function(){var n=this;if(!this._initialized){this.options.debug&&m.debug("Initializing script...");var i=this.options,t=i.chatElementSelector,o=i.prefix;if(t){var a=document.querySelector(t);a?(a.addEventListener("keydown",(function(i){return d(n,void 0,void 0,(function(){var n,r,s,l,d,u;return c(this,(function(c){switch(c.label){case 0:return"Enter"!=i.key?[3,2]:(n=a.value).startsWith(o)?(r=n.trim().slice(null==o?void 0:o.length).split(/ +/g),s=r[0],l=r.slice(1),(d=this.command(s.toLowerCase()))?d.disabled?[2]:(u=(0,e.createChatContext)(t),d.clearChat&&u.clear(),[4,d.run(this,u,l)]):[3,2]):[2];case 1:c.sent(),c.label=2;case 2:return[2]}}))}))})),this._initialized=!0,this.options.debug&&m.debug("Script initialized.")):m.error('Given chatElementSelector "'+t+'" not found as an element.')}}},n}();a.Script=f;var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.defineCommand=void 0,p.defineCommand=function(e){return e};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.definePlugin=void 0,h.definePlugin=function(e){return e};var y={};Object.defineProperty(y,"__esModule",{value:!0});var b={};Object.defineProperty(b,"__esModule",{value:!0});var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.Script=void 0,Object.defineProperty(w,"Script",{enumerable:!0,get:function(){return a.Script}});var v={},g=this&&this.__createBinding||(Object.create?function(e,n,i,t){void 0===t&&(t=i),Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[i]}})}:function(e,n,i,t){void 0===t&&(t=i),e[t]=n[i]}),C=this&&this.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||g(n,e,i)};Object.defineProperty(v,"__esModule",{value:!0}),v.ChatContext=void 0,Object.defineProperty(v,"ChatContext",{enumerable:!0,get:function(){return e.ChatContext}}),C(y,v),C(b,v),C(w,v);var _={},O=this&&this.__createBinding||(Object.create?function(e,n,i,t){void 0===t&&(t=i),Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[i]}})}:function(e,n,i,t){void 0===t&&(t=i),e[t]=n[i]}),S=this&&this.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||O(n,e,i)};Object.defineProperty(_,"__esModule",{value:!0}),_.defineCommand=_.createScript=void 0,Object.defineProperty(_,"createChatContext",{enumerable:!0,get:function(){return e.createChatContext}}),Object.defineProperty(_,"createScript",{enumerable:!0,get:function(){return a.createScript}}),Object.defineProperty(_,"defineCommand",{enumerable:!0,get:function(){return p.defineCommand}}),Object.defineProperty(_,"definePlugin",{enumerable:!0,get:function(){return h.definePlugin}}),S(v,_);var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.Colors=N.DEFAULT_OPTIONS=void 0,N.DEFAULT_OPTIONS={textColor:"#ffffff",visibilityTime:5e3,alertElement:"#curser"},function(e){e.WHITE="#FFFFFF",e.SILVER="#C0C0C0",e.GRAY="#808080",e.GREY="#808080",e.BLACK="#000000",e.RED="#FF0000",e.MAROON="#800000",e.YELLOW="#FFF000",e.OLIVE="#808000",e.LIME="#00FF00",e.GREEN="#008000",e.AQUA="#00FFFF",e.TEAL="#008080",e.BLUE="#0000FF",e.NAVY="#000080",e.FUCHSIA="#FF00FF",e.PURPLE="#800080"}(N.Colors||(N.Colors={}));var P={},A=this&&this.__assign||function(){return(A=Object.assign||function(e){for(var n,i=1,t=arguments.length;i<t;i++)for(var o in n=arguments[i])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};Object.defineProperty(P,"__esModule",{value:!0}),P.useAlert=void 0,P.useAlert=function(e,n){n=A(A({},N.DEFAULT_OPTIONS),n);var i=document.querySelector(n.alertElement);n.textColor&&(i.style.color=n.textColor),i.style.fontSize="24px",i.textContent=e,i.style.display="block",setTimeout((function(){i.style.display="none"}),n.visibilityTime)};var F={};Object.defineProperty(F,"__esModule",{value:!0});var M={},j=this&&this.__createBinding||(Object.create?function(e,n,i,t){void 0===t&&(t=i),Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[i]}})}:function(e,n,i,t){void 0===t&&(t=i),e[t]=n[i]}),E=this&&this.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||j(n,e,i)};Object.defineProperty(M,"__esModule",{value:!0}),E(F,M);var k={},x=this&&this.__createBinding||(Object.create?function(e,n,i,t){void 0===t&&(t=i),Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[i]}})}:function(e,n,i,t){void 0===t&&(t=i),e[t]=n[i]}),L=this&&this.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||x(n,e,i)};Object.defineProperty(k,"__esModule",{value:!0}),k.Colors=k.useAlert=void 0,Object.defineProperty(k,"useAlert",{enumerable:!0,get:function(){return P.useAlert}}),L(M,k),Object.defineProperty(k,"Colors",{enumerable:!0,get:function(){return N.Colors}});var T={};const D=[{displayName:"Dark Theme",name:"darktheme",function:window.setDark,id:"cDark"},{displayName:"Fancy Grid",name:"fancygrid",function:window.setFancyGrid,id:"cFancyGrid"},{displayName:"Section Grid",name:"sectiongrid",function:window.setSectionGrid,id:"cSectionGrid"},{displayName:"Gridlines",name:["gridline","gridlines"],function:window.setGrid,id:"cGrid"},{displayName:"Skins",name:["skin","skins"],function:window.setSkins,id:"cSkins"},{displayName:"Wearables",name:["wearable","wearables"],function:window.setWearables,id:"cWearables"},{displayName:"Show Names",name:["name","names"],function:window.setNames,id:"cNames"},{displayName:"Minion Names",name:["minionname","minionnames"],function:window.setMinionNames,id:"cMinionNames"},{displayName:"Large Names",name:["largename","largenames"],function:window.setLargeNames,id:"cLargeNames"},{displayName:"Name Outlines",name:["nameoutline","nameoutlines"],function:window.setNameOutlines,id:"cNameOutlines"},{displayName:"Show Mass",name:"mass",function:window.setMass,id:"cMass"},{displayName:"Show Food",name:"food",function:window.setFood,id:"cFood"},{displayName:"Cell Animations",name:["cellanimation","cellanimations"],function:window.setCellAnimations,id:"cCellAnimations"},{displayName:"Skin Animations",name:["skinanimation","skinanimations"],function:window.setSkinAnimations,id:"cSkinAnimations"},{displayName:"Map Border",name:"mapborder",function:window.setMapBorder,id:"cMapBorder"},{displayName:"Sounds",name:["sound","sounds"],function:window.setSounds,id:"cSounds"},{displayName:"Infinite Zoom",name:"infinitezoom",function:window.setZoom,id:"cZoom"},{displayName:"Fixed Zoom",name:"fixedzoom",function:window.setFixedZoom,id:"cFixedZoom"},{displayName:"Slow Motion",name:"slowmotion",function:window.setSlowMotion,id:"cSlowMotion"},{displayName:"Minion Panel",name:"minionpanel",function:window.setMinionUi,id:"cMinionUi"},{displayName:"Leaderboard",name:"leaderboard",function:window.setLeaderboard,id:"cLeaderboard"},{displayName:"Chat",name:"chat",function:window.setChat,id:"cChat"},{displayName:"Minimap",name:"minimap",function:window.setMinimap,id:"cMinimap"},{displayName:"FPS / Ping / Stats",name:["fps","ping","stats"],function:window.setFPS,id:"cFPS"},{displayName:"Cell Colors",name:["color","colors","cellcolor","cellcolors"],function:window.setColors,id:"cColors"},{displayName:"Cell Borders",name:["cellborder","cellborders"],function:window.setCellBorders,id:"cCellBorders"},{displayName:"Cell Spikes",name:["cellspike","cellspikes"],function:window.setCellSpikes,id:"cCellSpikes"},{displayName:"Classic Virus Look",name:"classicvirus",function:window.setClassicViruses,id:"cClassicViruses"},{displayName:"Polygon Shapes",name:["polygonshape","polygonshapes"],function:window.setPolygonShapes,id:"cPolygonShapes"},{displayName:"Line Shapes",name:["lineshape","lineshapes"],function:window.setLineShapes,id:"cLineShapes"},{displayName:"Bubble Cells",name:["bubblecell","bubblecells"],function:window.setBubbleCells,id:"cBubbleCells"}],G=[{displayName:"Online Status",name:"onlinestatus",function:window.setFriendlistOnline,id:"cVisibilityStatus"},{displayName:"Allow Party Invitations",name:"partyinvite",function:window.showPartyInvite,id:"cAllowPartyInvite"},{displayName:"Allow Party Animations",name:["partyanimation","partyanimations"],function:window.setPartyAnimations,id:"cAllowPartyAnimations"},{displayName:"Auto Feed",name:"autofeed",function:window.setAutoFeedEnabled,id:"cAutoFeed"},{displayName:"Gold Nickname",name:["goldnick","goldnickname"],function:window.setGoldNickname,id:"cGoldName"},{displayName:"Gold Crown in Chat",name:"goldcrown",function:window.setGoldCrownChat,id:"cGoldCrownChat"},{displayName:"Set Skins on Minions",name:["minionskin","minionskins"],function:window.setMinionSkins,id:"cMinionSkinStatus"},{displayName:"Video Ads",name:["videoad","videoads"],function:window.setVideoAds,id:"cVideoAds"}];T.availableSettings=[...D,...G];const{defineCommand:I}=_,{useAlert:B,Colors:R}=k,{availableSettings:U}=T;var V=[I({name:"setting",aliases:["s"],run:(e,n,i)=>{if(1==i.length){const e=U.find(e=>!!e&&(Array.isArray(e.name)?e.name.find(e=>e==i[0]):e.name==i[0]));if(!e)return void B(`No setting found with name "${i[0]}"`,{textColor:R.RED});const{displayName:n,id:t}=e,o=document.getElementById(t);B(`The setting "${n}" is turned ${o.checked?"on":"off"}`,{textColor:o.checked?R.LIME:R.RED})}if(2==i.length&&("on"==i[1]||"off"==i[1])){const e="on"===i[1],n=U.find(e=>!!e&&(Array.isArray(e.name)?e.name.find(e=>e==i[0]):e.name==i[0]));if(!n)return void B(`No setting found with name "${i[0]}"`,{textColor:R.RED});const{displayName:t,function:o,id:a}=n,r=document.getElementById(a);o(e),r.checked=e,B(`The setting "${t}" has been turned ${e?"on":"off"}`,{textColor:e?R.LIME:R.RED})}}})];const{createScript:$}=_,{name:W,version:z,description:Z,author:Y}={name:"agma-chat-command-settings",version:"2.3.1",description:"Configure your settings using the chat.",author:"CodingWithNuke"},q=$({info:{name:W,version:z,description:Z,author:Y},chatElementSelector:"#chtbox",silent:!0});V.forEach(e=>q.command(e.name,e))}();