/* eslint-disable prefer-rest-params */
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as jsdom from 'jsdom';
import * as canvas from 'canvas';
import * as Filereader from 'filereader';
(globalThis as any).FileReader = Filereader.default;
globalThis.window = new jsdom.JSDOM().window;
globalThis.document = window.document;
const oldCreateElement = window.document.createElement;
(window as any).document.createElement = function (eleStr) {
    if (eleStr === 'canvas') {
        return canvas.createCanvas(200, 200);
    }
    return oldCreateElement.apply(this, arguments as any);
}
if (!globalThis.navigator) {
    globalThis.navigator = window.navigator;
}

globalThis.HTMLCollection = window.HTMLCollection;
globalThis.getComputedStyle = window.getComputedStyle;

globalThis.canvas = canvas;
globalThis.HTMLElement = window.HTMLElement;
globalThis.HTMLDivElement = window.HTMLDivElement;
globalThis.HTMLImageElement = window.HTMLImageElement;
(globalThis as any).customElements = void 0;
(globalThis as any).self = globalThis;