'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const __chunk_1 = require('./chunk-2755df65.js');
require('./chunk-f5b13333.js');
const __chunk_3 = require('./chunk-451ee4a2.js');

class FlashMessage {
    constructor(hostRef) {
        __chunk_1.registerInstance(this, hostRef);
        this.active = false;
        this.activeClass = 'primary';
    }
    async show(message, activeClass, duration = 2000) {
        this.message = message;
        this.activeClass = activeClass;
        this.active = true;
        __chunk_3.DomUtil.fadeIn(this.el, 150, 0, 'flex');
        this.timeout = setTimeout(() => {
            this.active = false;
        }, duration);
    }
    dismiss() {
        this.active = false;
        __chunk_3.DomUtil.fadeOut(this.el, 150, 0);
        clearTimeout(this.timeout);
    }
    render() {
        return (__chunk_1.h("div", { onClick: () => this.dismiss(), class: 'flash-container ' + (this.active ? 'show ' : 'hide ') + this.activeClass }, __chunk_1.h("div", { class: "message" }, this.message), __chunk_1.h("p", { class: "dismiss" }, "tap to dismiss")));
    }
    get el() { return __chunk_1.getElement(this); }
    static get style() { return ":root{--ema-color:#343a40;--ema-primary:#007bff;--ema-secondary:#6c757d;--ema-success:#28a745;--ema-info:#17a2b8;--ema-warning:#ffc107;--ema-danger:#dc3545;--ema-light:#f8f9fa;--ema-dark:#343a40;--ema-background:#fff;--ema-background-diap:rgba(29,29,29,0.97);--ema-border-color:#c5c9cd;--ema-border:1px solid #c5c9cd;--ema-border-radius:3px 3px 3px 3px;--ema-box-shadow:1px 1px 10px 1px #ccc;--ema-margin:0.25rem;--ema-margin-sm:0.5rem;--ema-margin-md:1rem;--ema-margin-lg:1.5rem;--ema-margin-xl:2rem;--ema-padding:0.25rem;--ema-padding-sm:0.5rem;--ema-padding-md:1rem;--ema-padding-lg:1.5rem;--ema-padding-xl:2rem;--ema-gray-100:#f8f9fa;--ema-gray-200:#e9ecef;--ema-gray-300:#dee2e6;--ema-gray-400:#ced4da;--ema-gray-500:#adb5bd;--ema-gray-600:#868e96;--ema-gray-700:#495057;--ema-gray-800:#343a40;--ema-gray-900:#212529}ema-flash-message{position:fixed;z-index:31000;top:0;left:50%;-webkit-transition:opacity .7s;transition:opacity .7s;display:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}ema-flash-message .flash-container{background-color:#000;border-radius:var(--ema-border-radius);display:block;min-height:56px;min-width:360px;max-width:480px;color:var(--ema-light);margin:0 auto 0 -50%;padding:var(--ema-padding,.5rem);text-align:center}ema-flash-message .show{display:block;opacity:1}ema-flash-message .hide{display:none;opacity:0}ema-flash-message .dismiss{cursor:pointer;position:absolute;min-width:360px;bottom:var(--ema-padding,.5rem);margin:0 auto;font-size:.7em;opacity:.5;text-align:center}ema-flash-message .primary{background-color:var(--ema-primary)}ema-flash-message .secondary,ema-flash-message .success{background-color:var(--ema-success)}ema-flash-message .danger{background-color:var(--ema-danger)}ema-flash-message .light{background-color:var(--ema-background,#fff)}ema-flash-message .dark{background-color:var(--ema-background-diap)}"; }
}

exports.ema_flash_message = FlashMessage;
