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KAAM,aA/I/D,SAAS1C,EAAmBF,GAC3B,IAAI0C,EAAO1C,EAAI0C,KAAO1C,EAAI0C,MAAQ,GAClC,OAAOA,EAAK,gBAAkBA,EAAK,iBAAmB,IAhDxD","sources":["webpack://sakurairo-scripts/./node_modules/prismjs/plugins/command-line/prism-command-line.js"],"sourcesContent":["(function () {\n\n\tif (typeof Prism === 'undefined' || typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tvar CLASS_PATTERN = /(?:^|\\s)command-line(?:\\s|$)/;\n\tvar PROMPT_CLASS = 'command-line-prompt';\n\n\t/** @type {(str: string, prefix: string) => boolean} */\n\tvar startsWith = ''.startsWith\n\t\t? function (s, p) { return s.startsWith(p); }\n\t\t: function (s, p) { return s.indexOf(p) === 0; };\n\n\t// Support for IE11 that has no endsWith()\n\t/** @type {(str: string, suffix: string) => boolean} */\n\tvar endsWith = ''.endsWith\n\t\t? function (str, suffix) {\n\t\t\treturn str.endsWith(suffix);\n\t\t}\n\t\t: function (str, suffix) {\n\t\t\tvar len = str.length;\n\t\t\treturn str.substring(len - suffix.length, len) === suffix;\n\t\t};\n\n\t/**\n\t * Returns whether the given hook environment has a command line info object.\n\t *\n\t * @param {any} env\n\t * @returns {boolean}\n\t */\n\tfunction hasCommandLineInfo(env) {\n\t\tvar vars = env.vars = env.vars || {};\n\t\treturn 'command-line' in vars;\n\t}\n\t/**\n\t * Returns the command line info object from the given hook environment.\n\t *\n\t * @param {any} env\n\t * @returns {CommandLineInfo}\n\t *\n\t * @typedef CommandLineInfo\n\t * @property {boolean} [complete]\n\t * @property {number} [numberOfLines]\n\t * @property {string[]} [outputLines]\n\t */\n\tfunction getCommandLineInfo(env) {\n\t\tvar vars = env.vars = env.vars || {};\n\t\treturn vars['command-line'] = vars['command-line'] || {};\n\t}\n\n\n\tPrism.hooks.add('before-highlight', function (env) {\n\t\tvar commandLine = getCommandLineInfo(env);\n\n\t\tif (commandLine.complete || !env.code) {\n\t\t\tcommandLine.complete = true;\n\t\t\treturn;\n\t\t}\n\n\t\t// Works only for <code> wrapped inside <pre> (not inline).\n\t\tvar pre = env.element.parentElement;\n\t\tif (!pre || !/pre/i.test(pre.nodeName) || // Abort only if neither the <pre> nor the <code> have the class\n\t\t\t(!CLASS_PATTERN.test(pre.className) && !CLASS_PATTERN.test(env.element.className))) {\n\t\t\tcommandLine.complete = true;\n\t\t\treturn;\n\t\t}\n\n\t\t// The element might be highlighted multiple times, so we just remove the previous prompt\n\t\tvar existingPrompt = env.element.querySelector('.' + PROMPT_CLASS);\n\t\tif (existingPrompt) {\n\t\t\texistingPrompt.remove();\n\t\t}\n\n\t\tvar codeLines = env.code.split('\\n');\n\n\t\tcommandLine.numberOfLines = codeLines.length;\n\t\t/** @type {string[]} */\n\t\tvar outputLines = commandLine.outputLines = [];\n\n\t\tvar outputSections = pre.getAttribute('data-output');\n\t\tvar outputFilter = pre.getAttribute('data-filter-output');\n\t\tif (outputSections !== null) { // The user specified the output lines. -- cwells\n\t\t\toutputSections.split(',').forEach(function (section) {\n\t\t\t\tvar range = section.split('-');\n\t\t\t\tvar outputStart = parseInt(range[0], 10);\n\t\t\t\tvar outputEnd = range.length === 2 ? parseInt(range[1], 10) : outputStart;\n\n\t\t\t\tif (!isNaN(outputStart) && !isNaN(outputEnd)) {\n\t\t\t\t\tif (outputStart < 1) {\n\t\t\t\t\t\toutputStart = 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (outputEnd > codeLines.length) {\n\t\t\t\t\t\toutputEnd = codeLines.length;\n\t\t\t\t\t}\n\t\t\t\t\t// Convert start and end to 0-based to simplify the arrays. -- cwells\n\t\t\t\t\toutputStart--;\n\t\t\t\t\toutputEnd--;\n\t\t\t\t\t// Save the output line in an array and clear it in the code so it's not highlighted. -- cwells\n\t\t\t\t\tfor (var j = outputStart; j <= outputEnd; j++) {\n\t\t\t\t\t\toutputLines[j] = codeLines[j];\n\t\t\t\t\t\tcodeLines[j] = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else if (outputFilter) { // Treat lines beginning with this string as output. -- cwells\n\t\t\tfor (var i = 0; i < codeLines.length; i++) {\n\t\t\t\tif (startsWith(codeLines[i], outputFilter)) { // This line is output. -- cwells\n\t\t\t\t\toutputLines[i] = codeLines[i].slice(outputFilter.length);\n\t\t\t\t\tcodeLines[i] = '';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar continuationLineIndicies = commandLine.continuationLineIndicies = new Set();\n\t\tvar lineContinuationStr = pre.getAttribute('data-continuation-str');\n\t\tvar continuationFilter = pre.getAttribute('data-filter-continuation');\n\n\t\t// Identify code lines where the command has continued onto subsequent\n\t\t// lines and thus need a different prompt. Need to do this after the output\n\t\t// lines have been removed to ensure we don't pick up a continuation string\n\t\t// in an output line.\n\t\tfor (var j = 0; j < codeLines.length; j++) {\n\t\t\tvar line = codeLines[j];\n\t\t\tif (!line) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Record the next line as a continuation if this one ends in a continuation str.\n\t\t\tif (lineContinuationStr && endsWith(line, lineContinuationStr)) {\n\t\t\t\tcontinuationLineIndicies.add(j + 1);\n\t\t\t}\n\t\t\t// Record this line as a continuation if marked with a continuation prefix\n\t\t\t// (that we will remove).\n\t\t\tif (j > 0 && continuationFilter && startsWith(line, continuationFilter)) {\n\t\t\t\tcodeLines[j] = line.slice(continuationFilter.length);\n\t\t\t\tcontinuationLineIndicies.add(j);\n\t\t\t}\n\t\t}\n\n\t\tenv.code = codeLines.join('\\n');\n\t});\n\n\tPrism.hooks.add('before-insert', function (env) {\n\t\tvar commandLine = getCommandLineInfo(env);\n\n\t\tif (commandLine.complete) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Reinsert the output lines into the highlighted code. -- cwells\n\t\tvar codeLines = env.highlightedCode.split('\\n');\n\t\tvar outputLines = commandLine.outputLines || [];\n\t\tfor (var i = 0, l = codeLines.length; i < l; i++) {\n\t\t\t// Add spans to allow distinction of input/output text for styling\n\t\t\tif (outputLines.hasOwnProperty(i)) {\n\t\t\t\t// outputLines were removed from codeLines so missed out on escaping\n\t\t\t\t// of markup so do it here.\n\t\t\t\tcodeLines[i] = '<span class=\"token output\">'\n\t\t\t\t\t+ Prism.util.encode(outputLines[i]) + '</span>';\n\t\t\t} else {\n\t\t\t\tcodeLines[i] = '<span class=\"token command\">'\n\t\t\t\t\t+ codeLines[i] + '</span>';\n\t\t\t}\n\t\t}\n\t\tenv.highlightedCode = codeLines.join('\\n');\n\t});\n\n\tPrism.hooks.add('complete', function (env) {\n\t\tif (!hasCommandLineInfo(env)) {\n\t\t\t// the previous hooks never ran\n\t\t\treturn;\n\t\t}\n\n\t\tvar commandLine = getCommandLineInfo(env);\n\n\t\tif (commandLine.complete) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar pre = env.element.parentElement;\n\t\tif (CLASS_PATTERN.test(env.element.className)) { // Remove the class \"command-line\" from the <code>\n\t\t\tenv.element.className = env.element.className.replace(CLASS_PATTERN, ' ');\n\t\t}\n\t\tif (!CLASS_PATTERN.test(pre.className)) { // Add the class \"command-line\" to the <pre>\n\t\t\tpre.className += ' command-line';\n\t\t}\n\n\t\tfunction getAttribute(key, defaultValue) {\n\t\t\treturn (pre.getAttribute(key) || defaultValue).replace(/\"/g, '"');\n\t\t}\n\n\t\t// Create the \"rows\" that will become the command-line prompts. -- cwells\n\t\tvar promptLines = '';\n\t\tvar rowCount = commandLine.numberOfLines || 0;\n\t\tvar promptText = getAttribute('data-prompt', '');\n\t\tvar promptLine;\n\t\tif (promptText !== '') {\n\t\t\tpromptLine = '<span data-prompt=\"' + promptText + '\"></span>';\n\t\t} else {\n\t\t\tvar user = getAttribute('data-user', 'user');\n\t\t\tvar host = getAttribute('data-host', 'localhost');\n\t\t\tpromptLine = '<span data-user=\"' + user + '\" data-host=\"' + host + '\"></span>';\n\t\t}\n\n\t\tvar continuationLineIndicies = commandLine.continuationLineIndicies || new Set();\n\t\tvar continuationPromptText = getAttribute('data-continuation-prompt', '>');\n\t\tvar continuationPromptLine = '<span data-continuation-prompt=\"' + continuationPromptText + '\"></span>';\n\n\t\t// Assemble all the appropriate prompt/continuation lines\n\t\tfor (var j = 0; j < rowCount; j++) {\n\t\t\tif (continuationLineIndicies.has(j)) {\n\t\t\t\tpromptLines += continuationPromptLine;\n\t\t\t} else {\n\t\t\t\tpromptLines += promptLine;\n\t\t\t}\n\t\t}\n\n\t\t// Create the wrapper element. -- cwells\n\t\tvar prompt = document.createElement('span');\n\t\tprompt.className = PROMPT_CLASS;\n\t\tprompt.innerHTML = promptLines;\n\n\t\t// Remove the prompt from the output lines. -- cwells\n\t\tvar outputLines = commandLine.outputLines || [];\n\t\tfor (var i = 0, l = outputLines.length; i < l; i++) {\n\t\t\tif (outputLines.hasOwnProperty(i)) {\n\t\t\t\tvar node = prompt.children[i];\n\t\t\t\tnode.removeAttribute('data-user');\n\t\t\t\tnode.removeAttribute('data-host');\n\t\t\t\tnode.removeAttribute('data-prompt');\n\t\t\t}\n\t\t}\n\n\t\tenv.element.insertBefore(prompt, env.element.firstChild);\n\t\tcommandLine.complete = true;\n\t});\n\n}());\n"],"names":["Prism","document","CLASS_PATTERN","PROMPT_CLASS","startsWith","s","p","indexOf","endsWith","str","suffix","len","length","substring","hooks","add","env","commandLine","getCommandLineInfo","complete","code","pre","element","parentElement","test","nodeName","className","existingPrompt","querySelector","remove","codeLines","split","numberOfLines","outputLines","outputSections","getAttribute","outputFilter","forEach","section","range","outputStart","parseInt","outputEnd","isNaN","j","i","slice","continuationLineIndicies","Set","lineContinuationStr","continuationFilter","line","join","highlightedCode","l","hasOwnProperty","util","encode","vars","hasCommandLineInfo","replace","promptLine","promptLines","rowCount","promptText","continuationPromptLine","has","prompt","createElement","innerHTML","node","children","removeAttribute","insertBefore","firstChild","key","defaultValue"],"sourceRoot":""}
|