"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.elementBasicSetup = void 0;
const smartpromise_1 = require("@pushrocks/smartpromise");
/**
 * a basic setup for elements
 * makes sure everything is in check
 */
exports.elementBasicSetup = async () => {
    if (globalThis.deesCssToolsReady) {
        await globalThis.deesCssToolsReady.promise;
    }
    else {
        // lets prevent double execution
        globalThis.deesCssToolsReady = smartpromise_1.defer();
        // lets make sure the dom is ready
        const documentReady = smartpromise_1.defer();
        document.onreadystatechange = () => {
            if (document.readyState === 'interactive') {
                documentReady.resolve();
            }
        };
        await documentReady.promise;
        // lets get started
        const head = document.querySelector('head');
        const body = document.querySelector('body');
        // material font
        const materialFontCss = `
      @font-face {
        font-family: 'Material Icons';
        font-style: normal;
        font-weight: 400;
        src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
      }
    `;
        const styleElement = document.createElement('style');
        styleElement.type = 'text/css';
        styleElement.appendChild(document.createTextNode(materialFontCss));
        head.appendChild(styleElement);
        globalThis.deesCssToolsReady.resolve();
    }
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3NzdG9vbHMuZWxlbWVudGJhc2ljc2V0dXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jc3N0b29scy5lbGVtZW50YmFzaWNzZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwREFBZ0Q7QUFFaEQ7OztHQUdHO0FBQ1UsUUFBQSxpQkFBaUIsR0FBRyxLQUFLLElBQUksRUFBRTtJQUMxQyxJQUFJLFVBQVUsQ0FBQyxpQkFBaUIsRUFBRTtRQUNoQyxNQUFNLFVBQVUsQ0FBQyxpQkFBaUIsQ0FBQyxPQUFPLENBQUM7S0FDNUM7U0FBTTtRQUNMLGdDQUFnQztRQUNoQyxVQUFVLENBQUMsaUJBQWlCLEdBQUcsb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