import Renderables from '../Renderables';
import { Timestamp } from "../timestamp";
/**
 * Implementation of the 'selectable' markup element.
 * A li HTML element is created and the class lto-selectable
 * is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 */
var Selectable = /** @class */ (function () {
    function Selectable(message) {
        this.spec = message;
    }
    /**
     * @inheritDoc
     */
    Selectable.prototype.render = function (renderer, isNested) {
        var _this = this;
        var position = this.spec.position || 'left';
        var selectable = document.createElement('div');
        selectable.classList.add('lto-selectable', "lto-" + position);
        selectable.setAttribute("name", this.spec.name || "");
        if (this.spec.id !== undefined) {
            selectable.id = this.spec.id;
        }
        if (this.spec.class !== undefined) {
            this.spec.class.split(" ").forEach(function (e) { return selectable.classList.add(e); });
        }
        selectable.appendChild(Timestamp.render());
        var elements = (this.spec.elements || []).map(function (e) { return renderer.render(e, _this); });
        elements.forEach(function (e) { return e.forEach(function (x) { return selectable.appendChild(x); }); });
        if (isNested) {
            selectable.classList.add('lto-nested');
        }
        return selectable;
    };
    return Selectable;
}());
export { Selectable };
Renderables.register("selectable", Selectable);
//# sourceMappingURL=index.js.map