import { h } from '../webcomponents.core.js';

import './chunk-de721f0a.js';
import { e as Util } from './chunk-f9f1602a.js';

class Test {
    constructor() {
        this.id = Util.getUUID();
    }
    componentDidLoad() {
        this.postRender();
    }
    componentDidUpdate() {
        this.postRender();
    }
    postRender() {
        this.changeHandler();
    }
    changeHandler() {
        this.change.emit({ data: this.getData(), el: this.el, timestamp: Util.getTimeStamp() });
    }
    async setData(data, extend = false) {
        if (!this.data)
            this.data = {};
        if (extend) {
            Object.keys(data).forEach((k) => {
                this.data[k] = data[k];
            });
            return;
        }
        this.data = data;
    }
    async getData() {
        return this.data;
    }
    async getId() {
        return this.id;
    }
    render() {
        if (this.dataJson) {
            this.data = JSON.parse(this.dataJson);
        }
        return (h("div", null,
            h("button", null, "Click button")));
    }
    static get is() { return "ema-test"; }
    static get properties() { return {
        "data": {
            "state": true
        },
        "dataJson": {
            "type": String,
            "attr": "data-json"
        },
        "el": {
            "elementRef": true
        },
        "getData": {
            "method": true
        },
        "getId": {
            "method": true
        },
        "setData": {
            "method": true
        }
    }; }
    static get events() { return [{
            "name": "change",
            "method": "change",
            "bubbles": true,
            "cancelable": true,
            "composed": true
        }]; }
    static get style() { return ""; }
}

export { Test as EmaTest };
