在您安裝前,Greasy Fork希望您了解本腳本包含“可能不受歡迎的功能”,可能幫助腳本的作者獲利,而不能給你帶來任何收益。
此腳本會在您造訪的網站插入廣告。
Delta - Agario extension, with zoom, minimap, helpers, adblocker
目前為
// ==UserScript== // @name 'Delta - 999999 in 1 // @name:ru 'Delta - 999999 в 1 // @name:uk 'Delta - 999999 в 1 // @name:ru 'Delta - 999999 в 1' // @name:ja 'デルタ - 999999 イン 1' // @name:es 'Delta - 999999 en 1' // @name:zh-CN 'Delta - 999999 合 1' // @name:de 'Delta - 999999 in 1' // @name:ar 'دلتا - 999999 في 1' // @description Delta - Agario extension, with zoom, minimap, helpers, adblocker // @description:es Delta - extensión para Agario con zoom, minimapa, ayudas y bloqueador de anuncios // @description:ru Delta — расширение для Agario с зумом, миникартой, помощниками и блокировщиком рекламы // @description:zh-CN Delta - agario 的扩展,带有缩放、小地图、辅助功能和广告拦截器 // @description:uk Delta — розширення для Agario із зумом, мінікартою, помічниками та блокувальником реклами // @description:tr Delta - Agario için yakınlaştırma, mini harita, yardımcılar ve reklam engelleyici uzantısı // @description:de Delta – Erweiterung für Agario mit Zoom, Minikarte, Helfern und Werbeblocker // @description:ja Delta - Agario のズーム、ミニマップ、ヘルパー、広告ブロッカー付き拡張機能 // @description:pl Delta - rozszerzenie do Agario z powiększeniem, minimapą, pomocnikami i blokadą reklam // @description:fr Delta - extension pour Agario avec zoom, mini-carte, assistants et bloqueur de publicité // @description:ar دلتا - إضافة لـ Agario مع مانع إعلانات // @version 7.9 // @namespace delta.agar // @author neo // @icon https://deltav4.gitlab.io/favicon.ico // @match *://*.agar.io/ // @run-at document-start // @grant GM.xmlHttpRequest // @grant GM.registerMenuCommand // @grant window.close // @grant unsafeWindow // @license MPL-2.0 // @antifeature ads // @supportURL https://discord.gg/HHmyKW6 // @connect cdnjs.cloudflare.net // @require https://cdnjs.cloudflare.com/ajax/libs/preact/10.21.0/preact.umd.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/preact/10.21.0/hooks.umd.min.js // @require https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4 // ==/UserScript== /* GREASYFORK VERSION Sorry, Delta is no longer available for GreasyFork users. Delta will be available again after all GreasyFork rules are met. Right now there is a lite version of Delta en: If this user script does not start, write me a discord ru: Если данное расширение не запускается, напишите мне в дискорд https://discord.gg/HHmyKW6 */(function (window) { var __webpack_modules__ = { 32: module => { "use strict"; module.exports = preact; }, 93: (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { camelCaseToWords: () => camelCaseToWords, find_node: () => find_node, overrideMethod: () => overrideMethod, overridePrototype: () => overridePrototype, updateCssString: () => updateCssString }); function find_node(where = window['agarApp'].home, cond) { const results = []; const find_static = (where = window['agarApp'].home, cond) => { function each_children(child, depth) { depth += 1; child.forEach((ch => { if (cond(ch, depth)) { results.push(ch); } ch.children && each_children(ch.children, depth); })); } each_children(where, -1); return results; }; function each_children(child, depth) { var _a, _b, _c, _d, _e, _f, _g; depth += 1; if (cond(child, depth)) { results.push(child); } child._staticTrees && find_static(child._staticTrees, cond); null === (_a = child.$children) || void 0 === _a || _a.forEach((ch => { each_children(ch, depth); })); null === (_b = child.children) || void 0 === _b || _b.forEach((ch => { each_children(ch, depth); })); null === (_d = null === (_c = child._vnode) || void 0 === _c ? void 0 : _c.children) || void 0 === _d || _d.forEach((ch => { each_children(ch, depth); })); null === (_g = null === (_f = null === (_e = child._vnode) || void 0 === _e ? void 0 : _e.componentOptions) || void 0 === _f ? void 0 : _f.children) || void 0 === _g || _g.forEach((ch => { each_children(ch, depth); })); } each_children(where, -1); return results; } function overrideMethod(obj, methodName, getMethod) { const originalMethod = obj[methodName]; obj[methodName] = function() { return getMethod(originalMethod, arguments); }; } function overridePrototype(obj, methodName, getMethod) { const originalMethod = obj[methodName]; return obj[methodName] = getMethod(originalMethod); } const updateCssString = (() => { const records = {}; return (name, css) => { if (!records[name]) { const style = document.createElement('style'); style.setAttribute('data-css-name', name); document.head.appendChild(style); records[name] = style; } records[name].textContent = css; }; })(); function camelCaseToWords(s) { const result = s.replace(/([A-Z])/g, ' $1'); return result.charAt(0).toUpperCase() + result.slice(1); } }, 122: (module, __unused_webpack___webpack_exports__, __webpack_require__) => { "use strict"; var Eventify = __webpack_require__(742); var __classPrivateFieldGet = function(receiver, state, kind, f) { if ("a" === kind && !f) { throw new TypeError("Private accessor was defined without a getter"); } if ("function" === typeof state ? receiver !== state || !f : !state.has(receiver)) { throw new TypeError("Cannot read private member from an object whose class did not declare it"); } return "m" === kind ? f : "a" === kind ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _Storage_namespace; class Storage { constructor() { _Storage_namespace.set(this, 'v6'); } set(key, object, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f"), middleware = d => d) { localStorage.setItem(namespace + key, middleware(JSON.stringify(object))); } get(key, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f"), middleware = d => d) { let obj = {}; const rawData = localStorage.getItem(namespace + key); if ('string' === typeof rawData) { try { obj = JSON.parse(middleware(rawData)); } catch (e) { console.error(e); } } return obj; } clear(key, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f")) { return localStorage.removeItem(namespace + key); } } _Storage_namespace = new WeakMap; const storage = new Storage; var utils = __webpack_require__(93); function coreInitPatch() { (0, utils.overrideMethod)(window['core'], 'setFpsCap', (originalMethod => originalMethod(-1))); } function coreUiPatch() { document.querySelector('#title').innerHTML = 'Delta'; } function coreAdsPatch() { var _a, _b, _c, _d, _e; null === (_a = (0, utils.find_node)(void 0, (child => { var _a; return null === (_a = child.$vnode) || void 0 === _a ? void 0 : _a.tag.includes('-ads'); }))[0]) || void 0 === _a || _a.$destroy(); null === (_b = (0, utils.find_node)(void 0, (child => { var _a; return null === (_a = child.$vnode) || void 0 === _a ? void 0 : _a.tag.includes('-promo'); }))[0]) || void 0 === _b || _b.$destroy(); (0, utils.find_node)(void 0, (child => { var _a, _b; return null === (_b = null === (_a = child.elm) || void 0 === _a ? void 0 : _a.id) || void 0 === _b ? void 0 : _b.includes('agar-io'); })).forEach((child => { var _a; null === (_a = child.elm.parentElement) || void 0 === _a || _a.removeChild(child.elm); })); (0, utils.find_node)(void 0, (child => child.playVideoAd)).forEach((elem => { elem.getVideoTimestamp = () => Date.now(); })); { const vnode = null === (_c = (0, utils.find_node)(void 0, (child => Object.getPrototypeOf(child).hasOwnProperty('hasBottomAd')))) || void 0 === _c ? void 0 : _c[0]; if (vnode) { Object.defineProperties(vnode, { fastEntry: { get: () => true } }); } } { const vnode = (0, utils.find_node)(void 0, (child => { var _a; if ('socialButtons' == (null === (_a = null === child || void 0 === child ? void 0 : child.elm) || void 0 === _a ? void 0 : _a.id)) { return true; } }))[0]; if (vnode) { vnode.elm.parentElement.removeChild(vnode.elm); } } { const bubble = (0, utils.find_node)(void 0, (child => { var _a, _b; return null === (_b = null === (_a = child.data) || void 0 === _a ? void 0 : _a.staticClass) || void 0 === _b ? void 0 : _b.includes('bubble'); }))[0]; null === (_d = null === bubble || void 0 === bubble ? void 0 : bubble.elm) || void 0 === _d || _d.parentElement.removeChild(null === bubble || void 0 === bubble ? void 0 : bubble.elm); } { const vnode = null === (_e = (0, utils.find_node)(void 0, (child => Object.getPrototypeOf(child).hasOwnProperty('hasBottomAd')))) || void 0 === _e ? void 0 : _e[0]; if (vnode) { [ 'hasBottomAd', 'hasSideAds' ].map((prop => { vnode._computedWatchers[prop]['getter'] = () => false; })); Object.defineProperties(vnode, { hasBottomAd: { get: () => false }, fastEntry: { get: () => true } }); } } document.documentElement.style.setProperty("--bottom-banner-height", '0px'); window.Object.defineProperty(window, 'agarApp', { get() { return window['agarApp_']; }, set(value) { window['agarApp_'] = value; onAgarApp(); } }); function onAgarApp() { var _a, _b, _c; var _d; null !== (_a = (_d = window['agarApp']).ads) && void 0 !== _a || (_d.ads = {}); Object.assign(window['agarApp'].ads, { requestAds() {}, requestAd() {}, refreshAd() {}, destroyAd() {}, adSlots() {}, enableTargetedAds() {}, disableTargetedAds() {}, isTargeted() {}, supersonicAds: { BrandConnectReadyEvent() {}, BrandConnectDoneEvent() {}, BrandConnectOpenEvent() {}, BrandConnectCloseEvent() {}, BrandConnectCompletedEvent() {}, hasEngagement() { return false; } } }); if (null === (_b = window['agarApp']) || void 0 === _b ? void 0 : _b.main) { [ 'sendEndSession', 'initDataDog', 'sendAnalyticsInitEvent', 'onGoliathReady', 'onGoliathUnload', 'initAnalytics', 'initGuestAnalytics', 'sendAnalyticsInitEvent', 'initBrowserId' ].forEach((prop => { window['agarApp'].main[prop] = () => {}; })); } if (null === (_c = window['agarApp']) || void 0 === _c ? void 0 : _c.MCSDK) { [ 'sendMatchEvent' ].forEach((prop => window['agarApp'].MCSDK[prop] = () => {})); } } try { onAgarApp(); } catch (e) {} } function fixNoServers() { let AgarioEndpoints = null; class HookXMLHttpRequest extends window.XMLHttpRequest { constructor() { super(); } open(method, _url, async, username, password) { const url = new URL(_url, location.href); if (url.pathname.endsWith('/info')) { this.addEventListener('load', (() => { const regions = JSON.parse(this.responseText); AgarioEndpoints = regions; })); } if (url.pathname.endsWith('/findServerWithFriends')) { console.log('Hooked XMLHttpRequest:', method, url); this.addEventListener('load', (e => { const endpoints = JSON.parse(this.responseText); if ('no_servers' == endpoints.status) { e.stopPropagation(); e.stopImmediatePropagation(); [ 'responseText', 'response' ].forEach((prop => { Object.defineProperty(this, prop, { value: JSON.stringify({ endpoints: { http: 'web-arenas-live-v25-0.agario.miniclippt.com/us-east-1/3-80-219-193', https: 'web-arenas-live-v25-0.agario.miniclippt.com/us-east-1/3-80-219-193' }, status: 'ok', count: 0 }) }); })); this.dispatchEvent(new ProgressEvent('load', e)); } })); } super.open(method, url, async, username, password); } } window.XMLHttpRequest = HookXMLHttpRequest; } var external_preact_ = __webpack_require__(32); var jsxRuntime_module = __webpack_require__(557); class Portal extends external_preact_.Component { constructor() { super(...arguments); this.isMounted = false; } componentDidUpdate(props) { for (const i in props) { if (props[i] !== this.props[i]) { return setTimeout((() => this.renderLayer())); } } } componentDidMount() { this.isMounted = true; this.renderLayer = this.renderLayer.bind(this); this.renderLayer(); } componentWillUnmount() { this.renderLayer(false); this.isMounted = false; if (this.remote && this.remote.parentNode) { this.remote.parentNode.removeChild(this.remote); } } findNode(node) { return 'string' === typeof node ? document.querySelector(node) : node; } renderLayer(show = true) { if (!this.isMounted) { return; } if (this.props.into !== this.intoPointer) { this.intoPointer = this.props.into; if (this.into && this.remote) { this.remote = (0, external_preact_.render)((0, jsxRuntime_module.jsx)(PortalProxy, {}), createRootFragment(this.into, this.remote)); } this.into = this.findNode(this.props.into); } this.remote = (0, external_preact_.render)((0, jsxRuntime_module.jsx)(PortalProxy, { context: this.$state, children: show && this.props.children ? [ this.props.children ] : null }), createRootFragment(this.into, this.remote)); } render() { return null; } } class PortalProxy extends external_preact_.Component { getChildContext() { return this.props.context; } render({children: children} = this.props) { return children && children[0] || null; } } function createRootFragment(parent, replaceNode) { if (replaceNode) { replaceNode = Array.isArray(replaceNode) ? replaceNode : [ replaceNode ]; } else { replaceNode = [ parent ]; parent = parent.parentNode; } const s = replaceNode[replaceNode.length - 1].nextSibling; const rootFragment = { nodeType: 1, parentNode: parent, firstChild: replaceNode[0], childNodes: replaceNode, insertBefore: (c, r) => { parent.insertBefore(c, r || s); return c; }, appendChild: c => { parent.insertBefore(c, s); return c; }, removeChild: function(c) { parent.removeChild(c); return c; } }; parent.__k = rootFragment; return rootFragment; } var Contexts = __webpack_require__(621); var Menu = __webpack_require__(647); var external_preactHooks_ = __webpack_require__(632); function g(n, t) { for (var e in t) { n[e] = t[e]; } return n; } function E(n, t) { for (var e in n) { if ("__source" !== e && !(e in t)) { return !0; } } for (var r in t) { if ("__source" !== r && n[r] !== t[r]) { return !0; } } return !1; } function C(n, t) { var e = t(), r = (0, external_preactHooks_.useState)({ t: { __: e, u: t } }), u = r[0].t, o = r[1]; return (0, external_preactHooks_.useLayoutEffect)((function() { u.__ = e, u.u = t, x(u) && o({ t: u }); }), [ n, e, t ]), (0, external_preactHooks_.useEffect)((function() { return x(u) && o({ t: u }), n((function() { x(u) && o({ t: u }); })); }), [ n ]), e; } function x(n) { var t, e, r = n.u, u = n.__; try { var o = r(); return !((t = u) === (e = o) && (0 !== t || 1 / t == 1 / e) || t != t && e != e); } catch (n) { return !0; } } function R(n) { n(); } function w(n) { return n; } function k() { return [ !1, R ]; } var I = external_preactHooks_.useLayoutEffect; function N(n, t) { this.props = n, this.context = t; } function M(n, e) { function r(n) { var t = this.props.ref, r = t == n.ref; return !r && t && (t.call ? t(null) : t.current = null), e ? !e(this.props, n) || !r : E(this.props, n); } function u(e) { return this.shouldComponentUpdate = r, (0, external_preact_.createElement)(n, e); } return u.displayName = "Memo(" + (n.displayName || n.name) + ")", u.prototype.isReactComponent = !0, u.__f = !0, u; } (N.prototype = new external_preact_.Component).isPureReactComponent = !0, N.prototype.shouldComponentUpdate = function(n, t) { return E(this.props, n) || E(this.state, t); }; var T = external_preact_.options.__b; external_preact_.options.__b = function(n) { n.type && n.type.__f && n.ref && (n.props.ref = n.ref, n.ref = null), T && T(n); }; var A = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.forward_ref") || 3911; function D(n) { function t(t) { var e = g({}, t); return delete e.ref, n(e, t.ref || null); } return t.$$typeof = A, t.render = t, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (n.displayName || n.name) + ")", t; } var L = function(n, t) { return null == n ? null : (0, external_preact_.toChildArray)((0, external_preact_.toChildArray)(n).map(t)); }, O = { map: L, forEach: L, count: function(n) { return n ? (0, external_preact_.toChildArray)(n).length : 0; }, only: function(n) { var t = (0, external_preact_.toChildArray)(n); if (1 !== t.length) { throw "Children.only"; } return t[0]; }, toArray: external_preact_.toChildArray }, F = external_preact_.options.__e; external_preact_.options.__e = function(n, t, e, r) { if (n.then) { for (var u, o = t; o = o.__; ) { if ((u = o.__c) && u.__c) { return null == t.__e && (t.__e = e.__e, t.__k = e.__k), u.__c(n, t); } } } F(n, t, e, r); }; var U = external_preact_.options.unmount; function V(n, t, e) { return n && (n.__c && n.__c.__H && (n.__c.__H.__.forEach((function(n) { "function" == typeof n.__c && n.__c(); })), n.__c.__H = null), null != (n = g({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c = null), n.__k = n.__k && n.__k.map((function(n) { return V(n, t, e); }))), n; } function W(n, t, e) { return n && e && (n.__v = null, n.__k = n.__k && n.__k.map((function(n) { return W(n, t, e); })), n.__c && n.__c.__P === t && (n.__e && e.appendChild(n.__e), n.__c.__e = !0, n.__c.__P = e)), n; } function P() { this.__u = 0, this.o = null, this.__b = null; } function j(n) { var t = n.__.__c; return t && t.__a && t.__a(n); } function z(n) { var e, r, u; function o(o) { if (e || (e = n()).then((function(n) { r = n.default || n; }), (function(n) { u = n; })), u) { throw u; } if (!r) { throw e; } return (0, external_preact_.createElement)(r, o); } return o.displayName = "Lazy", o.__f = !0, o; } function B() { this.i = null, this.l = null; } external_preact_.options.unmount = function(n) { var t = n.__c; t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), U && U(n); }, (P.prototype = new external_preact_.Component).__c = function(n, t) { var e = t.__c, r = this; null == r.o && (r.o = []), r.o.push(e); var u = j(r.__v), o = !1, i = function() { o || (o = !0, e.__R = null, u ? u(c) : c()); }; e.__R = i; var c = function() { if (! --r.__u) { if (r.state.__a) { var n = r.state.__a; r.__v.__k[0] = W(n, n.__c.__P, n.__c.__O); } var t; for (r.setState({ __a: r.__b = null }); t = r.o.pop(); ) { t.forceUpdate(); } } }; r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), n.then(i, i); }, P.prototype.componentWillUnmount = function() { this.o = []; }, P.prototype.render = function(n, e) { if (this.__b) { if (this.__v.__k) { var r = document.createElement("div"), o = this.__v.__k[0].__c; this.__v.__k[0] = V(this.__b, r, o.__O = o.__P); } this.__b = null; } var i = e.__a && (0, external_preact_.createElement)(external_preact_.Fragment, null, n.fallback); return i && (i.__u &= -33), [ (0, external_preact_.createElement)(external_preact_.Fragment, null, e.__a ? null : n.children), i ]; }; var H = function(n, t, e) { if (++e[1] === e[0] && n.l.delete(t), n.props.revealOrder && ("t" !== n.props.revealOrder[0] || !n.l.size)) { for (e = n.i; e; ) { for (;e.length > 3; ) { e.pop()(); } if (e[1] < e[0]) { break; } n.i = e = e[2]; } } }; function Z(n) { return this.getChildContext = function() { return n.context; }, n.children; } function Y(n) { var e = this, r = n.h; e.componentWillUnmount = function() { (0, external_preact_.render)(null, e.v), e.v = null, e.h = null; }, e.h && e.h !== r && e.componentWillUnmount(), e.v || (e.h = r, e.v = { nodeType: 1, parentNode: r, childNodes: [], contains: function() { return !0; }, appendChild: function(n) { this.childNodes.push(n), e.h.appendChild(n); }, insertBefore: function(n, t) { this.childNodes.push(n), e.h.insertBefore(n, t); }, removeChild: function(n) { this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), e.h.removeChild(n); } }), (0, external_preact_.render)((0, external_preact_.createElement)(Z, { context: e.context }, n.__v), e.v); } function $(n, e) { var r = (0, external_preact_.createElement)(Y, { __v: n, h: e }); return r.containerInfo = e, r; } (B.prototype = new external_preact_.Component).__a = function(n) { var t = this, e = j(t.__v), r = t.l.get(n); return r[0]++, function(u) { var o = function() { t.props.revealOrder ? (r.push(u), H(t, n, r)) : u(); }; e ? e(o) : o(); }; }, B.prototype.render = function(n) { this.i = null, this.l = new Map; var t = (0, external_preact_.toChildArray)(n.children); n.revealOrder && "b" === n.revealOrder[0] && t.reverse(); for (var e = t.length; e--; ) { this.l.set(t[e], this.i = [ 1, 0, this.i ]); } return n.children; }, B.prototype.componentDidUpdate = B.prototype.componentDidMount = function() { var n = this; this.l.forEach((function(t, e) { H(n, e, t); })); }; var q = "undefined" != typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, G = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, J = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, K = /[A-Z0-9]/g, Q = "undefined" != typeof document, X = function(n) { return ("undefined" != typeof Symbol && "symbol" == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n); }; function nn(n, t, e) { return null == t.__k && (t.textContent = ""), (0, external_preact_.render)(n, t), "function" == typeof e && e(), n ? n.__c : null; } function tn(n, t, e) { return (0, external_preact_.hydrate)(n, t), "function" == typeof e && e(), n ? n.__c : null; } external_preact_.Component.prototype.isReactComponent = {}, [ "componentWillMount", "componentWillReceiveProps", "componentWillUpdate" ].forEach((function(t) { Object.defineProperty(external_preact_.Component.prototype, t, { configurable: !0, get: function() { return this["UNSAFE_" + t]; }, set: function(n) { Object.defineProperty(this, t, { configurable: !0, writable: !0, value: n }); } }); })); var en = external_preact_.options.event; function rn() {} function un() { return this.cancelBubble; } function on() { return this.defaultPrevented; } external_preact_.options.event = function(n) { return en && (n = en(n)), n.persist = rn, n.isPropagationStopped = un, n.isDefaultPrevented = on, n.nativeEvent = n; }; var cn, ln = { enumerable: !1, configurable: !0, get: function() { return this.class; } }, fn = external_preact_.options.vnode; external_preact_.options.vnode = function(n) { "string" == typeof n.type && function(n) { var t = n.props, e = n.type, u = {}, o = -1 === e.indexOf("-"); for (var i in t) { var c = t[i]; if (!("value" === i && "defaultValue" in t && null == c || Q && "children" === i && "noscript" === e || "class" === i || "className" === i)) { var l = i.toLowerCase(); "defaultValue" === i && "value" in t && null == t.value ? i = "value" : "download" === i && !0 === c ? c = "" : "translate" === l && "no" === c ? c = !1 : "o" === l[0] && "n" === l[1] ? "ondoubleclick" === l ? i = "ondblclick" : "onchange" !== l || "input" !== e && "textarea" !== e || X(t.type) ? "onfocus" === l ? i = "onfocusin" : "onblur" === l ? i = "onfocusout" : J.test(i) && (i = l) : l = i = "oninput" : o && G.test(i) ? i = i.replace(K, "-$&").toLowerCase() : null === c && (c = void 0), "oninput" === l && u[i = l] && (i = "oninputCapture"), u[i] = c; } } "select" == e && u.multiple && Array.isArray(u.value) && (u.value = (0, external_preact_.toChildArray)(t.children).forEach((function(n) { n.props.selected = -1 != u.value.indexOf(n.props.value); }))), "select" == e && null != u.defaultValue && (u.value = (0, external_preact_.toChildArray)(t.children).forEach((function(n) { n.props.selected = u.multiple ? -1 != u.defaultValue.indexOf(n.props.value) : u.defaultValue == n.props.value; }))), t.class && !t.className ? (u.class = t.class, Object.defineProperty(u, "className", ln)) : (t.className && !t.class || t.class && t.className) && (u.class = u.className = t.className), n.props = u; }(n), n.$$typeof = q, fn && fn(n); }; var an = external_preact_.options.__r; external_preact_.options.__r = function(n) { an && an(n), cn = n.__c; }; var sn = external_preact_.options.diffed; external_preact_.options.diffed = function(n) { sn && sn(n); var t = n.props, e = n.__e; null != e && "textarea" === n.type && "value" in t && t.value !== e.value && (e.value = null == t.value ? "" : t.value), cn = null; }; var hn = { ReactCurrentDispatcher: { current: { readContext: function(n) { return cn.__n[n.__c].props.value; }, useCallback: external_preactHooks_.useCallback, useContext: external_preactHooks_.useContext, useDebugValue: external_preactHooks_.useDebugValue, useDeferredValue: w, useEffect: external_preactHooks_.useEffect, useId: external_preactHooks_.useId, useImperativeHandle: external_preactHooks_.useImperativeHandle, useInsertionEffect: I, useLayoutEffect: external_preactHooks_.useLayoutEffect, useMemo: external_preactHooks_.useMemo, useReducer: external_preactHooks_.useReducer, useRef: external_preactHooks_.useRef, useState: external_preactHooks_.useState, useSyncExternalStore: C, useTransition: k } } }; function dn(n) { return external_preact_.createElement.bind(null, n); } function pn(n) { return !!n && n.$$typeof === q; } function mn(n) { return pn(n) && n.type === external_preact_.Fragment; } function yn(n) { return !!n && !!n.displayName && ("string" == typeof n.displayName || n.displayName instanceof String) && n.displayName.startsWith("Memo("); } function _n(n) { return pn(n) ? external_preact_.cloneElement.apply(null, arguments) : n; } function bn(n) { return !!n.__k && ((0, external_preact_.render)(null, n), !0); } function Sn(n) { return n && (n.base || 1 === n.nodeType && n) || null; } var gn = function(n, t) { return n(t); }, En = function(n, t) { return n(t); }, Cn = external_preact_.Fragment, xn = pn; external_preactHooks_.useState, external_preactHooks_.useId, external_preactHooks_.useReducer, external_preactHooks_.useEffect, external_preactHooks_.useLayoutEffect, external_preactHooks_.useRef, external_preactHooks_.useImperativeHandle, external_preactHooks_.useMemo, external_preactHooks_.useCallback, external_preactHooks_.useContext, external_preactHooks_.useDebugValue, external_preact_.createElement, external_preact_.createContext, external_preact_.createRef, external_preact_.Fragment, external_preact_.Component; function Minimap() { const app = (0, external_preactHooks_.useContext)(Contexts.AppContext); const $canvas = (0, external_preactHooks_.useRef)(null); const $sectors = (0, external_preactHooks_.useRef)(null); (0, external_preactHooks_.useLayoutEffect)((() => { const ctx = $canvas.current.getContext('2d'); const sectors = $sectors.current.querySelectorAll('.sector'); let sectorIndex = -1; let rafId = requestAnimationFrame(render); (0, utils.updateCssString)('minimap-styles', minimapStyles); function render() { const sectorId = app.world.drawMinimap(ctx, $canvas.current); setSector(sectorId); rafId = requestAnimationFrame(render); } function setSector(index) { if (index === sectorIndex || index < 0) { return; } index = Math.min(index, sectors.length - 1); -1 !== sectorIndex && sectors[sectorIndex].classList.remove('active'); sectors[index].classList.add('active'); sectorIndex = index; } return () => { cancelAnimationFrame(rafId); }; }), []); return (0, jsxRuntime_module.jsxs)("div", { id: "xevo-minimap", style: { zIndex: 1000 }, children: [ (0, jsxRuntime_module.jsxs)("div", { class: "background", ref: $sectors, children: [ (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "A1" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "A2" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "A3" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "A4" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "A5" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "B1" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "B2" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "B3" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "B4" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "B5" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "C1" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "C2" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "C3" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "C4" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "C5" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "D1" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "D2" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "D3" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "D4" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "D5" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "E1" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "E2" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "E3" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "E4" }), (0, jsxRuntime_module.jsx)("div", { class: "sector", children: "E5" }) ] }), (0, jsxRuntime_module.jsx)("canvas", { id: "minimap", width: "200", height: "200", ref: $canvas }) ] }); } const minimapStyles = "\n :root {\n --bottom-banner-height: 0px !important;\n }\n #minimap {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n #xevo-minimap {\n position: fixed;\n bottom: 15px;\n right: 15px;\n width: 200px;\n height: 200px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 10px;\n overflow: hidden;\n background-color: rgba(20, 20, 20, 0.75);\n box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);\n }\n #xevo-minimap .background {\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n grid-template-rows: repeat(5, 1fr);\n width: 100%;\n height: 100%;\n }\n #xevo-minimap .sector {\n display: flex;\n justify-content: center;\n align-items: center;\n color: #ddd;\n font-size: 12px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n transition: background-color 0.3s ease, transform 0.2s ease;\n }\n #xevo-minimap .sector.active {\n background-color: rgba(0, 191, 255, 0.3);\n border: 1px solid #00bfff;\n }\n "; function initLiteui(app) { const liteui = document.createElement('div'); liteui.style = 'display:flex; flex-direction:column; overflow:hidden;'; document.getElementById('instructions').insertAdjacentElement('afterend', liteui); (0, external_preact_.render)((0, jsxRuntime_module.jsx)(jsxRuntime_module.Fragment, { children: (0, jsxRuntime_module.jsx)(Portal, { into: liteui, children: (0, jsxRuntime_module.jsx)(jsxRuntime_module.Fragment, { children: (0, jsxRuntime_module.jsxs)("div", { "data-portal": true, className: "w-full", style: "overflow: hidden;display: flex;height: 100%;flex-direction: column;", children: [ (0, jsxRuntime_module.jsx)(Contexts.AppContext.Provider, { value: app, children: (0, jsxRuntime_module.jsx)(Menu.MenuButtons, {}) }), (0, jsxRuntime_module.jsx)(Contexts.AppContext.Provider, { value: app, children: (0, jsxRuntime_module.jsx)(Menu.Menu, {}) }) ] }) }) }) }), document.body); const minimapElem = document.createElement('div'); (0, external_preact_.render)((0, jsxRuntime_module.jsx)(Contexts.AppContext.Provider, { value: app, children: (0, jsxRuntime_module.jsx)(Minimap, {}) }), minimapElem); document.body.insertAdjacentElement('afterbegin', minimapElem); const observer = new window.MutationObserver((mtRecs => { for (const mtRec of mtRecs) { const elem = mtRec.target; if ('none' !== elem.style.display) { elem.style.display = 'flex'; elem.style.display = 'flex-direction:column'; } } })); observer.observe(window.document.querySelector('#mainPanel'), { attributeFilter: [ 'style' ] }); } const styles = "\n#title {\n margin-top: 0 !important;\n}\n#mainui-play {\n height: 595px;\n}\n#mainPanel {\n display: flex ;\n flex-direction: column;\n height: 100%;\n}\n#socialLoginContainer{\n position: initial !important;\n}\n#instructions{\n position: initial !important;\n display: none !important;\n overflow: hidden !important;\n flex-direction: column !important;\n margin: 0 !important;\n}\n.play-container {\n display: flex;\n height: 100%;\n padding: 0 !important;\n}\n\n#play {\n top: initial !important;\n}\n\n#nick{\n position: initial !important;\n left: initial !important;\n top: initial !important; \n float: initial !important;\n}\n\n#skinButton {\n position: relative !important;\n display: block;\n left: initial !important;\n width: 46px;\n height: 46px;\n}\n#playnick {\n position: initial !important;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center\n}\n#socialLoginContainer {\n top: initial !important;\n margin: 4px 20px 0px 20px !important;\n}\n\n.guest{\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n\n.menu-addon {\n gap: 4px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.menu-button {\n color: #fff;\n background-color: #54c800;\n border-color: #54c800;\n height: 34px;\n font-size: 20px;\n line-height: 1.5;\n padding: 0 0.5rem;\n}\n\n.menu-button:hover {\n filter: brightness(0.7) contrast(1);\n}\n.input-addon {\n width: 100%;\n height: 28px;\n}\n\n.circle.green {\n position: absolute !important; \n}\n.sprite-main {\n background-image: url(/mc/atlas/main_shop.png) !important;\n}\n#settingsButton {\n left:5px;\n position: absolute !important;\n}\n.circle {\n display: flex;\n justify-content: center;\n}\n"; var settings = __webpack_require__(423); function makeGLobal(name, value) { window[name] = value; return value; } class Sampler { constructor() { this.samplerIndex = 0; this.sampler = new Float32Array(30).fill(0); this.averagePerSecond = 0; this.renderedFrames = 0; this.average = 0; this.now = 0; } step() { const now = Date.now(); const elapsed = now - this.now; this.now = now; const delta = elapsed / 1000; const perSecond = 1 / delta; let average = 0; let howmuchSamples = 0; this.sampler[this.samplerIndex] = Math.round(perSecond); this.samplerIndex = (this.samplerIndex + 1) % this.sampler.length; for (let i = 0; i < Math.min(this.sampler.length, this.renderedFrames); i++) { average += this.sampler[i]; howmuchSamples++; } average = Math.round(average / howmuchSamples); this.average = average; if (this.renderedFrames <= this.sampler.length) { this.renderedFrames++; } } } function applyPatch(u8, operations, anyFail) { let result = u8; for (const {pattern: pattern, payload: payload, type: type} of operations) { const index = findPattern(result, pattern); if (-1 === index) { console.warn(`Pattern not found: ${pattern.map((b => b.toString(16))).join(' ')}`); anyFail(); continue; } let patchIndex = index; if ('insertAfter' === type) { patchIndex = index + pattern.length; } else if ('insertBefore' === type) { patchIndex = index; } else if ('replaceAfter' === type) { patchIndex = index + pattern.length; const sliceBefore = result.slice(0, patchIndex); const sliceAfter = result.slice(patchIndex + payload.length); result = concatUint8Arrays([ sliceBefore, new Uint8Array(payload), sliceAfter ]); continue; } else if ('replaceBefore' === type) { patchIndex = index - payload.length; if (patchIndex < 0) { throw new Error('replaceBefore would underflow the buffer'); } const sliceBefore = result.slice(0, patchIndex); const sliceAfter = result.slice(index); result = concatUint8Arrays([ sliceBefore, new Uint8Array(payload), sliceAfter ]); continue; } const sliceBefore = result.slice(0, patchIndex); const sliceAfter = result.slice(patchIndex); result = concatUint8Arrays([ sliceBefore, new Uint8Array(payload), sliceAfter ]); } return result; } function findPattern(buffer, pattern) { for (let i = 0; i <= buffer.length - pattern.length; i++) { let match = true; for (let j = 0; j < pattern.length; j++) { if (buffer[i + j] !== pattern[j]) { match = false; break; } } if (match) { return i; } } return -1; } function concatUint8Arrays(arrays) { const totalLength = arrays.reduce(((sum, arr) => sum + arr.length), 0); const result = new Uint8Array(totalLength); let offset = 0; for (const arr of arrays) { result.set(arr, offset); offset += arr.length; } return result; } class World { constructor(app) { this.xorBuffer = (buffer, key) => { const dataView = new DataView(buffer); for (let i = 0; i < dataView.byteLength; i++) { dataView.setUint8(i, dataView.getUint8(i) ^ key >>> i % 4 * 8 & 255); } return buffer; }; this.overWriteWS = _target => { const target = _target; setTimeout((() => { target._onopen = target.onopen; target._onmessage = target.onmessage; target.onopen = e => { this.reset(); target._onopen(e); }; target.onmessage = message => { target._onmessage(message); let offset = 0; let msg = message.data; if (this.decryptionKey) { msg = this.xorBuffer(msg, 31122 ^ this.decryptionKey); } const view = new DataView(msg); const opcode = view.getUint8(offset++); switch (opcode) { case 17: const playerX = view.getFloat32(offset, true); offset += 4; const playerY = view.getFloat32(offset, true); offset += 4; this.targetX = this.receiveX(playerX); this.targetY = this.receiveY(playerY); break; case 32: this.myCellIds.push(view.getUint32(offset, true)); break; case 69: this.ghostCells(view, offset); break; case 241: this.decryptionKey = view.getUint32(offset, true); break; case 255: this.handleMessages(this.uncompressMessage(new Uint8Array(view.buffer.slice(5)), new Uint8Array(view.getUint32(offset, true)))); break; } }; }), 0); }; this.websocketHooked = false; this.reset(); this.app = app; } reset() { this.minimap = []; this.offsetX = 0; this.offsetY = 0; this.borderX = 0; this.borderY = 0; this.targetX = 0; this.targetY = 0; this.myCellIds = []; this.decryptionKey = 0; this.mapOffsetFixed = false; this.mapShiftX = 0; this.mapShiftY = 0; this.mapOffsetX = 0; this.mapOffsetY = 0; this.mapMinX = 0; this.mapMinY = 0; this.mapMaxX = 0; this.mapMaxY = 0; this.mapMidX = 0; this.mapMidY = 0; this.mapSizeH = 0; this.mapSizeV = 0; this.mapShrinkW = 0; this.mapShrinkH = 0; this.viewX = 0; this.viewY = 0; this.mirrorV = false; this.mirrorH = false; } uncompressMessage(input, output) { for (let i = 0, j = 0; i < input.length; ) { const byte = input[i++]; let literalsLength = byte >> 4; if (literalsLength > 0) { let length = literalsLength + 240; while (255 === length) { length = input[i++]; literalsLength += length; } const end = i + literalsLength; while (i < end) { output[j++] = input[i++]; } if (i === input.length) { return output; } } const offset = input[i++] | input[i++] << 8; if (0 === offset || offset > j) { return -(i - 2); } let matchLength = 15 & byte; let length = matchLength + 240; while (255 === length) { length = input[i++]; matchLength += length; } let pos = j - offset; const end = j + matchLength + 4; while (j < end) { output[j++] = output[pos++]; } } return output; } handleMessages(message) { let offset = 0; const view = new DataView(message.buffer); const opcode = view.getUint8(offset++); switch (opcode) { case 16: { const eatRecordLength = view.getUint16(offset, true); offset += 2; for (let i = 0; i < eatRecordLength; i++) { offset += 8; } while (true) { const id = view.getUint32(offset, true); offset += 4; if (0 === id) { break; } const targetX = this.receiveX(view.getInt32(offset, true)); offset += 4; const targetY = this.receiveY(view.getInt32(offset, true)); offset += 4; offset += 2; const flags = view.getUint8(offset++); const extendedFlags = 128 & flags ? view.getUint8(offset++) : 0; if (2 & flags) { offset += 3; } if (4 & flags) { while (0 !== view.getInt8(offset++)) {} } if (8 & flags) { while (0 !== view.getInt8(offset++)) {} } if (4 & extendedFlags) { offset += 4; } if (-1 !== this.myCellIds.indexOf(id)) { this.targetX = targetX; this.targetY = targetY; } } const removeLength = view.getUint16(offset, true); offset += 2; for (let i = 0; i < removeLength; i++) { const removedID = view.getUint32(offset, true); offset += 4; if (this.myCellIds.includes(removedID)) { this.myCellIds = this.myCellIds.filter((id => id != removedID)); } } } break; case 64: const minx = view.getFloat64(offset, true); offset += 8; const miny = view.getFloat64(offset, true); offset += 8; const maxx = view.getFloat64(offset, true); offset += 8; const maxy = view.getFloat64(offset, true); if (!this.mapOffsetFixed) { this.offsetX = (minx + maxx) / 2; this.offsetY = (miny + maxy) / 2; this.borderX = maxx - minx; this.borderY = maxy - miny; this.setMapOffset(minx, miny, maxx, maxy); this.mapOffsetFixed = true; } break; } } setMapOffset(left, top, right, bottom) { const isAgario = true; if (right - left > 14000 && bottom - top > 14000 || !isAgario) { if (this.mapOffsetFixed) { return; } if (isAgario) { const side = 14142; this.mapShrinkW = side / (right - left); this.mapShrinkH = side / (bottom - top); left = this.shrinkX(left); top = this.shrinkY(top); right = this.shrinkX(right); bottom = this.shrinkY(bottom); } this.mapShiftY = 0; this.mapShiftX = 0; const prX = 0.5 * -(right - left); const prY = 0.5 * -(bottom - top); const diffX = prX - left; const diffY = prY - top; this.mapShiftX = -diffX; this.mapShiftY = -diffY; left = this.shiftX(left); top = this.shiftY(top); right = this.shiftX(right); bottom = this.shiftY(bottom); this.mapOffsetX = 0.5 * (right - left) - right; this.mapOffsetY = 0.5 * (bottom - top) - bottom; this.mapMinX = left; this.mapMinY = top; this.mapMaxX = right; this.mapMaxY = bottom; this.mapMidX = 0.5 * (this.mapMaxX + this.mapMinX); this.mapMidY = 0.5 * (this.mapMaxY + this.mapMinY); this.mapSizeH = this.mapMaxX - this.mapMinX; this.mapSizeV = this.mapMaxY - this.mapMinY; if (!this.mapOffsetFixed) { this.viewX = 0.5 * (right + left); this.viewY = 0.5 * (bottom + top); } this.mapOffsetFixed = true; } } ghostCells(view, offset) { this.minimap = []; let x = 0, y = 0, mass = 0; const length = view.getUint16(offset, true); offset += 2; for (let i = 0; i < length; i++) { x = this.receiveX(view.getInt32(offset, true)); offset += 4; y = this.receiveY(view.getInt32(offset, true)); offset += 4; mass = view.getUint32(offset, true); offset += 5; this.minimap.push({ x: x, y: y, size: ~~Math.sqrt(100 * mass), mass: mass }); } } unshrinkX(x) { return x / this.mapShrinkW; } unshrinkY(y) { return y / this.mapShrinkH; } shrinkX(x) { return x * this.mapShrinkW; } shrinkY(y) { return y * this.mapShrinkH; } unshiftX(x) { return x - -this.mapShiftX; } unshiftY(y) { return y - -this.mapShiftY; } shiftX(x) { return x - this.mapShiftX; } shiftY(y) { return y - this.mapShiftY; } invflipX(x) { return this.mirrorH ? x : this.mapMaxX - (x - this.mapMinX); } invflipY(y) { return this.mirrorV ? y : this.mapMaxY - (y - this.mapMinY); } flipX(x) { return !this.mirrorH ? x : this.mapMaxX - (x - this.mapMinX); } flipY(y) { return !this.mirrorV ? y : this.mapMaxY - (y - this.mapMinY); } receiveX(x) { x = this.shrinkX(x); x = this.shiftX(x); x = this.flipX(x); return x; } receiveY(y) { y = this.shrinkY(y); y = this.shiftY(y); y = this.flipY(y); return y; } serverX(x) { x = this.flipX(x); x = this.unshiftX(x); x = this.unshrinkX(x); return x; } serverY(y) { y = this.flipY(y); y = this.unshiftY(y); y = this.unshrinkY(y); return y; } drawMinimap(ctx, canvas, clear = true) { function safe(number) { return 0 == number ? 1 : number; } if (clear) { ctx.clearRect(0, 0, canvas.width, canvas.height); } this.minimap.forEach((cell => { const x = safe(cell.x + this.borderX / 2) / this.borderX * canvas.width; const y = safe(cell.y + this.borderY / 2) / this.borderY * canvas.height; const size = cell.size / this.borderX * canvas.width + 1; ctx.fillStyle = '#ffd700'; ctx.beginPath(); ctx.arc(x, y, size, 0, 2 * Math.PI); ctx.fill(); })); const playerX = safe(this.targetX + this.borderX / 2) / this.borderX * canvas.width; const playerY = safe(this.targetY + this.borderY / 2) / this.borderY * canvas.height; ctx.fillStyle = '#00bfff'; ctx.beginPath(); ctx.arc(playerX, playerY, 5, 0, 2 * Math.PI); ctx.fill(); const sectorSizeX = canvas.width / 5; const sectorSizeY = canvas.height / 5; const sectorCol = Math.floor(playerX / sectorSizeX); const sectorRow = Math.floor(playerY / sectorSizeY); const activeSectorIndex = 5 * sectorRow + sectorCol; return Number.isFinite(activeSectorIndex) ? activeSectorIndex : -1; } initialize() { if (this.websocketHooked) { return console.error('Error: WebSocket already hooked'); } this.websocketHooked = true; const self = this; class WS extends window.WebSocket { constructor(url, protocols) { const errorStack = (new Error).stack; const isAgar = /wasm:\/\//.test(errorStack); super(url, protocols); if (isAgar) { self.overWriteWS(this); } } } WS.injectedOnce = false; window.WebSocket = WS; } } var __awaiter = function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P((function(resolve) { resolve(value); })); } return new (P || (P = Promise))((function(resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); })); }; class App { display_vue() { return (0, utils.find_node)(window['agarApp'].home, ((child, depth) => { var _a; console.log(child, null === (_a = null === child || void 0 === child ? void 0 : child.$vnode) || void 0 === _a ? void 0 : _a.tag); return true; })); } constructor() { this.sampler = new Sampler; this.performance_now = 0; this.timer_mp = 1; this.waitForSpawn = false; this.zoom_speed = 0.8; this.sector = 5; this.zoomvalue = 0.3; this.stopmovement = false; this.mouse = { x: 0, y: 0 }; this.camera = { x: 0, y: 0 }; this.state = (0, Eventify.EventObject)({ play: false, pause: false, ws: '' }); this.memory = (0, Eventify.EventObject)({ skinUrl: '' }); this.mainui = null; this.emsc = null; this.observerPatcher = e => { window['app'] = this; const app = 'window.app'; window['applyPatch'] = applyPatch; const replacements = { registerSkin: [ [ /("\s?registerSkin\s?"\s?:\s?function\s?\(\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?\)\s?\{\s?)/i, `$1${app}.onRegisterSkin($2,$3,$4,$5,$6);` ] ], onConnect: [ [ /(;..?\s?\.\s?onopen\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onConnect(this.url, this);` ] ], mobileData: [ [ /(\s?if\s?\(\s?window\s?\[\s?"\s?MC\s?"\s?]\s?&&\s?window\s?\[\s?"\s?MC\s?"\s?]\s?\[\s?"\s?onMobileData\s?"\s?]\s?\)\s?window\s?\[\s?"\s?MC\s?"\s?]\s?\[\s?"\s?onMobileData\s?"\s?]\s?\(\s?(.+?)\s?\))/i, `$2=${app}.onPacket($2);$1` ] ], 'Emscripten hook': [ [ /(\w+)\W+instantiateWasm/, `(${app}.onEmscripten($1)), $&` ] ], 'Mouse hook': [ [ /("\s?setTarget\s?"\s?:\s?function\s?\(\s?(.+?)\s?,\s?(.+?)\s?\)\s?\{\s?)/i, `$1$2=${app}.onMouseX($2);$3=${app}.onMouseY($3);` ] ], 'Player Zoom': [ [ /("\s?playerZoom\s?"\s?:\s?function\s?\(\s?(.+?)\s?\)\s?\{\s?)/i, `$1$2=${app}.onPlayerZoom($2);` ] ], 'WebSocket onclose': [ [ /(;..?\s?\.\s?onclose\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onDisconnect(this);` ] ], 'WebSocket onerror': [ [ /(;..?\s?\.\s?onerror\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onDisconnect(this);` ] ], 'Binary Patch': [ [ /(instantiate\(\s?)([^,]+)/, `$1${app}.patchWasm($2)` ] ], something: [ [ /([a-z]{6}\s?[a-z|A-Z]{16}\s?\(\s?([a-z]{6})\s?,\s?[a-z|A-Z]{10}\s?,\s?[a-z|A-Z]{7}\s?,\s?[a-zA-Z]{8}\s?\)\s?\{\s?)/i, '$1$2=true;' ] ] }; for (const [name, array] of Object.entries(replacements)) { let current = 0; for (const [regexp, replacer] of array) { if (regexp.test(e)) { e = e.replace(regexp, replacer); current++; } else { console.log(`[Not Found - ${current}]: `, name); } } } return e; }; this.calls = []; this.world = new World(this); const storageName = 'lite_settings'; settings.settings.import(Object.assign(Object.assign({}, settings.settings.export()), storage.get(storageName))); settings.settings.on('*', (_ => { storage.set(storageName, settings.settings.export()); })); Object.assign(this.memory, storage.get('memory')); this.memory.on('*', (() => { console.log('nick', this.memory); storage.set('memory', this.memory); })); settings.settings.on('ZoomOut', (v => { v ? this.zoomvalue = 0.3 : this.zoomvalue = 1; }))(settings.settings.proxy.ZoomOut); this.initObserver().then((() => { this.world.initialize(); this.waitCore().then((() => { this.handleCoreInit(); })); })); (0, utils.overrideMethod)(window.console, 'log', (function(o, args) { var _a, _b; if (null === (_b = (_a = args[0]).startsWith) || void 0 === _b ? void 0 : _b.call(_a, ' ,,,,,')) { return window.console.log = o; } return o.apply(this, args); })); } loadAndPatchCore(url, resolve) { return __awaiter(this, void 0, void 0, (function*() { try { const request = new XMLHttpRequest; request.open('GET', url, false); request.onload = () => { const patchedText = this.observerPatcher(request.responseText); const blob = new Blob([ patchedText ], { type: 'text/javascript' }); const blobURL = URL.createObjectURL(blob); const script = document.createElement('script'); script.id = 'agario.core.js'; script.src = blobURL; script.onload = () => { URL.revokeObjectURL(blobURL); resolve(); }; document.body.appendChild(script); }; request.send(); } catch (error) { console.error('[ERROR] Failed to load and patch core:', error); } })); } initObserver() { const deferred = (0, Eventify.deferrify)(); const observer = new window.MutationObserver((mtRecs => { var _a; for (const mtRec of mtRecs) { for (let i = 0; i < mtRec.addedNodes.length; i++) { const elem = mtRec.addedNodes[i]; const [t] = elem.src && elem.src.match(/agario\.core\.js.+/i) || []; if (t) { observer.disconnect(); elem.remove(); null === (_a = elem.parentNode) || void 0 === _a || _a.removeChild(elem); this.loadAndPatchCore(t, deferred.resolve); } } } })); observer.observe(document, { childList: true, subtree: true }); return deferred.promise; } patchWasm(u) { let anyFail = false; const patchedUint8Array = applyPatch(new Uint8Array(u), [ { pattern: [ 0x45, 0x0d, 0x00, 0x20, 0x02, 0x10, 0x0f, 0x20, 0x01, 0x20, 0x02, 0x10, 0x1e, 0x21, 0x01 ], payload: [ 0x20, 0x00, 0x28, 0x02, 0x1c, 0x45, 0x04, 0x40, 0x0f, 0x0b ], type: 'insertAfter' }, { pattern: [ 0x81, 0x03, 0x84, 0x03, 0x10, 0x87, 0x03, 0x86, 0x03, 0x85, 0x03, 0x0a ], payload: [ 203 ], type: 'replaceAfter' }, { pattern: [ 0x00, 0x20, 0x00, 0x20, 0x04, 0x37, 0x03, 0x08, 0x20, 0x03, 0x41, 0x10, 0x6a, 0x24, 0x00, 0x0b ], payload: [ 138 ], type: 'replaceAfter' }, { pattern: [ 0x01, 0x2d, 0x00, 0x07, 0x20, 0x02, 0x41, 0x1b, 0x6c, 0x41, 0x01, 0x6a, 0x73, 0x3a, 0x00, 0x07, 0x20, 0x1f, 0xbf, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ], payload: [ 0, 0 ], type: 'replaceAfter' } ], (() => anyFail = true)); if (anyFail) { return u; } return patchedUint8Array.buffer; } waitCore() { return __awaiter(this, void 0, void 0, (function*() { const deferred = (0, Eventify.deferrify)(); addEventListener('core_init_complete', (() => { var _a; if (!window['core']) { if (null === (_a = window['MC']) || void 0 === _a ? void 0 : _a['onAgarioCoreLoaded']) { const old_loaded = window['MC']['onAgarioCoreLoaded']; window['MC']['onAgarioCoreLoaded'] = function() { deferred.resolve(); window['MC']['onAgarioCoreLoaded'] = old_loaded; return old_loaded.apply(this, arguments); }; return; } Object.defineProperty(window, 'core', { get: () => window['_core'], set: value => (window['_core'] = value, deferred.resolve()) }); return; } deferred.resolve(); })); addEventListener('event_regions_update', (() => __awaiter(this, void 0, void 0, (function*() {})))); return deferred.promise; })); } handleCoreInit() { this.init(); coreInitPatch(); coreAdsPatch(); fixNoServers(); coreUiPatch(); this.onCoreInit(); (0, utils.updateCssString)('main', styles); initLiteui(this); } modifyScore(sourceString) { if (!this.state.play) { sourceString = ''; } return `${sourceString}`; } init() { const modifyScore = this.modifyScore.bind(this); const onPlayerSpawn = this.onPlayerSpawn.bind(this); const onPlayerDeath = this.onPlayerDeath.bind(this); (0, utils.overridePrototype)(CanvasRenderingContext2D.prototype, 'fillText', (o => function() { if (arguments[0].includes('Scor')) { arguments[0] = modifyScore(arguments[0]); } return o.apply(this, arguments); })); (0, utils.overridePrototype)(CanvasRenderingContext2D.prototype, 'measureText', (o => function() { if (arguments[0].includes('Scor')) { arguments[0] = modifyScore(arguments[0]); } return o.apply(this, arguments); })); (0, utils.overrideMethod)(window['MC'], 'onPlayerSpawn', (function(o, args) { o.apply(this, args); onPlayerSpawn(...args); })); (0, utils.overrideMethod)(window['MC'], 'onPlayerDeath', (function(o, args) { o.apply(this, args); onPlayerDeath(...args); })); } onEmscripten(Module) { var _a, _b; this.emsc = Module; makeGLobal('emsc', Module); console.log('emsc', Module); const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); const world = this.world; const self = this; const traceCalls = [ 'clearRect', 'drawImage', 'fillText', 'strokeText', 'fillRect', 'strokeRect', 'moveTo', 'scale', 'save', 'restore', 'translate', 'transform', 'setTransform' ]; let gotScale = false; let callNumber = -1; traceCalls.forEach((method => { (0, utils.overrideMethod)(ctx, method, (function(o, args) { callNumber++; const cmd = o.apply(ctx, args); return cmd; })); })); (0, utils.overrideMethod)(ctx, 'scale', (function(o, args) { if (!gotScale) { gotScale = true; self.zoomvalue = args[0]; } const cmd = o.apply(ctx, args); return cmd; })); (0, utils.overrideMethod)(ctx, 'drawImage', (function(o, args) { let dx = 0, dy = 0, dw = 0, dh = 0; if (9 == args.length) { dx = args[5]; dy = args[6]; dw = args[7]; dh = args[8]; } else if (3 == args.length) { dx = args[1]; dy = args[2]; } const cmd = o.apply(ctx, args); return cmd; })); let translateCall = -1; (0, utils.overrideMethod)(ctx, 'translate', (function(o, args) { translateCall++; if (2 == translateCall) { self.camera.x = args[0]; self.camera.y = args[1]; self.drawBackground(ctx, world, o); } return o.apply(ctx, args); })); null !== (_a = Module['preMainLoop']) && void 0 !== _a || (Module['preMainLoop'] = () => {}); (0, utils.overrideMethod)(Module, 'preMainLoop', ((o, args) => { this.calls = []; o.apply(this, args); })); null !== (_b = Module['postMainLoop']) && void 0 !== _b || (Module['postMainLoop'] = () => {}); (0, utils.overrideMethod)(Module, 'postMainLoop', ((o, args) => { this.sampler.step(); callNumber = -1; translateCall = -1; gotScale = false; this.drawHud(ctx); o.apply(this, args); })); } onRegisterSkin() {} onMouseX(x) { if (this.state.pause) { return window.innerWidth / 2; } this.syncMouse(x, void 0); return x; } onMouseY(y) { if (this.state.pause) { return window.innerHeight / 2; } this.syncMouse(void 0, y); return y; } onCoreInit() { settings.settings.on('Minimap', (() => {}))(); settings.settings.on('AcidMode', (v => { window['core'].setAcid(v); }))(settings.settings.proxy.AcidMode); } get menuShow() { if (!this.mainui) { this.mainui = (0, utils.find_node)(window['agarApp'].home, (child => { var _a, _b; return null === (_b = null === (_a = child.$vnode) || void 0 === _a ? void 0 : _a.tag) || void 0 === _b ? void 0 : _b.toLowerCase().includes('mainui'); }))[0]; } if (!this.mainui) { return false; } return this.mainui.menuShow; } onConnect(url) { console.log('Connected', url); this.state.ws = url; if (this.waitForSpawn) { window['MC'].playGame(); this.waitForSpawn = false; } this.disableMenuBackground(); } disableMenuBackground() { this.emsc._ac_special_on(); window['core'].setFpsCap(-1); window['core'].setFadeout(false); requestAnimationFrame((() => { window['core'].setFadeout(true); })); this.emsc._ac_spectate(); } spetate() { var _a; null === (_a = (0, utils.find_node)(void 0, (child => null === child || void 0 === child ? void 0 : child.spectate))[0]) || void 0 === _a || _a.spectate(); } connect(url) { window['core'].disableIntegrityChecks(!url.includes('miniclippt')); if (window['raga'] && url.indexOf('raga') > -1) { window['raga'].isSwitchingGameMode = true; window['raga'].gameMode = 'ragaffa-16x'; } window['core'].connect(url); } respawn() { if (this.state.play) { this.connect(this.state.ws); this.waitForSpawn = true; } else { window['core'].setFadeout(false); window['core'].sendSpectate(); window['MC'].playGame(); setTimeout((() => {}), 200); } } onPlayerSpawn(...args) { this.state.play = true; this.reset(); } onPlayerDeath(...args) { (0, utils.find_node)(void 0, (child => { if (void 0 !== child.fastEntry) { return true; } else { return false; } })).forEach((child => { !child.fastEntry && Object.defineProperty(child, 'fastEntry', { get: () => true, set: x => x }); })); window['core'].setFadeout(true); window['_setInterval'] || window.setInterval; window['_clearInterval'] || window.clearInterval; const setTimeout = window['_setTimeout'] || window.setTimeout; window['_clearTimeout'] || window.clearTimeout; this.state.play = false; this.reset(); if (!window['agarApp'].home.$children[0].$children[0].showMenu && settings.settings.proxy.AutoRespawn) { this.respawn(); return true; } else { const prev = this.timer_mp; this.timer_mp = 10000; setTimeout((() => this.timer_mp = prev), 800); } } onPacket(packet) { return packet; } reset() { this.stopmovement = false; this.world.myCellIds = []; } dumpMem() { const blob = new Blob([ this['emsc'].buffer ]); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'dump.bin'; a.click(); URL.revokeObjectURL(a.href); } onDisconnect(obj) { console.log('disconnected', obj); } onPlayerZoom(zoom) { this.zoomvalue = zoom; return zoom; } syncCamera(x, y) { this.camera.x = x; this.camera.y = y; } syncMouse(x, y) { if (void 0 !== x) { this.mouse.x = x - this.world.mapOffsetX; } if (void 0 !== y) { this.mouse.y = y - this.world.mapOffsetY; } } renderLoop() {} drawBackground(ctx, world, translate = ctx['translate']) { const offsetX = this.camera.x + this.world.offsetX; const offsetY = this.camera.y + this.world.offsetY; const initialAlpha = ctx.globalAlpha; translate(offsetX, offsetY); if (settings.settings.proxy.MapBorder) { ctx.globalAlpha = 0.2; ctx.lineWidth = 20; ctx.fillStyle = 'green'; ctx.strokeRect(this.world.mapMinX, this.world.mapMinY, this.world.mapSizeH, this.world.mapSizeV); ctx.globalAlpha = initialAlpha; } const parselw = this.world.mapSizeH / this.sector; const parselh = this.world.mapSizeV / this.sector; if (settings.settings.proxy.MapSectors) { ctx.beginPath(); ctx.lineWidth = 10; ctx.strokeStyle = 'green'; ctx.globalAlpha = 0.2; for (let zi = 1; zi < this.sector; zi++) { ctx.moveTo(this.world.mapMinX, this.world.mapMinY + parselw * zi); ctx.lineTo(this.world.mapMaxX, this.world.mapMinY + parselw * zi); ctx.moveTo(this.world.mapMinX + parselh * zi, this.world.mapMinY); ctx.lineTo(this.world.mapMinX + parselh * zi, this.world.mapMaxY); } ctx.stroke(); ctx.closePath(); ctx.globalAlpha = initialAlpha; } if (settings.settings.proxy.MapSectorLabels) { ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.font = parselw / 2.8 + 'px Segoe Print'; ctx.globalAlpha = 0.2; ctx.fillStyle = 'green'; const bucw = parselw / 2, buch = parselh / 2; for (let sat = 0; sat < this.sector; sat++) { const label = String.fromCharCode(65 + sat); for (let sut = 0; sut < this.sector; sut++) { ctx.fillText(label + (sut + 1), this.world.mapMinX + parselw * sut + bucw, this.world.mapMinY + parselh * sat + buch); } } ctx.globalAlpha = initialAlpha; } ctx.textBaseline = 'middle'; ctx.textAlign = 'center'; ctx.font = '380px Segoe Print'; ctx.globalAlpha = 0.5; ctx.fillStyle = '#808080'; ctx.fillText('Delta', 0, 0); ctx.globalAlpha = initialAlpha; translate(-offsetX, -offsetY); return; } drawHud(ctx) { ctx.fillStyle = 'rgba(0, 0, 0, 0.3)'; ctx.fillRect(0, 0, 0, 0); } } function registerMenuCommands() { const links = [ { name: '🜂⁷ Play cell games on Delt.io', url: 'https://delt.io' }, { name: '🖭 Delta Discord', url: 'https://bit.ly/3RXQXQd' } ]; try { links.forEach((link => GM.registerMenuCommand(link.name, (() => window.location.href = link.url)))); } catch (e) {} } function registerCheckUpdates() { GM.registerMenuCommand(`Version: ${GM.info.script.version} - Check for updates`, checkUpdates); } function checkUpdates() { const url = GM.info.scriptUpdateURL; if (!url) { return alert('⛔ Error:\nNo update URL found!'); } const version2int = (x = "0") => x.split('.').reduce(((n, c, i, a) => n + parseInt(c) * Math.pow(100, a.length - i - 1)), 0); const req = new Promise((r => GM.xmlHttpRequest({ method: 'GET', url: url, onload: r }))); req.then((res => { const matches = /\/\/\s*@version\s*(\S+)/im.exec(res.responseText); if (!matches) { return alert('⛔ Error:\nNo version found!'); } const remoteVersion = version2int(matches[1]); const localVersion = version2int(GM.info.script.version); if (remoteVersion > localVersion) { const msg = `🔔 New version available: ${matches[1]}\n\nDo you want to update?`; if (confirm(msg)) { const installer = window.open(url, '_blank'); const i = setInterval((() => { if (!installer.closed) { return; } clearInterval(i); location.reload(); }), 100); } } else { alert('👍 You are using the latest version!'); } })).catch((e => { console.error(e); alert('⛔ Error: Cant fetch update info!\n' + e); })); } function isGM() { return 'undefined' !== typeof GM && GM; } function enableVueDevtools() { (0, utils.overrideMethod)(window.Object, 'defineProperty', ((originalMethod, args) => { if ('config' === args[1]) { const orig_getter = args[2].get; args[2].get = function() { const vueConfig = orig_getter(); vueConfig.devtools = true; vueConfig.productionTip = true; return () => vueConfig; }; window.Object.defineProperty = originalMethod; } return originalMethod.apply(window.Object, args); })); } function enableFastCanvasView() { Object.defineProperty(window.HTMLCanvasElement.prototype, 'aaa', { get() { this.toBlob((blob => { const blobUrl = URL.createObjectURL(blob); window.open(blobUrl); })); return 1; } }); } module = __webpack_require__.hmd(module); enableVueDevtools(); enableFastCanvasView(); const app = new App; makeGLobal('app', app); makeGLobal('find_node', utils.find_node); if (isGM()) { registerMenuCommands(); registerCheckUpdates(); } if (null === module || void 0 === module ? void 0 : module['hot']) { module['hot'].accept(); module['hot'].addDisposeHandler((function() { console.log('module.hot.addDisposeHandler', ...arguments); })); module['hot'].addStatusHandler((function() { console.log('module.hot.addStatusHandler', ...arguments); })); } }, 423: (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { settings: () => settings }); var Eventify = __webpack_require__(742); class FontManager { constructor() { this.possibleFonts = { Ubuntu: { fontWeights: { 700: 'bold', 500: '' } }, Roboto: { fontWeights: { 700: 'bold', 500: '' } }, Oswald: { fontWeights: { 700: 'bold', 500: '' } }, 'Titillium Web': { fontWeights: { 400: '' } }, 'Exo 2': { fontWeights: { 400: '', 600: 'semi-bold' } }, Play: { fontWeights: { 400: '', 700: 'bold' } }, 'Press Start 2P': { fontWeights: { 500: '' } }, Pacifico: { fontWeights: { 500: '' } }, 'VCR OSD Mono': { fontWeights: { 500: '' } } }; this.h = null; this.d = document.createElement('DIV'); this.s = document.createElement('SPAN'); this.defaultWidth = 0; this.defaultHeight = 0; this.d.appendChild(this.s); this.d.style.fontFamily = 'sans'; this.s.style.fontFamily = 'sans'; this.s.style.fontSize = '72px'; this.s.innerHTML = 'mmmmmmmmmmlil'; document.addEventListener('DOMContentLoaded', (() => { this.h = document.getElementsByTagName('BODY')[0]; this.h.appendChild(this.d); this.defaultWidth = this.s.offsetWidth; this.defaultHeight = this.s.offsetHeight; this.h.removeChild(this.d); })); } test(fontFamily) { this.h.appendChild(this.d); const b = {}; b.name = this.s.style.fontFamily = fontFamily; b.width = this.s.offsetWidth; b.height = this.s.offsetHeight; this.h.removeChild(this.d); fontFamily = fontFamily.toLowerCase(); if ('serif' == fontFamily) { b.found = true; } else { b.found = b.width != this.defaultWidth || b.height != this.defaultHeight; } return b; } } FontManager.el = document.createElement('span'); const fontManager = new FontManager; var _a; class MicroColor { constructor(red = 255, green = 255, blue = 255, alpha = 255) { this.r = red; this.g = green; this.b = blue; this.a = alpha; this.vector = new Float32Array(4); this.bytes = new Uint8Array(4); this.dataview = new DataView(this.bytes.buffer); this.string = '#000000'; this.int = 0; this.inta = 0; this.updVector(); this.updString(); this.updInt(); } updVector() { this.vector[0] = this.r / 255; this.vector[1] = this.g / 255; this.vector[2] = this.b / 255; this.vector[3] = this.a / 255; this.bytes[0] = this.r; this.bytes[1] = this.g; this.bytes[2] = this.b; this.bytes[3] = this.a; this.float = this.dataview.getFloat32(0, true); this.u32 = this.r | this.g << 8 | this.b << 16 | this.a << 24; } updString() { this.string = this.toRgb(true); } updInt() { this.int = this.getInt(); this.inta = this.getInta(); } cloneFrom(t) { this.r = t.r; this.g = t.g; this.b = t.b; this.a = t.a; this.updVector(); this.updString(); return this; } fromHSL(h, s, l, a = 255) { s /= 100; l /= 100; const c = (1 - Math.abs(2 * l - 1)) * s; const x = c * (1 - Math.abs(h / 60 % 2 - 1)); const m = l - c / 2; let r = 0; let g = 0; let b = 0; if (0 <= h && h < 60) { r = c, g = x, b = 0; } else if (60 <= h && h < 120) { r = x, g = c, b = 0; } else if (120 <= h && h < 180) { r = 0, g = c, b = x; } else if (180 <= h && h < 240) { r = 0, g = x, b = c; } else if (240 <= h && h < 300) { r = x, g = 0, b = c; } else if (300 <= h && h < 360) { r = c, g = 0, b = x; } this.r = Math.round(255 * (r + m)); this.g = Math.round(255 * (g + m)); this.b = Math.round(255 * (b + m)); this.a = a; return this; } fromRGB(r, g, b, a = 255) { this.r = r; this.g = g; this.b = b; this.a = a; this.updVector(); this.updString(); return this; } fromINT(int, reorder) { this.a = (4278190080 & int) >>> 24; this.r = (16711680 & int) >>> 16; this.g = (65280 & int) >>> 8; this.b = (255 & int) >>> 0; if (reorder) { Object.assign(this, { r: this.a, g: this.r, b: this.g, a: this.b }); } this.updVector(); this.updString(); return this; } fromHex(hex) { const len = hex.length; if (!hex || 7 !== len && 9 !== len) { return this; } let i = 9 === hex.length ? 32 : 24; const n = parseInt(hex.slice(1), 16); const r = n >> (i -= 8) & 255; const g = n >> (i -= 8) & 255; const b = n >> (i -= 8) & 255; const a = i ? n >> i - 8 & 255 : 255; return this.fromRGB(r, g, b, a); } get getNormalFromSecure() { return _a.rgbToInt(Math.ceil(this.r / 0.9), Math.ceil(this.g / 0.9), Math.ceil(this.b / 0.9)); } toRgb(useAlpha) { return useAlpha ? `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a / 255})` : `rgb(${this.r}, ${this.g}, ${this.b})`; } getHEXA() { let r = this.r.toString(16); let g = this.g.toString(16); let b = this.b.toString(16); let a = this.a.toString(16); if (1 == r.length) { r = '0' + r; } if (1 == g.length) { g = '0' + g; } if (1 == b.length) { b = '0' + b; } if (1 == a.length) { a = '0' + a; } return '#' + r + g + b + a; } getFloat() { const bits = this.a << 24 | this.b << 16 | this.g << 8 | this.r; return _a.pack(0xfeffffff & bits); } getHEX() { return '#' + (16777216 | this.getInt()).toString(16).substring(1); } getInt() { return this.r << 16 | this.g << 8 | this.b; } getIntaShader(alpha) { return this.r | this.g << 8 | this.b << 16 | (alpha < 0 ? this.a : alpha) << 24; } getIntShader() { return this.r | this.g << 8 | this.b << 16; } getInta() { return this.a << 24 | this.r << 16 | this.g << 8 | this.b; } getSecureHex() { return _a.colorIntToHex(_a.rgbToInt(~~(0.9 * this.r), ~~(0.9 * this.g), ~~(0.9 * this.b))); } static rgbToInt(r, g, b) { return r << 16 | g << 8 | b; } static colorIntToHex(int) { let s = int.toString(16); for (;s.length < 6; ) { s = '0' + s; } return '#' + s; } static inta2shader(int) { const a = (0xff000000 & int) >>> 24; const r = (0xff0000 & int) >>> 16; const g = (0xff00 & int) >>> 8; const b = (0xff & int) >>> 0; return r | g << 8 | b << 16 | a << 24; } toHEX8() { return `#${(16777216 | this.getInt()).toString(16).substring(1)}${this.a.toString(16).padStart(2, '0')}`; } static pack(i) { _a.int32[0] = i; return _a.float32[0]; } static unpack(f) { _a.float32[0] = f; return _a.int32[0]; } static darkenColor(color, percent) { const num = 'string' == typeof color ? parseInt(color, 16) : color, amt = Math.round(2.55 * percent), R = (num >> 16) + amt, B = (num >> 8 & 0x00ff) + amt, G = (0x0000ff & num) + amt; return 255 << 24 | R << 16 | G << 8 | B; } static brighten(int, amount = 10) { const a = (4278190080 & int) >>> 24; let r = (16711680 & int) >>> 16; let g = (65280 & int) >>> 8; let b = (255 & int) >>> 0; r = Math.max(0, Math.min(255, r - Math.round(-amount / 100 * 255))); g = Math.max(0, Math.min(255, g - Math.round(-amount / 100 * 255))); b = Math.max(0, Math.min(255, b - Math.round(-amount / 100 * 255))); return a << 24 | r << 16 | g << 8 | b; } static multiplyAlpha(int, alpha) { return ((int >>> 24) * alpha & 0xff) << 24 | 0x00ffffff & int; } } _a = MicroColor; (() => { _a.int8 = new Int8Array(4); _a.int32 = new Int32Array(_a.int8.buffer, 0, 1); _a.float32 = new Float32Array(_a.int8.buffer, 0, 1); })(); MicroColor.temp = new _a; MicroColor.isValidHex = hex => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex); MicroColor.getChunksFromString = (st, chunkSize) => st.match(new RegExp(`.{${chunkSize}}`, 'g')); MicroColor.convertHexUnitTo256 = hexStr => parseInt(hexStr.repeat(2 / hexStr.length), 16); MicroColor.getAlphafloat = (a, alpha) => { if ('undefined' !== typeof a) { return a / 255; } if ('number' != typeof alpha || alpha < 0 || alpha > 1) { return 1; } return alpha; }; MicroColor.hexToRGBA = hex => { if (!_a.isValidHex(hex)) { throw new Error('Invalid HEX'); } const chunkSize = Math.floor((hex.length - 1) / 3); const hexArr = _a.getChunksFromString(hex.slice(1), chunkSize); return hexArr.map(_a.convertHexUnitTo256); }; class BasicSetting { constructor({path: path = "DEFAULT", name: name = ""}) { this.exportable = true; this.type = 'NONE'; this._value = null; this.default = null; this.path = path; this.name = name; } get value() { return this._value; } set value(data) { this._value = data; } setter(data) { this.value = data; } get export() { return this.value; } } class Slider extends BasicSetting { constructor({name: name, min: min, max: max, step: step, value: value, useCss: useCss = false, dim: dim = "", unit: unit = "", path: path}) { var _a; super({ name: name, path: path }); this.type = 'SLD'; this.min = min; this.max = max; this.step = step; this.value = value; this.default = value; this.useCss = useCss; this.dim = dim; this.unit = unit; this.precision = (null === (_a = step.toString().split('.')[1]) || void 0 === _a ? void 0 : _a.length) || 0; this.setter(value); } get export() { return this.value; } toJSON() { return this.export; } setter(data) { if ('number' !== typeof data || 'undefined' == typeof data) { data = this.default; } this.value = data; } } class Option extends BasicSetting { constructor({name: name, value: value, path: path}) { super({ name: name, path: path }); this.type = 'OPT'; this.value = value; this.default = value; this.setter(value); } get export() { return this.value; } toJSON() { return this.export; } setter(data) { this.value = data; } } class Input extends BasicSetting { constructor({name: name, value: value, csshook: csshook = s => s, path: path, useCss: useCss = false, options: options = {}}) { super({ name: name, path: path }); this.type = 'INP'; this.value = value; this.default = value; this.csshook = csshook; this.useCss = useCss; this.options = options; this.setter(value); } get export() { return this.value; } toJSON() { return this.export; } setter(data) { if ('string' !== typeof data || 'undefined' == typeof data) { data = this.default; } this.value = String(data); } cssValue() { return this.csshook ? this.csshook(this.value) : this.value; } } class Font extends BasicSetting { constructor({value: value = "normal normal 500 25px Ubuntu", path: path = ""}) { super({ path: path }); this.fontStyle = 'normal'; this.fontVariant = 'normal'; this.fontWeight = '500'; this.fontSize = '25px'; this.lineHeight = 'normal'; this.fontFamily = 'Ubuntu'; this.type = 'FONT'; this.default = this.value; this.setter(value); } get value() { const fontSize_lineHeight = this.fontSize + '/' + this.lineHeight; return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSize_lineHeight} ${this.fontFamily}`; } set value(cssFontString) { this.setter(cssFontString); } get export() { return this.value; } setter(cssFontString) { var _a; if ('undefined' === typeof cssFontString || null === cssFontString) { cssFontString = this.default; } if ('string' === typeof cssFontString && ' ' == cssFontString[0]) { cssFontString = this.default; } null !== (_a = Font.el) && void 0 !== _a || (Font.el = Font.getElem()); Font.el.style.font = cssFontString; this.fontStyle = Font.el.style.fontStyle; this.fontVariant = Font.el.style.fontVariant; this.fontWeight = Font.el.style.fontWeight; this.fontSize = Font.el.style.fontSize; this.lineHeight = Font.el.style.lineHeight; this.fontFamily = Font.el.style.fontFamily; } toJSON() { return this.export; } toSelectboxFormat() { return this.fontWeight + ' 25px ' + this.fontFamily; } load(text, timeout) { return new Promise(((resolve, reject) => { const fontFamily = this.fontFamily.replace(/"/g, ''); if (fontManager.possibleFonts[fontFamily] && fontManager.possibleFonts[fontFamily].isSystemFont) { return resolve(); } const fonts = Array.from(document.fonts).filter((font => font.family === fontFamily && font.weight === this.fontWeight)); Promise.all(fonts.map((font => font.load()))).then((() => resolve())); new FontFaceObserver(fontFamily.replace(/"/g, ''), { weight: this.fontWeight }).load(text, timeout).then(resolve, reject); })); } } Font.getElem = () => { var _a; const el = document.createElement('span'); null === (_a = document.body) || void 0 === _a || _a.appendChild(el); el.style.zIndex = '-9999'; el.style.position = 'absolute'; el.style.top = '-100px'; return el; }; Font.el = null; class Settings extends Eventify.Eventify { constructor(descriptions) { super(); this.raw = descriptions; const self = this; this.proxy = new Proxy(this.raw, { set: (target, prop, newValue) => { const previous = target[prop].value; self.emit('before*', prop, newValue); target[prop].setter(newValue); try { newValue !== previous && self.emit.call(this, prop, newValue, previous); newValue !== previous && self.emit('*', prop, newValue, previous); } catch (message) { console.error(message); } return true; }, get(target, prop) { return target[prop].value; } }); } import(object) { if (!object) { return; } for (const option in this.raw) { if (this.raw.hasOwnProperty(option) && object.hasOwnProperty(option)) { this.proxy[option] = object[option]; } } } export() { const export_data = {}; for (const option in this.raw) { export_data[option] = this.raw[option].export; } return export_data; } restore() { for (const opt in this.raw) { const option = opt; if (this.raw.hasOwnProperty(option)) { this.proxy[option] = this.raw[option].default; } } } } var Group1; (function(Group1) { Group1["s_game"] = "gameplayGroup"; })(Group1 || (Group1 = {})); const settingsDescriptions = { AutoZoom: new Option({ path: Group1.s_game, value: false }), Minimap: new Option({ path: Group1.s_game, value: true }), ZoomOut: new Option({ path: Group1.s_game, value: false }), AutoRespawn: new Option({ path: Group1.s_game, value: false }), AcidMode: new Option({ path: Group1.s_game, value: false }), LeaderboardTitle: new Input({ path: Group1.s_game, value: 'Delta' }), MapBorder: new Option({ path: Group1.s_game, value: true }), MapSectors: new Option({ path: Group1.s_game, value: true }), MapSectorLabels: new Option({ path: Group1.s_game, value: true }), transparent_cells: new Slider({ path: Group1.s_game, value: 1, min: 0.1, max: 1, step: 0.1 }) }; const settings = new Settings(settingsDescriptions); }, 557: (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { Fragment: () => preact__WEBPACK_IMPORTED_MODULE_0__.Fragment, jsx: () => u, jsxs: () => u }); var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); var f = 0; Array.isArray; function u(e, t, n, o, i, u) { t || (t = {}); var a, c, p = t; if ("ref" in p) { for (c in p = {}, t) { "ref" == c ? a = t[c] : p[c] = t[c]; } } var l = { type: e, props: p, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f, __i: -1, __u: 0, __source: i, __self: u }; if ("function" == typeof e && (a = e.defaultProps)) { for (c in a) { void 0 === p[c] && (p[c] = a[c]); } } return preact__WEBPACK_IMPORTED_MODULE_0__.options.vnode && preact__WEBPACK_IMPORTED_MODULE_0__.options.vnode(l), l; } }, 621: (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { AppContext: () => AppContext }); var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); const AppContext = (0, preact__WEBPACK_IMPORTED_MODULE_0__.createContext)(null); }, 632: module => { "use strict"; module.exports = preactHooks; }, 647: (module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { Menu: () => Menu, MenuButtons: () => MenuButtons }); var external_preactHooks_ = __webpack_require__(632); var settings = __webpack_require__(423); var Contexts = __webpack_require__(621); var utils = __webpack_require__(93); var Eventify = __webpack_require__(742); function vh(v) { const h = window.innerHeight; return v * h / 100; } function vw(v) { const w = window.innerWidth; return v * w / 100; } function gcd(a = window.innerWidth, b = window.innerHeight) { return 0 == b ? a : gcd(b, a % b); } const scaling = (0, Eventify.EventObject)({ uiScale: 1 }); function calcScale() { const gc = gcd(); let sizeOfMap = 1; const {w: w, h: h} = { w: 4, h: 3 }; if (gc * window.innerWidth / (gc * window.innerHeight) > w / h) { sizeOfMap = vh(27) / 200; } else { sizeOfMap = h * vw(27) / w / 200; } scaling.uiScale = Math.min(1, sizeOfMap); } window.addEventListener('resize', calcScale); calcScale(); function useEventify(effect, deps) { const eventify = (0, external_preactHooks_.useMemo)((() => new Eventify.Eventify), []); (0, external_preactHooks_.useEffect)((() => { const destroy = effect(eventify); return () => { if (destroy) { destroy(); } eventify.unlisten(); }; }), deps); } var jsxRuntime_module = __webpack_require__(557); function keepValue(a) { const e = a; if (27 === e.keyCode) { e.target.blur(); e.preventDefault(); } } function UiOption({target: target, name: name}) { const [value, updateValue] = (0, external_preactHooks_.useState)(target.raw[name].value); useEventify((e => e.listenTo(target, name, (() => updateValue(target.raw[name].value)))()), [ name ]); return (0, jsxRuntime_module.jsx)(UiOptionMarkup, { name: (0, utils.camelCaseToWords)(target.raw[name].name || name), value: value, onValue: value => { updateValue(value); target.proxy[name] = value; } }); } function UiOptionMarkup({name: name, value: value, onValue: onValue}) { return (0, jsxRuntime_module.jsxs)("label", { className: "flex p-1 text-left gap-2", children: [ (0, jsxRuntime_module.jsx)("div", { className: "grow", children: name }), (0, jsxRuntime_module.jsx)("div", { className: "", children: (0, jsxRuntime_module.jsxs)("label", { className: "switch", children: [ (0, jsxRuntime_module.jsx)("input", { name: Math.random().toString(), className: "", onChange: e => onValue(e.target['checked']), checked: value, defaultChecked: value, type: "checkbox" }), (0, jsxRuntime_module.jsx)("div", { className: "slider round", "data-on": 'ui_on', "data-off": 'ui_off' }) ] }) }) ] }); } function UiSlider({target: target, name: name}) { const helperRef = (0, external_preactHooks_.useRef)(); const unit = target.raw[name].unit || ''; function updateValue(value) { helperRef.current.innerText = String(value.toFixed(target.raw[name].precision)) + unit; } useEventify((e => { e.listenTo(target, name, (() => updateValue(target.raw[name].value)))(); return () => e.unlisten(); }), [ name ]); return (0, jsxRuntime_module.jsx)(SliderRender, { name: (0, utils.camelCaseToWords)(name), value: target.raw[name].value, data: target.raw[name], onValue: value => { target.proxy[name] = value; updateValue(value); }, helperRef: helperRef }); } function SliderRender({name: name, value: value, data: data, onValue: onValue, helperRef: helperRef}) { const rangeRef = (0, external_preactHooks_.useRef)(); return (0, jsxRuntime_module.jsxs)("label", { class: "flex p-1 text-left gap-2", children: [ (0, jsxRuntime_module.jsx)("div", { class: "grow", children: name }), (0, jsxRuntime_module.jsx)("div", { ref: helperRef, class: "helper" }), (0, jsxRuntime_module.jsx)("div", { class: "text-left", children: (0, jsxRuntime_module.jsx)("input", { name: Math.random().toString(), ref: rangeRef, class: "", type: "range", onInput: e => onValue(Number(e.target['value'])), min: data.min, max: data.max, step: data.step, value: value, defaultValue: value.toString() }) }) ] }); } function UiSelectbox({target: target, name: name}) { const [value, updateValue] = (0, external_preactHooks_.useState)(target.raw[name].value); useEventify((e => { const handleStatusChange = () => updateValue(target.raw[name].value); e.listenTo(target, name, handleStatusChange); handleStatusChange(); return () => e.unlisten(); }), [ name ]); return (0, jsxRuntime_module.jsx)(SelectboxRender, { name: (0, utils.camelCaseToWords)(name.toString()), value: value, data: target.raw[name].options, onValue: value => { target.proxy[name] = value; } }); } function SelectboxRender({name: name, value: value, data: data, onValue: onValue}) { return (0, jsxRuntime_module.jsxs)("div", { className: "flex p-1 text-left gap-2", children: [ (0, jsxRuntime_module.jsx)("div", { className: "grow", children: name }), (0, jsxRuntime_module.jsx)("div", { className: "", children: (0, jsxRuntime_module.jsx)("select", { name: Math.random().toString(), className: "selectbox", value: value, onChange: e => onValue(isNaN(e.target.value) ? e.target.value : Number(e.target.value)), children: Object.entries(data).map((([name, value]) => (0, jsxRuntime_module.jsx)("option", { value: value, children: (0, utils.camelCaseToWords)(name) }))) }) }) ] }); } function UiInputbox({target: target, name: name}) { var _a; function onValue(value) { target.proxy[name] = value; } const [value, updateValue] = (0, external_preactHooks_.useState)(target.raw[name].value); useEventify((e => { const handleStatusChange = () => updateValue(target.raw[name].value); e.listenTo(target, name, handleStatusChange); handleStatusChange(); return () => e.unlisten(); }), [ name ]); const display_name = (0, utils.camelCaseToWords)(name); return (0, jsxRuntime_module.jsxs)("div", { class: "flex p-1 text-left gap-2", children: [ (0, jsxRuntime_module.jsx)("div", { class: "grow", children: display_name }), (0, jsxRuntime_module.jsxs)("div", { class: "flex grow", style: { width: '30%' }, children: [ (0, jsxRuntime_module.jsx)("input", { name: Math.random().toString(), class: "input", type: "search", inputMode: "text", autocomplete: "off", style: "width: 100%;", placeholder: name.toString(), onKeyDown: keepValue, onInput: e => onValue(e.target['value']), value: value, defaultValue: value }), true ? (0, jsxRuntime_module.jsxs)("select", { name: 'select-' + Math.random(), class: "w-4", onChange: _e => { const e = _e; void 0 != e.target.value && onValue(e.target.value); e.target.value = ''; e.target.blur(); }, style: "", children: [ (0, jsxRuntime_module.jsx)("option", { value: "" }), 'undefined' !== typeof target.raw[name].default && (0, jsxRuntime_module.jsx)("option", { value: target.raw[name].default, children: "Default" }), null === (_a = Object.entries(target.raw[name].options)) || void 0 === _a ? void 0 : _a.map((([key, val]) => (0, jsxRuntime_module.jsx)("option", { value: val, children: key }))) ] }) : 0 ] }) ] }); } function SettingsList({array: array, target: target}) { const result = array.map((([optName, setting]) => { const type = setting.type; if ('OPT' == type) { return (0, jsxRuntime_module.jsx)(UiOption, { target: target, name: optName }); } if ('SLD' == type) { return (0, jsxRuntime_module.jsx)(UiSlider, { target: target, name: optName }); } if ('SEL' == type) { return (0, jsxRuntime_module.jsx)(UiSelectbox, { target: target, name: optName }); } if ('INP' == type) { return (0, jsxRuntime_module.jsx)(UiInputbox, { target: target, name: optName }); } if ('COL' == type) { return (0, jsxRuntime_module.jsx)(UiColorbox, { target: target, name: optName }); } })); return result; } module = __webpack_require__.hmd(module); var _a; function MenuButtons() { const app = (0, external_preactHooks_.useContext)(Contexts.AppContext); const inputRef = (0, external_preactHooks_.useRef)(); useEventify((e => { e.listenTo(app.state, 'ws', (() => { inputRef.current.value = app.state.ws; }))(); }), []); return (0, jsxRuntime_module.jsxs)("div", { class: 'menu-addon', style: { marginTop: '4px', display: 'flex', flexDirection: 'column', alignItems: 'center' }, children: [ (0, jsxRuntime_module.jsx)("button", { style: { width: '242px' }, type: "submit", class: "btn menu-button ", onClick: () => app.spetate(), children: "Spectate" }), (0, jsxRuntime_module.jsxs)("div", { style: { display: 'flex', gap: '4px', paddingTop: '4px' }, children: [ (0, jsxRuntime_module.jsx)("input", { class: "input-addon", placeholder: "server", ref: inputRef }), (0, jsxRuntime_module.jsx)("button", { type: "submit", class: "btn menu-button", onClick: () => app.connect(inputRef.current.value), children: "Connect" }) ] }) ] }); } const Menu = () => (0, jsxRuntime_module.jsx)("div", { style: { overflowY: 'scroll' }, onWheel: e => e.stopPropagation(), children: (0, jsxRuntime_module.jsxs)("div", { className: "mx-2", children: [ (0, jsxRuntime_module.jsx)(SettingsList, { array: Object.entries(settings.settings.raw), target: settings.settings }), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), (0, jsxRuntime_module.jsx)("br", {}), " Delta" ] }) }); null === (_a = null === module || void 0 === module ? void 0 : module['hot']) || void 0 === _a || _a.accept(); }, 742: (__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.d(__webpack_exports__, { EventObject: () => EventObject, Eventify: () => Eventify, deferrify: () => deferrify }); function EventMixin(Base) { class EventifyBase extends Base { events={}; ev=[]; blockRemovingListeners=false; on(...rest) { if (rest.length < 2) { throw new Error('Eventify.on() need at least 2 arguments'); } const length = rest.length; const listener = rest[length - 1]; for (let i = 0; length - 1 > i; i++) { const event = rest[i]; if ('object' !== typeof this.events[event]) { this.events[event] = []; } this.events[event].push(listener); } return listener; } removeListener(event, listener) { if ('object' === typeof this.events[event]) { const idx = this.events[event].indexOf(listener); if (idx > -1) { this.events[event].splice(idx, 1); } if (0 === this.events[event].length) { delete this.events[event]; } } } emit(event, ...rest) { if ('object' === typeof this.events[event]) { const listeners = this.events[event].slice(); for (const listener of listeners) { listener.apply(this, rest); } } } once(event, listener) { const once_listener = (...args) => { this.removeListener(event, once_listener); listener.apply(this, args); }; this.on(event, once_listener); return once_listener; } waitTimeout(event, timeout, abortController) { const ret = this.waitfor(event, ((_, rejector) => { const timeoutId = setTimeout((() => { const error = new Error(`Waiting "${event.toString()}" Timeout`); error.cause = 'timeout'; rejector(error); }), timeout); if (abortController) { function abort() { clearTimeout(timeoutId); const error = new Error(`Waiting "${event.toString()}" Aborted`); error.cause = 'aborted'; rejector(error); } if (abortController.signal.aborted) { abort(); } else { abortController.signal.addEventListener('abort', abort, { once: true }); } } return () => { clearTimeout(timeoutId); }; })); return ret; } waitfor(event, reject_callback) { return new Promise(((_resolve, _reject) => { let destroyCallbackCalled = false; const removeListener = () => { this.removeListener(event, resolver); this.removeListener(event, rejector); if (destroyCallbackCalled) { return; } destroyCallbackCalled = true; destroyRejectCallback(); }; function resolver(v) { _resolve(v); removeListener(); } function rejector(e) { _reject(e); removeListener(); } const destroyRejectCallback = reject_callback(resolver, rejector); const self = this; self.listenSelf(event, resolver); self.listenSelf(event, rejector); })); } delegateTo(target, ...rest) { if (arguments.length < 3) { throw new Error('Eventify.delegateTo() need at least 3 arguments'); } const length = rest.length, listener = rest[length - 1]; for (let i = 0; length - 1 > i; i++) { const event = rest[i]; if ('object' !== typeof target.events[event]) { target.events[event] = []; } target.ev.push({ delegated: this, event: event, listener: listener }); this.on(event, listener); } return listener; } listenTo(target, ...rest) { return target.delegateTo(this, ...rest); } listenSelf(...rest) { return this.listenTo(this, ...rest); } unlisten() { const before = this.ev.slice(); for (let i = 0; before.length > i; i++) { const target = before[i].delegated; const eventName = before[i].event; const listener = before[i].listener; target.removeListener(eventName, listener); const idx = this.ev.indexOf(before[i]); if (idx > -1) { this.ev.splice(idx, 1); } } if (this.ev.length > 0) { console.error('We have error in unlisten()', before, this.ev); } } } return EventifyBase; } class Eventify extends(EventMixin(class {})){} const props = [ 'on', 'removeListener', 'emit', 'once', 'listenTo', 'delegateTo', 'listenSelf', 'unlisten', 'ev', 'events', 'waitfor', 'waitTimeout' ]; const eventify = function(object) { const EVENTIFY = new Eventify; props.forEach((key => { Object.defineProperty(object, key, { value: EVENTIFY[key], enumerable: false, writable: false }); })); return object; }; function EventObject(object) { const _Eventify = eventify(object); const eventObject = new Proxy(object, { set(target, prop, val) { const prev = object[prop]; const curr = val; _Eventify.emit('before*', prop, val); object[prop] = val; try { _Eventify.emit(prop, val, prev); if (prev !== curr) { _Eventify.emit('change:*', prop, val); _Eventify.emit('change:' + String(prop), val, prev); } _Eventify.emit('*', prop, val, prev); } catch (message) { console.error(message); } return true; } }); Object.defineProperty(eventObject, 'raw', { get() { return object; } }); return eventObject; } function deferrify(params) { let resolve = null; let reject = null; const promise = new Promise(((resolveFunc, rejectFunc) => { resolve = resolveFunc; reject = rejectFunc; if (params?.signal instanceof Promise) { params.signal.catch(reject); } else if (params?.signal?.aborted) { reject(); } })); return { promise: promise, resolve: resolve, reject: reject }; } } }; var __webpack_module_cache__ = {}; function __webpack_require__(moduleId) { var cachedModule = __webpack_module_cache__[moduleId]; if (void 0 !== cachedModule) { return cachedModule.exports; } var module = __webpack_module_cache__[moduleId] = { id: moduleId, loaded: false, exports: {} }; __webpack_modules__[moduleId](module, module.exports, __webpack_require__); module.loaded = true; return module.exports; } (() => { __webpack_require__.n = module => { var getter = module && module.__esModule ? () => module['default'] : () => module; __webpack_require__.d(getter, { a: getter }); return getter; }; })(); (() => { __webpack_require__.d = (exports, definition) => { for (var key in definition) { if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); } } }; })(); (() => { __webpack_require__.hmd = module => { module = Object.create(module); if (!module.children) { module.children = []; } Object.defineProperty(module, 'exports', { enumerable: true, set: () => { throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); } }); return module; }; })(); (() => { __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); })(); var __webpack_exports__ = __webpack_require__(122); MyLibrary = __webpack_exports__; })(typeof unsafeWindow !== 'undefined' ? unsafeWindow : window);