var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
(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", "../../di/DISingleton"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DISingleton_1 = require("../../di/DISingleton");
    var regExps = [
        [/(\_{3})([^\_]+)(\_{3})/gmi, "<strong><em>$2</em></strong>"],
        [/(\_{2})([^\_]+)(\_{2})/gmi, "<strong>$2</strong>"],
        [/(\_{1})([^\_]+)(\_{1})/gmi, "<em>$2</em>"],
        [/(\*{3})([^\*]+)(\*{3})/gmi, "<strong><em>$2</em></strong>"],
        [/(\*{2})([^\*]+)(\*{2})/gmi, "<strong>$2</strong>"],
        [/(\*{1})([^\*]+)(\*{1})/gmi, "<em>$2</em>"],
        [/(\#{5})\s([^\n]+)/gmi, "<h5>$2</h5>"],
        [/(\#{4})\s([^\n]+)/gmi, "<h4>$2</h4>"],
        [/(\#{3})\s([^\n]+)/gmi, "<h3>$2</h3>"],
        [/(\#{2})\s([^\n]+)/gmi, "<h2>$2</h2>"],
        [/(\#{1})\s([^\n]+)/gmi, "<h1>$2</h1>"],
        [/\n+/gmi, function (t) { return "<br/>"; }]
    ];
    var MarkdownService = /** @class */ (function () {
        function MarkdownService() {
        }
        MarkdownService_1 = MarkdownService;
        MarkdownService.prototype.toHtml = function (text) {
            for (var _i = 0, regExps_1 = regExps; _i < regExps_1.length; _i++) {
                var iterator = regExps_1[_i];
                var reg = iterator[0];
                if (iterator.length === 2) {
                    var re = iterator[1];
                    if (typeof re === "string" || typeof re === "function") {
                        text = text.replace(reg, re);
                    }
                }
            }
            return text;
        };
        var MarkdownService_1;
        MarkdownService.instance = new MarkdownService_1();
        MarkdownService = MarkdownService_1 = __decorate([
            DISingleton_1.default()
        ], MarkdownService);
        return MarkdownService;
    }());
    exports.default = MarkdownService;
});
//# sourceMappingURL=MarkdownService.js.map