diepAPI

https://github.com/Cazka/diepAPI

Version vom 03.10.2022. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greatest.deepsurf.us/scripts/433681/1100602/diepAPI.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         diepAPI
// @description  https://github.com/Cazka/diepAPI
// @version      3.0.0
// @author       Cazka
// @match        https://diep.io/*
// @icon         https://www.google.com/s2/favicons?domain=diep.io
// @namespace    https://greatest.deepsurf.us/users/541070
// @run-at       document-start
// @grant        none
// ==/UserScript==
(() => {
  const _window = "undefined" == typeof unsafeWindow ? window : unsafeWindow;
  if (_window.diepAPI) return;

  //diepAPI start
  var diepAPI;
  (() => {
    "use strict";
    var e = {
        d: (t, n) => {
          for (var s in n) e.o(n, s) && !e.o(t, s) && Object.defineProperty(t, s, { enumerable: !0, get: n[s] });
        },
        o: (e, t) => Object.prototype.hasOwnProperty.call(e, t),
        r: (e) => {
          "undefined" != typeof Symbol &&
            Symbol.toStringTag &&
            Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
            Object.defineProperty(e, "__esModule", { value: !0 });
        },
      },
      t = {};
    e.r(t), e.d(t, { apis: () => n, core: () => s, extensions: () => i, tools: () => o, types: () => a });
    var n = {};
    e.r(n),
      e.d(n, {
        arena: () => u,
        camera: () => w,
        game: () => l,
        minimap: () => h,
        player: () => f,
        playerMovement: () => v,
        scaling: () => p,
      });
    var s = {};
    e.r(s), e.d(s, { CanvasKit: () => c, EventEmitter: () => d, Movement: () => m, Vector: () => r });
    var i = {};
    e.r(i), e.d(i, { debugTool: () => T, entityManager: () => b });
    var o = {};
    e.r(o), e.d(o, { backgroundOverlay: () => S, overlay: () => R });
    var a = {};
    e.r(a), e.d(a, { Entity: () => C, EntityColor: () => k, EntityType: () => g });
    class r {
      x;
      y;
      constructor(e, t) {
        (this.x = e), (this.y = t);
      }
      static len(e) {
        return Math.sqrt(e.x ** 2 + e.y ** 2);
      }
      static round(e) {
        return new r(Math.round(e.x), Math.round(e.y));
      }
      static scale(e, t) {
        return new r(e * t.x, e * t.y);
      }
      static unscale(e, t) {
        return new r(t.x / e, t.y / e);
      }
      static add(e, t) {
        return new r(e.x + t.x, e.y + t.y);
      }
      static subtract(e, t) {
        return new r(e.x - t.x, e.y - t.y);
      }
      static multiply(e, t) {
        return new r(e.x * t.x, e.y * t.y);
      }
      static divide(e, t) {
        return new r(e.x / t.x, e.y / t.y);
      }
      static distance(e, t) {
        return r.len(r.subtract(e, t));
      }
      static centroid(...e) {
        const t = e.reduce((e, t) => r.add(e, t), new r(0, 0));
        return r.scale(1 / e.length, t);
      }
      static radius(...e) {
        const t = r.centroid(...e);
        return e.reduce((e, n) => e + r.distance(t, n), 0) / e.length;
      }
    }
    class c {
      static createCanvas() {
        const e = document.createElement("canvas");
        return (
          (e.className = "CanvasKit-bypass"),
          (e.style.pointerEvents = "none"),
          (e.style.position = "fixed"),
          (e.style["z-index"] = 1),
          (e.style.top = "0px"),
          (e.style.left = "0px"),
          (e.style.right = "0px"),
          (e.style.bottom = "0px"),
          (e.style.width = "100%"),
          (e.style.height = "100%"),
          e
        );
      }
      static hookRAF(e) {
        window.requestAnimationFrame = new Proxy(window.requestAnimationFrame, {
          apply: (t, n, s) => (e(), Reflect.apply(t, n, s)),
        });
      }
      static hookCtx(e, t) {
        const n = _window.CanvasRenderingContext2D.prototype;
        n[e] = new Proxy(n[e], {
          apply: (e, n, s) => ("CanvasKit-bypass" !== n.canvas.className && t(e, n, s), Reflect.apply(e, n, s)),
        });
      }
      static overrideCtx(e, t) {
        const n = _window.CanvasRenderingContext2D.prototype;
        n[e] = new Proxy(n[e], {
          apply: (e, n, s) => ("CanvasKit-bypass" !== n.canvas.className ? t(e, n, s) : Reflect.apply(e, n, s)),
        });
      }
      static hookPolygon(e, t) {
        let n = 0,
          s = [];
        c.hookCtx("beginPath", (e, t, i) => {
          (n = 1), (s = []);
        }),
          c.hookCtx("moveTo", (e, t, i) => {
            if (1 === n) return n++, void s.push(new r(i[0], i[1]));
            n = 0;
          }),
          c.hookCtx("lineTo", (t, i, o) => {
            if (n >= 2 && n <= e) return n++, void s.push(new r(o[0], o[1]));
            n = 0;
          }),
          c.hookCtx("fill", (i, o, a) => {
            if (n === e + 1) return n++, void t(s, o);
            n = 0;
          });
      }
    }
    class d extends EventTarget {
      emit(e, ...t) {
        this.dispatchEvent(new CustomEvent(e, { detail: t }));
      }
      on(e, t) {
        this.addEventListener(e, (e) => Reflect.apply(t, this, e.detail));
      }
      once(e, t) {
        this.addEventListener(e, (e) => Reflect.apply(t, this, e.detail), { once: !0 });
      }
      off(e, t) {
        this.removeEventListener(e, t);
      }
    }
    const l = new (class extends d {
        #e = !1;
        constructor() {
          super(), c.hookRAF(() => this.#t());
        }
        #t() {
          this.#e || void 0 === window.input || ((this.#e = !0), this.#n()), super.emit("frame");
        }
        #n() {
          setTimeout(() => super.emit("ready"), 100);
        }
      })(),
      h = new (class {
        #s = new r(1, 1);
        #i = new r(0, 0);
        #o = new r(1, 1);
        #a = new r(1, 1);
        #r = new r(0.5, 0.5);
        #c = !1;
        constructor() {
          l.once("ready", () => {
            _window.input.set_convar("ren_minimap_viewport", "true"),
              (_window.input.set_convar = new Proxy(_window.input.set_convar, {
                apply: (e, t, n) => {
                  if ("ren_minimap_viewport" !== n[0]) return Reflect.apply(e, t, n);
                  this.#c = n[1];
                },
              }));
          }),
            this.#d(),
            this.#l(),
            this.#h();
        }
        get minimapDim() {
          return this.#s;
        }
        get minimapPos() {
          return this.#i;
        }
        get viewportDim() {
          return this.#o;
        }
        get viewportPos() {
          return this.#a;
        }
        get arrowPos() {
          return this.#r;
        }
        #d() {
          c.hookCtx("strokeRect", (e, t, n) => {
            const s = t.getTransform();
            (this.#s = new r(s.a, s.d)), (this.#i = new r(s.e, s.f));
          });
        }
        #l() {
          c.overrideCtx("fillRect", (e, t, n) => {
            const s = t.getTransform();
            return 0.1 !== t.globalAlpha ||
              Math.abs(s.a / s.d - window.innerWidth / window.innerHeight) >
                (window.innerWidth / window.innerHeight) * 5e-5
              ? Reflect.apply(e, t, n)
              : ((this.#o = new r(s.a, s.d)), (this.#a = new r(s.e, s.f)), this.#c ? Reflect.apply(e, t, n) : void 0);
          });
        }
        #h() {
          c.hookPolygon(3, (e, t) => {
            const n = Math.round(r.distance(e[0], e[1])),
              s = Math.round(r.distance(e[0], e[2])),
              i = Math.round(r.distance(e[1], e[2]));
            if (n === s && s === i) return;
            const o = r.centroid(...e),
              a = r.subtract(o, this.#i),
              c = r.divide(a, this.#s);
            this.#r = c;
          });
        }
      })(),
      w = new (class {
        get position() {
          const e = r.add(h.viewportPos, r.unscale(2, h.viewportDim)),
            t = r.subtract(e, h.minimapPos),
            n = r.divide(t, h.minimapDim);
          return u.scale(n);
        }
      })(),
      p = new (class {
        #w = 1;
        #p = !1;
        constructor() {
          setTimeout(() => {
            _window.input.set_convar = new Proxy(_window.input.set_convar, {
              apply: (e, t, n) => {
                "ren_solid_background" === n[0] ? (this.#p = n[1]) : Reflect.apply(e, t, n);
              },
            });
          }, 1e3),
            c.overrideCtx("stroke", (e, t, n) =>
              "#cdcdcd" !== t.fillStyle || 0 === t.globalAlpha
                ? Reflect.apply(e, t, n)
                : ((this.#w = 10 * t.globalAlpha), this.#p ? void 0 : Reflect.apply(e, t, n))
            );
        }
        get windowRatio() {
          return Math.max(_window.innerWidth / 1920, _window.innerHeight / 1080);
        }
        get scalingFactor() {
          return this.#w;
        }
        get fov() {
          return this.#w / this.windowRatio;
        }
        toArenaUnits(e) {
          return r.unscale(this.#w, e);
        }
        toCanvasUnits(e) {
          return r.scale(this.#w, e);
        }
        toArenaPos(e) {
          const t = r.subtract(e, this.screenToCanvas(new r(_window.innerWidth / 2, _window.innerHeight / 2))),
            n = this.toArenaUnits(t);
          return r.add(n, w.position);
        }
        toCanvasPos(e) {
          const t = r.subtract(e, w.position),
            n = this.toCanvasUnits(t);
          return r.add(n, this.screenToCanvas(new r(_window.innerWidth / 2, _window.innerHeight / 2)));
        }
        screenToCanvasUnits(e) {
          return e * _window.devicePixelRatio;
        }
        canvasToScreenUnits(e) {
          return e / _window.devicePixelRatio;
        }
        screenToCanvas(e) {
          return r.scale(_window.devicePixelRatio, e);
        }
        canvasToScreen(e) {
          return r.scale(1 / _window.devicePixelRatio, e);
        }
      })(),
      u = new (class {
        #u = 1;
        constructor() {
          setInterval(() => {
            const e = r.divide(h.minimapDim, h.viewportDim),
              t = r.multiply(e, p.screenToCanvas(new r(_window.innerWidth, _window.innerHeight))),
              n = r.round(p.toArenaUnits(t));
            this.#u = n.x;
          }, 16);
        }
        get size() {
          return this.#u;
        }
        scale(e) {
          const t = (e) => Math.round(this.#u * (e - 0.5));
          return new r(t(e.x), t(e.y));
        }
        unscale(e) {
          const t = (e) => e / this.#u + 0.5;
          return new r(t(e.x), t(e.y));
        }
      })(),
      y = new (class {
        #y;
        #m;
        connected;
        constructor() {
          (this.#y = [0, 0, 0, 0]),
            (this.#m = [...Array(17)].map((e) => ({ pressed: !1 }))),
            (this.connected = !1),
            (window.navigator.getGamepads = new Proxy(window.navigator.getGamepads, {
              apply: (e, t, n) => (this.connected ? [this.#v()] : Reflect.apply(e, t, n)),
            }));
        }
        set x(e) {
          this.#y[0] = e;
        }
        set y(e) {
          this.#y[1] = e;
        }
        set mx(e) {
          this.#y[2] = e;
        }
        set my(e) {
          this.#y[3] = e;
        }
        set leftMouse(e) {
          this.#m[7].pressed = e;
        }
        set rightMouse(e) {
          this.#m[6].pressed = e;
        }
        get x() {
          return this.#y[0];
        }
        get y() {
          return this.#y[1];
        }
        get mx() {
          return this.#y[2];
        }
        get my() {
          return this.#y[3];
        }
        get leftMouse() {
          return this.#m[7].pressed;
        }
        get rightMouse() {
          return this.#m[6].pressed;
        }
        #v() {
          return { axes: this.#y, buttons: this.#m, mapping: "standard" };
        }
      })();
    class m {
      #x = new r(0, 0);
      #f = new r(0, 0);
      #g = 10;
      #k = [];
      #P = 0;
      #C = performance.now();
      get position() {
        return this.#x;
      }
      get velocity() {
        return this.#f;
      }
      predictPos(e) {
        const t = (e + performance.now() - this.#C) / 1e3;
        return r.add(this.#x, r.scale(t, this.#f));
      }
      updatePos(e) {
        this.#_(e), (this.#x = e);
      }
      #_(e) {
        const t = performance.now(),
          n = (t - this.#C) / 1e3;
        if (0 === n) return;
        this.#C = t;
        const s = r.unscale(n, r.subtract(e, this.#x));
        (this.#k[this.#P++] = s),
          (this.#P %= this.#g),
          (this.#f = r.unscale(
            this.#k.length,
            this.#k.reduce((e, t) => r.add(e, t))
          ));
      }
    }
    const v = new (class extends m {
        constructor() {
          super(), l.on("frame", () => super.updatePos(u.scale(h.arrowPos)));
        }
      })(),
      x = (e) => new Promise((t, n) => setTimeout(t, e)),
      f = new (class extends d {
        #b = !0;
        #R = !1;
        #T = new r(0, 0);
        #S = new r(0, 0);
        #U = _window.localStorage.gamemode;
        #D = 1;
        #M = "Tank";
        constructor() {
          super(),
            l.once("ready", () => {
              l.on("frame", () => {
                const e = !_window.input.should_prevent_unload();
                this.#b != e && ((this.#b = e), this.#b ? this.#A() : this.#N());
              }),
                l.on("frame", () => {
                  this.#S = p.toArenaPos(this.#T);
                });
              const e = document.getElementById("canvas");
              (e.onmousemove = new Proxy(e.onmousemove, {
                apply: (e, t, n) => {
                  if (!this.#R) return this.#B(n[0]), Reflect.apply(e, t, n);
                },
              })),
                (e.onmousedown = new Proxy(e.onmousedown, {
                  apply: (e, t, n) => {
                    if (!this.#R) return this.#E(n[0]), Reflect.apply(e, t, n);
                  },
                })),
                (e.onmouseup = new Proxy(e.onmouseup, {
                  apply: (e, t, n) => {
                    if (!this.#R) return this.#H(n[0]), Reflect.apply(e, t, n);
                  },
                })),
                (_window.onkeydown = new Proxy(_window.onkeydown, {
                  apply: (e, t, n) => (this.#I(n[0]), Reflect.apply(e, t, n)),
                })),
                (_window.onkeyup = new Proxy(_window.onkeyup, {
                  apply: (e, t, n) => (this.#W(n[0]), Reflect.apply(e, t, n)),
                })),
                c.hookCtx("fillText", (e, t, n) => {
                  const s = n[0].match(/^Lvl (\d+) (\w+\s?\w*)$/);
                  if (null == s) return;
                  const i = Number(s[1]),
                    o = s[2];
                  for (; i > this.#D + 1; ) super.emit("level", ++this.#D);
                  i !== this.#D && super.emit("level", i),
                    o !== this.#M && super.emit("tank", o),
                    (this.#D = i),
                    (this.#M = s[2]);
                });
            });
        }
        get position() {
          return v.position;
        }
        get velocity() {
          return v.velocity;
        }
        get mouse() {
          return this.#S;
        }
        get isDead() {
          return this.#b;
        }
        get gamemode() {
          return this.#U;
        }
        get level() {
          return this.#D;
        }
        get tank() {
          return this.#M;
        }
        predictPos(e) {
          return v.predictPos(e);
        }
        async #A() {
          await x(50), super.emit("dead");
        }
        async #N() {
          (this.#U = _window.localStorage.gamemode), await x(50), super.emit("spawn");
        }
        useGamepad(e) {
          y.connected = e;
        }
        keyDown(e) {
          if ("string" == typeof e) {
            if (1 != e.length) throw new Error(`diepAPI: Unsupported key: ${e}`);
            e = e.toUpperCase().charCodeAt(0);
          }
          _window.input.keyDown(e), this.#I({ keyCode: e });
        }
        keyUp(e) {
          if ("string" == typeof e) {
            if (1 != e.length) throw new Error(`diepAPI: Unsupported key: ${e}`);
            e = e.toUpperCase().charCodeAt(0);
          }
          _window.input.keyUp(e), this.#W({ keyCode: e });
        }
        async keyPress(e) {
          this.keyDown(e), await x(200), this.keyUp(e), await x(10);
        }
        async spawn(e, t = 0) {
          this.#b &&
            (void 0 !== e && (document.getElementById("textInput").value = e),
            await this.keyPress(13),
            await x(250),
            await this.spawn(e, t + 1));
        }
        async upgrade_stat(e, t) {
          if (e < 1 || e > 8) throw `diepAPI: ${e} is not a supported stat`;
          this.keyDown(85);
          for (let n = 0; n < t; n++) await this.keyPress(48 + e);
          this.keyUp(85), await x(250);
        }
        async upgrade_tank(e) {
          const t = (e -= 1) % 2,
            n = Math.floor(e / 2),
            s = p.screenToCanvasUnits(p.windowRatio * (115 * t + 97.5)),
            i = p.screenToCanvasUnits(p.windowRatio * (110 * n + 120));
          (this.#R = !0),
            _window.input.mouse(s, i),
            await this.keyPress(1),
            await x(200),
            (this.#R = !1),
            await x(1500);
        }
        moveTo(e) {
          if (y.connected) {
            const t = r.subtract(e, this.position),
              n = r.len(t);
            if (0 === n) return (y.x = 0), void (y.y = 0);
            const s = r.scale(1 / n, t);
            (y.x = s.x), (y.y = s.y);
          } else {
            const t = r.subtract(e, this.position);
            t.x > 0
              ? (this.keyUp("a"), this.keyDown("d"))
              : t.x < 0
              ? (this.keyUp("d"), this.keyDown("a"))
              : (this.keyUp("a"), this.keyUp("d")),
              t.y > 0
                ? (this.keyUp("w"), this.keyDown("s"))
                : t.y < 0
                ? (this.keyUp("s"), this.keyDown("w"))
                : (this.keyUp("w"), this.keyUp("s"));
          }
        }
        lookAt(e) {
          const t = p.toCanvasPos(e);
          _window.input.mouse(t.x, t.y), this.#B({ clientX: t.x, clientY: t.y });
        }
        #B(e) {
          if (((this.#T = p.screenToCanvas(new r(e.clientX, e.clientY))), y.connected)) {
            const e = p.toArenaPos(this.#T),
              t = r.subtract(e, this.position);
            let n = r.scale(p.fov / 1200 / 1.1, t);
            const s = r.len(n);
            0 !== s && s < 0.15 && (n = r.scale(0.15 / s, n)), (y.mx = n.x), (y.my = n.y);
          }
        }
        #E(e) {
          y.connected && this.#I({ keyCode: e.which });
        }
        #H(e) {
          y.connected && this.#W({ keyCode: e.which });
        }
        #I(e) {
          if ((super.emit("keydown", e.keyCode), y.connected))
            switch (e.keyCode) {
              case 37:
              case 65:
                y.x = -1;
                break;
              case 40:
              case 83:
                y.y = 1;
                break;
              case 38:
              case 87:
                y.y = -1;
                break;
              case 39:
              case 68:
                y.x = 1;
                break;
              case 1:
              case 32:
                y.leftMouse = !0;
                break;
              case 3:
              case 16:
                y.rightMouse = !0;
            }
        }
        #W(e) {
          if ((super.emit("keyup", e.keyCode), y.connected))
            switch (e.keyCode) {
              case 37:
              case 65:
              case 39:
              case 68:
                y.x = 0;
                break;
              case 40:
              case 83:
              case 38:
              case 87:
                y.y = 0;
                break;
              case 1:
              case 32:
                y.leftMouse = !1;
                break;
              case 3:
              case 16:
                y.rightMouse = !1;
            }
        }
      })();
    var g, k;
    !(function (e) {
      (e[(e.Player = 0)] = "Player"),
        (e[(e.Bullet = 1)] = "Bullet"),
        (e[(e.Drone = 2)] = "Drone"),
        (e[(e.Trap = 3)] = "Trap"),
        (e[(e.Square = 4)] = "Square"),
        (e[(e.Triangle = 5)] = "Triangle"),
        (e[(e.Pentagon = 6)] = "Pentagon"),
        (e[(e.AlphaPentagon = 7)] = "AlphaPentagon"),
        (e[(e.Crasher = 8)] = "Crasher"),
        (e[(e.UNKNOWN = 9)] = "UNKNOWN");
    })(g || (g = {})),
      (function (e) {
        (e.TeamBlue = "#00b2e1"),
          (e.TeamRed = "#f14e54"),
          (e.TeamPurple = "#bf7ff5"),
          (e.TeamGreen = "#00e16e"),
          (e.Square = "#ffe869"),
          (e.Triangle = "#fc7677"),
          (e.Pentagon = "#768dfc"),
          (e.AlphaPentagon = "#768dfc"),
          (e.Crasher = "#f177dd"),
          (e.NecromancerDrone = "#fcc376");
      })(k || (k = {}));
    const P = [k.TeamBlue, k.TeamRed, k.TeamPurple, k.TeamGreen];
    class C extends m {
      type;
      parent;
      extras;
      constructor(e, t, n) {
        super(), (this.type = e), (this.parent = t), (this.extras = n);
      }
      updatePos(e) {
        super.updatePos(e);
      }
    }
    class _ {
      onload;
      #$ = !1;
      constructor(e) {
        this.onload = e;
      }
      load() {
        this.#$ || ((this.#$ = !0), this.onload());
      }
    }
    const b = new (class extends _ {
        #z = [];
        #L = [];
        constructor() {
          super(() => {
            l.on("frame", () => {
              (this.#z = this.#L), (this.#L = []);
            }),
              this.#F(),
              this.#O(),
              this.#V(),
              this.#K();
          });
        }
        get entities() {
          return this.#z;
        }
        getPlayer() {
          return this.#z.filter((e) => e.type == g.Player && r.distance(e.position, v.position) < 28)[0];
        }
        #q(e, t, n = {}) {
          const s = this.#G(e, t);
          let i;
          if (-1 === s) {
            let s = null;
            if (e == g.Bullet) {
              const e = this.#G(g.Player, t, 300);
              e >= 0 && (s = this.entities[e]);
            }
            i = new C(e, s, { id: Math.random().toString(36).slice(2, 5), timestamp: performance.now(), ...n });
          } else i = this.#z[s];
          i.updatePos(t), this.#L.push(i);
        }
        #G(e, t, n = 42) {
          let s = -1,
            i = 1 / 0;
          return (
            this.#z.forEach((n, o) => {
              if (n.type !== e) return;
              const a = r.distance(n.position, t);
              a < i && ((i = a), (s = o));
            }),
            i > n ? -1 : s
          );
        }
        #F() {
          c.hookPolygon(3, (e, t) => {
            const n = Math.round(r.distance(e[0], e[1])),
              s = Math.round(r.distance(e[0], e[2])),
              i = Math.round(r.distance(e[1], e[2]));
            if (n !== s || s !== i) return;
            if ("#000000" === t.fillStyle) return;
            e = e.map((e) => p.toArenaPos(e));
            const o = r.centroid(...e),
              a = Math.round(r.radius(...e)),
              c = t.fillStyle;
            let d;
            switch (a) {
              case 23:
              case 30:
              case 40:
              case 41:
              case 42:
              case 43:
              case 44:
              case 45:
              case 46:
                P.includes(c) && (d = g.Drone);
                break;
              case 35:
                k.Crasher === c && (d = g.Crasher);
                break;
              case 55:
                k.Crasher === c && (d = g.Crasher), k.Triangle === c && (d = g.Triangle);
            }
            void 0 === d && (d = g.UNKNOWN), this.#q(d, o, { color: c, radius: a });
          });
        }
        #O() {
          c.hookPolygon(4, (e, t) => {
            e = e.map((e) => p.toArenaPos(e));
            const n = r.centroid(...e),
              s = Math.round(r.radius(...e)),
              i = t.fillStyle;
            let o;
            55 === s &&
              (k.Square === i && (o = g.Square), (P.includes(i) || k.NecromancerDrone === i) && (o = g.Drone)),
              void 0 === o && (o = g.UNKNOWN),
              this.#q(o, n, { color: i, radius: s });
          });
        }
        #V() {
          c.hookPolygon(5, (e, t) => {
            e = e.map((e) => p.toArenaPos(e));
            const n = r.centroid(...e),
              s = Math.round(r.radius(...e)),
              i = t.fillStyle;
            let o;
            switch (s) {
              case 75:
                k.Pentagon === i && (o = g.Pentagon);
                break;
              case 200:
                k.AlphaPentagon === i && (o = g.AlphaPentagon);
            }
            void 0 === o && (o = g.UNKNOWN), this.#q(o, n, { color: i, radius: s });
          });
        }
        #K() {
          let e,
            t,
            n,
            s = 0;
          const i = () => {
            (e = p.toArenaPos(e)), (n = p.toArenaUnits(new r(n, n)).x);
            let s = g.UNKNOWN;
            (s = n > 53 ? g.Player : g.Bullet), this.#q(s, e, { color: t, radius: n });
          };
          c.hookCtx("beginPath", (e, t, n) => {
            3 === s ? (3 !== s ? (s = 0) : s++) : (s = 1);
          }),
            c.hookCtx("arc", (o, a, c) => {
              if (1 === s) {
                s++;
                const t = a.getTransform();
                return (e = new r(t.e, t.f)), void (n = t.a);
              }
              return 4 === s ? (s++, void (t = a.fillStyle)) : 6 === s ? (s++, void i()) : void (s = 0);
            }),
            c.hookCtx("fill", (e, t, n) => {
              2 !== s && 5 !== s ? (s = 0) : s++;
            });
        }
      })(),
      R = new (class {
        canvas;
        ctx;
        constructor() {
          (this.canvas = c.createCanvas()),
            (this.ctx = this.canvas.getContext("2d")),
            document.body.appendChild(this.canvas),
            _window.addEventListener("resize", () => this.#j()),
            l.on("frame", () => this.#X()),
            this.#j();
        }
        #j() {
          (this.canvas.width = _window.innerWidth * _window.devicePixelRatio),
            (this.canvas.height = _window.innerHeight * _window.devicePixelRatio);
        }
        #X() {
          (this.canvas.width = _window.innerWidth * _window.devicePixelRatio),
            (this.canvas.height = _window.innerHeight * _window.devicePixelRatio),
            this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height),
            this.ctx.setTransform(1, 0, 0, 1, 0, 0);
        }
      })(),
      T = new (class extends _ {
        #Y = !1;
        #J = !1;
        #Q = !1;
        #Z = !1;
        #ee = !1;
        constructor() {
          super(() => {
            b.load(),
              l.on("frame", () => {
                b.entities.forEach((e) => {
                  const t = p.toCanvasPos(e.position),
                    n = p.toCanvasPos(e.predictPos(1e3)),
                    s = p.toCanvasUnits(new r(2 * e.extras.radius, 2 * e.extras.radius));
                  this.#Y && this.#te(e, t, s),
                    this.#J && this.#ne(t, n),
                    this.#Q && this.#se(e, t),
                    this.#Z && this.#ie(e, t, s);
                }),
                  this.#ee && this.#oe();
              });
          });
        }
        drawAll(e) {
          (this.#Y = e), (this.#J = e), (this.#Q = e), (this.#Z = e), (this.#ee = e);
        }
        drawBoundingBox(e) {
          this.#Y = e;
        }
        drawVelocity(e) {
          this.#J = e;
        }
        drawParent(e) {
          this.#Q = e;
        }
        drawInfo(e) {
          this.#Z = e;
        }
        drawStats(e) {
          this.#ee = e;
        }
        #te(e, t, n) {
          R.ctx.save(),
            (R.ctx.strokeStyle = e.type === g.UNKNOWN ? "#ffffff" : e.extras.color),
            (R.ctx.lineWidth = p.toCanvasUnits(new r(5, 5)).x),
            R.ctx.strokeRect(t.x - n.x / 2, t.y - n.y / 2, n.x, n.y),
            R.ctx.restore();
        }
        #ne(e, t) {
          R.ctx.save(),
            (R.ctx.strokeStyle = "#000000"),
            (R.ctx.lineWidth = p.toCanvasUnits(new r(5, 5)).x),
            R.ctx.beginPath(),
            R.ctx.moveTo(e.x, e.y),
            R.ctx.lineTo(t.x, t.y),
            R.ctx.stroke(),
            R.ctx.restore();
        }
        #se(e, t) {
          if (null === e.parent) return;
          const n = p.toCanvasPos(e.parent.position);
          R.ctx.save(),
            (R.ctx.strokeStyle = "#8aff69"),
            (R.ctx.lineWidth = p.toCanvasUnits(new r(5, 5)).x),
            R.ctx.beginPath(),
            R.ctx.moveTo(t.x, t.y),
            R.ctx.lineTo(n.x, n.y),
            R.ctx.stroke(),
            R.ctx.restore();
        }
        #ie(e, t, n) {
          R.ctx.save();
          const s = p.toCanvasUnits(new r(30, 30)).x;
          (R.ctx.font = s + "px Ubuntu"),
            (R.ctx.fillStyle = "#ffffff"),
            (R.ctx.strokeStyle = "#000000"),
            (R.ctx.lineWidth = s / 5),
            R.ctx.strokeText(
              `${e.extras.id} ${Math.floor((performance.now() - e.extras.timestamp) / 1e3)}`,
              t.x,
              t.y - 0.7 * n.y
            ),
            R.ctx.fillText(
              `${e.extras.id} ${Math.floor((performance.now() - e.extras.timestamp) / 1e3)}`,
              t.x,
              t.y - 0.7 * n.y
            ),
            R.ctx.restore();
        }
        #oe() {
          const e = `Debug Tool:\n        Game Info:\n        gamemode: ${f.gamemode}\n        entities: ${
            b.entities.length
          }\n        \n        Player Info:\n        Is dead: ${f.isDead}\n        level: ${f.level}\n        tank: ${
            f.tank
          }\n        position: ${Math.round(f.position.x)},${Math.round(f.position.y)}\n        mouse: ${Math.round(
            f.mouse.x
          )},${Math.round(f.mouse.y)}\n        velocity [units/seconds]: ${Math.round(
            Math.hypot(f.velocity.x, f.velocity.y)
          )}`;
          R.ctx.save();
          const t = 20 * _window.devicePixelRatio;
          (R.ctx.font = `${t}px Ubuntu`),
            (R.ctx.fillStyle = "#ffffff"),
            (R.ctx.strokeStyle = "#000000"),
            (R.ctx.lineWidth = t / 5),
            e.split("\n").forEach((e, n) => {
              R.ctx.strokeText(e, 0, 0.25 * _window.innerHeight + n * t * 1.05),
                R.ctx.fillText(e, 0, 0.25 * _window.innerHeight + n * t * 1.05);
            }),
            R.ctx.restore();
        }
      })(),
      S = new (class {
        canvas;
        ctx;
        #ae;
        #re;
        constructor() {
          (this.canvas = c.createCanvas()),
            (this.ctx = this.canvas.getContext("2d")),
            _window.addEventListener("resize", () => this.#j()),
            l.on("frame", () => this.#X()),
            this.#j(),
            l.once("ready", () => {
              (this.#ae = document.getElementById("canvas")), (this.#re = this.#ae.getContext("2d")), this.#ce();
            });
        }
        #j() {
          (this.canvas.width = _window.innerWidth * _window.devicePixelRatio),
            (this.canvas.height = _window.innerHeight * _window.devicePixelRatio);
        }
        #X() {
          (this.canvas.width = _window.innerWidth * _window.devicePixelRatio),
            (this.canvas.height = _window.innerHeight * _window.devicePixelRatio),
            this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height),
            this.ctx.setTransform(1, 0, 0, 1, 0, 0);
        }
        #ce() {
          c.overrideCtx("fillRect", (e, t, n) => {
            if ("object" != typeof t.fillStyle) return Reflect.apply(e, t, n);
            const s = Reflect.apply(e, t, n);
            return (
              this.#re.save(),
              this.#re.setTransform(1, 0, 0, 1, 0, 0),
              (this.#re.globalAlpha = 1),
              this.#re.drawImage(this.canvas, 0, 0),
              this.#re.restore(),
              s
            );
          });
        }
      })();
    diepAPI = t;
  })();

  //diepAPI end

  _window.diepAPI = diepAPI;
})();