var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
import { LitElement, html, css } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import * as plugins from './typedserver_web.plugins.js';
let TypedserverInfoscreen = (() => {
    let _classDecorators = [customElement('typedserver-infoscreen')];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = LitElement;
    let _text_decorators;
    let _text_initializers = [];
    let _text_extraInitializers = [];
    let _success_decorators;
    let _success_initializers = [];
    let _success_extraInitializers = [];
    var TypedserverInfoscreen = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _text_decorators = [property()];
            _success_decorators = [property()];
            __esDecorate(this, null, _text_decorators, { kind: "accessor", name: "text", static: false, private: false, access: { has: obj => "text" in obj, get: obj => obj.text, set: (obj, value) => { obj.text = value; } }, metadata: _metadata }, _text_initializers, _text_extraInitializers);
            __esDecorate(this, null, _success_decorators, { kind: "accessor", name: "success", static: false, private: false, access: { has: obj => "success" in obj, get: obj => obj.success, set: (obj, value) => { obj.success = value; } }, metadata: _metadata }, _success_initializers, _success_extraInitializers);
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            TypedserverInfoscreen = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        #text_accessor_storage = __runInitializers(this, _text_initializers, 'Hello');
        //INSTANCE
        get text() { return this.#text_accessor_storage; }
        set text(value) { this.#text_accessor_storage = value; }
        #success_accessor_storage = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _success_initializers, false));
        get success() { return this.#success_accessor_storage; }
        set success(value) { this.#success_accessor_storage = value; }
        static styles = [
            css `
      * {
        box-sizing: border-box;
      }

      :host {
        
      }

      .mainbox {
        z-index: 1000;
        position: fixed;
        transition: all 0.3s;
        display: block;
        bottom: -50px;
        right: 0px;
        left: 0px;
        height : 50px;
        background: #222;
        color: #CCC;
        padding: 15px;
        border-top: 1px solid #e4002b;
        text-align: center;
        font-family: 'Roboto', sans-serif;
        color: #fff;
        background: #111;
        box-shadow: 0px -30px 30px rgba(0,0,0,1);
        opacity: 0;
      }

      @media (prefers-color-scheme: light) {
        .mainbox {
          color: #333;
          background: #eeeeee;
          box-shadow: 0px 0px 5px rgba(0,0,0,0.3);
        }
      }

      .show {
        bottom: 0px;
        opacity: 1;
      }

      .success {
        background: green;
        border-top: 1px solid green;
      }
    `
        ];
        setText(textArg) {
            this.success = false;
            this.text = textArg;
            this.show();
            this.success = false;
        }
        setSuccess(textArg) {
            this.text = textArg;
            this.show();
            this.success = true;
            setTimeout(() => this.hide(), 1000);
        }
        appended = (__runInitializers(this, _success_extraInitializers), false);
        async show() {
            document.body.append(this);
            this.appended = true;
            await plugins.smartdelay.delayFor(0);
            const mainbox = this.shadowRoot.querySelector('.mainbox');
            mainbox.classList.add('show');
        }
        async hide() {
            this.text = '';
            if (this.appended) {
                const mainbox = this.shadowRoot.querySelector('.mainbox');
                mainbox.classList.remove('show');
            }
            await plugins.smartdelay.delayFor(300);
            if (this.appended) {
                this.appended = false;
                document.body.removeChild(this);
            }
        }
        render() {
            return html `
      <div class="mainbox ${this.success ? 'success' : ''}">${this.text}</div>
    `;
        }
        async firstUpdated(_changedProperties) {
            super.firstUpdated(_changedProperties);
        }
        static {
            __runInitializers(_classThis, _classExtraInitializers);
        }
    };
    return TypedserverInfoscreen = _classThis;
})();
export { TypedserverInfoscreen };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZWRzZXJ2ZXJfd2ViLmluZm9zY3JlZW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90c193ZWJfaW5qZWN0L3R5cGVkc2VydmVyX3dlYi5pbmZvc2NyZWVuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUMsVUFBVSxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUMsTUFBTSxLQUFLLENBQUM7QUFDMUMsT0FBTyxFQUFFLGFBQWEsRUFBRSxRQUFRLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUU1RCxPQUFPLE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