var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "../web/services/MarkdownService", "./FormattedString"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var MarkdownService_1 = require("../web/services/MarkdownService");
    var FormattedString_1 = require("./FormattedString");
    var Markdown = /** @class */ (function (_super) {
        __extends(Markdown, _super);
        function Markdown() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        Markdown.from = function (text) {
            return new Markdown(text);
        };
        Markdown.prototype.applyTo = function (app, element) {
            element.innerHTML = this.toHtmlString(app);
        };
        Markdown.prototype.toString = function () {
            return this.text;
        };
        Markdown.prototype.toHtmlString = function (app) {
            var ms = app
                ? app.resolve(MarkdownService_1.default)
                : MarkdownService_1.default.instance;
            return ms.toHtml(this.text);
        };
        return Markdown;
    }(FormattedString_1.default));
    exports.default = Markdown;
});
//# sourceMappingURL=Markdown.js.map