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AHI,IAAW,IACX,GAAO,oBAAsB,KAE1B,CACX,CAEA,MAAQ,EAAO,QAAU,GACrB,EAAO,OAEP,EAAyB,MAAlB,EAAO,OAGlB,MAAO,QACX,IAER,GA4DJ","file":"/npm/cm-show-invisibles@3.1.0/lib/show-invisibles.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/cm-show-invisibles@3.1.0/lib/show-invisibles.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/* global CodeMirror */\n/* global define */\n\n((mod) => {\n    if (typeof exports === 'object' && typeof module === 'object') // CommonJS\n        return mod(require('codemirror/lib/codemirror'));\n    \n    if (typeof define === 'function' && define.amd) // AMD\n        return define(['codemirror/lib/codemirror'], mod);\n    \n    mod(CodeMirror);\n})((CodeMirror) => {\n    CodeMirror.defineOption('showInvisibles', false, (cm, val, prev) => {\n        let Count = 0;\n        const Maximum = cm.getOption('maxInvisibles') || 16;\n        \n        if (prev === CodeMirror.Init)\n            prev = false;\n        \n        if (prev && !val) {\n            cm.removeOverlay('invisibles');\n            return rm();\n        }\n        \n        if (!prev && val) {\n            add(Maximum);\n            \n            cm.addOverlay({\n                name: 'invisibles',\n                token: function nextToken(stream) {\n                    let spaces = 0;\n                    let peek = stream.peek() === ' ';\n                    \n                    if (peek) {\n                        while (peek && spaces < Maximum) {\n                            ++spaces;\n                            \n                            stream.next();\n                            peek = stream.peek() === ' ';\n                        }\n                        \n                        let ret = 'whitespace whitespace-' + spaces;\n                        \n                        /*\n                         * styles should be different\n                         * could not be two same styles\n                         * beside because of this check in runmode\n                         * function in `codemirror.js`:\n                         *\n                         * 6624: if (!flattenSpans || curStyle != style) {}\n                         */\n                        if (spaces === Maximum)\n                            ret += ' whitespace-rand-' + Count++;\n                        \n                        return ret;\n                    }\n                    \n                    while (!stream.eol() && !peek) {\n                        stream.next();\n                        \n                        peek = stream.peek() === ' ';\n                    }\n                    \n                    return 'cm-eol';\n                },\n            });\n        }\n    });\n    \n    function add(max) {\n        const classBase = '.CodeMirror .cm-whitespace-';\n        const spaceChar = '·';\n        const style = document.createElement('style');\n        \n        style.setAttribute('data-name', 'js-show-invisibles');\n        \n        let rules = '';\n        let spaceChars = '';\n        \n        for (let i = 1; i <= max; ++i) {\n            spaceChars += spaceChar;\n            rules += classBase + i + `:not([class*=\"cm-trailing-space-\"])::before { content: \"${spaceChars}\";}\\n`;\n        }\n        \n        const gfmRules = '[class*=cm-trailing-space]::before{content: \"·\";}';\n        \n        style.textContent = [\n            getStyle(),\n            getEOL(),\n            rules,\n            gfmRules,\n        ].join('\\n');\n        \n        document.head.appendChild(style);\n    }\n    \n    function rm() {\n        const style = document.querySelector('[data-name=\"js-show-invisibles\"]');\n        document.head.removeChild(style);\n    }\n    \n    function getStyle() {\n        const style = [\n            '.cm-whitespace::before {',\n            'position: absolute;',\n            'pointer-events: none;',\n            'color: #404F7D;',\n            '}',\n        ].join('');\n        \n        return style;\n    }\n    \n    function getEOL() {\n        const style = [\n            '.CodeMirror-code > div > pre > span::after, .CodeMirror-line > span::after {',\n            '   pointer-events: none;',\n            '   color: #404F7D;',\n            '   content: \"¬\"',\n            '}',\n            '.CodeMirror-code > div:last-child > pre > span::after {',\n            '   display: none;',\n            '}',\n        ].join('');\n        \n        return style;\n    }\n});\n\n"]}