"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Renderables_1 = require("../Renderables");
var node_1 = require("../../support/node");
var Specification_1 = require("../../support/Specification");
/**
 * Implementation of the 'link' markup element. An
 * a HTML element is created and the given attributes
 * for href and target are taken over from the markup. The
 * class lto-link is added to allow CSS manipulations.
 *
 * @see {@link IRenderable}
 */
var Link = /** @class */ (function () {
    function Link(spec) {
        this.spec = spec;
    }
    /**
     * @inheritDoc
     */
    Link.prototype.render = function (renderer, isNested) {
        var link = node_1.default("a");
        link.addAttributes({
            href: Link.decode(this.spec.value || ""),
            target: '_blank'
        });
        new Specification_1.Specification(this.spec).initNode(link, "lto-link");
        return link.unwrap();
    };
    Link.decode = function (input) {
        var txt = document.createElement("textarea");
        txt.innerHTML = input;
        return txt.value;
    };
    return Link;
}());
exports.Link = Link;
Renderables_1.default.register("link", Link);
//# sourceMappingURL=index.js.map