"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jquery_1 = __importDefault(require("jquery"));
require("block-ui");
class Progress {
    static start() {
        return new Promise(resolve => {
            const body = (0, jquery_1.default)('body');
            body.block({
                message: '<i class="icon-spinner3 icon-3x spinner"></i>',
                overlayCSS: {
                    backgroundColor: '#1B2024',
                    opacity: 0.85,
                    cursor: 'wait'
                },
                css: {
                    border: 0,
                    padding: 0,
                    backgroundColor: 'none',
                    color: '#fff'
                },
                baseZ: 1100,
                onBlock: resolve,
                onUnblock: () => {
                    body.trigger('block:Unblock');
                }
            });
        });
    }
    static end() {
        const asyncStopTimeout = 300;
        const body = (0, jquery_1.default)('body');
        return new Promise(resolve => {
            body.one('block:Unblock', () => {
                resolve();
            });
            setTimeout(() => {
                body.unblock();
            }, asyncStopTimeout);
        });
    }
}
exports.default = Progress;
