MWI-Hit-Tracker-Canvas

A Tampermonkey script to track MWI hits on Canvas

当前为 2025-05-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MWI-Hit-Tracker-Canvas
  3. // @namespace MWI-Hit-Tracker-Canvas
  4. // @version 0.9.3
  5. // @author Artintel, BKN46
  6. // @description A Tampermonkey script to track MWI hits on Canvas
  7. // @icon https://www.milkywayidle.com/favicon.svg
  8. // @include https://*.milkywayidle.com/*
  9. // @match https://www.milkywayidle.com/*
  10. // @license MIT
  11. // ==/UserScript==
  12. (function () {
  13. 'use strict';
  14.  
  15. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  16.  
  17. var check = function (it) {
  18. return it && it.Math == Math && it;
  19. };
  20.  
  21. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  22. var global$c =
  23. // eslint-disable-next-line es/no-global-this -- safe
  24. check(typeof globalThis == 'object' && globalThis) ||
  25. check(typeof window == 'object' && window) ||
  26. // eslint-disable-next-line no-restricted-globals -- safe
  27. check(typeof self == 'object' && self) ||
  28. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  29. // eslint-disable-next-line no-new-func -- fallback
  30. (function () { return this; })() || Function('return this')();
  31.  
  32. var objectGetOwnPropertyDescriptor = {};
  33.  
  34. var fails$8 = function (exec) {
  35. try {
  36. return !!exec();
  37. } catch (error) {
  38. return true;
  39. }
  40. };
  41.  
  42. var fails$7 = fails$8;
  43.  
  44. // Detect IE8's incomplete defineProperty implementation
  45. var descriptors = !fails$7(function () {
  46. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  47. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  48. });
  49.  
  50. var objectPropertyIsEnumerable = {};
  51.  
  52. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  53. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  54. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  55.  
  56. // Nashorn ~ JDK8 bug
  57. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  58.  
  59. // `Object.prototype.propertyIsEnumerable` method implementation
  60. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  61. objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  62. var descriptor = getOwnPropertyDescriptor$1(this, V);
  63. return !!descriptor && descriptor.enumerable;
  64. } : $propertyIsEnumerable;
  65.  
  66. var createPropertyDescriptor$2 = function (bitmap, value) {
  67. return {
  68. enumerable: !(bitmap & 1),
  69. configurable: !(bitmap & 2),
  70. writable: !(bitmap & 4),
  71. value: value
  72. };
  73. };
  74.  
  75. var toString = {}.toString;
  76.  
  77. var classofRaw$1 = function (it) {
  78. return toString.call(it).slice(8, -1);
  79. };
  80.  
  81. var fails$6 = fails$8;
  82. var classof$2 = classofRaw$1;
  83.  
  84. var split = ''.split;
  85.  
  86. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  87. var indexedObject = fails$6(function () {
  88. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  89. // eslint-disable-next-line no-prototype-builtins -- safe
  90. return !Object('z').propertyIsEnumerable(0);
  91. }) ? function (it) {
  92. return classof$2(it) == 'String' ? split.call(it, '') : Object(it);
  93. } : Object;
  94.  
  95. // `RequireObjectCoercible` abstract operation
  96. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  97. var requireObjectCoercible$2 = function (it) {
  98. if (it == undefined) throw TypeError("Can't call method on " + it);
  99. return it;
  100. };
  101.  
  102. // toObject with fallback for non-array-like ES3 strings
  103. var IndexedObject = indexedObject;
  104. var requireObjectCoercible$1 = requireObjectCoercible$2;
  105.  
  106. var toIndexedObject$3 = function (it) {
  107. return IndexedObject(requireObjectCoercible$1(it));
  108. };
  109.  
  110. // `IsCallable` abstract operation
  111. // https://tc39.es/ecma262/#sec-iscallable
  112. var isCallable$d = function (argument) {
  113. return typeof argument === 'function';
  114. };
  115.  
  116. var isCallable$c = isCallable$d;
  117.  
  118. var isObject$5 = function (it) {
  119. return typeof it === 'object' ? it !== null : isCallable$c(it);
  120. };
  121.  
  122. var global$b = global$c;
  123. var isCallable$b = isCallable$d;
  124.  
  125. var aFunction = function (argument) {
  126. return isCallable$b(argument) ? argument : undefined;
  127. };
  128.  
  129. var getBuiltIn$4 = function (namespace, method) {
  130. return arguments.length < 2 ? aFunction(global$b[namespace]) : global$b[namespace] && global$b[namespace][method];
  131. };
  132.  
  133. var getBuiltIn$3 = getBuiltIn$4;
  134.  
  135. var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
  136.  
  137. var global$a = global$c;
  138. var userAgent = engineUserAgent;
  139.  
  140. var process = global$a.process;
  141. var Deno = global$a.Deno;
  142. var versions = process && process.versions || Deno && Deno.version;
  143. var v8 = versions && versions.v8;
  144. var match, version;
  145.  
  146. if (v8) {
  147. match = v8.split('.');
  148. version = match[0] < 4 ? 1 : match[0] + match[1];
  149. } else if (userAgent) {
  150. match = userAgent.match(/Edge\/(\d+)/);
  151. if (!match || match[1] >= 74) {
  152. match = userAgent.match(/Chrome\/(\d+)/);
  153. if (match) version = match[1];
  154. }
  155. }
  156.  
  157. var engineV8Version = version && +version;
  158.  
  159. /* eslint-disable es/no-symbol -- required for testing */
  160.  
  161. var V8_VERSION = engineV8Version;
  162. var fails$5 = fails$8;
  163.  
  164. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  165. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
  166. var symbol = Symbol();
  167. // Chrome 38 Symbol has incorrect toString conversion
  168. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  169. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  170. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  171. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  172. });
  173.  
  174. /* eslint-disable es/no-symbol -- required for testing */
  175.  
  176. var NATIVE_SYMBOL$1 = nativeSymbol;
  177.  
  178. var useSymbolAsUid = NATIVE_SYMBOL$1
  179. && !Symbol.sham
  180. && typeof Symbol.iterator == 'symbol';
  181.  
  182. var isCallable$a = isCallable$d;
  183. var getBuiltIn$2 = getBuiltIn$4;
  184. var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
  185.  
  186. var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
  187. return typeof it == 'symbol';
  188. } : function (it) {
  189. var $Symbol = getBuiltIn$2('Symbol');
  190. return isCallable$a($Symbol) && Object(it) instanceof $Symbol;
  191. };
  192.  
  193. var tryToString$1 = function (argument) {
  194. try {
  195. return String(argument);
  196. } catch (error) {
  197. return 'Object';
  198. }
  199. };
  200.  
  201. var isCallable$9 = isCallable$d;
  202. var tryToString = tryToString$1;
  203.  
  204. // `Assert: IsCallable(argument) is true`
  205. var aCallable$5 = function (argument) {
  206. if (isCallable$9(argument)) return argument;
  207. throw TypeError(tryToString(argument) + ' is not a function');
  208. };
  209.  
  210. var aCallable$4 = aCallable$5;
  211.  
  212. // `GetMethod` abstract operation
  213. // https://tc39.es/ecma262/#sec-getmethod
  214. var getMethod$4 = function (V, P) {
  215. var func = V[P];
  216. return func == null ? undefined : aCallable$4(func);
  217. };
  218.  
  219. var isCallable$8 = isCallable$d;
  220. var isObject$4 = isObject$5;
  221.  
  222. // `OrdinaryToPrimitive` abstract operation
  223. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  224. var ordinaryToPrimitive$1 = function (input, pref) {
  225. var fn, val;
  226. if (pref === 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = fn.call(input))) return val;
  227. if (isCallable$8(fn = input.valueOf) && !isObject$4(val = fn.call(input))) return val;
  228. if (pref !== 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = fn.call(input))) return val;
  229. throw TypeError("Can't convert object to primitive value");
  230. };
  231.  
  232. var shared$3 = {exports: {}};
  233.  
  234. var global$9 = global$c;
  235.  
  236. var setGlobal$3 = function (key, value) {
  237. try {
  238. // eslint-disable-next-line es/no-object-defineproperty -- safe
  239. Object.defineProperty(global$9, key, { value: value, configurable: true, writable: true });
  240. } catch (error) {
  241. global$9[key] = value;
  242. } return value;
  243. };
  244.  
  245. var global$8 = global$c;
  246. var setGlobal$2 = setGlobal$3;
  247.  
  248. var SHARED = '__core-js_shared__';
  249. var store$3 = global$8[SHARED] || setGlobal$2(SHARED, {});
  250.  
  251. var sharedStore = store$3;
  252.  
  253. var store$2 = sharedStore;
  254.  
  255. (shared$3.exports = function (key, value) {
  256. return store$2[key] || (store$2[key] = value !== undefined ? value : {});
  257. })('versions', []).push({
  258. version: '3.18.3',
  259. mode: 'global',
  260. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  261. });
  262.  
  263. var requireObjectCoercible = requireObjectCoercible$2;
  264.  
  265. // `ToObject` abstract operation
  266. // https://tc39.es/ecma262/#sec-toobject
  267. var toObject$2 = function (argument) {
  268. return Object(requireObjectCoercible(argument));
  269. };
  270.  
  271. var toObject$1 = toObject$2;
  272.  
  273. var hasOwnProperty = {}.hasOwnProperty;
  274.  
  275. // `HasOwnProperty` abstract operation
  276. // https://tc39.es/ecma262/#sec-hasownproperty
  277. var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
  278. return hasOwnProperty.call(toObject$1(it), key);
  279. };
  280.  
  281. var id = 0;
  282. var postfix = Math.random();
  283.  
  284. var uid$2 = function (key) {
  285. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  286. };
  287.  
  288. var global$7 = global$c;
  289. var shared$2 = shared$3.exports;
  290. var hasOwn$8 = hasOwnProperty_1;
  291. var uid$1 = uid$2;
  292. var NATIVE_SYMBOL = nativeSymbol;
  293. var USE_SYMBOL_AS_UID = useSymbolAsUid;
  294.  
  295. var WellKnownSymbolsStore = shared$2('wks');
  296. var Symbol$1 = global$7.Symbol;
  297. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
  298.  
  299. var wellKnownSymbol$8 = function (name) {
  300. if (!hasOwn$8(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  301. if (NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)) {
  302. WellKnownSymbolsStore[name] = Symbol$1[name];
  303. } else {
  304. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  305. }
  306. } return WellKnownSymbolsStore[name];
  307. };
  308.  
  309. var isObject$3 = isObject$5;
  310. var isSymbol$1 = isSymbol$2;
  311. var getMethod$3 = getMethod$4;
  312. var ordinaryToPrimitive = ordinaryToPrimitive$1;
  313. var wellKnownSymbol$7 = wellKnownSymbol$8;
  314.  
  315. var TO_PRIMITIVE = wellKnownSymbol$7('toPrimitive');
  316.  
  317. // `ToPrimitive` abstract operation
  318. // https://tc39.es/ecma262/#sec-toprimitive
  319. var toPrimitive$1 = function (input, pref) {
  320. if (!isObject$3(input) || isSymbol$1(input)) return input;
  321. var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
  322. var result;
  323. if (exoticToPrim) {
  324. if (pref === undefined) pref = 'default';
  325. result = exoticToPrim.call(input, pref);
  326. if (!isObject$3(result) || isSymbol$1(result)) return result;
  327. throw TypeError("Can't convert object to primitive value");
  328. }
  329. if (pref === undefined) pref = 'number';
  330. return ordinaryToPrimitive(input, pref);
  331. };
  332.  
  333. var toPrimitive = toPrimitive$1;
  334. var isSymbol = isSymbol$2;
  335.  
  336. // `ToPropertyKey` abstract operation
  337. // https://tc39.es/ecma262/#sec-topropertykey
  338. var toPropertyKey$2 = function (argument) {
  339. var key = toPrimitive(argument, 'string');
  340. return isSymbol(key) ? key : String(key);
  341. };
  342.  
  343. var global$6 = global$c;
  344. var isObject$2 = isObject$5;
  345.  
  346. var document$1 = global$6.document;
  347. // typeof document.createElement is 'object' in old IE
  348. var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
  349.  
  350. var documentCreateElement$1 = function (it) {
  351. return EXISTS$1 ? document$1.createElement(it) : {};
  352. };
  353.  
  354. var DESCRIPTORS$5 = descriptors;
  355. var fails$4 = fails$8;
  356. var createElement = documentCreateElement$1;
  357.  
  358. // Thank's IE8 for his funny defineProperty
  359. var ie8DomDefine = !DESCRIPTORS$5 && !fails$4(function () {
  360. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  361. return Object.defineProperty(createElement('div'), 'a', {
  362. get: function () { return 7; }
  363. }).a != 7;
  364. });
  365.  
  366. var DESCRIPTORS$4 = descriptors;
  367. var propertyIsEnumerableModule = objectPropertyIsEnumerable;
  368. var createPropertyDescriptor$1 = createPropertyDescriptor$2;
  369. var toIndexedObject$2 = toIndexedObject$3;
  370. var toPropertyKey$1 = toPropertyKey$2;
  371. var hasOwn$7 = hasOwnProperty_1;
  372. var IE8_DOM_DEFINE$1 = ie8DomDefine;
  373.  
  374. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  375. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  376.  
  377. // `Object.getOwnPropertyDescriptor` method
  378. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  379. objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  380. O = toIndexedObject$2(O);
  381. P = toPropertyKey$1(P);
  382. if (IE8_DOM_DEFINE$1) try {
  383. return $getOwnPropertyDescriptor(O, P);
  384. } catch (error) { /* empty */ }
  385. if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  386. };
  387.  
  388. var objectDefineProperty = {};
  389.  
  390. var isObject$1 = isObject$5;
  391.  
  392. // `Assert: Type(argument) is Object`
  393. var anObject$b = function (argument) {
  394. if (isObject$1(argument)) return argument;
  395. throw TypeError(String(argument) + ' is not an object');
  396. };
  397.  
  398. var DESCRIPTORS$3 = descriptors;
  399. var IE8_DOM_DEFINE = ie8DomDefine;
  400. var anObject$a = anObject$b;
  401. var toPropertyKey = toPropertyKey$2;
  402.  
  403. // eslint-disable-next-line es/no-object-defineproperty -- safe
  404. var $defineProperty = Object.defineProperty;
  405.  
  406. // `Object.defineProperty` method
  407. // https://tc39.es/ecma262/#sec-object.defineproperty
  408. objectDefineProperty.f = DESCRIPTORS$3 ? $defineProperty : function defineProperty(O, P, Attributes) {
  409. anObject$a(O);
  410. P = toPropertyKey(P);
  411. anObject$a(Attributes);
  412. if (IE8_DOM_DEFINE) try {
  413. return $defineProperty(O, P, Attributes);
  414. } catch (error) { /* empty */ }
  415. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  416. if ('value' in Attributes) O[P] = Attributes.value;
  417. return O;
  418. };
  419.  
  420. var DESCRIPTORS$2 = descriptors;
  421. var definePropertyModule$2 = objectDefineProperty;
  422. var createPropertyDescriptor = createPropertyDescriptor$2;
  423.  
  424. var createNonEnumerableProperty$5 = DESCRIPTORS$2 ? function (object, key, value) {
  425. return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
  426. } : function (object, key, value) {
  427. object[key] = value;
  428. return object;
  429. };
  430.  
  431. var redefine$3 = {exports: {}};
  432.  
  433. var isCallable$7 = isCallable$d;
  434. var store$1 = sharedStore;
  435.  
  436. var functionToString = Function.toString;
  437.  
  438. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  439. if (!isCallable$7(store$1.inspectSource)) {
  440. store$1.inspectSource = function (it) {
  441. return functionToString.call(it);
  442. };
  443. }
  444.  
  445. var inspectSource$2 = store$1.inspectSource;
  446.  
  447. var global$5 = global$c;
  448. var isCallable$6 = isCallable$d;
  449. var inspectSource$1 = inspectSource$2;
  450.  
  451. var WeakMap$1 = global$5.WeakMap;
  452.  
  453. var nativeWeakMap = isCallable$6(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
  454.  
  455. var shared$1 = shared$3.exports;
  456. var uid = uid$2;
  457.  
  458. var keys = shared$1('keys');
  459.  
  460. var sharedKey$3 = function (key) {
  461. return keys[key] || (keys[key] = uid(key));
  462. };
  463.  
  464. var hiddenKeys$4 = {};
  465.  
  466. var NATIVE_WEAK_MAP = nativeWeakMap;
  467. var global$4 = global$c;
  468. var isObject = isObject$5;
  469. var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
  470. var hasOwn$6 = hasOwnProperty_1;
  471. var shared = sharedStore;
  472. var sharedKey$2 = sharedKey$3;
  473. var hiddenKeys$3 = hiddenKeys$4;
  474.  
  475. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  476. var WeakMap = global$4.WeakMap;
  477. var set, get, has;
  478.  
  479. var enforce = function (it) {
  480. return has(it) ? get(it) : set(it, {});
  481. };
  482.  
  483. var getterFor = function (TYPE) {
  484. return function (it) {
  485. var state;
  486. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  487. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  488. } return state;
  489. };
  490. };
  491.  
  492. if (NATIVE_WEAK_MAP || shared.state) {
  493. var store = shared.state || (shared.state = new WeakMap());
  494. var wmget = store.get;
  495. var wmhas = store.has;
  496. var wmset = store.set;
  497. set = function (it, metadata) {
  498. if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  499. metadata.facade = it;
  500. wmset.call(store, it, metadata);
  501. return metadata;
  502. };
  503. get = function (it) {
  504. return wmget.call(store, it) || {};
  505. };
  506. has = function (it) {
  507. return wmhas.call(store, it);
  508. };
  509. } else {
  510. var STATE = sharedKey$2('state');
  511. hiddenKeys$3[STATE] = true;
  512. set = function (it, metadata) {
  513. if (hasOwn$6(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  514. metadata.facade = it;
  515. createNonEnumerableProperty$4(it, STATE, metadata);
  516. return metadata;
  517. };
  518. get = function (it) {
  519. return hasOwn$6(it, STATE) ? it[STATE] : {};
  520. };
  521. has = function (it) {
  522. return hasOwn$6(it, STATE);
  523. };
  524. }
  525.  
  526. var internalState = {
  527. set: set,
  528. get: get,
  529. has: has,
  530. enforce: enforce,
  531. getterFor: getterFor
  532. };
  533.  
  534. var DESCRIPTORS$1 = descriptors;
  535. var hasOwn$5 = hasOwnProperty_1;
  536.  
  537. var FunctionPrototype = Function.prototype;
  538. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  539. var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
  540.  
  541. var EXISTS = hasOwn$5(FunctionPrototype, 'name');
  542. // additional protection from minified / mangled / dropped function names
  543. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  544. var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
  545.  
  546. var functionName = {
  547. EXISTS: EXISTS,
  548. PROPER: PROPER,
  549. CONFIGURABLE: CONFIGURABLE
  550. };
  551.  
  552. var global$3 = global$c;
  553. var isCallable$5 = isCallable$d;
  554. var hasOwn$4 = hasOwnProperty_1;
  555. var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
  556. var setGlobal$1 = setGlobal$3;
  557. var inspectSource = inspectSource$2;
  558. var InternalStateModule$1 = internalState;
  559. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  560.  
  561. var getInternalState$1 = InternalStateModule$1.get;
  562. var enforceInternalState = InternalStateModule$1.enforce;
  563. var TEMPLATE = String(String).split('String');
  564.  
  565. (redefine$3.exports = function (O, key, value, options) {
  566. var unsafe = options ? !!options.unsafe : false;
  567. var simple = options ? !!options.enumerable : false;
  568. var noTargetGet = options ? !!options.noTargetGet : false;
  569. var name = options && options.name !== undefined ? options.name : key;
  570. var state;
  571. if (isCallable$5(value)) {
  572. if (String(name).slice(0, 7) === 'Symbol(') {
  573. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  574. }
  575. if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  576. createNonEnumerableProperty$3(value, 'name', name);
  577. }
  578. state = enforceInternalState(value);
  579. if (!state.source) {
  580. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  581. }
  582. }
  583. if (O === global$3) {
  584. if (simple) O[key] = value;
  585. else setGlobal$1(key, value);
  586. return;
  587. } else if (!unsafe) {
  588. delete O[key];
  589. } else if (!noTargetGet && O[key]) {
  590. simple = true;
  591. }
  592. if (simple) O[key] = value;
  593. else createNonEnumerableProperty$3(O, key, value);
  594. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  595. })(Function.prototype, 'toString', function toString() {
  596. return isCallable$5(this) && getInternalState$1(this).source || inspectSource(this);
  597. });
  598.  
  599. var objectGetOwnPropertyNames = {};
  600.  
  601. var ceil = Math.ceil;
  602. var floor = Math.floor;
  603.  
  604. // `ToIntegerOrInfinity` abstract operation
  605. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  606. var toIntegerOrInfinity$2 = function (argument) {
  607. var number = +argument;
  608. // eslint-disable-next-line no-self-compare -- safe
  609. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  610. };
  611.  
  612. var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
  613.  
  614. var max = Math.max;
  615. var min$1 = Math.min;
  616.  
  617. // Helper for a popular repeating case of the spec:
  618. // Let integer be ? ToInteger(index).
  619. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  620. var toAbsoluteIndex$1 = function (index, length) {
  621. var integer = toIntegerOrInfinity$1(index);
  622. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  623. };
  624.  
  625. var toIntegerOrInfinity = toIntegerOrInfinity$2;
  626.  
  627. var min = Math.min;
  628.  
  629. // `ToLength` abstract operation
  630. // https://tc39.es/ecma262/#sec-tolength
  631. var toLength$1 = function (argument) {
  632. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  633. };
  634.  
  635. var toLength = toLength$1;
  636.  
  637. // `LengthOfArrayLike` abstract operation
  638. // https://tc39.es/ecma262/#sec-lengthofarraylike
  639. var lengthOfArrayLike$2 = function (obj) {
  640. return toLength(obj.length);
  641. };
  642.  
  643. var toIndexedObject$1 = toIndexedObject$3;
  644. var toAbsoluteIndex = toAbsoluteIndex$1;
  645. var lengthOfArrayLike$1 = lengthOfArrayLike$2;
  646.  
  647. // `Array.prototype.{ indexOf, includes }` methods implementation
  648. var createMethod = function (IS_INCLUDES) {
  649. return function ($this, el, fromIndex) {
  650. var O = toIndexedObject$1($this);
  651. var length = lengthOfArrayLike$1(O);
  652. var index = toAbsoluteIndex(fromIndex, length);
  653. var value;
  654. // Array#includes uses SameValueZero equality algorithm
  655. // eslint-disable-next-line no-self-compare -- NaN check
  656. if (IS_INCLUDES && el != el) while (length > index) {
  657. value = O[index++];
  658. // eslint-disable-next-line no-self-compare -- NaN check
  659. if (value != value) return true;
  660. // Array#indexOf ignores holes, Array#includes - not
  661. } else for (;length > index; index++) {
  662. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  663. } return !IS_INCLUDES && -1;
  664. };
  665. };
  666.  
  667. var arrayIncludes = {
  668. // `Array.prototype.includes` method
  669. // https://tc39.es/ecma262/#sec-array.prototype.includes
  670. includes: createMethod(true),
  671. // `Array.prototype.indexOf` method
  672. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  673. indexOf: createMethod(false)
  674. };
  675.  
  676. var hasOwn$3 = hasOwnProperty_1;
  677. var toIndexedObject = toIndexedObject$3;
  678. var indexOf = arrayIncludes.indexOf;
  679. var hiddenKeys$2 = hiddenKeys$4;
  680.  
  681. var objectKeysInternal = function (object, names) {
  682. var O = toIndexedObject(object);
  683. var i = 0;
  684. var result = [];
  685. var key;
  686. for (key in O) !hasOwn$3(hiddenKeys$2, key) && hasOwn$3(O, key) && result.push(key);
  687. // Don't enum bug & hidden keys
  688. while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
  689. ~indexOf(result, key) || result.push(key);
  690. }
  691. return result;
  692. };
  693.  
  694. // IE8- don't enum bug keys
  695. var enumBugKeys$3 = [
  696. 'constructor',
  697. 'hasOwnProperty',
  698. 'isPrototypeOf',
  699. 'propertyIsEnumerable',
  700. 'toLocaleString',
  701. 'toString',
  702. 'valueOf'
  703. ];
  704.  
  705. var internalObjectKeys$1 = objectKeysInternal;
  706. var enumBugKeys$2 = enumBugKeys$3;
  707.  
  708. var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
  709.  
  710. // `Object.getOwnPropertyNames` method
  711. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  712. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  713. objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  714. return internalObjectKeys$1(O, hiddenKeys$1);
  715. };
  716.  
  717. var objectGetOwnPropertySymbols = {};
  718.  
  719. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  720. objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
  721.  
  722. var getBuiltIn$1 = getBuiltIn$4;
  723. var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
  724. var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
  725. var anObject$9 = anObject$b;
  726.  
  727. // all object keys, includes non-enumerable and symbols
  728. var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
  729. var keys = getOwnPropertyNamesModule.f(anObject$9(it));
  730. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  731. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  732. };
  733.  
  734. var hasOwn$2 = hasOwnProperty_1;
  735. var ownKeys = ownKeys$1;
  736. var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
  737. var definePropertyModule$1 = objectDefineProperty;
  738.  
  739. var copyConstructorProperties$1 = function (target, source) {
  740. var keys = ownKeys(source);
  741. var defineProperty = definePropertyModule$1.f;
  742. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  743. for (var i = 0; i < keys.length; i++) {
  744. var key = keys[i];
  745. if (!hasOwn$2(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  746. }
  747. };
  748.  
  749. var fails$3 = fails$8;
  750. var isCallable$4 = isCallable$d;
  751.  
  752. var replacement = /#|\.prototype\./;
  753.  
  754. var isForced$1 = function (feature, detection) {
  755. var value = data[normalize(feature)];
  756. return value == POLYFILL ? true
  757. : value == NATIVE ? false
  758. : isCallable$4(detection) ? fails$3(detection)
  759. : !!detection;
  760. };
  761.  
  762. var normalize = isForced$1.normalize = function (string) {
  763. return String(string).replace(replacement, '.').toLowerCase();
  764. };
  765.  
  766. var data = isForced$1.data = {};
  767. var NATIVE = isForced$1.NATIVE = 'N';
  768. var POLYFILL = isForced$1.POLYFILL = 'P';
  769.  
  770. var isForced_1 = isForced$1;
  771.  
  772. var global$2 = global$c;
  773. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  774. var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
  775. var redefine$2 = redefine$3.exports;
  776. var setGlobal = setGlobal$3;
  777. var copyConstructorProperties = copyConstructorProperties$1;
  778. var isForced = isForced_1;
  779.  
  780. /*
  781. options.target - name of the target object
  782. options.global - target is the global object
  783. options.stat - export as static methods of target
  784. options.proto - export as prototype methods of target
  785. options.real - real prototype method for the `pure` version
  786. options.forced - export even if the native feature is available
  787. options.bind - bind methods to the target, required for the `pure` version
  788. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  789. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  790. options.sham - add a flag to not completely full polyfills
  791. options.enumerable - export as enumerable property
  792. options.noTargetGet - prevent calling a getter on target
  793. options.name - the .name of the function if it does not match the key
  794. */
  795. var _export = function (options, source) {
  796. var TARGET = options.target;
  797. var GLOBAL = options.global;
  798. var STATIC = options.stat;
  799. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  800. if (GLOBAL) {
  801. target = global$2;
  802. } else if (STATIC) {
  803. target = global$2[TARGET] || setGlobal(TARGET, {});
  804. } else {
  805. target = (global$2[TARGET] || {}).prototype;
  806. }
  807. if (target) for (key in source) {
  808. sourceProperty = source[key];
  809. if (options.noTargetGet) {
  810. descriptor = getOwnPropertyDescriptor(target, key);
  811. targetProperty = descriptor && descriptor.value;
  812. } else targetProperty = target[key];
  813. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  814. // contained in target
  815. if (!FORCED && targetProperty !== undefined) {
  816. if (typeof sourceProperty === typeof targetProperty) continue;
  817. copyConstructorProperties(sourceProperty, targetProperty);
  818. }
  819. // add a flag to not completely full polyfills
  820. if (options.sham || (targetProperty && targetProperty.sham)) {
  821. createNonEnumerableProperty$2(sourceProperty, 'sham', true);
  822. }
  823. // extend global
  824. redefine$2(target, key, sourceProperty, options);
  825. }
  826. };
  827.  
  828. var anInstance$1 = function (it, Constructor, name) {
  829. if (it instanceof Constructor) return it;
  830. throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
  831. };
  832.  
  833. var internalObjectKeys = objectKeysInternal;
  834. var enumBugKeys$1 = enumBugKeys$3;
  835.  
  836. // `Object.keys` method
  837. // https://tc39.es/ecma262/#sec-object.keys
  838. // eslint-disable-next-line es/no-object-keys -- safe
  839. var objectKeys$1 = Object.keys || function keys(O) {
  840. return internalObjectKeys(O, enumBugKeys$1);
  841. };
  842.  
  843. var DESCRIPTORS = descriptors;
  844. var definePropertyModule = objectDefineProperty;
  845. var anObject$8 = anObject$b;
  846. var objectKeys = objectKeys$1;
  847.  
  848. // `Object.defineProperties` method
  849. // https://tc39.es/ecma262/#sec-object.defineproperties
  850. // eslint-disable-next-line es/no-object-defineproperties -- safe
  851. var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  852. anObject$8(O);
  853. var keys = objectKeys(Properties);
  854. var length = keys.length;
  855. var index = 0;
  856. var key;
  857. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  858. return O;
  859. };
  860.  
  861. var getBuiltIn = getBuiltIn$4;
  862.  
  863. var html$1 = getBuiltIn('document', 'documentElement');
  864.  
  865. /* global ActiveXObject -- old IE, WSH */
  866.  
  867. var anObject$7 = anObject$b;
  868. var defineProperties = objectDefineProperties;
  869. var enumBugKeys = enumBugKeys$3;
  870. var hiddenKeys = hiddenKeys$4;
  871. var html = html$1;
  872. var documentCreateElement = documentCreateElement$1;
  873. var sharedKey$1 = sharedKey$3;
  874.  
  875. var GT = '>';
  876. var LT = '<';
  877. var PROTOTYPE = 'prototype';
  878. var SCRIPT = 'script';
  879. var IE_PROTO$1 = sharedKey$1('IE_PROTO');
  880.  
  881. var EmptyConstructor = function () { /* empty */ };
  882.  
  883. var scriptTag = function (content) {
  884. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  885. };
  886.  
  887. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  888. var NullProtoObjectViaActiveX = function (activeXDocument) {
  889. activeXDocument.write(scriptTag(''));
  890. activeXDocument.close();
  891. var temp = activeXDocument.parentWindow.Object;
  892. activeXDocument = null; // avoid memory leak
  893. return temp;
  894. };
  895.  
  896. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  897. var NullProtoObjectViaIFrame = function () {
  898. // Thrash, waste and sodomy: IE GC bug
  899. var iframe = documentCreateElement('iframe');
  900. var JS = 'java' + SCRIPT + ':';
  901. var iframeDocument;
  902. iframe.style.display = 'none';
  903. html.appendChild(iframe);
  904. // https://github.com/zloirock/core-js/issues/475
  905. iframe.src = String(JS);
  906. iframeDocument = iframe.contentWindow.document;
  907. iframeDocument.open();
  908. iframeDocument.write(scriptTag('document.F=Object'));
  909. iframeDocument.close();
  910. return iframeDocument.F;
  911. };
  912.  
  913. // Check for document.domain and active x support
  914. // No need to use active x approach when document.domain is not set
  915. // see https://github.com/es-shims/es5-shim/issues/150
  916. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  917. // avoid IE GC bug
  918. var activeXDocument;
  919. var NullProtoObject = function () {
  920. try {
  921. activeXDocument = new ActiveXObject('htmlfile');
  922. } catch (error) { /* ignore */ }
  923. NullProtoObject = typeof document != 'undefined'
  924. ? document.domain && activeXDocument
  925. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  926. : NullProtoObjectViaIFrame()
  927. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  928. var length = enumBugKeys.length;
  929. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  930. return NullProtoObject();
  931. };
  932.  
  933. hiddenKeys[IE_PROTO$1] = true;
  934.  
  935. // `Object.create` method
  936. // https://tc39.es/ecma262/#sec-object.create
  937. var objectCreate = Object.create || function create(O, Properties) {
  938. var result;
  939. if (O !== null) {
  940. EmptyConstructor[PROTOTYPE] = anObject$7(O);
  941. result = new EmptyConstructor();
  942. EmptyConstructor[PROTOTYPE] = null;
  943. // add "__proto__" for Object.getPrototypeOf polyfill
  944. result[IE_PROTO$1] = O;
  945. } else result = NullProtoObject();
  946. return Properties === undefined ? result : defineProperties(result, Properties);
  947. };
  948.  
  949. var fails$2 = fails$8;
  950.  
  951. var correctPrototypeGetter = !fails$2(function () {
  952. function F() { /* empty */ }
  953. F.prototype.constructor = null;
  954. // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  955. return Object.getPrototypeOf(new F()) !== F.prototype;
  956. });
  957.  
  958. var hasOwn$1 = hasOwnProperty_1;
  959. var isCallable$3 = isCallable$d;
  960. var toObject = toObject$2;
  961. var sharedKey = sharedKey$3;
  962. var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
  963.  
  964. var IE_PROTO = sharedKey('IE_PROTO');
  965. var ObjectPrototype = Object.prototype;
  966.  
  967. // `Object.getPrototypeOf` method
  968. // https://tc39.es/ecma262/#sec-object.getprototypeof
  969. // eslint-disable-next-line es/no-object-getprototypeof -- safe
  970. var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  971. var object = toObject(O);
  972. if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
  973. var constructor = object.constructor;
  974. if (isCallable$3(constructor) && object instanceof constructor) {
  975. return constructor.prototype;
  976. } return object instanceof Object ? ObjectPrototype : null;
  977. };
  978.  
  979. var fails$1 = fails$8;
  980. var isCallable$2 = isCallable$d;
  981. var getPrototypeOf = objectGetPrototypeOf;
  982. var redefine$1 = redefine$3.exports;
  983. var wellKnownSymbol$6 = wellKnownSymbol$8;
  984.  
  985. var ITERATOR$2 = wellKnownSymbol$6('iterator');
  986. var BUGGY_SAFARI_ITERATORS = false;
  987.  
  988. // `%IteratorPrototype%` object
  989. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  990. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  991.  
  992. /* eslint-disable es/no-array-prototype-keys -- safe */
  993. if ([].keys) {
  994. arrayIterator = [].keys();
  995. // Safari 8 has buggy iterators w/o `next`
  996. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  997. else {
  998. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  999. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  1000. }
  1001. }
  1002.  
  1003. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$1(function () {
  1004. var test = {};
  1005. // FF44- legacy iterators case
  1006. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  1007. });
  1008.  
  1009. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  1010.  
  1011. // `%IteratorPrototype%[@@iterator]()` method
  1012. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  1013. if (!isCallable$2(IteratorPrototype$2[ITERATOR$2])) {
  1014. redefine$1(IteratorPrototype$2, ITERATOR$2, function () {
  1015. return this;
  1016. });
  1017. }
  1018.  
  1019. var iteratorsCore = {
  1020. IteratorPrototype: IteratorPrototype$2,
  1021. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  1022. };
  1023.  
  1024. // https://github.com/tc39/proposal-iterator-helpers
  1025. var $$2 = _export;
  1026. var global$1 = global$c;
  1027. var anInstance = anInstance$1;
  1028. var isCallable$1 = isCallable$d;
  1029. var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
  1030. var fails = fails$8;
  1031. var hasOwn = hasOwnProperty_1;
  1032. var wellKnownSymbol$5 = wellKnownSymbol$8;
  1033. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  1034.  
  1035. var TO_STRING_TAG$3 = wellKnownSymbol$5('toStringTag');
  1036.  
  1037. var NativeIterator = global$1.Iterator;
  1038.  
  1039. // FF56- have non-standard global helper `Iterator`
  1040. var FORCED = !isCallable$1(NativeIterator)
  1041. || NativeIterator.prototype !== IteratorPrototype$1
  1042. // FF44- non-standard `Iterator` passes previous tests
  1043. || !fails(function () { NativeIterator({}); });
  1044.  
  1045. var IteratorConstructor = function Iterator() {
  1046. anInstance(this, IteratorConstructor);
  1047. };
  1048.  
  1049. if (!hasOwn(IteratorPrototype$1, TO_STRING_TAG$3)) {
  1050. createNonEnumerableProperty$1(IteratorPrototype$1, TO_STRING_TAG$3, 'Iterator');
  1051. }
  1052.  
  1053. if (FORCED || !hasOwn(IteratorPrototype$1, 'constructor') || IteratorPrototype$1.constructor === Object) {
  1054. createNonEnumerableProperty$1(IteratorPrototype$1, 'constructor', IteratorConstructor);
  1055. }
  1056.  
  1057. IteratorConstructor.prototype = IteratorPrototype$1;
  1058.  
  1059. $$2({ global: true, forced: FORCED }, {
  1060. Iterator: IteratorConstructor
  1061. });
  1062.  
  1063. var iterators = {};
  1064.  
  1065. var wellKnownSymbol$4 = wellKnownSymbol$8;
  1066. var Iterators$1 = iterators;
  1067.  
  1068. var ITERATOR$1 = wellKnownSymbol$4('iterator');
  1069. var ArrayPrototype = Array.prototype;
  1070.  
  1071. // check on default Array iterator
  1072. var isArrayIteratorMethod$1 = function (it) {
  1073. return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$1] === it);
  1074. };
  1075.  
  1076. var aCallable$3 = aCallable$5;
  1077.  
  1078. // optional / simple context binding
  1079. var functionBindContext = function (fn, that, length) {
  1080. aCallable$3(fn);
  1081. if (that === undefined) return fn;
  1082. switch (length) {
  1083. case 0: return function () {
  1084. return fn.call(that);
  1085. };
  1086. case 1: return function (a) {
  1087. return fn.call(that, a);
  1088. };
  1089. case 2: return function (a, b) {
  1090. return fn.call(that, a, b);
  1091. };
  1092. case 3: return function (a, b, c) {
  1093. return fn.call(that, a, b, c);
  1094. };
  1095. }
  1096. return function (/* ...args */) {
  1097. return fn.apply(that, arguments);
  1098. };
  1099. };
  1100.  
  1101. var wellKnownSymbol$3 = wellKnownSymbol$8;
  1102.  
  1103. var TO_STRING_TAG$2 = wellKnownSymbol$3('toStringTag');
  1104. var test = {};
  1105.  
  1106. test[TO_STRING_TAG$2] = 'z';
  1107.  
  1108. var toStringTagSupport = String(test) === '[object z]';
  1109.  
  1110. var TO_STRING_TAG_SUPPORT = toStringTagSupport;
  1111. var isCallable = isCallable$d;
  1112. var classofRaw = classofRaw$1;
  1113. var wellKnownSymbol$2 = wellKnownSymbol$8;
  1114.  
  1115. var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
  1116. // ES3 wrong here
  1117. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1118.  
  1119. // fallback for IE11 Script Access Denied error
  1120. var tryGet = function (it, key) {
  1121. try {
  1122. return it[key];
  1123. } catch (error) { /* empty */ }
  1124. };
  1125.  
  1126. // getting tag from ES6+ `Object.prototype.toString`
  1127. var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  1128. var O, tag, result;
  1129. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1130. // @@toStringTag case
  1131. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
  1132. // builtinTag case
  1133. : CORRECT_ARGUMENTS ? classofRaw(O)
  1134. // ES3 arguments fallback
  1135. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  1136. };
  1137.  
  1138. var classof = classof$1;
  1139. var getMethod$2 = getMethod$4;
  1140. var Iterators = iterators;
  1141. var wellKnownSymbol$1 = wellKnownSymbol$8;
  1142.  
  1143. var ITERATOR = wellKnownSymbol$1('iterator');
  1144.  
  1145. var getIteratorMethod$2 = function (it) {
  1146. if (it != undefined) return getMethod$2(it, ITERATOR)
  1147. || getMethod$2(it, '@@iterator')
  1148. || Iterators[classof(it)];
  1149. };
  1150.  
  1151. var aCallable$2 = aCallable$5;
  1152. var anObject$6 = anObject$b;
  1153. var getIteratorMethod$1 = getIteratorMethod$2;
  1154.  
  1155. var getIterator$1 = function (argument, usingIterator) {
  1156. var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
  1157. if (aCallable$2(iteratorMethod)) return anObject$6(iteratorMethod.call(argument));
  1158. throw TypeError(String(argument) + ' is not iterable');
  1159. };
  1160.  
  1161. var anObject$5 = anObject$b;
  1162. var getMethod$1 = getMethod$4;
  1163.  
  1164. var iteratorClose$2 = function (iterator, kind, value) {
  1165. var innerResult, innerError;
  1166. anObject$5(iterator);
  1167. try {
  1168. innerResult = getMethod$1(iterator, 'return');
  1169. if (!innerResult) {
  1170. if (kind === 'throw') throw value;
  1171. return value;
  1172. }
  1173. innerResult = innerResult.call(iterator);
  1174. } catch (error) {
  1175. innerError = true;
  1176. innerResult = error;
  1177. }
  1178. if (kind === 'throw') throw value;
  1179. if (innerError) throw innerResult;
  1180. anObject$5(innerResult);
  1181. return value;
  1182. };
  1183.  
  1184. var anObject$4 = anObject$b;
  1185. var isArrayIteratorMethod = isArrayIteratorMethod$1;
  1186. var lengthOfArrayLike = lengthOfArrayLike$2;
  1187. var bind = functionBindContext;
  1188. var getIterator = getIterator$1;
  1189. var getIteratorMethod = getIteratorMethod$2;
  1190. var iteratorClose$1 = iteratorClose$2;
  1191.  
  1192. var Result = function (stopped, result) {
  1193. this.stopped = stopped;
  1194. this.result = result;
  1195. };
  1196.  
  1197. var iterate$1 = function (iterable, unboundFunction, options) {
  1198. var that = options && options.that;
  1199. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1200. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1201. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1202. var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  1203. var iterator, iterFn, index, length, result, next, step;
  1204.  
  1205. var stop = function (condition) {
  1206. if (iterator) iteratorClose$1(iterator, 'normal', condition);
  1207. return new Result(true, condition);
  1208. };
  1209.  
  1210. var callFn = function (value) {
  1211. if (AS_ENTRIES) {
  1212. anObject$4(value);
  1213. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1214. } return INTERRUPTED ? fn(value, stop) : fn(value);
  1215. };
  1216.  
  1217. if (IS_ITERATOR) {
  1218. iterator = iterable;
  1219. } else {
  1220. iterFn = getIteratorMethod(iterable);
  1221. if (!iterFn) throw TypeError(String(iterable) + ' is not iterable');
  1222. // optimisation for array iterators
  1223. if (isArrayIteratorMethod(iterFn)) {
  1224. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1225. result = callFn(iterable[index]);
  1226. if (result && result instanceof Result) return result;
  1227. } return new Result(false);
  1228. }
  1229. iterator = getIterator(iterable, iterFn);
  1230. }
  1231.  
  1232. next = iterator.next;
  1233. while (!(step = next.call(iterator)).done) {
  1234. try {
  1235. result = callFn(step.value);
  1236. } catch (error) {
  1237. iteratorClose$1(iterator, 'throw', error);
  1238. }
  1239. if (typeof result == 'object' && result && result instanceof Result) return result;
  1240. } return new Result(false);
  1241. };
  1242.  
  1243. // https://github.com/tc39/proposal-iterator-helpers
  1244. var $$1 = _export;
  1245. var iterate = iterate$1;
  1246. var anObject$3 = anObject$b;
  1247.  
  1248. $$1({ target: 'Iterator', proto: true, real: true }, {
  1249. forEach: function forEach(fn) {
  1250. iterate(anObject$3(this), fn, { IS_ITERATOR: true });
  1251. }
  1252. });
  1253.  
  1254. var redefine = redefine$3.exports;
  1255.  
  1256. var redefineAll$1 = function (target, src, options) {
  1257. for (var key in src) redefine(target, key, src[key], options);
  1258. return target;
  1259. };
  1260.  
  1261. var aCallable$1 = aCallable$5;
  1262. var anObject$2 = anObject$b;
  1263. var create = objectCreate;
  1264. var createNonEnumerableProperty = createNonEnumerableProperty$5;
  1265. var redefineAll = redefineAll$1;
  1266. var wellKnownSymbol = wellKnownSymbol$8;
  1267. var InternalStateModule = internalState;
  1268. var getMethod = getMethod$4;
  1269. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  1270.  
  1271. var setInternalState = InternalStateModule.set;
  1272. var getInternalState = InternalStateModule.get;
  1273.  
  1274. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1275.  
  1276. var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
  1277. var IteratorProxy = function Iterator(state) {
  1278. state.next = aCallable$1(state.iterator.next);
  1279. state.done = false;
  1280. state.ignoreArg = !IS_ITERATOR;
  1281. setInternalState(this, state);
  1282. };
  1283.  
  1284. IteratorProxy.prototype = redefineAll(create(IteratorPrototype), {
  1285. next: function next(arg) {
  1286. var state = getInternalState(this);
  1287. var args = arguments.length ? [state.ignoreArg ? undefined : arg] : IS_ITERATOR ? [] : [undefined];
  1288. state.ignoreArg = false;
  1289. var result = state.done ? undefined : nextHandler.call(state, args);
  1290. return { done: state.done, value: result };
  1291. },
  1292. 'return': function (value) {
  1293. var state = getInternalState(this);
  1294. var iterator = state.iterator;
  1295. state.done = true;
  1296. var $$return = getMethod(iterator, 'return');
  1297. return { done: true, value: $$return ? anObject$2($$return.call(iterator, value)).value : value };
  1298. },
  1299. 'throw': function (value) {
  1300. var state = getInternalState(this);
  1301. var iterator = state.iterator;
  1302. state.done = true;
  1303. var $$throw = getMethod(iterator, 'throw');
  1304. if ($$throw) return $$throw.call(iterator, value);
  1305. throw value;
  1306. }
  1307. });
  1308.  
  1309. if (!IS_ITERATOR) {
  1310. createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG, 'Generator');
  1311. }
  1312.  
  1313. return IteratorProxy;
  1314. };
  1315.  
  1316. var anObject$1 = anObject$b;
  1317. var iteratorClose = iteratorClose$2;
  1318.  
  1319. // call something on iterator step with safe closing on error
  1320. var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
  1321. try {
  1322. return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value);
  1323. } catch (error) {
  1324. iteratorClose(iterator, 'throw', error);
  1325. }
  1326. };
  1327.  
  1328. // https://github.com/tc39/proposal-iterator-helpers
  1329. var $ = _export;
  1330. var aCallable = aCallable$5;
  1331. var anObject = anObject$b;
  1332. var createIteratorProxy = iteratorCreateProxy;
  1333. var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
  1334.  
  1335. var IteratorProxy = createIteratorProxy(function (args) {
  1336. var iterator = this.iterator;
  1337. var result = anObject(this.next.apply(iterator, args));
  1338. var done = this.done = !!result.done;
  1339. if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value);
  1340. });
  1341.  
  1342. $({ target: 'Iterator', proto: true, real: true }, {
  1343. map: function map(mapper) {
  1344. return new IteratorProxy({
  1345. iterator: anObject(this),
  1346. mapper: aCallable(mapper)
  1347. });
  1348. }
  1349. });
  1350.  
  1351. const isZHInGameSetting = localStorage.getItem("i18nextLng")?.toLowerCase()?.startsWith("zh"); // 获取游戏内设置语言
  1352. let isZH = isZHInGameSetting; // MWITools 本身显示的语言默认由游戏内设置语言决定
  1353.  
  1354. let settingsMap = {
  1355. tracker0: {
  1356. id: "tracker0",
  1357. desc: isZH ? "玩家 #1" : "player #1",
  1358. isTrue: true,
  1359. r: 255,
  1360. g: 99,
  1361. b: 132
  1362. },
  1363. tracker1: {
  1364. id: "tracker1",
  1365. desc: isZH ? "玩家 #2" : "player #2",
  1366. isTrue: true,
  1367. r: 54,
  1368. g: 162,
  1369. b: 235
  1370. },
  1371. tracker2: {
  1372. id: "tracker2",
  1373. desc: isZH ? "玩家 #3" : "player #3",
  1374. isTrue: true,
  1375. r: 255,
  1376. g: 206,
  1377. b: 86
  1378. },
  1379. tracker3: {
  1380. id: "tracker3",
  1381. desc: isZH ? "玩家 #4" : "player #4",
  1382. isTrue: true,
  1383. r: 75,
  1384. g: 192,
  1385. b: 192
  1386. },
  1387. tracker4: {
  1388. id: "tracker4",
  1389. desc: isZH ? "玩家 #5" : "player #5",
  1390. isTrue: true,
  1391. r: 153,
  1392. g: 102,
  1393. b: 255
  1394. },
  1395. tracker6: {
  1396. id: "tracker6",
  1397. desc: isZH ? "敌人" : "enemies",
  1398. isTrue: true,
  1399. r: 255,
  1400. g: 0,
  1401. b: 0
  1402. }
  1403. };
  1404. readSettings();
  1405. function waitForSetttins() {
  1406. const targetNode = document.querySelector("div.SettingsPanel_profileTab__214Bj");
  1407. if (targetNode) {
  1408. if (!targetNode.querySelector("#tracker_settings")) {
  1409. targetNode.insertAdjacentHTML("beforeend", `<div id="tracker_settings"></div>`);
  1410. const insertElem = targetNode.querySelector("div#tracker_settings");
  1411. insertElem.insertAdjacentHTML("beforeend", `<div style="float: left; color: orange">${isZH ? "MWI-Hit-Tracker 设置 :" : "MWI-Hit-Tracker Settings: "}</div></br>`);
  1412. for (const setting of Object.values(settingsMap)) {
  1413. insertElem.insertAdjacentHTML("beforeend", `<div class="tracker-option"><input type="checkbox" id="${setting.id}" ${setting.isTrue ? "checked" : ""}></input>${setting.desc}<div class="color-preview" id="colorPreview_${setting.id}"></div></div>`);
  1414. // 颜色自定义
  1415. const colorPreview = document.getElementById('colorPreview_' + setting.id);
  1416. let currentColor = {
  1417. r: setting.r,
  1418. g: setting.g,
  1419. b: setting.b
  1420. };
  1421.  
  1422. // 点击打开颜色选择器
  1423. colorPreview.addEventListener('click', () => {
  1424. const settingColor = {
  1425. r: settingsMap[setting.id].r,
  1426. g: settingsMap[setting.id].g,
  1427. b: settingsMap[setting.id].b
  1428. };
  1429. const modal = createColorPicker(settingColor, newColor => {
  1430. currentColor = newColor;
  1431. settingsMap[setting.id].r = newColor.r;
  1432. settingsMap[setting.id].g = newColor.g;
  1433. settingsMap[setting.id].b = newColor.b;
  1434. localStorage.setItem("tracker_settingsMap", JSON.stringify(settingsMap));
  1435. updatePreview();
  1436. });
  1437. document.body.appendChild(modal);
  1438. });
  1439. function updatePreview() {
  1440. colorPreview.style.backgroundColor = `rgb(${currentColor.r},${currentColor.g},${currentColor.b})`;
  1441. }
  1442. updatePreview();
  1443. function createColorPicker(initialColor, callback) {
  1444. // 创建弹窗容器
  1445. const backdrop = document.createElement('div');
  1446. backdrop.className = 'modal-backdrop';
  1447. const modal = document.createElement('div');
  1448. modal.className = 'color-picker-modal';
  1449.  
  1450. // 颜色预览
  1451. //const preview = document.createElement('div');
  1452. //preview.className = 'color-preview';
  1453. //preview.style.height = '100px';
  1454. // 创建SVG容器
  1455. const preview = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  1456. preview.setAttribute("width", "200");
  1457. preview.setAttribute("height", "150");
  1458. preview.style.display = 'block';
  1459. // 创建抛物线路径
  1460. const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
  1461. Object.assign(path.style, {
  1462. strokeWidth: '5px',
  1463. fill: 'none',
  1464. strokeLinecap: 'round'
  1465. });
  1466. path.setAttribute("d", "M 0 130 Q 100 0 200 130");
  1467. preview.appendChild(path);
  1468.  
  1469. // 颜色控制组件
  1470. const controls = document.createElement('div');
  1471. ['r', 'g', 'b'].forEach(channel => {
  1472. const container = document.createElement('div');
  1473. container.className = 'slider-container';
  1474.  
  1475. // 标签
  1476. const label = document.createElement('label');
  1477. label.textContent = channel.toUpperCase() + ':';
  1478. label.style.color = "white";
  1479.  
  1480. // 滑块
  1481. const slider = document.createElement('input');
  1482. slider.type = 'range';
  1483. slider.min = 0;
  1484. slider.max = 255;
  1485. slider.value = initialColor[channel];
  1486.  
  1487. // 输入框
  1488. const input = document.createElement('input');
  1489. input.type = 'number';
  1490. input.min = 0;
  1491. input.max = 255;
  1492. input.value = initialColor[channel];
  1493. input.style.width = '60px';
  1494.  
  1495. // 双向绑定
  1496. const updateChannel = value => {
  1497. value = Math.min(255, Math.max(0, parseInt(value) || 0));
  1498. slider.value = value;
  1499. input.value = value;
  1500. currentColor[channel] = value;
  1501. path.style.stroke = getColorString(currentColor);
  1502. };
  1503. slider.addEventListener('input', e => updateChannel(e.target.value));
  1504. input.addEventListener('change', e => updateChannel(e.target.value));
  1505. container.append(label, slider, input);
  1506. controls.append(container);
  1507. });
  1508.  
  1509. // 操作按钮
  1510. const actions = document.createElement('div');
  1511. actions.className = 'modal-actions';
  1512. const confirmBtn = document.createElement('button');
  1513. confirmBtn.textContent = isZH ? '确定' : 'OK';
  1514. confirmBtn.onclick = () => {
  1515. callback(currentColor);
  1516. backdrop.remove();
  1517. };
  1518. const cancelBtn = document.createElement('button');
  1519. cancelBtn.textContent = isZH ? '取消' : 'Cancel';
  1520. cancelBtn.onclick = () => backdrop.remove();
  1521. actions.append(cancelBtn, confirmBtn);
  1522.  
  1523. // 组装弹窗
  1524. const getColorString = color => `rgb(${color.r},${color.g},${color.b})`;
  1525. path.style.stroke = getColorString(settingsMap[setting.id]);
  1526. modal.append(preview, controls, actions);
  1527. backdrop.append(modal);
  1528.  
  1529. // 点击背景关闭
  1530. backdrop.addEventListener('click', e => {
  1531. if (e.target === backdrop) backdrop.remove();
  1532. });
  1533. return backdrop;
  1534. }
  1535. }
  1536. insertElem.addEventListener("change", saveSettings);
  1537. }
  1538. }
  1539. setTimeout(waitForSetttins, 500);
  1540. }
  1541. function saveSettings() {
  1542. for (const checkbox of document.querySelectorAll("div#tracker_settings input")) {
  1543. settingsMap[checkbox.id].isTrue = checkbox.checked;
  1544. localStorage.setItem("tracker_settingsMap", JSON.stringify(settingsMap));
  1545. }
  1546. }
  1547. function readSettings() {
  1548. const ls = localStorage.getItem("tracker_settingsMap");
  1549. if (ls) {
  1550. const lsObj = JSON.parse(ls);
  1551. for (const option of Object.values(lsObj)) {
  1552. if (settingsMap.hasOwnProperty(option.id)) {
  1553. settingsMap[option.id].isTrue = option.isTrue;
  1554. settingsMap[option.id].r = option.r;
  1555. settingsMap[option.id].g = option.g;
  1556. settingsMap[option.id].b = option.b;
  1557. }
  1558. }
  1559. }
  1560. }
  1561. const style = document.createElement('style');
  1562. style.textContent = `
  1563. .tracker-option {
  1564. display: flex;
  1565. align-items: center;
  1566. }
  1567.  
  1568. .color-preview {
  1569. cursor: pointer;
  1570. width: 20px;
  1571. height: 20px;
  1572. margin: 3px 3px;
  1573. border: 1px solid #ccc;
  1574. border-radius: 3px;
  1575. }
  1576.  
  1577. .color-picker-modal {
  1578. position: fixed;
  1579. top: 50%;
  1580. left: 50%;
  1581. transform: translate(-50%, -50%);
  1582. background: rgba(0, 0, 0, 0.5);
  1583. padding: 20px;
  1584. border: 1px solid rgba(255, 255, 255, 0.2);
  1585. border-radius: 8px;
  1586. box-shadow: 0 0 20px rgba(0,0,0,0.2);
  1587. z-index: 1000;
  1588. }
  1589.  
  1590. .modal-backdrop {
  1591. position: fixed;
  1592. top: 0;
  1593. left: 0;
  1594. right: 0;
  1595. bottom: 0;
  1596. background: rgba(0,0,0,0.5);
  1597. z-index: 999;
  1598. }
  1599.  
  1600. .modal-actions {
  1601. margin-top: 20px;
  1602. display: flex;
  1603. gap: 10px;
  1604. justify-content: flex-end;
  1605. }
  1606. `;
  1607. document.head.appendChild(style);
  1608.  
  1609. /*
  1610. projectEffect = {
  1611. speedFactor: 1, // 速度因子
  1612. trailLength: 50, // 尾迹长度
  1613. gravity: 0.2, // 重力
  1614. shake: true, // 是否震动
  1615. color: rgba(0, 0, 0, 0), // 强制颜色
  1616. onHit: { // 碰撞时的粒子效果
  1617. "smoke": 0,
  1618. },
  1619. draw: (ctx, p) => { // 绘制函数, ctx为canvas的上下文对象, p为Projectile对象
  1620.  
  1621. },
  1622. glow: (ctx, p) => { // 光晕绘制函数, ctx为canvas的上下文对象, p为Projectile对象,空则不绘制
  1623.  
  1624. },
  1625. }
  1626. */
  1627.  
  1628. const projectileEffectsMap = {
  1629. 'fireball': {
  1630. speedFactor: 1,
  1631. trailLength: 35,
  1632. shake: true,
  1633. onHit: {
  1634. "smoke": size => Math.min(Math.ceil(size * 4), 8),
  1635. "ember": size => Math.min(Math.ceil(size * 10), 40),
  1636. "shockwave": size => Math.min(Math.ceil(size), 4),
  1637. "smallParticle": size => Math.min(Math.ceil(size * 4), 10)
  1638. },
  1639. draw: (ctx, p) => {
  1640. ctx.beginPath();
  1641. ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
  1642. ctx.fillStyle = p.color;
  1643. ctx.fill();
  1644. },
  1645. glow: (ctx, p) => {
  1646. const gradient = ctx.createRadialGradient(p.x, p.y, 0, p.x, p.y, p.size * 2);
  1647. gradient.addColorStop(0, `${p.color}`);
  1648. gradient.addColorStop(1, `${p.color}`);
  1649. ctx.fillStyle = gradient;
  1650. }
  1651. },
  1652. 'heal': {
  1653. trailLength: 60,
  1654. shake: false,
  1655. onHit: {
  1656. "holyCross": size => Math.min(Math.ceil(size * 12), 10)
  1657. },
  1658. draw: (ctx, p) => {
  1659. // draw a star
  1660. ctx.beginPath();
  1661. ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
  1662. ctx.fillStyle = p.color;
  1663. ctx.fill();
  1664. }
  1665. },
  1666. 'selfHeal': {
  1667. speedFactor: 10,
  1668. trailLength: 0,
  1669. gravity: 0,
  1670. shake: false,
  1671. color: 'rgba(0, 255, 0, 0.5)',
  1672. onHit: {
  1673. "holyCross": size => Math.min(Math.ceil(size * 12), 10)
  1674. },
  1675. draw: (ctx, p) => {}
  1676. },
  1677. 'selfManaRegen': {
  1678. speedFactor: 10,
  1679. trailLength: 0,
  1680. gravity: 0,
  1681. shake: false,
  1682. color: 'rgba(68, 120, 241, 0.69)',
  1683. onHit: {
  1684. "holyCross": size => Math.min(Math.ceil(size * 12), 10)
  1685. },
  1686. draw: (ctx, p) => {}
  1687. }
  1688. };
  1689.  
  1690. const onHitEffectsMap = {
  1691. "smoke": {
  1692. angle: p => Math.random() * Math.PI * 2,
  1693. alpha: p => 0.7,
  1694. speed: p => (Math.random() * 1 + 0.2) * Math.sqrt(p.size),
  1695. size: p => (Math.random() * 15 + 8) * p.size,
  1696. life: p => 2000 * Math.sqrt(p.size),
  1697. gravity: p => -1 * Math.sqrt(p.size),
  1698. draw: (ctx, p) => {
  1699. p.x += Math.cos(p.angle) * p.speed;
  1700. p.y += Math.sin(p.angle) * p.speed + p.gravity;
  1701. p.life -= 2;
  1702. p.alpha = Math.max(0, p.alpha - 0.003);
  1703. if (p.life > 0) {
  1704. ctx.beginPath();
  1705. ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
  1706. ctx.fillStyle = `rgba(80, 80, 80, ${p.alpha * (p.life / 1200)})`;
  1707. ctx.fill();
  1708. }
  1709. }
  1710. },
  1711. "ember": {
  1712. angle: p => Math.random() * Math.PI * 2,
  1713. alpha: p => 1,
  1714. speed: p => (Math.random() * 2 + 0.5) * Math.sqrt(p.size),
  1715. size: p => (Math.random() * 6 + 2) * p.size,
  1716. life: p => 1200 * Math.sqrt(p.size),
  1717. gravity: p => 0.3,
  1718. draw: (ctx, p) => {
  1719. p.speed *= 0.99; // 慢慢减速
  1720. p.x += Math.cos(p.angle) * p.speed;
  1721. p.y += Math.sin(p.angle) * p.speed + p.gravity;
  1722. p.life -= 3;
  1723. if (p.life > 0) {
  1724. const alpha = p.life / 800;
  1725. ctx.beginPath();
  1726. ctx.arc(p.x, p.y, p.size * (p.life / 800), 0, Math.PI * 2);
  1727. ctx.fillStyle = `${p.color.slice(0, -4)}%, ${alpha})`;
  1728. ctx.fill();
  1729.  
  1730. // 余烬偶尔产生的小火花
  1731. if (Math.random() < 0.03) {
  1732. ctx.beginPath();
  1733. ctx.arc(p.x, p.y, p.size * 1.5, 0, Math.PI * 2);
  1734. ctx.fillStyle = `hsla(30, 100%, 70%, ${alpha * 0.7})`;
  1735. ctx.fill();
  1736. }
  1737. }
  1738. }
  1739. },
  1740. "shockwave": {
  1741. size: p => 7 * p.size,
  1742. life: p => 800 * Math.sqrt(p.size),
  1743. draw: (ctx, p) => {
  1744. if (!p.maxSize) {
  1745. p.maxSize = p.size * (100 + Math.random() * 100) / 7;
  1746. }
  1747. p.size += (p.maxSize - p.size) * 0.1;
  1748. p.life -= 10;
  1749. if (p.life > 0) {
  1750. const alpha = p.life / 400;
  1751. ctx.beginPath();
  1752. ctx.strokeStyle = p.color;
  1753. ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
  1754. ctx.lineWidth = 5 * alpha;
  1755. ctx.stroke();
  1756. }
  1757. }
  1758. },
  1759. "smallParticle": {
  1760. angle: p => Math.random() * Math.PI * 2,
  1761. size: p => (Math.random() * 12 + 8) * p.size,
  1762. speed: p => (Math.random() * 6 + 2) * Math.sqrt(p.size),
  1763. gravity: p => 0.3 + Math.random() * 0.1,
  1764. life: p => 400 * p.size,
  1765. draw: (ctx, p) => {
  1766. p.size = p.size * (1 - p.life / 400);
  1767. p.x += Math.cos(p.angle) * p.speed;
  1768. p.y += Math.sin(p.angle) * p.speed + p.gravity;
  1769. p.life -= 3;
  1770. if (p.life > 0) {
  1771. ctx.beginPath();
  1772. ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
  1773. ctx.fillStyle = p.color;
  1774. ctx.fill();
  1775. }
  1776. }
  1777. },
  1778. "holyCross": {
  1779. x: p => p.x + (Math.random() - 0.5) * 60,
  1780. y: p => p.y + (Math.random() - 0.5) * 10,
  1781. size: p => (8 * Math.random() + 12) * p.size,
  1782. life: p => 1200 * Math.sqrt(p.size),
  1783. speed: p => 0,
  1784. gravity: p => -0.008 * Math.random() - 0.008,
  1785. draw: (ctx, p) => {
  1786. p.speed += p.gravity;
  1787. p.y += p.speed;
  1788. p.life -= 3;
  1789. if (p.life > 0) {
  1790. ctx.save();
  1791. ctx.translate(p.x, p.y);
  1792. ctx.fillStyle = p.color;
  1793. ctx.fillRect(-p.size / 2, -p.size * 2, p.size, p.size * 4);
  1794. ctx.fillRect(-p.size * 2, -p.size / 2, p.size * 4, p.size);
  1795. ctx.restore();
  1796. }
  1797. }
  1798. }
  1799. };
  1800.  
  1801. const canvas = initTrackerCanvas();
  1802. const ctx = canvas.getContext('2d');
  1803. function initTrackerCanvas() {
  1804. const gamePanel = document.querySelector("body");
  1805. const canvas = document.createElement('canvas');
  1806. canvas.id = 'hitTrackerCanvas';
  1807. canvas.style.position = 'fixed';
  1808. canvas.style.top = '0';
  1809. canvas.style.left = '0';
  1810. canvas.style.pointerEvents = 'none';
  1811. canvas.style.zIndex = '200';
  1812. canvas.style.width = '100%';
  1813. canvas.style.height = '100%';
  1814. canvas.width = window.innerWidth;
  1815. canvas.height = window.innerHeight;
  1816. canvas.pointerEvents = 'none';
  1817. gamePanel.appendChild(canvas);
  1818. window.addEventListener('resize', () => {
  1819. canvas.width = window.innerWidth;
  1820. canvas.height = window.innerHeight;
  1821. });
  1822. return canvas;
  1823. }
  1824.  
  1825. // Update shake animation effect to ensure element returns to original position
  1826. function applyShakeEffect(element, intensity = 1, duration = 500) {
  1827. if (!element) return;
  1828.  
  1829. // Store the element's original position/transform
  1830. const originalTransform = element.style.transform || '';
  1831. const originalTransition = element.style.transition || '';
  1832.  
  1833. // Scale intensity based on size/damage
  1834. const scaledIntensity = Math.min(10, intensity);
  1835.  
  1836. // Apply CSS animation
  1837. element.style.transition = 'transform 50ms ease-in-out';
  1838. let shakeCount = 0;
  1839. const maxShakes = Math.ceil(intensity);
  1840. const shakeInterval = 50;
  1841. const interval = setInterval(() => {
  1842. if (shakeCount >= maxShakes) {
  1843. // Ensure element returns to original position
  1844. clearInterval(interval);
  1845. element.style.transform = originalTransform;
  1846. element.style.transition = originalTransition;
  1847. return;
  1848. }
  1849.  
  1850. // Random offset for shaking effect
  1851. const xOffset = (Math.random() - 0.5) * 2 * scaledIntensity;
  1852. const yOffset = (Math.random() - 0.5) * 2 * scaledIntensity;
  1853. element.style.transform = `${originalTransform} translate(${xOffset}px, ${yOffset}px)`;
  1854. shakeCount++;
  1855. }, shakeInterval);
  1856.  
  1857. // Additional safeguard: ensure element returns to original position after max duration
  1858. setTimeout(() => {
  1859. clearInterval(interval);
  1860. element.style.transform = 'translate(0, 0)';
  1861. element.style.transition = originalTransition;
  1862. }, shakeInterval * (maxShakes + 1)); // Slightly longer than maxShakes * interval time
  1863. }
  1864. function addDamageHPBar(element, damage) {
  1865. const hpBarContainer = element.querySelector(".HitpointsBar_hitpointsBar__2vIqC");
  1866. const hpBarFront = hpBarContainer.querySelector(".HitpointsBar_currentHp__5exLr");
  1867. // hpBarFront.style.zIndex = "1";
  1868. const hpBarValue = hpBarContainer.querySelector(".HitpointsBar_hpValue__xNp7m");
  1869. // hpBarValue.style.zIndex = "2";
  1870. const hpStat = hpBarValue.innerHTML.split("/");
  1871. const currentHp = parseInt(hpStat[0]);
  1872. const maxHp = parseInt(hpStat[1]);
  1873.  
  1874. // Insert a HpBar behind and set the color to red
  1875. const hpBarBack = document.createElement("div");
  1876. hpBarBack.className = "HitpointsBar_currentHp__5exLr HitTracker_hpDrop";
  1877. hpBarBack.style.background = "var(--color-warning)";
  1878. hpBarBack.style.position = "absolute";
  1879. hpBarBack.style.top = "0px";
  1880. hpBarBack.style.left = "0px";
  1881. // hpBarBack.style.zIndex = "1"; // Ensure the back bar is below the front bar
  1882. hpBarBack.style.width = `${hpBarFront.offsetWidth}px`;
  1883. hpBarBack.style.height = `${hpBarFront.offsetHeight}px`;
  1884. hpBarBack.style.transformOrigin = "left center";
  1885. hpBarBack.style.transform = `scaleX(${(currentHp + damage) / maxHp})`;
  1886. // add animation to drop down
  1887. hpBarBack.style.transition = "transform 0.5s ease-in-out";
  1888. hpBarFront.parentNode.insertBefore(hpBarBack, hpBarFront); // Insert the back bar before the front bar
  1889.  
  1890. setTimeout(() => {
  1891. hpBarBack.style.transform = `scaleX(0)`;
  1892. }, 200);
  1893. setTimeout(() => {
  1894. hpBarBack.remove();
  1895. }, 800);
  1896. }
  1897.  
  1898. // 更新和渲染所有命中效果
  1899. function updateOnHits() {
  1900. // 遍历所有活跃的命中
  1901. for (let i = activeOnHitAnimation.length - 1; i >= 0; i--) {
  1902. const effect = activeOnHitAnimation[i];
  1903. effect.count++;
  1904. if (effect.count >= effect.maxCount) {
  1905. activeOnHitAnimation.splice(i, 1);
  1906. continue;
  1907. }
  1908. ctx.save();
  1909.  
  1910. // 更新各自效果
  1911. effect.effects.forEach((e, index) => {
  1912. e.draw(ctx, e);
  1913. });
  1914.  
  1915. // 伤害文本
  1916. if (effect.otherInfo.damage) {
  1917. const fontSize = Math.min(Math.max(14, Math.pow(effect.otherInfo.damage, 0.65) / 2), 70);
  1918. const damageText = `${effect.otherInfo.damage}`;
  1919. ctx.font = `${fontSize}px Arial`;
  1920. ctx.textAlign = 'center';
  1921. ctx.textBaseline = 'middle';
  1922. // border
  1923. ctx.strokeStyle = effect.otherInfo.color;
  1924. ctx.lineWidth = 6;
  1925. ctx.strokeText(damageText, effect.otherInfo.end.x, effect.otherInfo.end.y - 20);
  1926. // main
  1927. ctx.fillStyle = 'white';
  1928. const textWidth = ctx.measureText(damageText).width;
  1929. if (textWidth < 100) {
  1930. ctx.fillText(damageText, effect.otherInfo.end.x, effect.otherInfo.end.y - 20);
  1931. } else {
  1932. ctx.fillText(damageText, effect.otherInfo.end.x, effect.otherInfo.end.y - 20, textWidth + 10);
  1933. }
  1934. }
  1935. ctx.restore();
  1936. }
  1937. }
  1938. let fpsStatTime = new Date().getTime();
  1939. let fpsQueue = [];
  1940. let fps = 60;
  1941.  
  1942. // 动画循环
  1943. function animate() {
  1944. // 计算FPS
  1945. const now = Date.now();
  1946. const delta = now - fpsStatTime;
  1947. fpsStatTime = now;
  1948. const fpsNow = Math.round(1000 / delta);
  1949. fpsQueue.push(fpsNow);
  1950. if (fpsQueue.length > 30) {
  1951. fpsQueue.shift();
  1952. }
  1953. fps = Math.round(fpsQueue.reduce((a, b) => a + b) / fpsQueue.length);
  1954.  
  1955. // 完全清空画布
  1956. ctx.clearRect(0, 0, canvas.width, canvas.height);
  1957.  
  1958. // 更新并绘制所有弹丸
  1959. for (let i = projectiles.length - 1; i >= 0; i--) {
  1960. const proj = projectiles[i];
  1961. proj.update();
  1962. proj.draw(ctx);
  1963. if (proj.isArrived()) {
  1964. createOnHitEffect(proj); // 将弹丸大小传递给爆炸效果
  1965. projectiles.splice(i, 1);
  1966. } else if (proj.isOutOfBounds()) {
  1967. // 超出边界则移除弹丸,不产生爆炸效果
  1968. projectiles.splice(i, 1);
  1969. }
  1970. }
  1971.  
  1972. // 更新和渲染所有爆炸效果
  1973. updateOnHits();
  1974. requestAnimationFrame(animate);
  1975. }
  1976. class Projectile {
  1977. constructor(startX, startY, endX, endY, color, initialSpeed = 1, size = 10, otherInfo = {}) {
  1978. // 基础属性
  1979. this.x = startX;
  1980. this.y = startY;
  1981. this.start = {
  1982. x: startX,
  1983. y: startY
  1984. };
  1985. this.target = {
  1986. x: endX,
  1987. y: endY
  1988. };
  1989. this.otherInfo = otherInfo;
  1990. this.shakeApplied = false;
  1991. this.type = otherInfo.type || 'default';
  1992. this.effect = projectileEffectsMap[this.type] || projectileEffectsMap['fireball'];
  1993. this.doShake = this.effect.shake;
  1994.  
  1995. // 运动参数 - 向斜上方抛物线轨迹
  1996. this.gravity = this.effect.gravity || 0.2; // 重力加速度
  1997. this.initialSpeed = initialSpeed * (this.effect.speedFactor || 1); // 初始速度参数
  1998.  
  1999. // 计算水平距离和高度差
  2000. const dx = endX - startX;
  2001. const dy = endY - startY;
  2002.  
  2003. // 重新设计飞行时间计算,确保合理
  2004. // const timeInAir = distance / this.initialSpeed / 10;
  2005. let timeInAir = 80 / this.initialSpeed;
  2006.  
  2007. // FPS因子,确保在不同FPS下效果一致
  2008. const fpsFactor = Math.min(Math.max(fps / 120, 0.125), 8);
  2009. this.gravity *= fpsFactor;
  2010. timeInAir /= fpsFactor;
  2011.  
  2012. // 计算初始速度,修正公式确保能够到达目标
  2013. this.velocity = {
  2014. x: dx / timeInAir,
  2015. y: dy / timeInAir - this.gravity * timeInAir / 2
  2016. };
  2017.  
  2018. // 大小参数 (范围1-100)
  2019. this.sizeScale = Math.max(1, Math.min(100, size)) / 10; // 转换为比例因子
  2020.  
  2021. // 外观属性
  2022. this.size = 10 * this.sizeScale;
  2023. this.color = this.effect.color || color;
  2024.  
  2025. // 拖尾效果
  2026. this.trail = [];
  2027. this.maxTrailLength = Math.floor((this.effect.trailLength || 50) * Math.sqrt(this.sizeScale)); // 拖尾长度随大小增加
  2028. }
  2029. update() {
  2030. // 更新速度 (考虑重力)
  2031. this.velocity.y += this.gravity;
  2032.  
  2033. // 更新位置
  2034. this.x += this.velocity.x;
  2035. this.y += this.velocity.y;
  2036.  
  2037. // 更新拖尾
  2038. this.trail.push({
  2039. x: this.x,
  2040. y: this.y
  2041. });
  2042. if (this.trail.length > this.maxTrailLength) {
  2043. this.trail.shift();
  2044. }
  2045. }
  2046. draw(canvas) {
  2047. // 绘制拖尾
  2048. this.trail.forEach((pos, index) => {
  2049. const alpha = index / this.trail.length;
  2050. canvas.beginPath();
  2051. canvas.arc(pos.x, pos.y, this.size * alpha, 0, Math.PI * 2);
  2052. canvas.fillStyle = `${this.color}`;
  2053. canvas.fill();
  2054. });
  2055.  
  2056. // 绘制主体
  2057. this.effect.draw(canvas, this);
  2058.  
  2059. // 添加光晕效果
  2060. if (this.effect.glow) {
  2061. this.effect.glow(canvas, this);
  2062. }
  2063. }
  2064. isArrived() {
  2065. // 判断是否到达目标点 (调整判定距离)
  2066. const arrivalDistance = 20;
  2067. const hasArrived = Math.hypot(this.x - this.target.x, this.y - this.target.y) < arrivalDistance;
  2068. if (hasArrived && this.doShake && !this.shakeApplied && this.otherInfo.endElement) {
  2069. const shakeIntensity = Math.min(this.sizeScale * 5, 10);
  2070. applyShakeEffect(this.otherInfo.endElement, shakeIntensity);
  2071. this.shakeApplied = true;
  2072. }
  2073. return hasArrived;
  2074. }
  2075. isOutOfBounds() {
  2076. return this.x < 0 || this.x > canvas.width || this.y < 0 || this.y > canvas.height;
  2077. }
  2078. }
  2079.  
  2080. // Projectiles管理
  2081. let projectiles = [];
  2082.  
  2083. // 存储所有活跃的爆炸效果
  2084. let activeOnHitAnimation = [];
  2085.  
  2086. // 爆炸效果函数
  2087. function createOnHitEffect(projectile) {
  2088. const x = projectile.x;
  2089. const y = projectile.y;
  2090. const size = projectile.size;
  2091. projectile.color;
  2092. const otherInfo = projectile.otherInfo;
  2093.  
  2094. // Resize for onHit effect
  2095. const sizeScale = Math.max(1, Math.min(100, size)) / 20;
  2096. projectile.size = sizeScale;
  2097. const effects = [];
  2098. const onHitEffect = projectile.effect.onHit;
  2099. for (const effectName in onHitEffect) {
  2100. const effect = onHitEffectsMap[effectName];
  2101. if (!effect) continue;
  2102. const effectCount = onHitEffect[effectName](projectile.size);
  2103. for (let i = 0; i < effectCount; i++) {
  2104. effects.push({
  2105. x: effect.x ? effect.x(projectile) : x,
  2106. y: effect.y ? effect.y(projectile) : y,
  2107. angle: effect.angle ? effect.angle(projectile) : Math.random() * Math.PI * 2,
  2108. alpha: effect.alpha ? effect.alpha(projectile) : 0.8,
  2109. size: effect.size ? effect.size(projectile) : Math.random() * 10 + 5,
  2110. speed: effect.speed ? effect.speed(projectile) : Math.random() * 5 + 2,
  2111. gravity: effect.gravity ? effect.gravity(projectile) : 0,
  2112. life: effect.life ? effect.life(projectile) : 1000,
  2113. color: effect.color ? effect.color(projectile) : projectile.color,
  2114. draw: effect.draw ? effect.draw : (ctx, p) => {}
  2115. });
  2116. }
  2117. }
  2118.  
  2119. // 存储命中动画的活跃状态,用于跟踪
  2120. const onHitEffectData = {
  2121. effects: [...effects],
  2122. active: true,
  2123. count: 0,
  2124. maxCount: 120,
  2125. otherInfo: otherInfo
  2126. };
  2127. activeOnHitAnimation.push(onHitEffectData);
  2128. }
  2129. function createProjectile(startElement, endElement, color, initialSpeed = 1, damage = 200, projectileType = 'default') {
  2130. if (!startElement || !endElement) {
  2131. return;
  2132. }
  2133. const combatUnitContainer = endElement.querySelector(".CombatUnit_splatsContainer__2xcc0");
  2134. combatUnitContainer.style.visibility = "hidden";
  2135. const padding = 30;
  2136. const randomRange = {
  2137. x: Math.floor(Math.random() * (combatUnitContainer.offsetWidth - 2 * padding) - combatUnitContainer.offsetWidth / 2 + padding),
  2138. y: Math.floor(Math.random() * (combatUnitContainer.offsetHeight - 2 * padding) - combatUnitContainer.offsetHeight / 2 + padding)
  2139. };
  2140. const projectileLimit = 30;
  2141. const start = getElementCenter(startElement);
  2142. const end = getElementCenter(endElement);
  2143. end.x = Math.floor(end.x + randomRange.x);
  2144. end.y = Math.floor(end.y + randomRange.y);
  2145. const size = Math.min(Math.max(Math.pow(damage + 200, 0.7) / 20, 4), 16);
  2146. const otherInfo = {
  2147. type: projectileType,
  2148. start: start,
  2149. end: end,
  2150. damage: damage,
  2151. color: color,
  2152. startElement: startElement,
  2153. endElement: endElement
  2154. };
  2155. if (damage > 0) {
  2156. addDamageHPBar(endElement, damage);
  2157. }
  2158. const projectile = new Projectile(start.x, start.y, end.x, end.y, color, initialSpeed, size, otherInfo);
  2159. projectiles.push(projectile);
  2160. if (projectiles.length > projectileLimit) {
  2161. projectiles.shift();
  2162. }
  2163. }
  2164. function getElementCenter(element) {
  2165. const rect = element.getBoundingClientRect();
  2166. if (element.innerText.trim() === '') {
  2167. return {
  2168. x: rect.left + rect.width / 2,
  2169. y: rect.top
  2170. };
  2171. }
  2172. return {
  2173. x: rect.left + rect.width / 2,
  2174. y: rect.top + rect.height / 2
  2175. };
  2176. }
  2177.  
  2178. // #region Setting
  2179. waitForSetttins();
  2180. hookWS();
  2181.  
  2182. // #region Hook WS
  2183. function hookWS() {
  2184. const dataProperty = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
  2185. const oriGet = dataProperty.get;
  2186. dataProperty.get = hookedGet;
  2187. Object.defineProperty(MessageEvent.prototype, "data", dataProperty);
  2188. function hookedGet() {
  2189. const socket = this.currentTarget;
  2190. if (!(socket instanceof WebSocket)) {
  2191. return oriGet.call(this);
  2192. }
  2193. if (socket.url.indexOf("api.milkywayidle.com/ws") <= -1 && socket.url.indexOf("api-test.milkywayidle.com/ws") <= -1) {
  2194. return oriGet.call(this);
  2195. }
  2196. const message = oriGet.call(this);
  2197. Object.defineProperty(this, "data", {
  2198. value: message
  2199. }); // Anti-loop
  2200.  
  2201. return handleMessage(message);
  2202. }
  2203. }
  2204. let monstersHP = [];
  2205. let monstersMP = [];
  2206. let playersHP = [];
  2207. let playersMP = [];
  2208. let playersAbility = [];
  2209. function handleMessage(message) {
  2210. let obj = JSON.parse(message);
  2211. if (obj && obj.type === "new_battle") {
  2212. monstersHP = obj.monsters.map(monster => monster.currentHitpoints);
  2213. monstersMP = obj.monsters.map(monster => monster.currentManapoints);
  2214. playersHP = obj.players.map(player => player.currentHitpoints);
  2215. playersMP = obj.players.map(player => player.currentManapoints);
  2216. } else if (obj && obj.type === "battle_updated" && monstersHP.length) {
  2217. const mMap = obj.mMap;
  2218. const pMap = obj.pMap;
  2219. const monsterIndices = Object.keys(obj.mMap);
  2220. const playerIndices = Object.keys(obj.pMap);
  2221. let castMonster = -1;
  2222. monsterIndices.forEach(monsterIndex => {
  2223. if (mMap[monsterIndex].cMP < monstersMP[monsterIndex]) {
  2224. castMonster = monsterIndex;
  2225. }
  2226. monstersMP[monsterIndex] = mMap[monsterIndex].cMP;
  2227. });
  2228. let castPlayer = -1;
  2229. playerIndices.forEach(userIndex => {
  2230. if (pMap[userIndex].cMP < playersMP[userIndex]) {
  2231. castPlayer = userIndex;
  2232. }
  2233. playersMP[userIndex] = pMap[userIndex].cMP;
  2234. if (pMap[userIndex].abilityHrid) {
  2235. playersAbility[userIndex] = pMap[userIndex].abilityHrid;
  2236. }
  2237. });
  2238. monstersHP.forEach((mHP, mIndex) => {
  2239. const monster = mMap[mIndex];
  2240. if (monster) {
  2241. const hpDiff = mHP - monster.cHP;
  2242. monstersHP[mIndex] = monster.cHP;
  2243. if (hpDiff > 0 && playerIndices.length > 0) {
  2244. if (playerIndices.length > 1) {
  2245. playerIndices.forEach(userIndex => {
  2246. if (userIndex === castPlayer) {
  2247. registProjectile(userIndex, mIndex, hpDiff, false, playersAbility[userIndex]);
  2248. }
  2249. });
  2250. } else {
  2251. registProjectile(playerIndices[0], mIndex, hpDiff, false, playersAbility[playerIndices[0]]);
  2252. }
  2253. }
  2254. }
  2255. });
  2256. playersHP.forEach((pHP, pIndex) => {
  2257. const player = pMap[pIndex];
  2258. if (player) {
  2259. const hpDiff = pHP - player.cHP;
  2260. playersHP[pIndex] = player.cHP;
  2261. if (hpDiff > 0 && monsterIndices.length > 0) {
  2262. if (monsterIndices.length > 1) {
  2263. monsterIndices.forEach(monsterIndex => {
  2264. if (monsterIndex === castMonster) {
  2265. registProjectile(pIndex, monsterIndex, hpDiff, true);
  2266. }
  2267. });
  2268. } else {
  2269. registProjectile(pIndex, monsterIndices[0], hpDiff, true);
  2270. }
  2271. } else if (hpDiff < 0) {
  2272. if (castPlayer > -1) {
  2273. registProjectile(castPlayer, pIndex, -hpDiff, false, 'heal', true);
  2274. }
  2275. }
  2276. }
  2277. });
  2278. } else if (obj && obj.type === "battle_updated") {
  2279. const pMap = obj.pMap;
  2280. const playerIndices = Object.keys(obj.pMap);
  2281. playerIndices.forEach(userIndex => {
  2282. if (pMap[userIndex].abilityHrid) {
  2283. playersAbility[userIndex] = pMap[userIndex].abilityHrid;
  2284. }
  2285. });
  2286. }
  2287. return message;
  2288. }
  2289.  
  2290. // #region Main Logic
  2291.  
  2292. // 动画效果
  2293. function registProjectile(from, to, hpDiff, reversed = false, abilityHrid = 'default', toPlayer = false) {
  2294. if (reversed) {
  2295. if (!settingsMap.tracker6.isTrue) {
  2296. return null;
  2297. }
  2298. } else {
  2299. if (!settingsMap["tracker" + from].isTrue) {
  2300. return null;
  2301. }
  2302. }
  2303. const container = document.querySelector(".BattlePanel_playersArea__vvwlB");
  2304. if (container && container.children.length > 0) {
  2305. const playersContainer = container.children[0];
  2306. const effectFrom = playersContainer.children[from];
  2307. const monsterContainer = document.querySelector(".BattlePanel_monstersArea__2dzrY").children[0];
  2308. const effectTo = toPlayer ? playersContainer.children[to] : monsterContainer.children[to];
  2309. const trackerSetting = reversed ? settingsMap[`tracker6`] : settingsMap["tracker" + from];
  2310. let lineColor = "rgba(" + trackerSetting.r + ", " + trackerSetting.g + ", " + trackerSetting.b + ", 1)";
  2311. // console.log(`registProjectile: ${abilityHrid} ${hpDiff}`);
  2312. if (abilityHrid === 'heal') {
  2313. lineColor = "rgba(93, 212, 93, 0.8)";
  2314. }
  2315. if (!reversed) {
  2316. createProjectile(effectFrom, effectTo, lineColor, 1, hpDiff, abilityHrid);
  2317. } else {
  2318. createProjectile(effectTo, effectFrom, lineColor, 1, hpDiff, abilityHrid);
  2319. }
  2320. }
  2321. }
  2322.  
  2323. // 启动动画
  2324. animate();
  2325.  
  2326. })();