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EADA,EAAY,GAEhB,IAAK,KAAO,EACJ,EAAK,eAAe,IACpB,EAAU,KAAK,QAAU,EAAM,KAAQ,KAAK,cAAc,EAAK,IAAQ,KAG/E,OAAO,EAAU,OAAS,EAAI,IAAM,EAAU,KAAK,KAAO,EAAE,EA0DhE,OAvDI,EAAU,aACZ,EAAK,oBAAsB,QAGzB,EAAU,KACN,GACA,EAAO,KAAK,EAAU,GAAK,OACI,OAA3B,EAAU,eACV,EAAK,qBAAuB,EAAU,aACtC,EAAU,aAAe,OAG7B,EAAO,KAAK,aAAe,EAAU,GAAK,MAI9C,EAAU,KACN,GACA,EAAO,KAAK,EAAU,GAAK,OACI,OAA3B,EAAU,eACV,EAAK,qBAAuB,EAAU,aACtC,EAAU,aAAe,OAG/B,EAAO,KAAK,wBAA0B,EAAU,GAAK,MAI3D,EAAU,YAAY,SAAS,IAEvB,EACA,EAAY,KAAK,QAAU,GAIZ,SAAf,EACA,EAAY,KAAK,oBACK,QAAf,EACP,EAAY,KAAK,eACK,WAAf,EACP,EAAY,KAAK,qBACK,WAAf,EACP,EAAY,KAAK,qBACK,kBAAf,EACP,EAAgB,KAAK,gBAGrB,EAAgB,KAAK,EACzB,IAGA,EAAgB,QAChB,EAAY,KAAK,mBAAqB,EAAgB,KAAK,MAG3D,EACO,gBAAmB,EAAO,OAAO,GAAa,KAAK,KAAO,IAAO,EAAY,GAAQ,IAAM,EAAU,QAAU,UAE/G,gBAAmB,EAAO,OAAO,GAAa,KAAK,KAAO,IAAO,EAAY,GAAQ,IAAM,EAAU,QAAU,SAE9H,CAEA,gBAAA,CAAiB,GACb,MAAM,EAAQ,KAAK,YAAY,QAAQ,GAEnC,GAAS,GACT,KAAK,YAAY,OAAO,EAAO,EAEvC,EAGJ,OAAO,QAAU","file":"/npm/anser@2.3.5/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/anser@2.3.5/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\n// This file was originally written by @drudru (https://github.com/drudru/ansi_up), MIT, 2011\n\nconst ANSI_COLORS = [\n    [\n        { color: \"0, 0, 0\",        \"class\": \"ansi-black\"   }\n      , { color: \"187, 0, 0\",      \"class\": \"ansi-red\"     }\n      , { color: \"0, 187, 0\",      \"class\": \"ansi-green\"   }\n      , { color: \"187, 187, 0\",    \"class\": \"ansi-yellow\"  }\n      , { color: \"0, 0, 187\",      \"class\": \"ansi-blue\"    }\n      , { color: \"187, 0, 187\",    \"class\": \"ansi-magenta\" }\n      , { color: \"0, 187, 187\",    \"class\": \"ansi-cyan\"    }\n      , { color: \"255,255,255\",    \"class\": \"ansi-white\"   }\n    ]\n  , [\n        { color: \"85, 85, 85\",     \"class\": \"ansi-bright-black\"   }\n      , { color: \"255, 85, 85\",    \"class\": \"ansi-bright-red\"     }\n      , { color: \"0, 255, 0\",      \"class\": \"ansi-bright-green\"   }\n      , { color: \"255, 255, 85\",   \"class\": \"ansi-bright-yellow\"  }\n      , { color: \"85, 85, 255\",    \"class\": \"ansi-bright-blue\"    }\n      , { color: \"255, 85, 255\",   \"class\": \"ansi-bright-magenta\" }\n      , { color: \"85, 255, 255\",   \"class\": \"ansi-bright-cyan\"    }\n      , { color: \"255, 255, 255\",  \"class\": \"ansi-bright-white\"   }\n    ]\n];\n// https://datatracker.ietf.org/doc/html/rfc3986#appendix-A\nconst linkRegex = /(https?:\\/\\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\\]-]|&amp;|%[A-Fa-f0-9]{2})+)/gm;\n\nclass Anser {\n\n    /**\n     * Anser.escapeForHtml\n     * Escape the input HTML.\n     *\n     * This does the minimum escaping of text to make it compliant with HTML.\n     * In particular, the '&','<', and '>' characters are escaped. This should\n     * be run prior to `ansiToHtml`.\n     *\n     * @name Anser.escapeForHtml\n     * @function\n     * @param {String} txt The input text (containing the ANSI snippets).\n     * @returns {String} The escaped html.\n     */\n    static escapeForHtml (txt) {\n        return new Anser().escapeForHtml(txt);\n    }\n\n    /**\n     * Anser.linkify\n     * Adds the links in the HTML.\n     *\n     * This replaces any links in the text with anchor tags that display the\n     * link. You should apply this after you have run `ansiToHtml` on the text.\n     *\n     * @name Anser.linkify\n     * @function\n     * @param {String} txt The input text.\n     * @returns {String} The HTML containing the <a> tags (unescaped).\n     */\n    static linkify (txt) {\n        return new Anser().linkify(txt);\n    }\n\n    /**\n     * Anser.ansiToHtml\n     * This replaces ANSI terminal escape codes with SPAN tags that wrap the\n     * content.\n     *\n     * This function only interprets ANSI SGR (Select Graphic Rendition) codes\n     * that can be represented in HTML.\n     * For example, cursor movement codes are ignored and hidden from output.\n     * The default style uses colors that are very close to the prescribed\n     * standard. The standard assumes that the text will have a black\n     * background. These colors are set as inline styles on the SPAN tags.\n     *\n     * Another option is to set `use_classes: true` in the options argument.\n     * This will instead set classes on the spans so the colors can be set via\n     * CSS. The class names used are of the format `ansi-*-fg/bg` and\n     * `ansi-bright-*-fg/bg` where `*` is the color name,\n     * i.e black/red/green/yellow/blue/magenta/cyan/white.\n     *\n     * @name Anser.ansiToHtml\n     * @function\n     * @param {String} txt The input text.\n     * @param {Object} options The options passed to the ansiToHTML method.\n     * @returns {String} The HTML output.\n     */\n    static ansiToHtml (txt, options) {\n        return new Anser().ansiToHtml(txt, options);\n    }\n\n    /**\n     * Anser.ansiToJson\n     * Converts ANSI input into JSON output.\n     *\n     * @name Anser.ansiToJson\n     * @function\n     * @param {String} txt The input text.\n     * @param {Object} options The options passed to the ansiToHTML method.\n     * @returns {String} The HTML output.\n     */\n    static ansiToJson (txt, options) {\n        return new Anser().ansiToJson(txt, options);\n    }\n\n    /**\n     * Anser.ansiToText\n     * Converts ANSI input into text output.\n     *\n     * @name Anser.ansiToText\n     * @function\n     * @param {String} txt The input text.\n     * @returns {String} The text output.\n     */\n    static ansiToText (txt) {\n        return new Anser().ansiToText(txt);\n    }\n\n    /**\n     * Anser\n     * The `Anser` class.\n     *\n     * @name Anser\n     * @function\n     * @returns {Anser}\n     */\n    constructor () {\n        this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null;\n        this.bright = 0;\n        this.decorations = [];\n    }\n\n    /**\n     * setupPalette\n     * Sets up the palette.\n     *\n     * @name setupPalette\n     * @function\n     */\n    setupPalette () {\n        this.PALETTE_COLORS = [];\n\n        // Index 0..15 : System color\n        for (let i = 0; i < 2; ++i) {\n            for (let j = 0; j < 8; ++j) {\n                this.PALETTE_COLORS.push(ANSI_COLORS[i][j].color);\n            }\n        }\n\n        // Index 16..231 : RGB 6x6x6\n        // https://gist.github.com/jasonm23/2868981#file-xterm-256color-yaml\n        let levels = [0, 95, 135, 175, 215, 255];\n        let format = (r, g, b) => levels[r] + \", \" + levels[g] + \", \" + levels[b];\n        let r, g, b;\n        for (let r = 0; r < 6; ++r) {\n            for (let g = 0; g < 6; ++g) {\n                for (let b = 0; b < 6; ++b) {\n                    this.PALETTE_COLORS.push(format(r, g, b));\n                }\n            }\n        }\n\n        // Index 232..255 : Grayscale\n        let level = 8;\n        for (let i = 0; i < 24; ++i, level += 10) {\n            this.PALETTE_COLORS.push(level + \", \" + level + \", \" + level);\n        }\n    }\n\n    /**\n     * escapeForHtml\n     * Escapes the input text.\n     *\n     * @name escapeForHtml\n     * @function\n     * @param {String} txt The input text.\n     * @returns {String} The escpaed HTML output.\n     */\n    escapeForHtml (txt) {\n        return txt.replace(/[&<>\\\"]/gm, str =>\n                           str == \"&\" ? \"&amp;\" :\n                               str == '\"' ? \"&quot;\" :\n                               str == \"<\" ? \"&lt;\" :\n                               str == \">\" ? \"&gt;\" : \"\"\n                          );\n    }\n\n    /**\n     * linkify\n     * Adds HTML link elements.\n     *\n     * @name linkify\n     * @function\n     * @param {String} txt The input text.\n     * @returns {String} The HTML output containing link elements.\n     */\n    linkify (txt) {\n        return txt.replace(linkRegex, str => `<a href=\"${str}\">${str}</a>`);\n    }\n\n    /**\n     * ansiToHtml\n     * Converts ANSI input into HTML output.\n     *\n     * @name ansiToHtml\n     * @function\n     * @param {String} txt The input text.\n     * @param {Object} options The options passed ot the `process` method.\n     * @returns {String} The HTML output.\n     */\n    ansiToHtml (txt, options) {\n        return this.process(txt, options, true);\n    }\n\n    /**\n     * ansiToJson\n     * Converts ANSI input into HTML output.\n     *\n     * @name ansiToJson\n     * @function\n     * @param {String} txt The input text.\n     * @param {Object} options The options passed ot the `process` method.\n     * @returns {String} The JSON output.\n     */\n    ansiToJson (txt, options) {\n        options = options || {};\n        options.json = true;\n        options.clearLine = false;\n        return this.process(txt, options, true);\n    }\n\n    /**\n     * ansiToText\n     * Converts ANSI input into HTML output.\n     *\n     * @name ansiToText\n     * @function\n     * @param {String} txt The input text.\n     * @returns {String} The text output.\n     */\n    ansiToText (txt) {\n        return this.process(txt, {}, false);\n    }\n\n    /**\n     * process\n     * Processes the input.\n     *\n     * @name process\n     * @function\n     * @param {String} txt The input text.\n     * @param {Object} options An object passed to `processChunk` method, extended with:\n     *\n     *  - `json` (Boolean): If `true`, the result will be an object.\n     *  - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.\n     *\n     * @param {Boolean} markup\n     */\n    process (txt, options, markup) {\n        let self = this;\n        let raw_text_chunks = txt.split(/\\033\\[/);\n        let first_chunk = raw_text_chunks.shift(); // the first chunk is not the result of the split\n\n        if (options === undefined || options === null) {\n            options = {};\n        }\n        options.clearLine = /\\r/.test(txt); // check for Carriage Return\n        let color_chunks = raw_text_chunks.map(chunk => this.processChunk(chunk, options, markup))\n\n        if (options && options.json) {\n            let first = self.processChunkJson(\"\");\n            first.content = first_chunk;\n            first.clearLine = options.clearLine;\n            color_chunks.unshift(first);\n            if (options.remove_empty) {\n                color_chunks = color_chunks.filter(c => !c.isEmpty());\n            }\n            return color_chunks;\n        } else {\n            color_chunks.unshift(first_chunk);\n        }\n\n        return color_chunks.join(\"\");\n    }\n\n    /**\n     * processChunkJson\n     * Processes the current chunk into json output.\n     *\n     * @name processChunkJson\n     * @function\n     * @param {String} text The input text.\n     * @param {Object} options An object containing the following fields:\n     *\n     *  - `json` (Boolean): If `true`, the result will be an object.\n     *  - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.\n     *\n     * @param {Boolean} markup If false, the colors will not be parsed.\n     * @return {Object} The result object:\n     *\n     *  - `content` (String): The text.\n     *  - `fg` (String|null): The foreground color.\n     *  - `bg` (String|null): The background color.\n     *  - `fg_truecolor` (String|null): The foreground true color (if 16m color is enabled).\n     *  - `bg_truecolor` (String|null): The background true color (if 16m color is enabled).\n     *  - `clearLine` (Boolean): `true` if a carriageReturn \\r was fount at end of line.\n     *  - `was_processed` (Bolean): `true` if the colors were processed, `false` otherwise.\n     *  - `isEmpty` (Function): A function returning `true` if the content is empty, or `false` otherwise.\n     *\n     */\n    processChunkJson (text, options, markup) {\n\n        // Are we using classes or styles?\n        options = typeof options == \"undefined\" ? {} : options;\n        let use_classes = options.use_classes = typeof options.use_classes != \"undefined\" && options.use_classes;\n        let key = options.key = use_classes ? \"class\" : \"color\";\n\n        let result = {\n            content: text\n          , fg: null\n          , bg: null\n          , fg_truecolor: null\n          , bg_truecolor: null\n          , isInverted: false\n          , clearLine: options.clearLine\n          , decoration: null\n          , decorations: []\n          , was_processed: false\n          , isEmpty: () => !result.content\n        };\n\n        // Each \"chunk\" is the text after the CSI (ESC + \"[\") and before the next CSI/EOF.\n        //\n        // This regex matches four groups within a chunk.\n        //\n        // The first and third groups match code type.\n        // We supported only SGR command. It has empty first group and \"m\" in third.\n        //\n        // The second group matches all of the number+semicolon command sequences\n        // before the \"m\" (or other trailing) character.\n        // These are the graphics or SGR commands.\n        //\n        // The last group is the text (including newlines) that is colored by\n        // the other group\"s commands.\n        let matches = text.match(/^([!\\x3c-\\x3f]*)([\\d;]*)([\\x20-\\x2c]*[\\x40-\\x7e])([\\s\\S]*)/m);\n\n        if (!matches) return result;\n\n        let orig_txt = result.content = matches[4];\n        let nums = matches[2].split(\";\");\n\n        // We currently support only \"SGR\" (Select Graphic Rendition)\n        // Simply ignore if not a SGR command.\n        if (matches[1] !== \"\" || matches[3] !== \"m\") {\n            return result;\n        }\n\n        if (!markup) {\n            return result;\n        }\n\n        let self = this;\n\n        while (nums.length > 0) {\n            let num_str = nums.shift();\n            let num = parseInt(num_str);\n\n            if (isNaN(num) || num === 0) {\n                self.fg = self.bg = null;\n                self.decorations = [];\n            } else if (num === 1) {\n                self.decorations.push(\"bold\");\n            } else if (num === 2) {\n                self.decorations.push(\"dim\");\n            // Enable code 2 to get string\n            } else if (num === 3) {\n                  self.decorations.push(\"italic\");\n            } else if (num === 4) {\n                self.decorations.push(\"underline\");\n            } else if (num === 5) {\n                self.decorations.push(\"blink\");\n            } else if (num === 7) {\n                self.decorations.push(\"reverse\");\n            } else if (num === 8) {\n                self.decorations.push(\"hidden\");\n            // Enable code 9 to get strikethrough\n            } else if (num === 9) {\n                self.decorations.push(\"strikethrough\");\n            /**\n             * Add several widely used style codes\n             * @see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters\n             */\n            } else if (num === 21) {\n                self.removeDecoration(\"bold\");\n            } else if (num === 22) {\n                self.removeDecoration(\"bold\");\n                self.removeDecoration(\"dim\");\n            } else if (num === 23) {\n                self.removeDecoration(\"italic\");\n            } else if (num === 24) {\n                self.removeDecoration(\"underline\");\n            } else if (num === 25) {\n                self.removeDecoration(\"blink\");\n            } else if (num === 27) {\n                self.removeDecoration(\"reverse\");\n            } else if (num === 28) {\n                self.removeDecoration(\"hidden\");\n            } else if (num === 29) {\n                self.removeDecoration(\"strikethrough\");\n            } else if (num === 39) {\n                self.fg = null;\n            } else if (num === 49) {\n                self.bg = null;\n            // Foreground color\n            } else if ((num >= 30) && (num < 38)) {\n                self.fg = ANSI_COLORS[0][(num % 10)][key];\n            // Foreground bright color\n            } else if ((num >= 90) && (num < 98)) {\n                self.fg = ANSI_COLORS[1][(num % 10)][key];\n            // Background color\n            } else if ((num >= 40) && (num < 48)) {\n                self.bg = ANSI_COLORS[0][(num % 10)][key];\n            // Background bright color\n            } else if ((num >= 100) && (num < 108)) {\n                self.bg = ANSI_COLORS[1][(num % 10)][key];\n            } else if (num === 38 || num === 48) { // extend color (38=fg, 48=bg)\n                let is_foreground = (num === 38);\n                if (nums.length >= 1) {\n                    let mode = nums.shift();\n                    if (mode === \"5\" && nums.length >= 1) { // palette color\n                        let palette_index = parseInt(nums.shift());\n                        if (palette_index >= 0 && palette_index <= 255) {\n                            if (!use_classes) {\n                                if (!this.PALETTE_COLORS) {\n                                    self.setupPalette();\n                                }\n                                if (is_foreground) {\n                                    self.fg = this.PALETTE_COLORS[palette_index];\n                                } else {\n                                    self.bg = this.PALETTE_COLORS[palette_index];\n                                }\n                            } else {\n                                let klass = (palette_index >= 16)\n                                    ? (\"ansi-palette-\" + palette_index)\n                                    : ANSI_COLORS[palette_index > 7 ? 1 : 0][palette_index % 8][\"class\"];\n                                    if (is_foreground) {\n                                        self.fg = klass;\n                                    } else {\n                                        self.bg = klass;\n                                    }\n                            }\n                        }\n                    } else if(mode === \"2\" && nums.length >= 3) { // true color\n                        let r = parseInt(nums.shift());\n                        let g = parseInt(nums.shift());\n                        let b = parseInt(nums.shift());\n                        if ((r >= 0 && r <= 255) && (g >= 0 && g <= 255) && (b >= 0 && b <= 255)) {\n                            let color = r + \", \" + g + \", \" + b;\n                            if (!use_classes) {\n                                if (is_foreground) {\n                                    self.fg = color;\n                                } else {\n                                    self.bg = color;\n                                }\n                            } else {\n                                if (is_foreground) {\n                                    self.fg = \"ansi-truecolor\";\n                                    self.fg_truecolor = color;\n                                } else {\n                                    self.bg = \"ansi-truecolor\";\n                                    self.bg_truecolor = color;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        if ((self.fg === null) && (self.bg === null) && (self.decorations.length === 0)) {\n            return result;\n        } else {\n            let styles = [];\n            let classes = [];\n            let data = {};\n\n            result.fg = self.fg;\n            result.bg = self.bg;\n            result.fg_truecolor = self.fg_truecolor;\n            result.bg_truecolor = self.bg_truecolor;\n            result.decorations = self.decorations;\n            result.decoration = self.decorations.slice(-1).pop() || null;\n            result.was_processed = true;\n\n            return result;\n        }\n    }\n\n    /**\n     * processChunk\n     * Processes the current chunk of text.\n     *\n     * @name processChunk\n     * @function\n     * @param {String} text The input text.\n     * @param {Object} options An object containing the following fields:\n     *\n     *  - `json` (Boolean): If `true`, the result will be an object.\n     *  - `use_classes` (Boolean): If `true`, HTML classes will be appended to the HTML output.\n     *\n     * @param {Boolean} markup If false, the colors will not be parsed.\n     * @return {Object|String} The result (object if `json` is wanted back or string otherwise).\n     */\n    processChunk (text, options, markup) {\n        options = options || {};\n        let jsonChunk = this.processChunkJson(text, options, markup);\n        let use_classes = options.use_classes;\n\n        // \"reverse\" decoration reverses foreground and background colors\n        jsonChunk.decorations = jsonChunk.decorations\n            .filter((decoration) => {\n                if (decoration === \"reverse\") {\n                    // when reversing, missing colors are defaulted to black (bg) and white (fg)\n                    if (!jsonChunk.fg) {\n                      jsonChunk.fg = ANSI_COLORS[0][7][use_classes ? \"class\" : \"color\"];\n                    }\n                    if (!jsonChunk.bg) {\n                      jsonChunk.bg = ANSI_COLORS[0][0][use_classes ? \"class\" : \"color\"];\n                    }\n                    let tmpFg = jsonChunk.fg;\n                    jsonChunk.fg = jsonChunk.bg;\n                    jsonChunk.bg = tmpFg;\n                    let tmpFgTrue = jsonChunk.fg_truecolor;\n                    jsonChunk.fg_truecolor = jsonChunk.bg_truecolor;\n                    jsonChunk.bg_truecolor = tmpFgTrue;\n                    jsonChunk.isInverted = true;\n                    return false;\n                }\n                return true;\n            });\n\n        if (options.json) { return jsonChunk; }\n        if (jsonChunk.isEmpty()) { return \"\"; }\n        if (!jsonChunk.was_processed) { return jsonChunk.content; }\n\n        let colors = [];\n        let decorations = [];\n        let textDecorations = [];\n        let data = {};\n\n        let render_data = data => {\n            let fragments = [];\n            let key;\n            for (key in data) {\n                if (data.hasOwnProperty(key)) {\n                    fragments.push(\"data-\" + key + \"=\\\"\" + this.escapeForHtml(data[key]) + \"\\\"\");\n                }\n            }\n            return fragments.length > 0 ? \" \" + fragments.join(\" \") : \"\";\n        };\n\n        if (jsonChunk.isInverted) {\n          data[\"ansi-is-inverted\"] = \"true\";\n        }\n\n        if (jsonChunk.fg) {\n            if (use_classes) {\n                colors.push(jsonChunk.fg + \"-fg\");\n                if (jsonChunk.fg_truecolor !== null) {\n                    data[\"ansi-truecolor-fg\"] = jsonChunk.fg_truecolor;\n                    jsonChunk.fg_truecolor = null;\n                }\n            } else {\n                colors.push(\"color:rgb(\" + jsonChunk.fg + \")\");\n            }\n        }\n\n        if (jsonChunk.bg) {\n            if (use_classes) {\n                colors.push(jsonChunk.bg + \"-bg\");\n                if (jsonChunk.bg_truecolor !== null) {\n                    data[\"ansi-truecolor-bg\"] = jsonChunk.bg_truecolor;\n                    jsonChunk.bg_truecolor = null;\n                }\n            } else {\n              colors.push(\"background-color:rgb(\" + jsonChunk.bg + \")\");\n            }\n        }\n\n        jsonChunk.decorations.forEach((decoration) => {\n            // use classes\n            if (use_classes) {\n                decorations.push(\"ansi-\" + decoration);\n                return;\n            }\n            // use styles\n            if (decoration === \"bold\") {\n                decorations.push(\"font-weight:bold\");\n            } else if (decoration === \"dim\") {\n                decorations.push(\"opacity:0.5\");\n            } else if (decoration === \"italic\") {\n                decorations.push(\"font-style:italic\");\n            } else if (decoration === \"hidden\") {\n                decorations.push(\"visibility:hidden\");\n            } else if (decoration === \"strikethrough\") {\n                textDecorations.push(\"line-through\");\n            } else {\n                // underline and blink are treated here\n                textDecorations.push(decoration);\n            }\n        });\n\n        if (textDecorations.length) {\n            decorations.push(\"text-decoration:\" + textDecorations.join(\" \"));\n        }\n\n        if (use_classes) {\n            return \"<span class=\\\"\" + colors.concat(decorations).join(\" \") + \"\\\"\" + render_data(data) + \">\" + jsonChunk.content + \"</span>\";\n        } else {\n            return \"<span style=\\\"\" + colors.concat(decorations).join(\";\") + \"\\\"\" + render_data(data) + \">\" + jsonChunk.content + \"</span>\";\n        }\n    }\n\n    removeDecoration(decoration) {\n        const index = this.decorations.indexOf(decoration);\n\n        if (index >= 0) {\n            this.decorations.splice(index, 1);\n        }\n    }\n}\n\nmodule.exports = Anser;\n"]}