--- /dev/null
+(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId]) {
+/******/ return installedModules[moduleId].exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
+/******/ }
+/******/ };
+/******/
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/
+/******/ // create a fake namespace object
+/******/ // mode & 1: value is a module id, require it
+/******/ // mode & 2: merge all properties of value into the ns
+/******/ // mode & 4: return value when already ns object
+/******/ // mode & 8|1: behave like require
+/******/ __webpack_require__.t = function(value, mode) {
+/******/ if(mode & 1) value = __webpack_require__(value);
+/******/ if(mode & 8) return value;
+/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
+/******/ var ns = Object.create(null);
+/******/ __webpack_require__.r(ns);
+/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
+/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
+/******/ return ns;
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.activate = void 0;
+const coc_nvim_1 = __webpack_require__(1);
+const engine_1 = __webpack_require__(2);
+const documentSelector = [
+ {
+ language: 'markdown',
+ scheme: 'file'
+ },
+ {
+ language: 'markdown',
+ scheme: 'untitled'
+ }
+];
+let documentVersion = 0;
+const engine = new engine_1.MarkdownlintEngine();
+const config = coc_nvim_1.workspace.getConfiguration('markdownlint');
+function didOpenTextDocument(document) {
+ if (config.get('onOpen', true)) {
+ engine.lint(document);
+ }
+}
+async function didChangeTextDocument(params) {
+ if (!config.get('onChange', true)) {
+ return;
+ }
+ if (params.textDocument.version && documentVersion !== params.textDocument.version) {
+ documentVersion = params.textDocument.version;
+ const { document } = await coc_nvim_1.workspace.getCurrentState();
+ engine.lint(document);
+ }
+}
+async function didSaveTextDocument(document) {
+ if (config.get('onSave', true)) {
+ engine.lint(document);
+ }
+}
+async function activate(context) {
+ await engine.parseConfig();
+ context.subscriptions.push(coc_nvim_1.languages.registerCodeActionProvider(documentSelector, engine, 'markdownlint'), coc_nvim_1.commands.registerCommand(engine.fixAllCommandName, async () => {
+ const { document } = await coc_nvim_1.workspace.getCurrentState();
+ engine.fixAll(document);
+ }), coc_nvim_1.workspace.onDidOpenTextDocument(didOpenTextDocument), coc_nvim_1.workspace.onDidChangeTextDocument(didChangeTextDocument), coc_nvim_1.workspace.onDidSaveTextDocument(didSaveTextDocument), coc_nvim_1.events.on('BufEnter', bufnr => {
+ if (!bufnr) {
+ return;
+ }
+ const doc = coc_nvim_1.workspace.getDocument(bufnr);
+ if (!doc) {
+ return;
+ }
+ didOpenTextDocument(doc.textDocument);
+ }));
+ coc_nvim_1.workspace.documents.map((doc) => {
+ didOpenTextDocument(doc.textDocument);
+ });
+}
+exports.activate = activate;
+
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports) {
+
+module.exports = require("coc.nvim");
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.MarkdownlintEngine = void 0;
+const coc_nvim_1 = __webpack_require__(1);
+const deep_extend_1 = __importDefault(__webpack_require__(3));
+const fs_1 = __importDefault(__webpack_require__(4));
+const js_yaml_1 = __importDefault(__webpack_require__(5));
+const markdownlint_1 = __importDefault(__webpack_require__(37));
+const markdownlint_rule_helpers_1 = __webpack_require__(156);
+const path_1 = __importDefault(__webpack_require__(38));
+const rc_1 = __importDefault(__webpack_require__(157));
+const vscode_languageserver_protocol_1 = __webpack_require__(162);
+const projectConfigFiles = ['.markdownlint.json', '.markdownlint.yaml', '.markdownlint.yml'];
+const configFileParsers = [JSON.parse, js_yaml_1.default.safeLoad];
+class MarkdownlintEngine {
+ constructor() {
+ this.fixAllCommandName = 'markdownlint.fixAll';
+ this.source = 'markdownlint';
+ this.outputChannel = coc_nvim_1.workspace.createOutputChannel(this.source);
+ this.diagnosticCollection = coc_nvim_1.languages.createDiagnosticCollection(this.source);
+ this.config = {};
+ }
+ outputLine(message) {
+ if (this.outputChannel) {
+ this.outputChannel.appendLine(`[${new Date().toLocaleTimeString()}] ${message}`);
+ }
+ }
+ async parseConfig() {
+ try {
+ this.config = rc_1.default(this.source, {});
+ this.outputLine(`Info: global config: ${JSON.stringify(rc_1.default(this.source, {}))}`);
+ }
+ catch (e) {
+ this.outputLine(`Error: global config parse failed: ${e}`);
+ }
+ try {
+ const preferences = coc_nvim_1.workspace.getConfiguration('coc.preferences');
+ const rootFolder = await coc_nvim_1.workspace.resolveRootFolder(coc_nvim_1.Uri.parse(coc_nvim_1.workspace.uri), preferences.get('rootPatterns', []));
+ for (const projectConfigFile of projectConfigFiles) {
+ const fullPath = path_1.default.join(rootFolder, projectConfigFile);
+ if (fs_1.default.existsSync(fullPath)) {
+ // @ts-ignore
+ const projectConfig = markdownlint_1.default.readConfigSync(fullPath, configFileParsers);
+ this.config = deep_extend_1.default(this.config, projectConfig);
+ this.outputLine(`Info: local config: ${fullPath}, ${JSON.stringify(projectConfig)}`);
+ break;
+ }
+ }
+ }
+ catch (e) {
+ this.outputLine(`Error: local config parse failed: ${e}`);
+ }
+ const cocConfig = coc_nvim_1.workspace.getConfiguration('markdownlint').get('config');
+ if (cocConfig) {
+ this.config = deep_extend_1.default(this.config, cocConfig);
+ this.outputLine(`Info: config from coc-settings.json: ${JSON.stringify(cocConfig)}`);
+ }
+ this.outputLine(`Info: full config: ${JSON.stringify(this.config)}`);
+ }
+ markdownlintWrapper(document) {
+ const options = {
+ resultVersion: 3,
+ config: this.config,
+ // customRules: customRules,
+ strings: {
+ [document.uri]: document.getText()
+ }
+ };
+ let results = [];
+ try {
+ results = markdownlint_1.default.sync(options)[document.uri];
+ }
+ catch (e) {
+ this.outputLine(`Error: lint exception: ${e.stack}`);
+ }
+ return results;
+ }
+ async provideCodeActions(document, _range, context) {
+ const codeActions = [];
+ const fixInfoDiagnostics = [];
+ for (const diagnostic of context.diagnostics) {
+ // @ts-ignore
+ if (diagnostic.fixInfo) {
+ // @ts-ignore
+ const lineNumber = diagnostic.fixInfo.lineNumber - 1 || diagnostic.range.start.line;
+ const line = await coc_nvim_1.workspace.getLine(document.uri, lineNumber);
+ // @ts-ignore
+ const newText = markdownlint_rule_helpers_1.applyFix(line, diagnostic.fixInfo, '\n');
+ const edit = { changes: {} };
+ if (typeof newText === 'string') {
+ const range = vscode_languageserver_protocol_1.Range.create(lineNumber, 0, lineNumber, line.length);
+ edit.changes[document.uri] = [vscode_languageserver_protocol_1.TextEdit.replace(range, newText)];
+ }
+ else {
+ edit.changes[document.uri] = [vscode_languageserver_protocol_1.TextEdit.del(diagnostic.range)];
+ }
+ const title = `Fix: ${diagnostic.message.split(':')[0]}`;
+ const action = {
+ title,
+ edit,
+ diagnostics: [...context.diagnostics]
+ };
+ fixInfoDiagnostics.push(diagnostic);
+ codeActions.push(action);
+ }
+ }
+ if (fixInfoDiagnostics.length) {
+ const title = 'Fix All error found by markdownlint';
+ const sourceFixAllAction = {
+ title,
+ kind: vscode_languageserver_protocol_1.CodeActionKind.SourceFixAll,
+ diagnostics: fixInfoDiagnostics,
+ command: {
+ title,
+ command: this.fixAllCommandName
+ }
+ };
+ codeActions.push(sourceFixAllAction);
+ }
+ return codeActions;
+ }
+ lint(document) {
+ this.diagnosticCollection.clear();
+ if (document.languageId !== 'markdown') {
+ return;
+ }
+ const results = this.markdownlintWrapper(document);
+ if (!results.length) {
+ return;
+ }
+ const diagnostics = [];
+ results.forEach((result) => {
+ const ruleDescription = result.ruleDescription;
+ let message = result.ruleNames.join('/') + ': ' + ruleDescription;
+ if (result.errorDetail) {
+ message += ' [' + result.errorDetail + ']';
+ }
+ const start = vscode_languageserver_protocol_1.Position.create(result.lineNumber - 1, 0);
+ const end = vscode_languageserver_protocol_1.Position.create(result.lineNumber - 1, 0);
+ if (result.errorRange) {
+ start.character = result.errorRange[0] - 1;
+ end.character = start.character + result.errorRange[1];
+ }
+ const range = vscode_languageserver_protocol_1.Range.create(start, end);
+ const diagnostic = vscode_languageserver_protocol_1.Diagnostic.create(range, message);
+ diagnostic.severity = vscode_languageserver_protocol_1.DiagnosticSeverity.Warning;
+ diagnostic.source = this.source;
+ // @ts-ignore
+ diagnostic.fixInfo = result.fixInfo;
+ diagnostics.push(diagnostic);
+ });
+ this.diagnosticCollection.set(document.uri, diagnostics);
+ }
+ async fixAll(document) {
+ const results = this.markdownlintWrapper(document);
+ if (!results.length) {
+ return;
+ }
+ const text = document.getText();
+ const fixedText = markdownlint_rule_helpers_1.applyFixes(text, results);
+ if (text != fixedText) {
+ const doc = coc_nvim_1.workspace.getDocument(document.uri);
+ const end = vscode_languageserver_protocol_1.Position.create(doc.lineCount - 1, doc.getline(doc.lineCount - 1).length);
+ const edit = {
+ changes: {
+ [document.uri]: [vscode_languageserver_protocol_1.TextEdit.replace(vscode_languageserver_protocol_1.Range.create(vscode_languageserver_protocol_1.Position.create(0, 0), end), fixedText)]
+ }
+ };
+ await coc_nvim_1.workspace.applyEdit(edit);
+ }
+ }
+}
+exports.MarkdownlintEngine = MarkdownlintEngine;
+
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/*!
+ * @description Recursive object extending
+ * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
+ * @license MIT
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013-2018 Viacheslav Lotsmanov
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+
+function isSpecificValue(val) {
+ return (
+ val instanceof Buffer
+ || val instanceof Date
+ || val instanceof RegExp
+ ) ? true : false;
+}
+
+function cloneSpecificValue(val) {
+ if (val instanceof Buffer) {
+ var x = Buffer.alloc
+ ? Buffer.alloc(val.length)
+ : new Buffer(val.length);
+ val.copy(x);
+ return x;
+ } else if (val instanceof Date) {
+ return new Date(val.getTime());
+ } else if (val instanceof RegExp) {
+ return new RegExp(val);
+ } else {
+ throw new Error('Unexpected situation');
+ }
+}
+
+/**
+ * Recursive cloning array.
+ */
+function deepCloneArray(arr) {
+ var clone = [];
+ arr.forEach(function (item, index) {
+ if (typeof item === 'object' && item !== null) {
+ if (Array.isArray(item)) {
+ clone[index] = deepCloneArray(item);
+ } else if (isSpecificValue(item)) {
+ clone[index] = cloneSpecificValue(item);
+ } else {
+ clone[index] = deepExtend({}, item);
+ }
+ } else {
+ clone[index] = item;
+ }
+ });
+ return clone;
+}
+
+function safeGetProperty(object, property) {
+ return property === '__proto__' ? undefined : object[property];
+}
+
+/**
+ * Extening object that entered in first argument.
+ *
+ * Returns extended object or false if have no target object or incorrect type.
+ *
+ * If you wish to clone source object (without modify it), just use empty new
+ * object as first argument, like this:
+ * deepExtend({}, yourObj_1, [yourObj_N]);
+ */
+var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
+ if (arguments.length < 1 || typeof arguments[0] !== 'object') {
+ return false;
+ }
+
+ if (arguments.length < 2) {
+ return arguments[0];
+ }
+
+ var target = arguments[0];
+
+ // convert arguments to array and cut off target object
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ var val, src, clone;
+
+ args.forEach(function (obj) {
+ // skip argument if isn't an object, is null, or is an array
+ if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
+ return;
+ }
+
+ Object.keys(obj).forEach(function (key) {
+ src = safeGetProperty(target, key); // source value
+ val = safeGetProperty(obj, key); // new value
+
+ // recursion prevention
+ if (val === target) {
+ return;
+
+ /**
+ * if new value isn't object then just overwrite by new value
+ * instead of extending.
+ */
+ } else if (typeof val !== 'object' || val === null) {
+ target[key] = val;
+ return;
+
+ // just clone arrays (and recursive clone objects inside)
+ } else if (Array.isArray(val)) {
+ target[key] = deepCloneArray(val);
+ return;
+
+ // custom cloning and overwrite for specific objects
+ } else if (isSpecificValue(val)) {
+ target[key] = cloneSpecificValue(val);
+ return;
+
+ // overwrite by new value if source isn't object or array
+ } else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
+ target[key] = deepExtend({}, val);
+ return;
+
+ // source value and new value is objects both, extending...
+ } else {
+ target[key] = deepExtend(src, val);
+ return;
+ }
+ });
+ });
+
+ return target;
+};
+
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports) {
+
+module.exports = require("fs");
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+var yaml = __webpack_require__(6);
+
+
+module.exports = yaml;
+
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+var loader = __webpack_require__(7);
+var dumper = __webpack_require__(36);
+
+
+function deprecated(name) {
+ return function () {
+ throw new Error('Function ' + name + ' is deprecated and cannot be used.');
+ };
+}
+
+
+module.exports.Type = __webpack_require__(13);
+module.exports.Schema = __webpack_require__(12);
+module.exports.FAILSAFE_SCHEMA = __webpack_require__(16);
+module.exports.JSON_SCHEMA = __webpack_require__(15);
+module.exports.CORE_SCHEMA = __webpack_require__(14);
+module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
+module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(31);
+module.exports.load = loader.load;
+module.exports.loadAll = loader.loadAll;
+module.exports.safeLoad = loader.safeLoad;
+module.exports.safeLoadAll = loader.safeLoadAll;
+module.exports.dump = dumper.dump;
+module.exports.safeDump = dumper.safeDump;
+module.exports.YAMLException = __webpack_require__(9);
+
+// Deprecated schema names from JS-YAML 2.0.x
+module.exports.MINIMAL_SCHEMA = __webpack_require__(16);
+module.exports.SAFE_SCHEMA = __webpack_require__(11);
+module.exports.DEFAULT_SCHEMA = __webpack_require__(31);
+
+// Deprecated functions from JS-YAML 1.x.x
+module.exports.scan = deprecated('scan');
+module.exports.parse = deprecated('parse');
+module.exports.compose = deprecated('compose');
+module.exports.addConstructor = deprecated('addConstructor');
+
+
+/***/ }),
+/* 7 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/*eslint-disable max-len,no-use-before-define*/
+
+var common = __webpack_require__(8);
+var YAMLException = __webpack_require__(9);
+var Mark = __webpack_require__(10);
+var DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
+var DEFAULT_FULL_SCHEMA = __webpack_require__(31);
+
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+
+var CONTEXT_FLOW_IN = 1;
+var CONTEXT_FLOW_OUT = 2;
+var CONTEXT_BLOCK_IN = 3;
+var CONTEXT_BLOCK_OUT = 4;
+
+
+var CHOMPING_CLIP = 1;
+var CHOMPING_STRIP = 2;
+var CHOMPING_KEEP = 3;
+
+
+var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
+var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
+var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
+var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
+var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
+
+
+function _class(obj) { return Object.prototype.toString.call(obj); }
+
+function is_EOL(c) {
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
+}
+
+function is_WHITE_SPACE(c) {
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
+}
+
+function is_WS_OR_EOL(c) {
+ return (c === 0x09/* Tab */) ||
+ (c === 0x20/* Space */) ||
+ (c === 0x0A/* LF */) ||
+ (c === 0x0D/* CR */);
+}
+
+function is_FLOW_INDICATOR(c) {
+ return c === 0x2C/* , */ ||
+ c === 0x5B/* [ */ ||
+ c === 0x5D/* ] */ ||
+ c === 0x7B/* { */ ||
+ c === 0x7D/* } */;
+}
+
+function fromHexCode(c) {
+ var lc;
+
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ /*eslint-disable no-bitwise*/
+ lc = c | 0x20;
+
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
+ return lc - 0x61 + 10;
+ }
+
+ return -1;
+}
+
+function escapedHexLen(c) {
+ if (c === 0x78/* x */) { return 2; }
+ if (c === 0x75/* u */) { return 4; }
+ if (c === 0x55/* U */) { return 8; }
+ return 0;
+}
+
+function fromDecimalCode(c) {
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ return -1;
+}
+
+function simpleEscapeSequence(c) {
+ /* eslint-disable indent */
+ return (c === 0x30/* 0 */) ? '\x00' :
+ (c === 0x61/* a */) ? '\x07' :
+ (c === 0x62/* b */) ? '\x08' :
+ (c === 0x74/* t */) ? '\x09' :
+ (c === 0x09/* Tab */) ? '\x09' :
+ (c === 0x6E/* n */) ? '\x0A' :
+ (c === 0x76/* v */) ? '\x0B' :
+ (c === 0x66/* f */) ? '\x0C' :
+ (c === 0x72/* r */) ? '\x0D' :
+ (c === 0x65/* e */) ? '\x1B' :
+ (c === 0x20/* Space */) ? ' ' :
+ (c === 0x22/* " */) ? '\x22' :
+ (c === 0x2F/* / */) ? '/' :
+ (c === 0x5C/* \ */) ? '\x5C' :
+ (c === 0x4E/* N */) ? '\x85' :
+ (c === 0x5F/* _ */) ? '\xA0' :
+ (c === 0x4C/* L */) ? '\u2028' :
+ (c === 0x50/* P */) ? '\u2029' : '';
+}
+
+function charFromCodepoint(c) {
+ if (c <= 0xFFFF) {
+ return String.fromCharCode(c);
+ }
+ // Encode UTF-16 surrogate pair
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
+ return String.fromCharCode(
+ ((c - 0x010000) >> 10) + 0xD800,
+ ((c - 0x010000) & 0x03FF) + 0xDC00
+ );
+}
+
+var simpleEscapeCheck = new Array(256); // integer, for fast access
+var simpleEscapeMap = new Array(256);
+for (var i = 0; i < 256; i++) {
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
+}
+
+
+function State(input, options) {
+ this.input = input;
+
+ this.filename = options['filename'] || null;
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.onWarning = options['onWarning'] || null;
+ this.legacy = options['legacy'] || false;
+ this.json = options['json'] || false;
+ this.listener = options['listener'] || null;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.typeMap = this.schema.compiledTypeMap;
+
+ this.length = input.length;
+ this.position = 0;
+ this.line = 0;
+ this.lineStart = 0;
+ this.lineIndent = 0;
+
+ this.documents = [];
+
+ /*
+ this.version;
+ this.checkLineBreaks;
+ this.tagMap;
+ this.anchorMap;
+ this.tag;
+ this.anchor;
+ this.kind;
+ this.result;*/
+
+}
+
+
+function generateError(state, message) {
+ return new YAMLException(
+ message,
+ new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
+}
+
+function throwError(state, message) {
+ throw generateError(state, message);
+}
+
+function throwWarning(state, message) {
+ if (state.onWarning) {
+ state.onWarning.call(null, generateError(state, message));
+ }
+}
+
+
+var directiveHandlers = {
+
+ YAML: function handleYamlDirective(state, name, args) {
+
+ var match, major, minor;
+
+ if (state.version !== null) {
+ throwError(state, 'duplication of %YAML directive');
+ }
+
+ if (args.length !== 1) {
+ throwError(state, 'YAML directive accepts exactly one argument');
+ }
+
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
+
+ if (match === null) {
+ throwError(state, 'ill-formed argument of the YAML directive');
+ }
+
+ major = parseInt(match[1], 10);
+ minor = parseInt(match[2], 10);
+
+ if (major !== 1) {
+ throwError(state, 'unacceptable YAML version of the document');
+ }
+
+ state.version = args[0];
+ state.checkLineBreaks = (minor < 2);
+
+ if (minor !== 1 && minor !== 2) {
+ throwWarning(state, 'unsupported YAML version of the document');
+ }
+ },
+
+ TAG: function handleTagDirective(state, name, args) {
+
+ var handle, prefix;
+
+ if (args.length !== 2) {
+ throwError(state, 'TAG directive accepts exactly two arguments');
+ }
+
+ handle = args[0];
+ prefix = args[1];
+
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
+ }
+
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
+ }
+
+ if (!PATTERN_TAG_URI.test(prefix)) {
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
+ }
+
+ state.tagMap[handle] = prefix;
+ }
+};
+
+
+function captureSegment(state, start, end, checkJson) {
+ var _position, _length, _character, _result;
+
+ if (start < end) {
+ _result = state.input.slice(start, end);
+
+ if (checkJson) {
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
+ _character = _result.charCodeAt(_position);
+ if (!(_character === 0x09 ||
+ (0x20 <= _character && _character <= 0x10FFFF))) {
+ throwError(state, 'expected valid JSON character');
+ }
+ }
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
+ throwError(state, 'the stream contains non-printable characters');
+ }
+
+ state.result += _result;
+ }
+}
+
+function mergeMappings(state, destination, source, overridableKeys) {
+ var sourceKeys, key, index, quantity;
+
+ if (!common.isObject(source)) {
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
+ }
+
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
+ key = sourceKeys[index];
+
+ if (!_hasOwnProperty.call(destination, key)) {
+ destination[key] = source[key];
+ overridableKeys[key] = true;
+ }
+ }
+}
+
+function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
+ var index, quantity;
+
+ // The output is a plain object here, so keys can only be strings.
+ // We need to convert keyNode to a string, but doing so can hang the process
+ // (deeply nested arrays that explode exponentially using aliases).
+ if (Array.isArray(keyNode)) {
+ keyNode = Array.prototype.slice.call(keyNode);
+
+ for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
+ if (Array.isArray(keyNode[index])) {
+ throwError(state, 'nested arrays are not supported inside keys');
+ }
+
+ if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
+ keyNode[index] = '[object Object]';
+ }
+ }
+ }
+
+ // Avoid code execution in load() via toString property
+ // (still use its own toString for arrays, timestamps,
+ // and whatever user schema extensions happen to have @@toStringTag)
+ if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
+ keyNode = '[object Object]';
+ }
+
+
+ keyNode = String(keyNode);
+
+ if (_result === null) {
+ _result = {};
+ }
+
+ if (keyTag === 'tag:yaml.org,2002:merge') {
+ if (Array.isArray(valueNode)) {
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
+ }
+ } else {
+ mergeMappings(state, _result, valueNode, overridableKeys);
+ }
+ } else {
+ if (!state.json &&
+ !_hasOwnProperty.call(overridableKeys, keyNode) &&
+ _hasOwnProperty.call(_result, keyNode)) {
+ state.line = startLine || state.line;
+ state.position = startPos || state.position;
+ throwError(state, 'duplicated mapping key');
+ }
+ _result[keyNode] = valueNode;
+ delete overridableKeys[keyNode];
+ }
+
+ return _result;
+}
+
+function readLineBreak(state) {
+ var ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x0A/* LF */) {
+ state.position++;
+ } else if (ch === 0x0D/* CR */) {
+ state.position++;
+ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
+ state.position++;
+ }
+ } else {
+ throwError(state, 'a line break is expected');
+ }
+
+ state.line += 1;
+ state.lineStart = state.position;
+}
+
+function skipSeparationSpace(state, allowComments, checkIndent) {
+ var lineBreaks = 0,
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (allowComments && ch === 0x23/* # */) {
+ do {
+ ch = state.input.charCodeAt(++state.position);
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
+ }
+
+ if (is_EOL(ch)) {
+ readLineBreak(state);
+
+ ch = state.input.charCodeAt(state.position);
+ lineBreaks++;
+ state.lineIndent = 0;
+
+ while (ch === 0x20/* Space */) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
+ throwWarning(state, 'deficient indentation');
+ }
+
+ return lineBreaks;
+}
+
+function testDocumentSeparator(state) {
+ var _position = state.position,
+ ch;
+
+ ch = state.input.charCodeAt(_position);
+
+ // Condition state.position === state.lineStart is tested
+ // in parent on each call, for efficiency. No needs to test here again.
+ if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
+ ch === state.input.charCodeAt(_position + 1) &&
+ ch === state.input.charCodeAt(_position + 2)) {
+
+ _position += 3;
+
+ ch = state.input.charCodeAt(_position);
+
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function writeFoldedLines(state, count) {
+ if (count === 1) {
+ state.result += ' ';
+ } else if (count > 1) {
+ state.result += common.repeat('\n', count - 1);
+ }
+}
+
+
+function readPlainScalar(state, nodeIndent, withinFlowCollection) {
+ var preceding,
+ following,
+ captureStart,
+ captureEnd,
+ hasPendingContent,
+ _line,
+ _lineStart,
+ _lineIndent,
+ _kind = state.kind,
+ _result = state.result,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (is_WS_OR_EOL(ch) ||
+ is_FLOW_INDICATOR(ch) ||
+ ch === 0x23/* # */ ||
+ ch === 0x26/* & */ ||
+ ch === 0x2A/* * */ ||
+ ch === 0x21/* ! */ ||
+ ch === 0x7C/* | */ ||
+ ch === 0x3E/* > */ ||
+ ch === 0x27/* ' */ ||
+ ch === 0x22/* " */ ||
+ ch === 0x25/* % */ ||
+ ch === 0x40/* @ */ ||
+ ch === 0x60/* ` */) {
+ return false;
+ }
+
+ if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ return false;
+ }
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+
+ while (ch !== 0) {
+ if (ch === 0x3A/* : */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ break;
+ }
+
+ } else if (ch === 0x23/* # */) {
+ preceding = state.input.charCodeAt(state.position - 1);
+
+ if (is_WS_OR_EOL(preceding)) {
+ break;
+ }
+
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
+ break;
+
+ } else if (is_EOL(ch)) {
+ _line = state.line;
+ _lineStart = state.lineStart;
+ _lineIndent = state.lineIndent;
+ skipSeparationSpace(state, false, -1);
+
+ if (state.lineIndent >= nodeIndent) {
+ hasPendingContent = true;
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ } else {
+ state.position = captureEnd;
+ state.line = _line;
+ state.lineStart = _lineStart;
+ state.lineIndent = _lineIndent;
+ break;
+ }
+ }
+
+ if (hasPendingContent) {
+ captureSegment(state, captureStart, captureEnd, false);
+ writeFoldedLines(state, state.line - _line);
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+ }
+
+ if (!is_WHITE_SPACE(ch)) {
+ captureEnd = state.position + 1;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, captureEnd, false);
+
+ if (state.result) {
+ return true;
+ }
+
+ state.kind = _kind;
+ state.result = _result;
+ return false;
+}
+
+function readSingleQuotedScalar(state, nodeIndent) {
+ var ch,
+ captureStart, captureEnd;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x27/* ' */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x27/* ' */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x27/* ' */) {
+ captureStart = state.position;
+ state.position++;
+ captureEnd = state.position;
+ } else {
+ return true;
+ }
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
+}
+
+function readDoubleQuotedScalar(state, nodeIndent) {
+ var captureStart,
+ captureEnd,
+ hexLength,
+ hexResult,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x22/* " */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x22/* " */) {
+ captureSegment(state, captureStart, state.position, true);
+ state.position++;
+ return true;
+
+ } else if (ch === 0x5C/* \ */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (is_EOL(ch)) {
+ skipSeparationSpace(state, false, nodeIndent);
+
+ // TODO: rework to inline fn with no type cast?
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
+ state.result += simpleEscapeMap[ch];
+ state.position++;
+
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
+ hexLength = tmp;
+ hexResult = 0;
+
+ for (; hexLength > 0; hexLength--) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if ((tmp = fromHexCode(ch)) >= 0) {
+ hexResult = (hexResult << 4) + tmp;
+
+ } else {
+ throwError(state, 'expected hexadecimal character');
+ }
+ }
+
+ state.result += charFromCodepoint(hexResult);
+
+ state.position++;
+
+ } else {
+ throwError(state, 'unknown escape sequence');
+ }
+
+ captureStart = captureEnd = state.position;
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
+}
+
+function readFlowCollection(state, nodeIndent) {
+ var readNext = true,
+ _line,
+ _tag = state.tag,
+ _result,
+ _anchor = state.anchor,
+ following,
+ terminator,
+ isPair,
+ isExplicitPair,
+ isMapping,
+ overridableKeys = {},
+ keyNode,
+ keyTag,
+ valueNode,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x5B/* [ */) {
+ terminator = 0x5D;/* ] */
+ isMapping = false;
+ _result = [];
+ } else if (ch === 0x7B/* { */) {
+ terminator = 0x7D;/* } */
+ isMapping = true;
+ _result = {};
+ } else {
+ return false;
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ while (ch !== 0) {
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === terminator) {
+ state.position++;
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = isMapping ? 'mapping' : 'sequence';
+ state.result = _result;
+ return true;
+ } else if (!readNext) {
+ throwError(state, 'missed comma between flow collection entries');
+ }
+
+ keyTag = keyNode = valueNode = null;
+ isPair = isExplicitPair = false;
+
+ if (ch === 0x3F/* ? */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following)) {
+ isPair = isExplicitPair = true;
+ state.position++;
+ skipSeparationSpace(state, true, nodeIndent);
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ keyTag = state.tag;
+ keyNode = state.result;
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
+ isPair = true;
+ ch = state.input.charCodeAt(++state.position);
+ skipSeparationSpace(state, true, nodeIndent);
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ valueNode = state.result;
+ }
+
+ if (isMapping) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
+ } else if (isPair) {
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
+ } else {
+ _result.push(keyNode);
+ }
+
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x2C/* , */) {
+ readNext = true;
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ readNext = false;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a flow collection');
+}
+
+function readBlockScalar(state, nodeIndent) {
+ var captureStart,
+ folding,
+ chomping = CHOMPING_CLIP,
+ didReadContent = false,
+ detectedIndent = false,
+ textIndent = nodeIndent,
+ emptyLines = 0,
+ atMoreIndented = false,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x7C/* | */) {
+ folding = false;
+ } else if (ch === 0x3E/* > */) {
+ folding = true;
+ } else {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+
+ while (ch !== 0) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
+ if (CHOMPING_CLIP === chomping) {
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
+ } else {
+ throwError(state, 'repeat of a chomping mode identifier');
+ }
+
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
+ if (tmp === 0) {
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
+ } else if (!detectedIndent) {
+ textIndent = nodeIndent + tmp - 1;
+ detectedIndent = true;
+ } else {
+ throwError(state, 'repeat of an indentation width identifier');
+ }
+
+ } else {
+ break;
+ }
+ }
+
+ if (is_WHITE_SPACE(ch)) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (is_WHITE_SPACE(ch));
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (!is_EOL(ch) && (ch !== 0));
+ }
+ }
+
+ while (ch !== 0) {
+ readLineBreak(state);
+ state.lineIndent = 0;
+
+ ch = state.input.charCodeAt(state.position);
+
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
+ (ch === 0x20/* Space */)) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (!detectedIndent && state.lineIndent > textIndent) {
+ textIndent = state.lineIndent;
+ }
+
+ if (is_EOL(ch)) {
+ emptyLines++;
+ continue;
+ }
+
+ // End of the scalar.
+ if (state.lineIndent < textIndent) {
+
+ // Perform the chomping.
+ if (chomping === CHOMPING_KEEP) {
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ } else if (chomping === CHOMPING_CLIP) {
+ if (didReadContent) { // i.e. only if the scalar is not empty.
+ state.result += '\n';
+ }
+ }
+
+ // Break this `while` cycle and go to the funciton's epilogue.
+ break;
+ }
+
+ // Folded style: use fancy rules to handle line breaks.
+ if (folding) {
+
+ // Lines starting with white space characters (more-indented lines) are not folded.
+ if (is_WHITE_SPACE(ch)) {
+ atMoreIndented = true;
+ // except for the first content line (cf. Example 8.1)
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+
+ // End of more-indented block.
+ } else if (atMoreIndented) {
+ atMoreIndented = false;
+ state.result += common.repeat('\n', emptyLines + 1);
+
+ // Just one line break - perceive as the same line.
+ } else if (emptyLines === 0) {
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
+ state.result += ' ';
+ }
+
+ // Several line breaks - perceive as different lines.
+ } else {
+ state.result += common.repeat('\n', emptyLines);
+ }
+
+ // Literal style: just add exact number of line breaks between content lines.
+ } else {
+ // Keep all line breaks except the header line break.
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ }
+
+ didReadContent = true;
+ detectedIndent = true;
+ emptyLines = 0;
+ captureStart = state.position;
+
+ while (!is_EOL(ch) && (ch !== 0)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, state.position, false);
+ }
+
+ return true;
+}
+
+function readBlockSequence(state, nodeIndent) {
+ var _line,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = [],
+ following,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+
+ if (ch !== 0x2D/* - */) {
+ break;
+ }
+
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (!is_WS_OR_EOL(following)) {
+ break;
+ }
+
+ detected = true;
+ state.position++;
+
+ if (skipSeparationSpace(state, true, -1)) {
+ if (state.lineIndent <= nodeIndent) {
+ _result.push(null);
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
+ _result.push(state.result);
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
+ throwError(state, 'bad indentation of a sequence entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'sequence';
+ state.result = _result;
+ return true;
+ }
+ return false;
+}
+
+function readBlockMapping(state, nodeIndent, flowIndent) {
+ var following,
+ allowCompact,
+ _line,
+ _pos,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = {},
+ overridableKeys = {},
+ keyTag = null,
+ keyNode = null,
+ valueNode = null,
+ atExplicitKey = false,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ following = state.input.charCodeAt(state.position + 1);
+ _line = state.line; // Save the current line.
+ _pos = state.position;
+
+ //
+ // Explicit notation case. There are two separate blocks:
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
+ //
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
+
+ if (ch === 0x3F/* ? */) {
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = true;
+ allowCompact = true;
+
+ } else if (atExplicitKey) {
+ // i.e. 0x3A/* : */ === character after the explicit key.
+ atExplicitKey = false;
+ allowCompact = true;
+
+ } else {
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
+ }
+
+ state.position += 1;
+ ch = following;
+
+ //
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
+ //
+ } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
+
+ if (state.line === _line) {
+ ch = state.input.charCodeAt(state.position);
+
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x3A/* : */) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (!is_WS_OR_EOL(ch)) {
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
+ }
+
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = false;
+ allowCompact = false;
+ keyTag = state.tag;
+ keyNode = state.result;
+
+ } else if (detected) {
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else if (detected) {
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else {
+ break; // Reading is done. Go to the epilogue.
+ }
+
+ //
+ // Common reading code for both explicit and implicit notations.
+ //
+ if (state.line === _line || state.lineIndent > nodeIndent) {
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
+ if (atExplicitKey) {
+ keyNode = state.result;
+ } else {
+ valueNode = state.result;
+ }
+ }
+
+ if (!atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ skipSeparationSpace(state, true, -1);
+ ch = state.input.charCodeAt(state.position);
+ }
+
+ if (state.lineIndent > nodeIndent && (ch !== 0)) {
+ throwError(state, 'bad indentation of a mapping entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ //
+ // Epilogue.
+ //
+
+ // Special case: last mapping's node contains only the key in explicit notation.
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ }
+
+ // Expose the resulting mapping.
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'mapping';
+ state.result = _result;
+ }
+
+ return detected;
+}
+
+function readTagProperty(state) {
+ var _position,
+ isVerbatim = false,
+ isNamed = false,
+ tagHandle,
+ tagName,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x21/* ! */) return false;
+
+ if (state.tag !== null) {
+ throwError(state, 'duplication of a tag property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x3C/* < */) {
+ isVerbatim = true;
+ ch = state.input.charCodeAt(++state.position);
+
+ } else if (ch === 0x21/* ! */) {
+ isNamed = true;
+ tagHandle = '!!';
+ ch = state.input.charCodeAt(++state.position);
+
+ } else {
+ tagHandle = '!';
+ }
+
+ _position = state.position;
+
+ if (isVerbatim) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && ch !== 0x3E/* > */);
+
+ if (state.position < state.length) {
+ tagName = state.input.slice(_position, state.position);
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
+ }
+ } else {
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+
+ if (ch === 0x21/* ! */) {
+ if (!isNamed) {
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
+
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
+ throwError(state, 'named tag handle cannot contain such characters');
+ }
+
+ isNamed = true;
+ _position = state.position + 1;
+ } else {
+ throwError(state, 'tag suffix cannot contain exclamation marks');
+ }
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ tagName = state.input.slice(_position, state.position);
+
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
+ }
+ }
+
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
+ }
+
+ if (isVerbatim) {
+ state.tag = tagName;
+
+ } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
+ state.tag = state.tagMap[tagHandle] + tagName;
+
+ } else if (tagHandle === '!') {
+ state.tag = '!' + tagName;
+
+ } else if (tagHandle === '!!') {
+ state.tag = 'tag:yaml.org,2002:' + tagName;
+
+ } else {
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
+ }
+
+ return true;
+}
+
+function readAnchorProperty(state) {
+ var _position,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x26/* & */) return false;
+
+ if (state.anchor !== null) {
+ throwError(state, 'duplication of an anchor property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an anchor node must contain at least one character');
+ }
+
+ state.anchor = state.input.slice(_position, state.position);
+ return true;
+}
+
+function readAlias(state) {
+ var _position, alias,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x2A/* * */) return false;
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an alias node must contain at least one character');
+ }
+
+ alias = state.input.slice(_position, state.position);
+
+ if (!state.anchorMap.hasOwnProperty(alias)) {
+ throwError(state, 'unidentified alias "' + alias + '"');
+ }
+
+ state.result = state.anchorMap[alias];
+ skipSeparationSpace(state, true, -1);
+ return true;
+}
+
+function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
+ var allowBlockStyles,
+ allowBlockScalars,
+ allowBlockCollections,
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
+ atNewLine = false,
+ hasContent = false,
+ typeIndex,
+ typeQuantity,
+ type,
+ flowIndent,
+ blockIndent;
+
+ if (state.listener !== null) {
+ state.listener('open', state);
+ }
+
+ state.tag = null;
+ state.anchor = null;
+ state.kind = null;
+ state.result = null;
+
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
+ CONTEXT_BLOCK_OUT === nodeContext ||
+ CONTEXT_BLOCK_IN === nodeContext;
+
+ if (allowToSeek) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ }
+ }
+
+ if (indentStatus === 1) {
+ while (readTagProperty(state) || readAnchorProperty(state)) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+ allowBlockCollections = allowBlockStyles;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ } else {
+ allowBlockCollections = false;
+ }
+ }
+ }
+
+ if (allowBlockCollections) {
+ allowBlockCollections = atNewLine || allowCompact;
+ }
+
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
+ flowIndent = parentIndent;
+ } else {
+ flowIndent = parentIndent + 1;
+ }
+
+ blockIndent = state.position - state.lineStart;
+
+ if (indentStatus === 1) {
+ if (allowBlockCollections &&
+ (readBlockSequence(state, blockIndent) ||
+ readBlockMapping(state, blockIndent, flowIndent)) ||
+ readFlowCollection(state, flowIndent)) {
+ hasContent = true;
+ } else {
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
+ readSingleQuotedScalar(state, flowIndent) ||
+ readDoubleQuotedScalar(state, flowIndent)) {
+ hasContent = true;
+
+ } else if (readAlias(state)) {
+ hasContent = true;
+
+ if (state.tag !== null || state.anchor !== null) {
+ throwError(state, 'alias node should not have any properties');
+ }
+
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
+ hasContent = true;
+
+ if (state.tag === null) {
+ state.tag = '?';
+ }
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else if (indentStatus === 0) {
+ // Special case: block sequences are allowed to have same indentation level as the parent.
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
+ }
+ }
+
+ if (state.tag !== null && state.tag !== '!') {
+ if (state.tag === '?') {
+ // Implicit resolving is not allowed for non-scalar types, and '?'
+ // non-specific tag is only automatically assigned to plain scalars.
+ //
+ // We only need to check kind conformity in case user explicitly assigns '?'
+ // tag, for example like this: "!<?> [0]"
+ //
+ if (state.result !== null && state.kind !== 'scalar') {
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
+ }
+
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
+ type = state.implicitTypes[typeIndex];
+
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ state.result = type.construct(state.result);
+ state.tag = type.tag;
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ break;
+ }
+ }
+ } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
+
+ if (state.result !== null && type.kind !== state.kind) {
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
+ }
+
+ if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
+ } else {
+ state.result = type.construct(state.result);
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else {
+ throwError(state, 'unknown tag !<' + state.tag + '>');
+ }
+ }
+
+ if (state.listener !== null) {
+ state.listener('close', state);
+ }
+ return state.tag !== null || state.anchor !== null || hasContent;
+}
+
+function readDocument(state) {
+ var documentStart = state.position,
+ _position,
+ directiveName,
+ directiveArgs,
+ hasDirectives = false,
+ ch;
+
+ state.version = null;
+ state.checkLineBreaks = state.legacy;
+ state.tagMap = {};
+ state.anchorMap = {};
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (state.lineIndent > 0 || ch !== 0x25/* % */) {
+ break;
+ }
+
+ hasDirectives = true;
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveName = state.input.slice(_position, state.position);
+ directiveArgs = [];
+
+ if (directiveName.length < 1) {
+ throwError(state, 'directive name must not be less than one character in length');
+ }
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && !is_EOL(ch));
+ break;
+ }
+
+ if (is_EOL(ch)) break;
+
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveArgs.push(state.input.slice(_position, state.position));
+ }
+
+ if (ch !== 0) readLineBreak(state);
+
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
+ } else {
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
+ }
+ }
+
+ skipSeparationSpace(state, true, -1);
+
+ if (state.lineIndent === 0 &&
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+
+ } else if (hasDirectives) {
+ throwError(state, 'directives end mark is expected');
+ }
+
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
+ skipSeparationSpace(state, true, -1);
+
+ if (state.checkLineBreaks &&
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
+ }
+
+ state.documents.push(state.result);
+
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
+
+ if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+ }
+ return;
+ }
+
+ if (state.position < (state.length - 1)) {
+ throwError(state, 'end of the stream or a document separator is expected');
+ } else {
+ return;
+ }
+}
+
+
+function loadDocuments(input, options) {
+ input = String(input);
+ options = options || {};
+
+ if (input.length !== 0) {
+
+ // Add tailing `\n` if not exists
+ if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
+ input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
+ input += '\n';
+ }
+
+ // Strip BOM
+ if (input.charCodeAt(0) === 0xFEFF) {
+ input = input.slice(1);
+ }
+ }
+
+ var state = new State(input, options);
+
+ var nullpos = input.indexOf('\0');
+
+ if (nullpos !== -1) {
+ state.position = nullpos;
+ throwError(state, 'null byte is not allowed in input');
+ }
+
+ // Use 0 as string terminator. That significantly simplifies bounds check.
+ state.input += '\0';
+
+ while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
+ state.lineIndent += 1;
+ state.position += 1;
+ }
+
+ while (state.position < (state.length - 1)) {
+ readDocument(state);
+ }
+
+ return state.documents;
+}
+
+
+function loadAll(input, iterator, options) {
+ if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
+ options = iterator;
+ iterator = null;
+ }
+
+ var documents = loadDocuments(input, options);
+
+ if (typeof iterator !== 'function') {
+ return documents;
+ }
+
+ for (var index = 0, length = documents.length; index < length; index += 1) {
+ iterator(documents[index]);
+ }
+}
+
+
+function load(input, options) {
+ var documents = loadDocuments(input, options);
+
+ if (documents.length === 0) {
+ /*eslint-disable no-undefined*/
+ return undefined;
+ } else if (documents.length === 1) {
+ return documents[0];
+ }
+ throw new YAMLException('expected a single document in the stream, but found more');
+}
+
+
+function safeLoadAll(input, iterator, options) {
+ if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
+ options = iterator;
+ iterator = null;
+ }
+
+ return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+
+function safeLoad(input, options) {
+ return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+
+module.exports.loadAll = loadAll;
+module.exports.load = load;
+module.exports.safeLoadAll = safeLoadAll;
+module.exports.safeLoad = safeLoad;
+
+
+/***/ }),
+/* 8 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+function isNothing(subject) {
+ return (typeof subject === 'undefined') || (subject === null);
+}
+
+
+function isObject(subject) {
+ return (typeof subject === 'object') && (subject !== null);
+}
+
+
+function toArray(sequence) {
+ if (Array.isArray(sequence)) return sequence;
+ else if (isNothing(sequence)) return [];
+
+ return [ sequence ];
+}
+
+
+function extend(target, source) {
+ var index, length, key, sourceKeys;
+
+ if (source) {
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
+ key = sourceKeys[index];
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+}
+
+
+function repeat(string, count) {
+ var result = '', cycle;
+
+ for (cycle = 0; cycle < count; cycle += 1) {
+ result += string;
+ }
+
+ return result;
+}
+
+
+function isNegativeZero(number) {
+ return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
+}
+
+
+module.exports.isNothing = isNothing;
+module.exports.isObject = isObject;
+module.exports.toArray = toArray;
+module.exports.repeat = repeat;
+module.exports.isNegativeZero = isNegativeZero;
+module.exports.extend = extend;
+
+
+/***/ }),
+/* 9 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// YAML error class. http://stackoverflow.com/questions/8458984
+//
+
+
+function YAMLException(reason, mark) {
+ // Super constructor
+ Error.call(this);
+
+ this.name = 'YAMLException';
+ this.reason = reason;
+ this.mark = mark;
+ this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
+
+ // Include stack trace in error object
+ if (Error.captureStackTrace) {
+ // Chrome and NodeJS
+ Error.captureStackTrace(this, this.constructor);
+ } else {
+ // FF, IE 10+ and Safari 6+. Fallback for others
+ this.stack = (new Error()).stack || '';
+ }
+}
+
+
+// Inherit from Error
+YAMLException.prototype = Object.create(Error.prototype);
+YAMLException.prototype.constructor = YAMLException;
+
+
+YAMLException.prototype.toString = function toString(compact) {
+ var result = this.name + ': ';
+
+ result += this.reason || '(unknown reason)';
+
+ if (!compact && this.mark) {
+ result += ' ' + this.mark.toString();
+ }
+
+ return result;
+};
+
+
+module.exports = YAMLException;
+
+
+/***/ }),
+/* 10 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+var common = __webpack_require__(8);
+
+
+function Mark(name, buffer, position, line, column) {
+ this.name = name;
+ this.buffer = buffer;
+ this.position = position;
+ this.line = line;
+ this.column = column;
+}
+
+
+Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
+ var head, start, tail, end, snippet;
+
+ if (!this.buffer) return null;
+
+ indent = indent || 4;
+ maxLength = maxLength || 75;
+
+ head = '';
+ start = this.position;
+
+ while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
+ start -= 1;
+ if (this.position - start > (maxLength / 2 - 1)) {
+ head = ' ... ';
+ start += 5;
+ break;
+ }
+ }
+
+ tail = '';
+ end = this.position;
+
+ while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
+ end += 1;
+ if (end - this.position > (maxLength / 2 - 1)) {
+ tail = ' ... ';
+ end -= 5;
+ break;
+ }
+ }
+
+ snippet = this.buffer.slice(start, end);
+
+ return common.repeat(' ', indent) + head + snippet + tail + '\n' +
+ common.repeat(' ', indent + this.position - start + head.length) + '^';
+};
+
+
+Mark.prototype.toString = function toString(compact) {
+ var snippet, where = '';
+
+ if (this.name) {
+ where += 'in "' + this.name + '" ';
+ }
+
+ where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
+
+ if (!compact) {
+ snippet = this.getSnippet();
+
+ if (snippet) {
+ where += ':\n' + snippet;
+ }
+ }
+
+ return where;
+};
+
+
+module.exports = Mark;
+
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// JS-YAML's default schema for `safeLoad` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on standard YAML's Core schema and includes most of
+// extra types described at YAML tag repository. (http://yaml.org/type/)
+
+
+
+
+
+var Schema = __webpack_require__(12);
+
+
+module.exports = new Schema({
+ include: [
+ __webpack_require__(14)
+ ],
+ implicit: [
+ __webpack_require__(24),
+ __webpack_require__(25)
+ ],
+ explicit: [
+ __webpack_require__(26),
+ __webpack_require__(28),
+ __webpack_require__(29),
+ __webpack_require__(30)
+ ]
+});
+
+
+/***/ }),
+/* 12 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/*eslint-disable max-len*/
+
+var common = __webpack_require__(8);
+var YAMLException = __webpack_require__(9);
+var Type = __webpack_require__(13);
+
+
+function compileList(schema, name, result) {
+ var exclude = [];
+
+ schema.include.forEach(function (includedSchema) {
+ result = compileList(includedSchema, name, result);
+ });
+
+ schema[name].forEach(function (currentType) {
+ result.forEach(function (previousType, previousIndex) {
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
+ exclude.push(previousIndex);
+ }
+ });
+
+ result.push(currentType);
+ });
+
+ return result.filter(function (type, index) {
+ return exclude.indexOf(index) === -1;
+ });
+}
+
+
+function compileMap(/* lists... */) {
+ var result = {
+ scalar: {},
+ sequence: {},
+ mapping: {},
+ fallback: {}
+ }, index, length;
+
+ function collectType(type) {
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
+ }
+
+ for (index = 0, length = arguments.length; index < length; index += 1) {
+ arguments[index].forEach(collectType);
+ }
+ return result;
+}
+
+
+function Schema(definition) {
+ this.include = definition.include || [];
+ this.implicit = definition.implicit || [];
+ this.explicit = definition.explicit || [];
+
+ this.implicit.forEach(function (type) {
+ if (type.loadKind && type.loadKind !== 'scalar') {
+ throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
+ }
+ });
+
+ this.compiledImplicit = compileList(this, 'implicit', []);
+ this.compiledExplicit = compileList(this, 'explicit', []);
+ this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
+}
+
+
+Schema.DEFAULT = null;
+
+
+Schema.create = function createSchema() {
+ var schemas, types;
+
+ switch (arguments.length) {
+ case 1:
+ schemas = Schema.DEFAULT;
+ types = arguments[0];
+ break;
+
+ case 2:
+ schemas = arguments[0];
+ types = arguments[1];
+ break;
+
+ default:
+ throw new YAMLException('Wrong number of arguments for Schema.create function');
+ }
+
+ schemas = common.toArray(schemas);
+ types = common.toArray(types);
+
+ if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
+ throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
+ }
+
+ if (!types.every(function (type) { return type instanceof Type; })) {
+ throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
+ }
+
+ return new Schema({
+ include: schemas,
+ explicit: types
+ });
+};
+
+
+module.exports = Schema;
+
+
+/***/ }),
+/* 13 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var YAMLException = __webpack_require__(9);
+
+var TYPE_CONSTRUCTOR_OPTIONS = [
+ 'kind',
+ 'resolve',
+ 'construct',
+ 'instanceOf',
+ 'predicate',
+ 'represent',
+ 'defaultStyle',
+ 'styleAliases'
+];
+
+var YAML_NODE_KINDS = [
+ 'scalar',
+ 'sequence',
+ 'mapping'
+];
+
+function compileStyleAliases(map) {
+ var result = {};
+
+ if (map !== null) {
+ Object.keys(map).forEach(function (style) {
+ map[style].forEach(function (alias) {
+ result[String(alias)] = style;
+ });
+ });
+ }
+
+ return result;
+}
+
+function Type(tag, options) {
+ options = options || {};
+
+ Object.keys(options).forEach(function (name) {
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
+ }
+ });
+
+ // TODO: Add tag format check.
+ this.tag = tag;
+ this.kind = options['kind'] || null;
+ this.resolve = options['resolve'] || function () { return true; };
+ this.construct = options['construct'] || function (data) { return data; };
+ this.instanceOf = options['instanceOf'] || null;
+ this.predicate = options['predicate'] || null;
+ this.represent = options['represent'] || null;
+ this.defaultStyle = options['defaultStyle'] || null;
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
+
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
+ }
+}
+
+module.exports = Type;
+
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Standard YAML's Core schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2804923
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, Core schema has no distinctions from JSON schema is JS-YAML.
+
+
+
+
+
+var Schema = __webpack_require__(12);
+
+
+module.exports = new Schema({
+ include: [
+ __webpack_require__(15)
+ ]
+});
+
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Standard YAML's JSON schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2803231
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, this schema is not such strict as defined in the YAML specification.
+// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
+
+
+
+
+
+var Schema = __webpack_require__(12);
+
+
+module.exports = new Schema({
+ include: [
+ __webpack_require__(16)
+ ],
+ implicit: [
+ __webpack_require__(20),
+ __webpack_require__(21),
+ __webpack_require__(22),
+ __webpack_require__(23)
+ ]
+});
+
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Standard YAML's Failsafe schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2802346
+
+
+
+
+
+var Schema = __webpack_require__(12);
+
+
+module.exports = new Schema({
+ explicit: [
+ __webpack_require__(17),
+ __webpack_require__(18),
+ __webpack_require__(19)
+ ]
+});
+
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+module.exports = new Type('tag:yaml.org,2002:str', {
+ kind: 'scalar',
+ construct: function (data) { return data !== null ? data : ''; }
+});
+
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+module.exports = new Type('tag:yaml.org,2002:seq', {
+ kind: 'sequence',
+ construct: function (data) { return data !== null ? data : []; }
+});
+
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+module.exports = new Type('tag:yaml.org,2002:map', {
+ kind: 'mapping',
+ construct: function (data) { return data !== null ? data : {}; }
+});
+
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+function resolveYamlNull(data) {
+ if (data === null) return true;
+
+ var max = data.length;
+
+ return (max === 1 && data === '~') ||
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
+}
+
+function constructYamlNull() {
+ return null;
+}
+
+function isNull(object) {
+ return object === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:null', {
+ kind: 'scalar',
+ resolve: resolveYamlNull,
+ construct: constructYamlNull,
+ predicate: isNull,
+ represent: {
+ canonical: function () { return '~'; },
+ lowercase: function () { return 'null'; },
+ uppercase: function () { return 'NULL'; },
+ camelcase: function () { return 'Null'; }
+ },
+ defaultStyle: 'lowercase'
+});
+
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+function resolveYamlBoolean(data) {
+ if (data === null) return false;
+
+ var max = data.length;
+
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
+}
+
+function constructYamlBoolean(data) {
+ return data === 'true' ||
+ data === 'True' ||
+ data === 'TRUE';
+}
+
+function isBoolean(object) {
+ return Object.prototype.toString.call(object) === '[object Boolean]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:bool', {
+ kind: 'scalar',
+ resolve: resolveYamlBoolean,
+ construct: constructYamlBoolean,
+ predicate: isBoolean,
+ represent: {
+ lowercase: function (object) { return object ? 'true' : 'false'; },
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
+ camelcase: function (object) { return object ? 'True' : 'False'; }
+ },
+ defaultStyle: 'lowercase'
+});
+
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var common = __webpack_require__(8);
+var Type = __webpack_require__(13);
+
+function isHexCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
+}
+
+function isOctCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
+}
+
+function isDecCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
+}
+
+function resolveYamlInteger(data) {
+ if (data === null) return false;
+
+ var max = data.length,
+ index = 0,
+ hasDigits = false,
+ ch;
+
+ if (!max) return false;
+
+ ch = data[index];
+
+ // sign
+ if (ch === '-' || ch === '+') {
+ ch = data[++index];
+ }
+
+ if (ch === '0') {
+ // 0
+ if (index + 1 === max) return true;
+ ch = data[++index];
+
+ // base 2, base 8, base 16
+
+ if (ch === 'b') {
+ // base 2
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch !== '0' && ch !== '1') return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+
+ if (ch === 'x') {
+ // base 16
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isHexCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 8
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isOctCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 10 (except 0) or base 60
+
+ // value should not start with `_`;
+ if (ch === '_') return false;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch === ':') break;
+ if (!isDecCode(data.charCodeAt(index))) {
+ return false;
+ }
+ hasDigits = true;
+ }
+
+ // Should have digits and should not end with `_`
+ if (!hasDigits || ch === '_') return false;
+
+ // if !base60 - done;
+ if (ch !== ':') return true;
+
+ // base60 almost not used, no needs to optimize
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
+}
+
+function constructYamlInteger(data) {
+ var value = data, sign = 1, ch, base, digits = [];
+
+ if (value.indexOf('_') !== -1) {
+ value = value.replace(/_/g, '');
+ }
+
+ ch = value[0];
+
+ if (ch === '-' || ch === '+') {
+ if (ch === '-') sign = -1;
+ value = value.slice(1);
+ ch = value[0];
+ }
+
+ if (value === '0') return 0;
+
+ if (ch === '0') {
+ if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
+ if (value[1] === 'x') return sign * parseInt(value, 16);
+ return sign * parseInt(value, 8);
+ }
+
+ if (value.indexOf(':') !== -1) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseInt(v, 10));
+ });
+
+ value = 0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += (d * base);
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+
+ return sign * parseInt(value, 10);
+}
+
+function isInteger(object) {
+ return (Object.prototype.toString.call(object)) === '[object Number]' &&
+ (object % 1 === 0 && !common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:int', {
+ kind: 'scalar',
+ resolve: resolveYamlInteger,
+ construct: constructYamlInteger,
+ predicate: isInteger,
+ represent: {
+ binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
+ octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
+ decimal: function (obj) { return obj.toString(10); },
+ /* eslint-disable max-len */
+ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
+ },
+ defaultStyle: 'decimal',
+ styleAliases: {
+ binary: [ 2, 'bin' ],
+ octal: [ 8, 'oct' ],
+ decimal: [ 10, 'dec' ],
+ hexadecimal: [ 16, 'hex' ]
+ }
+});
+
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var common = __webpack_require__(8);
+var Type = __webpack_require__(13);
+
+var YAML_FLOAT_PATTERN = new RegExp(
+ // 2.5e4, 2.5 and integers
+ '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
+ // .2e4, .2
+ // special case, seems not from spec
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
+ // 20:59
+ '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
+ // .inf
+ '|[-+]?\\.(?:inf|Inf|INF)' +
+ // .nan
+ '|\\.(?:nan|NaN|NAN))$');
+
+function resolveYamlFloat(data) {
+ if (data === null) return false;
+
+ if (!YAML_FLOAT_PATTERN.test(data) ||
+ // Quick hack to not allow integers end with `_`
+ // Probably should update regexp & check speed
+ data[data.length - 1] === '_') {
+ return false;
+ }
+
+ return true;
+}
+
+function constructYamlFloat(data) {
+ var value, sign, base, digits;
+
+ value = data.replace(/_/g, '').toLowerCase();
+ sign = value[0] === '-' ? -1 : 1;
+ digits = [];
+
+ if ('+-'.indexOf(value[0]) >= 0) {
+ value = value.slice(1);
+ }
+
+ if (value === '.inf') {
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
+
+ } else if (value === '.nan') {
+ return NaN;
+
+ } else if (value.indexOf(':') >= 0) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseFloat(v, 10));
+ });
+
+ value = 0.0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += d * base;
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+ return sign * parseFloat(value, 10);
+}
+
+
+var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
+
+function representYamlFloat(object, style) {
+ var res;
+
+ if (isNaN(object)) {
+ switch (style) {
+ case 'lowercase': return '.nan';
+ case 'uppercase': return '.NAN';
+ case 'camelcase': return '.NaN';
+ }
+ } else if (Number.POSITIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '.inf';
+ case 'uppercase': return '.INF';
+ case 'camelcase': return '.Inf';
+ }
+ } else if (Number.NEGATIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '-.inf';
+ case 'uppercase': return '-.INF';
+ case 'camelcase': return '-.Inf';
+ }
+ } else if (common.isNegativeZero(object)) {
+ return '-0.0';
+ }
+
+ res = object.toString(10);
+
+ // JS stringifier can build scientific format without dots: 5e-100,
+ // while YAML requres dot: 5.e-100. Fix it with simple hack
+
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
+}
+
+function isFloat(object) {
+ return (Object.prototype.toString.call(object) === '[object Number]') &&
+ (object % 1 !== 0 || common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:float', {
+ kind: 'scalar',
+ resolve: resolveYamlFloat,
+ construct: constructYamlFloat,
+ predicate: isFloat,
+ represent: representYamlFloat,
+ defaultStyle: 'lowercase'
+});
+
+
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+var YAML_DATE_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9])' + // [2] month
+ '-([0-9][0-9])$'); // [3] day
+
+var YAML_TIMESTAMP_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9]?)' + // [2] month
+ '-([0-9][0-9]?)' + // [3] day
+ '(?:[Tt]|[ \\t]+)' + // ...
+ '([0-9][0-9]?)' + // [4] hour
+ ':([0-9][0-9])' + // [5] minute
+ ':([0-9][0-9])' + // [6] second
+ '(?:\\.([0-9]*))?' + // [7] fraction
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
+
+function resolveYamlTimestamp(data) {
+ if (data === null) return false;
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
+ return false;
+}
+
+function constructYamlTimestamp(data) {
+ var match, year, month, day, hour, minute, second, fraction = 0,
+ delta = null, tz_hour, tz_minute, date;
+
+ match = YAML_DATE_REGEXP.exec(data);
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
+
+ if (match === null) throw new Error('Date resolve error');
+
+ // match: [1] year [2] month [3] day
+
+ year = +(match[1]);
+ month = +(match[2]) - 1; // JS month starts with 0
+ day = +(match[3]);
+
+ if (!match[4]) { // no hour
+ return new Date(Date.UTC(year, month, day));
+ }
+
+ // match: [4] hour [5] minute [6] second [7] fraction
+
+ hour = +(match[4]);
+ minute = +(match[5]);
+ second = +(match[6]);
+
+ if (match[7]) {
+ fraction = match[7].slice(0, 3);
+ while (fraction.length < 3) { // milli-seconds
+ fraction += '0';
+ }
+ fraction = +fraction;
+ }
+
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
+
+ if (match[9]) {
+ tz_hour = +(match[10]);
+ tz_minute = +(match[11] || 0);
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
+ if (match[9] === '-') delta = -delta;
+ }
+
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
+
+ if (delta) date.setTime(date.getTime() - delta);
+
+ return date;
+}
+
+function representYamlTimestamp(object /*, style*/) {
+ return object.toISOString();
+}
+
+module.exports = new Type('tag:yaml.org,2002:timestamp', {
+ kind: 'scalar',
+ resolve: resolveYamlTimestamp,
+ construct: constructYamlTimestamp,
+ instanceOf: Date,
+ represent: representYamlTimestamp
+});
+
+
+/***/ }),
+/* 25 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+function resolveYamlMerge(data) {
+ return data === '<<' || data === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:merge', {
+ kind: 'scalar',
+ resolve: resolveYamlMerge
+});
+
+
+/***/ }),
+/* 26 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+var require;
+
+/*eslint-disable no-bitwise*/
+
+var NodeBuffer;
+
+try {
+ // A trick for browserified version, to not include `Buffer` shim
+ var _require = require;
+ NodeBuffer = __webpack_require__(27).Buffer;
+} catch (__) {}
+
+var Type = __webpack_require__(13);
+
+
+// [ 64, 65, 66 ] -> [ padding, CR, LF ]
+var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
+
+
+function resolveYamlBinary(data) {
+ if (data === null) return false;
+
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
+
+ // Convert one by one.
+ for (idx = 0; idx < max; idx++) {
+ code = map.indexOf(data.charAt(idx));
+
+ // Skip CR/LF
+ if (code > 64) continue;
+
+ // Fail on illegal characters
+ if (code < 0) return false;
+
+ bitlen += 6;
+ }
+
+ // If there are any bits left, source was corrupted
+ return (bitlen % 8) === 0;
+}
+
+function constructYamlBinary(data) {
+ var idx, tailbits,
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
+ max = input.length,
+ map = BASE64_MAP,
+ bits = 0,
+ result = [];
+
+ // Collect by 6*4 bits (3 bytes)
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 4 === 0) && idx) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ }
+
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
+ }
+
+ // Dump tail
+
+ tailbits = (max % 4) * 6;
+
+ if (tailbits === 0) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ } else if (tailbits === 18) {
+ result.push((bits >> 10) & 0xFF);
+ result.push((bits >> 2) & 0xFF);
+ } else if (tailbits === 12) {
+ result.push((bits >> 4) & 0xFF);
+ }
+
+ // Wrap into Buffer for NodeJS and leave Array for browser
+ if (NodeBuffer) {
+ // Support node 6.+ Buffer API when available
+ return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
+ }
+
+ return result;
+}
+
+function representYamlBinary(object /*, style*/) {
+ var result = '', bits = 0, idx, tail,
+ max = object.length,
+ map = BASE64_MAP;
+
+ // Convert every three bytes to 4 ASCII characters.
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 3 === 0) && idx) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ }
+
+ bits = (bits << 8) + object[idx];
+ }
+
+ // Dump tail
+
+ tail = max % 3;
+
+ if (tail === 0) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ } else if (tail === 2) {
+ result += map[(bits >> 10) & 0x3F];
+ result += map[(bits >> 4) & 0x3F];
+ result += map[(bits << 2) & 0x3F];
+ result += map[64];
+ } else if (tail === 1) {
+ result += map[(bits >> 2) & 0x3F];
+ result += map[(bits << 4) & 0x3F];
+ result += map[64];
+ result += map[64];
+ }
+
+ return result;
+}
+
+function isBinary(object) {
+ return NodeBuffer && NodeBuffer.isBuffer(object);
+}
+
+module.exports = new Type('tag:yaml.org,2002:binary', {
+ kind: 'scalar',
+ resolve: resolveYamlBinary,
+ construct: constructYamlBinary,
+ predicate: isBinary,
+ represent: representYamlBinary
+});
+
+
+/***/ }),
+/* 27 */
+/***/ (function(module, exports) {
+
+module.exports = require("buffer");
+
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+var _toString = Object.prototype.toString;
+
+function resolveYamlOmap(data) {
+ if (data === null) return true;
+
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
+ object = data;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+ pairHasKey = false;
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ for (pairKey in pair) {
+ if (_hasOwnProperty.call(pair, pairKey)) {
+ if (!pairHasKey) pairHasKey = true;
+ else return false;
+ }
+ }
+
+ if (!pairHasKey) return false;
+
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
+ else return false;
+ }
+
+ return true;
+}
+
+function constructYamlOmap(data) {
+ return data !== null ? data : [];
+}
+
+module.exports = new Type('tag:yaml.org,2002:omap', {
+ kind: 'sequence',
+ resolve: resolveYamlOmap,
+ construct: constructYamlOmap
+});
+
+
+/***/ }),
+/* 29 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+var _toString = Object.prototype.toString;
+
+function resolveYamlPairs(data) {
+ if (data === null) return true;
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ keys = Object.keys(pair);
+
+ if (keys.length !== 1) return false;
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return true;
+}
+
+function constructYamlPairs(data) {
+ if (data === null) return [];
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ keys = Object.keys(pair);
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return result;
+}
+
+module.exports = new Type('tag:yaml.org,2002:pairs', {
+ kind: 'sequence',
+ resolve: resolveYamlPairs,
+ construct: constructYamlPairs
+});
+
+
+/***/ }),
+/* 30 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function resolveYamlSet(data) {
+ if (data === null) return true;
+
+ var key, object = data;
+
+ for (key in object) {
+ if (_hasOwnProperty.call(object, key)) {
+ if (object[key] !== null) return false;
+ }
+ }
+
+ return true;
+}
+
+function constructYamlSet(data) {
+ return data !== null ? data : {};
+}
+
+module.exports = new Type('tag:yaml.org,2002:set', {
+ kind: 'mapping',
+ resolve: resolveYamlSet,
+ construct: constructYamlSet
+});
+
+
+/***/ }),
+/* 31 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// JS-YAML's default schema for `load` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on JS-YAML's default safe schema and includes
+// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
+//
+// Also this schema is used as default base schema at `Schema.create` function.
+
+
+
+
+
+var Schema = __webpack_require__(12);
+
+
+module.exports = Schema.DEFAULT = new Schema({
+ include: [
+ __webpack_require__(11)
+ ],
+ explicit: [
+ __webpack_require__(32),
+ __webpack_require__(33),
+ __webpack_require__(34)
+ ]
+});
+
+
+/***/ }),
+/* 32 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+function resolveJavascriptUndefined() {
+ return true;
+}
+
+function constructJavascriptUndefined() {
+ /*eslint-disable no-undefined*/
+ return undefined;
+}
+
+function representJavascriptUndefined() {
+ return '';
+}
+
+function isUndefined(object) {
+ return typeof object === 'undefined';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/undefined', {
+ kind: 'scalar',
+ resolve: resolveJavascriptUndefined,
+ construct: constructJavascriptUndefined,
+ predicate: isUndefined,
+ represent: representJavascriptUndefined
+});
+
+
+/***/ }),
+/* 33 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var Type = __webpack_require__(13);
+
+function resolveJavascriptRegExp(data) {
+ if (data === null) return false;
+ if (data.length === 0) return false;
+
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // if regexp starts with '/' it can have modifiers and must be properly closed
+ // `/foo/gim` - modifiers tail can be maximum 3 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+
+ if (modifiers.length > 3) return false;
+ // if expression starts with /, is should be properly terminated
+ if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
+ }
+
+ return true;
+}
+
+function constructJavascriptRegExp(data) {
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // `/foo/gim` - tail can be maximum 4 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+ regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
+ }
+
+ return new RegExp(regexp, modifiers);
+}
+
+function representJavascriptRegExp(object /*, style*/) {
+ var result = '/' + object.source + '/';
+
+ if (object.global) result += 'g';
+ if (object.multiline) result += 'm';
+ if (object.ignoreCase) result += 'i';
+
+ return result;
+}
+
+function isRegExp(object) {
+ return Object.prototype.toString.call(object) === '[object RegExp]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/regexp', {
+ kind: 'scalar',
+ resolve: resolveJavascriptRegExp,
+ construct: constructJavascriptRegExp,
+ predicate: isRegExp,
+ represent: representJavascriptRegExp
+});
+
+
+/***/ }),
+/* 34 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+var require;
+
+var esprima;
+
+// Browserified version does not have esprima
+//
+// 1. For node.js just require module as deps
+// 2. For browser try to require mudule via external AMD system.
+// If not found - try to fallback to window.esprima. If not
+// found too - then fail to parse.
+//
+try {
+ // workaround to exclude package from browserify list.
+ var _require = require;
+ esprima = __webpack_require__(35);
+} catch (_) {
+ /* eslint-disable no-redeclare */
+ /* global window */
+ if (typeof window !== 'undefined') esprima = window.esprima;
+}
+
+var Type = __webpack_require__(13);
+
+function resolveJavascriptFunction(data) {
+ if (data === null) return false;
+
+ try {
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true });
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ return false;
+ }
+
+ return true;
+ } catch (err) {
+ return false;
+ }
+}
+
+function constructJavascriptFunction(data) {
+ /*jslint evil:true*/
+
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true }),
+ params = [],
+ body;
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ throw new Error('Failed to resolve function');
+ }
+
+ ast.body[0].expression.params.forEach(function (param) {
+ params.push(param.name);
+ });
+
+ body = ast.body[0].expression.body.range;
+
+ // Esprima's ranges include the first '{' and the last '}' characters on
+ // function expressions. So cut them out.
+ if (ast.body[0].expression.body.type === 'BlockStatement') {
+ /*eslint-disable no-new-func*/
+ return new Function(params, source.slice(body[0] + 1, body[1] - 1));
+ }
+ // ES6 arrow functions can omit the BlockStatement. In that case, just return
+ // the body.
+ /*eslint-disable no-new-func*/
+ return new Function(params, 'return ' + source.slice(body[0], body[1]));
+}
+
+function representJavascriptFunction(object /*, style*/) {
+ return object.toString();
+}
+
+function isFunction(object) {
+ return Object.prototype.toString.call(object) === '[object Function]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/function', {
+ kind: 'scalar',
+ resolve: resolveJavascriptFunction,
+ construct: constructJavascriptFunction,
+ predicate: isFunction,
+ represent: representJavascriptFunction
+});
+
+
+/***/ }),
+/* 35 */
+/***/ (function(module, exports, __webpack_require__) {
+
+(function webpackUniversalModuleDefinition(root, factory) {
+/* istanbul ignore next */
+ if(true)
+ module.exports = factory();
+ else {}
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/* istanbul ignore if */
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ /*
+ Copyright JS Foundation and other contributors, https://js.foundation/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var comment_handler_1 = __webpack_require__(1);
+ var jsx_parser_1 = __webpack_require__(3);
+ var parser_1 = __webpack_require__(8);
+ var tokenizer_1 = __webpack_require__(15);
+ function parse(code, options, delegate) {
+ var commentHandler = null;
+ var proxyDelegate = function (node, metadata) {
+ if (delegate) {
+ delegate(node, metadata);
+ }
+ if (commentHandler) {
+ commentHandler.visit(node, metadata);
+ }
+ };
+ var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
+ var collectComment = false;
+ if (options) {
+ collectComment = (typeof options.comment === 'boolean' && options.comment);
+ var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
+ if (collectComment || attachComment) {
+ commentHandler = new comment_handler_1.CommentHandler();
+ commentHandler.attach = attachComment;
+ options.comment = true;
+ parserDelegate = proxyDelegate;
+ }
+ }
+ var isModule = false;
+ if (options && typeof options.sourceType === 'string') {
+ isModule = (options.sourceType === 'module');
+ }
+ var parser;
+ if (options && typeof options.jsx === 'boolean' && options.jsx) {
+ parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
+ }
+ else {
+ parser = new parser_1.Parser(code, options, parserDelegate);
+ }
+ var program = isModule ? parser.parseModule() : parser.parseScript();
+ var ast = program;
+ if (collectComment && commentHandler) {
+ ast.comments = commentHandler.comments;
+ }
+ if (parser.config.tokens) {
+ ast.tokens = parser.tokens;
+ }
+ if (parser.config.tolerant) {
+ ast.errors = parser.errorHandler.errors;
+ }
+ return ast;
+ }
+ exports.parse = parse;
+ function parseModule(code, options, delegate) {
+ var parsingOptions = options || {};
+ parsingOptions.sourceType = 'module';
+ return parse(code, parsingOptions, delegate);
+ }
+ exports.parseModule = parseModule;
+ function parseScript(code, options, delegate) {
+ var parsingOptions = options || {};
+ parsingOptions.sourceType = 'script';
+ return parse(code, parsingOptions, delegate);
+ }
+ exports.parseScript = parseScript;
+ function tokenize(code, options, delegate) {
+ var tokenizer = new tokenizer_1.Tokenizer(code, options);
+ var tokens;
+ tokens = [];
+ try {
+ while (true) {
+ var token = tokenizer.getNextToken();
+ if (!token) {
+ break;
+ }
+ if (delegate) {
+ token = delegate(token);
+ }
+ tokens.push(token);
+ }
+ }
+ catch (e) {
+ tokenizer.errorHandler.tolerate(e);
+ }
+ if (tokenizer.errorHandler.tolerant) {
+ tokens.errors = tokenizer.errors();
+ }
+ return tokens;
+ }
+ exports.tokenize = tokenize;
+ var syntax_1 = __webpack_require__(2);
+ exports.Syntax = syntax_1.Syntax;
+ // Sync with *.json manifests.
+ exports.version = '4.0.1';
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var syntax_1 = __webpack_require__(2);
+ var CommentHandler = (function () {
+ function CommentHandler() {
+ this.attach = false;
+ this.comments = [];
+ this.stack = [];
+ this.leading = [];
+ this.trailing = [];
+ }
+ CommentHandler.prototype.insertInnerComments = function (node, metadata) {
+ // innnerComments for properties empty block
+ // `function a() {/** comments **\/}`
+ if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
+ var innerComments = [];
+ for (var i = this.leading.length - 1; i >= 0; --i) {
+ var entry = this.leading[i];
+ if (metadata.end.offset >= entry.start) {
+ innerComments.unshift(entry.comment);
+ this.leading.splice(i, 1);
+ this.trailing.splice(i, 1);
+ }
+ }
+ if (innerComments.length) {
+ node.innerComments = innerComments;
+ }
+ }
+ };
+ CommentHandler.prototype.findTrailingComments = function (metadata) {
+ var trailingComments = [];
+ if (this.trailing.length > 0) {
+ for (var i = this.trailing.length - 1; i >= 0; --i) {
+ var entry_1 = this.trailing[i];
+ if (entry_1.start >= metadata.end.offset) {
+ trailingComments.unshift(entry_1.comment);
+ }
+ }
+ this.trailing.length = 0;
+ return trailingComments;
+ }
+ var entry = this.stack[this.stack.length - 1];
+ if (entry && entry.node.trailingComments) {
+ var firstComment = entry.node.trailingComments[0];
+ if (firstComment && firstComment.range[0] >= metadata.end.offset) {
+ trailingComments = entry.node.trailingComments;
+ delete entry.node.trailingComments;
+ }
+ }
+ return trailingComments;
+ };
+ CommentHandler.prototype.findLeadingComments = function (metadata) {
+ var leadingComments = [];
+ var target;
+ while (this.stack.length > 0) {
+ var entry = this.stack[this.stack.length - 1];
+ if (entry && entry.start >= metadata.start.offset) {
+ target = entry.node;
+ this.stack.pop();
+ }
+ else {
+ break;
+ }
+ }
+ if (target) {
+ var count = target.leadingComments ? target.leadingComments.length : 0;
+ for (var i = count - 1; i >= 0; --i) {
+ var comment = target.leadingComments[i];
+ if (comment.range[1] <= metadata.start.offset) {
+ leadingComments.unshift(comment);
+ target.leadingComments.splice(i, 1);
+ }
+ }
+ if (target.leadingComments && target.leadingComments.length === 0) {
+ delete target.leadingComments;
+ }
+ return leadingComments;
+ }
+ for (var i = this.leading.length - 1; i >= 0; --i) {
+ var entry = this.leading[i];
+ if (entry.start <= metadata.start.offset) {
+ leadingComments.unshift(entry.comment);
+ this.leading.splice(i, 1);
+ }
+ }
+ return leadingComments;
+ };
+ CommentHandler.prototype.visitNode = function (node, metadata) {
+ if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
+ return;
+ }
+ this.insertInnerComments(node, metadata);
+ var trailingComments = this.findTrailingComments(metadata);
+ var leadingComments = this.findLeadingComments(metadata);
+ if (leadingComments.length > 0) {
+ node.leadingComments = leadingComments;
+ }
+ if (trailingComments.length > 0) {
+ node.trailingComments = trailingComments;
+ }
+ this.stack.push({
+ node: node,
+ start: metadata.start.offset
+ });
+ };
+ CommentHandler.prototype.visitComment = function (node, metadata) {
+ var type = (node.type[0] === 'L') ? 'Line' : 'Block';
+ var comment = {
+ type: type,
+ value: node.value
+ };
+ if (node.range) {
+ comment.range = node.range;
+ }
+ if (node.loc) {
+ comment.loc = node.loc;
+ }
+ this.comments.push(comment);
+ if (this.attach) {
+ var entry = {
+ comment: {
+ type: type,
+ value: node.value,
+ range: [metadata.start.offset, metadata.end.offset]
+ },
+ start: metadata.start.offset
+ };
+ if (node.loc) {
+ entry.comment.loc = node.loc;
+ }
+ node.type = type;
+ this.leading.push(entry);
+ this.trailing.push(entry);
+ }
+ };
+ CommentHandler.prototype.visit = function (node, metadata) {
+ if (node.type === 'LineComment') {
+ this.visitComment(node, metadata);
+ }
+ else if (node.type === 'BlockComment') {
+ this.visitComment(node, metadata);
+ }
+ else if (this.attach) {
+ this.visitNode(node, metadata);
+ }
+ };
+ return CommentHandler;
+ }());
+ exports.CommentHandler = CommentHandler;
+
+
+/***/ },
+/* 2 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.Syntax = {
+ AssignmentExpression: 'AssignmentExpression',
+ AssignmentPattern: 'AssignmentPattern',
+ ArrayExpression: 'ArrayExpression',
+ ArrayPattern: 'ArrayPattern',
+ ArrowFunctionExpression: 'ArrowFunctionExpression',
+ AwaitExpression: 'AwaitExpression',
+ BlockStatement: 'BlockStatement',
+ BinaryExpression: 'BinaryExpression',
+ BreakStatement: 'BreakStatement',
+ CallExpression: 'CallExpression',
+ CatchClause: 'CatchClause',
+ ClassBody: 'ClassBody',
+ ClassDeclaration: 'ClassDeclaration',
+ ClassExpression: 'ClassExpression',
+ ConditionalExpression: 'ConditionalExpression',
+ ContinueStatement: 'ContinueStatement',
+ DoWhileStatement: 'DoWhileStatement',
+ DebuggerStatement: 'DebuggerStatement',
+ EmptyStatement: 'EmptyStatement',
+ ExportAllDeclaration: 'ExportAllDeclaration',
+ ExportDefaultDeclaration: 'ExportDefaultDeclaration',
+ ExportNamedDeclaration: 'ExportNamedDeclaration',
+ ExportSpecifier: 'ExportSpecifier',
+ ExpressionStatement: 'ExpressionStatement',
+ ForStatement: 'ForStatement',
+ ForOfStatement: 'ForOfStatement',
+ ForInStatement: 'ForInStatement',
+ FunctionDeclaration: 'FunctionDeclaration',
+ FunctionExpression: 'FunctionExpression',
+ Identifier: 'Identifier',
+ IfStatement: 'IfStatement',
+ ImportDeclaration: 'ImportDeclaration',
+ ImportDefaultSpecifier: 'ImportDefaultSpecifier',
+ ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
+ ImportSpecifier: 'ImportSpecifier',
+ Literal: 'Literal',
+ LabeledStatement: 'LabeledStatement',
+ LogicalExpression: 'LogicalExpression',
+ MemberExpression: 'MemberExpression',
+ MetaProperty: 'MetaProperty',
+ MethodDefinition: 'MethodDefinition',
+ NewExpression: 'NewExpression',
+ ObjectExpression: 'ObjectExpression',
+ ObjectPattern: 'ObjectPattern',
+ Program: 'Program',
+ Property: 'Property',
+ RestElement: 'RestElement',
+ ReturnStatement: 'ReturnStatement',
+ SequenceExpression: 'SequenceExpression',
+ SpreadElement: 'SpreadElement',
+ Super: 'Super',
+ SwitchCase: 'SwitchCase',
+ SwitchStatement: 'SwitchStatement',
+ TaggedTemplateExpression: 'TaggedTemplateExpression',
+ TemplateElement: 'TemplateElement',
+ TemplateLiteral: 'TemplateLiteral',
+ ThisExpression: 'ThisExpression',
+ ThrowStatement: 'ThrowStatement',
+ TryStatement: 'TryStatement',
+ UnaryExpression: 'UnaryExpression',
+ UpdateExpression: 'UpdateExpression',
+ VariableDeclaration: 'VariableDeclaration',
+ VariableDeclarator: 'VariableDeclarator',
+ WhileStatement: 'WhileStatement',
+ WithStatement: 'WithStatement',
+ YieldExpression: 'YieldExpression'
+ };
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+/* istanbul ignore next */
+ var __extends = (this && this.__extends) || (function () {
+ var 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 function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+ })();
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var character_1 = __webpack_require__(4);
+ var JSXNode = __webpack_require__(5);
+ var jsx_syntax_1 = __webpack_require__(6);
+ var Node = __webpack_require__(7);
+ var parser_1 = __webpack_require__(8);
+ var token_1 = __webpack_require__(13);
+ var xhtml_entities_1 = __webpack_require__(14);
+ token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier';
+ token_1.TokenName[101 /* Text */] = 'JSXText';
+ // Fully qualified element name, e.g. <svg:path> returns "svg:path"
+ function getQualifiedElementName(elementName) {
+ var qualifiedName;
+ switch (elementName.type) {
+ case jsx_syntax_1.JSXSyntax.JSXIdentifier:
+ var id = elementName;
+ qualifiedName = id.name;
+ break;
+ case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
+ var ns = elementName;
+ qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
+ getQualifiedElementName(ns.name);
+ break;
+ case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
+ var expr = elementName;
+ qualifiedName = getQualifiedElementName(expr.object) + '.' +
+ getQualifiedElementName(expr.property);
+ break;
+ /* istanbul ignore next */
+ default:
+ break;
+ }
+ return qualifiedName;
+ }
+ var JSXParser = (function (_super) {
+ __extends(JSXParser, _super);
+ function JSXParser(code, options, delegate) {
+ return _super.call(this, code, options, delegate) || this;
+ }
+ JSXParser.prototype.parsePrimaryExpression = function () {
+ return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
+ };
+ JSXParser.prototype.startJSX = function () {
+ // Unwind the scanner before the lookahead token.
+ this.scanner.index = this.startMarker.index;
+ this.scanner.lineNumber = this.startMarker.line;
+ this.scanner.lineStart = this.startMarker.index - this.startMarker.column;
+ };
+ JSXParser.prototype.finishJSX = function () {
+ // Prime the next lookahead.
+ this.nextToken();
+ };
+ JSXParser.prototype.reenterJSX = function () {
+ this.startJSX();
+ this.expectJSX('}');
+ // Pop the closing '}' added from the lookahead.
+ if (this.config.tokens) {
+ this.tokens.pop();
+ }
+ };
+ JSXParser.prototype.createJSXNode = function () {
+ this.collectComments();
+ return {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ };
+ JSXParser.prototype.createJSXChildNode = function () {
+ return {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ };
+ JSXParser.prototype.scanXHTMLEntity = function (quote) {
+ var result = '&';
+ var valid = true;
+ var terminated = false;
+ var numeric = false;
+ var hex = false;
+ while (!this.scanner.eof() && valid && !terminated) {
+ var ch = this.scanner.source[this.scanner.index];
+ if (ch === quote) {
+ break;
+ }
+ terminated = (ch === ';');
+ result += ch;
+ ++this.scanner.index;
+ if (!terminated) {
+ switch (result.length) {
+ case 2:
+ // e.g. '{'
+ numeric = (ch === '#');
+ break;
+ case 3:
+ if (numeric) {
+ // e.g. 'A'
+ hex = (ch === 'x');
+ valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
+ numeric = numeric && !hex;
+ }
+ break;
+ default:
+ valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
+ valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
+ break;
+ }
+ }
+ }
+ if (valid && terminated && result.length > 2) {
+ // e.g. 'A' becomes just '#x41'
+ var str = result.substr(1, result.length - 2);
+ if (numeric && str.length > 1) {
+ result = String.fromCharCode(parseInt(str.substr(1), 10));
+ }
+ else if (hex && str.length > 2) {
+ result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
+ }
+ else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
+ result = xhtml_entities_1.XHTMLEntities[str];
+ }
+ }
+ return result;
+ };
+ // Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
+ JSXParser.prototype.lexJSX = function () {
+ var cp = this.scanner.source.charCodeAt(this.scanner.index);
+ // < > / : = { }
+ if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
+ var value = this.scanner.source[this.scanner.index++];
+ return {
+ type: 7 /* Punctuator */,
+ value: value,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: this.scanner.index - 1,
+ end: this.scanner.index
+ };
+ }
+ // " '
+ if (cp === 34 || cp === 39) {
+ var start = this.scanner.index;
+ var quote = this.scanner.source[this.scanner.index++];
+ var str = '';
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source[this.scanner.index++];
+ if (ch === quote) {
+ break;
+ }
+ else if (ch === '&') {
+ str += this.scanXHTMLEntity(quote);
+ }
+ else {
+ str += ch;
+ }
+ }
+ return {
+ type: 8 /* StringLiteral */,
+ value: str,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ // ... or .
+ if (cp === 46) {
+ var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
+ var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
+ var value = (n1 === 46 && n2 === 46) ? '...' : '.';
+ var start = this.scanner.index;
+ this.scanner.index += value.length;
+ return {
+ type: 7 /* Punctuator */,
+ value: value,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ // `
+ if (cp === 96) {
+ // Only placeholder, since it will be rescanned as a real assignment expression.
+ return {
+ type: 10 /* Template */,
+ value: '',
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: this.scanner.index,
+ end: this.scanner.index
+ };
+ }
+ // Identifer can not contain backslash (char code 92).
+ if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
+ var start = this.scanner.index;
+ ++this.scanner.index;
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source.charCodeAt(this.scanner.index);
+ if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
+ ++this.scanner.index;
+ }
+ else if (ch === 45) {
+ // Hyphen (char code 45) can be part of an identifier.
+ ++this.scanner.index;
+ }
+ else {
+ break;
+ }
+ }
+ var id = this.scanner.source.slice(start, this.scanner.index);
+ return {
+ type: 100 /* Identifier */,
+ value: id,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ return this.scanner.lex();
+ };
+ JSXParser.prototype.nextJSXToken = function () {
+ this.collectComments();
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ var token = this.lexJSX();
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ if (this.config.tokens) {
+ this.tokens.push(this.convertToken(token));
+ }
+ return token;
+ };
+ JSXParser.prototype.nextJSXText = function () {
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ var start = this.scanner.index;
+ var text = '';
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source[this.scanner.index];
+ if (ch === '{' || ch === '<') {
+ break;
+ }
+ ++this.scanner.index;
+ text += ch;
+ if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ ++this.scanner.lineNumber;
+ if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
+ ++this.scanner.index;
+ }
+ this.scanner.lineStart = this.scanner.index;
+ }
+ }
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ var token = {
+ type: 101 /* Text */,
+ value: text,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ if ((text.length > 0) && this.config.tokens) {
+ this.tokens.push(this.convertToken(token));
+ }
+ return token;
+ };
+ JSXParser.prototype.peekJSXToken = function () {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.lexJSX();
+ this.scanner.restoreState(state);
+ return next;
+ };
+ // Expect the next JSX token to match the specified punctuator.
+ // If not, an exception will be thrown.
+ JSXParser.prototype.expectJSX = function (value) {
+ var token = this.nextJSXToken();
+ if (token.type !== 7 /* Punctuator */ || token.value !== value) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Return true if the next JSX token matches the specified punctuator.
+ JSXParser.prototype.matchJSX = function (value) {
+ var next = this.peekJSXToken();
+ return next.type === 7 /* Punctuator */ && next.value === value;
+ };
+ JSXParser.prototype.parseJSXIdentifier = function () {
+ var node = this.createJSXNode();
+ var token = this.nextJSXToken();
+ if (token.type !== 100 /* Identifier */) {
+ this.throwUnexpectedToken(token);
+ }
+ return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
+ };
+ JSXParser.prototype.parseJSXElementName = function () {
+ var node = this.createJSXNode();
+ var elementName = this.parseJSXIdentifier();
+ if (this.matchJSX(':')) {
+ var namespace = elementName;
+ this.expectJSX(':');
+ var name_1 = this.parseJSXIdentifier();
+ elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
+ }
+ else if (this.matchJSX('.')) {
+ while (this.matchJSX('.')) {
+ var object = elementName;
+ this.expectJSX('.');
+ var property = this.parseJSXIdentifier();
+ elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
+ }
+ }
+ return elementName;
+ };
+ JSXParser.prototype.parseJSXAttributeName = function () {
+ var node = this.createJSXNode();
+ var attributeName;
+ var identifier = this.parseJSXIdentifier();
+ if (this.matchJSX(':')) {
+ var namespace = identifier;
+ this.expectJSX(':');
+ var name_2 = this.parseJSXIdentifier();
+ attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
+ }
+ else {
+ attributeName = identifier;
+ }
+ return attributeName;
+ };
+ JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
+ var node = this.createJSXNode();
+ var token = this.nextJSXToken();
+ if (token.type !== 8 /* StringLiteral */) {
+ this.throwUnexpectedToken(token);
+ }
+ var raw = this.getTokenRaw(token);
+ return this.finalize(node, new Node.Literal(token.value, raw));
+ };
+ JSXParser.prototype.parseJSXExpressionAttribute = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ this.finishJSX();
+ if (this.match('}')) {
+ this.tolerateError('JSX attributes must only be assigned a non-empty expression');
+ }
+ var expression = this.parseAssignmentExpression();
+ this.reenterJSX();
+ return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
+ };
+ JSXParser.prototype.parseJSXAttributeValue = function () {
+ return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
+ this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
+ };
+ JSXParser.prototype.parseJSXNameValueAttribute = function () {
+ var node = this.createJSXNode();
+ var name = this.parseJSXAttributeName();
+ var value = null;
+ if (this.matchJSX('=')) {
+ this.expectJSX('=');
+ value = this.parseJSXAttributeValue();
+ }
+ return this.finalize(node, new JSXNode.JSXAttribute(name, value));
+ };
+ JSXParser.prototype.parseJSXSpreadAttribute = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ this.expectJSX('...');
+ this.finishJSX();
+ var argument = this.parseAssignmentExpression();
+ this.reenterJSX();
+ return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
+ };
+ JSXParser.prototype.parseJSXAttributes = function () {
+ var attributes = [];
+ while (!this.matchJSX('/') && !this.matchJSX('>')) {
+ var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
+ this.parseJSXNameValueAttribute();
+ attributes.push(attribute);
+ }
+ return attributes;
+ };
+ JSXParser.prototype.parseJSXOpeningElement = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('<');
+ var name = this.parseJSXElementName();
+ var attributes = this.parseJSXAttributes();
+ var selfClosing = this.matchJSX('/');
+ if (selfClosing) {
+ this.expectJSX('/');
+ }
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
+ };
+ JSXParser.prototype.parseJSXBoundaryElement = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('<');
+ if (this.matchJSX('/')) {
+ this.expectJSX('/');
+ var name_3 = this.parseJSXElementName();
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
+ }
+ var name = this.parseJSXElementName();
+ var attributes = this.parseJSXAttributes();
+ var selfClosing = this.matchJSX('/');
+ if (selfClosing) {
+ this.expectJSX('/');
+ }
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
+ };
+ JSXParser.prototype.parseJSXEmptyExpression = function () {
+ var node = this.createJSXChildNode();
+ this.collectComments();
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ return this.finalize(node, new JSXNode.JSXEmptyExpression());
+ };
+ JSXParser.prototype.parseJSXExpressionContainer = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ var expression;
+ if (this.matchJSX('}')) {
+ expression = this.parseJSXEmptyExpression();
+ this.expectJSX('}');
+ }
+ else {
+ this.finishJSX();
+ expression = this.parseAssignmentExpression();
+ this.reenterJSX();
+ }
+ return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
+ };
+ JSXParser.prototype.parseJSXChildren = function () {
+ var children = [];
+ while (!this.scanner.eof()) {
+ var node = this.createJSXChildNode();
+ var token = this.nextJSXText();
+ if (token.start < token.end) {
+ var raw = this.getTokenRaw(token);
+ var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
+ children.push(child);
+ }
+ if (this.scanner.source[this.scanner.index] === '{') {
+ var container = this.parseJSXExpressionContainer();
+ children.push(container);
+ }
+ else {
+ break;
+ }
+ }
+ return children;
+ };
+ JSXParser.prototype.parseComplexJSXElement = function (el) {
+ var stack = [];
+ while (!this.scanner.eof()) {
+ el.children = el.children.concat(this.parseJSXChildren());
+ var node = this.createJSXChildNode();
+ var element = this.parseJSXBoundaryElement();
+ if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
+ var opening = element;
+ if (opening.selfClosing) {
+ var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
+ el.children.push(child);
+ }
+ else {
+ stack.push(el);
+ el = { node: node, opening: opening, closing: null, children: [] };
+ }
+ }
+ if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
+ el.closing = element;
+ var open_1 = getQualifiedElementName(el.opening.name);
+ var close_1 = getQualifiedElementName(el.closing.name);
+ if (open_1 !== close_1) {
+ this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
+ }
+ if (stack.length > 0) {
+ var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
+ el = stack[stack.length - 1];
+ el.children.push(child);
+ stack.pop();
+ }
+ else {
+ break;
+ }
+ }
+ }
+ return el;
+ };
+ JSXParser.prototype.parseJSXElement = function () {
+ var node = this.createJSXNode();
+ var opening = this.parseJSXOpeningElement();
+ var children = [];
+ var closing = null;
+ if (!opening.selfClosing) {
+ var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
+ children = el.children;
+ closing = el.closing;
+ }
+ return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
+ };
+ JSXParser.prototype.parseJSXRoot = function () {
+ // Pop the opening '<' added from the lookahead.
+ if (this.config.tokens) {
+ this.tokens.pop();
+ }
+ this.startJSX();
+ var element = this.parseJSXElement();
+ this.finishJSX();
+ return element;
+ };
+ JSXParser.prototype.isStartOfExpression = function () {
+ return _super.prototype.isStartOfExpression.call(this) || this.match('<');
+ };
+ return JSXParser;
+ }(parser_1.Parser));
+ exports.JSXParser = JSXParser;
+
+
+/***/ },
+/* 4 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ // See also tools/generate-unicode-regex.js.
+ var Regex = {
+ // Unicode v8.0.0 NonAsciiIdentifierStart:
+ NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
+ // Unicode v8.0.0 NonAsciiIdentifierPart:
+ NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
+ };
+ exports.Character = {
+ /* tslint:disable:no-bitwise */
+ fromCodePoint: function (cp) {
+ return (cp < 0x10000) ? String.fromCharCode(cp) :
+ String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
+ String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
+ },
+ // https://tc39.github.io/ecma262/#sec-white-space
+ isWhiteSpace: function (cp) {
+ return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
+ (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
+ },
+ // https://tc39.github.io/ecma262/#sec-line-terminators
+ isLineTerminator: function (cp) {
+ return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
+ },
+ // https://tc39.github.io/ecma262/#sec-names-and-keywords
+ isIdentifierStart: function (cp) {
+ return (cp === 0x24) || (cp === 0x5F) ||
+ (cp >= 0x41 && cp <= 0x5A) ||
+ (cp >= 0x61 && cp <= 0x7A) ||
+ (cp === 0x5C) ||
+ ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
+ },
+ isIdentifierPart: function (cp) {
+ return (cp === 0x24) || (cp === 0x5F) ||
+ (cp >= 0x41 && cp <= 0x5A) ||
+ (cp >= 0x61 && cp <= 0x7A) ||
+ (cp >= 0x30 && cp <= 0x39) ||
+ (cp === 0x5C) ||
+ ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
+ },
+ // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
+ isDecimalDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x39); // 0..9
+ },
+ isHexDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x39) ||
+ (cp >= 0x41 && cp <= 0x46) ||
+ (cp >= 0x61 && cp <= 0x66); // a..f
+ },
+ isOctalDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x37); // 0..7
+ }
+ };
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var jsx_syntax_1 = __webpack_require__(6);
+ /* tslint:disable:max-classes-per-file */
+ var JSXClosingElement = (function () {
+ function JSXClosingElement(name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
+ this.name = name;
+ }
+ return JSXClosingElement;
+ }());
+ exports.JSXClosingElement = JSXClosingElement;
+ var JSXElement = (function () {
+ function JSXElement(openingElement, children, closingElement) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXElement;
+ this.openingElement = openingElement;
+ this.children = children;
+ this.closingElement = closingElement;
+ }
+ return JSXElement;
+ }());
+ exports.JSXElement = JSXElement;
+ var JSXEmptyExpression = (function () {
+ function JSXEmptyExpression() {
+ this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
+ }
+ return JSXEmptyExpression;
+ }());
+ exports.JSXEmptyExpression = JSXEmptyExpression;
+ var JSXExpressionContainer = (function () {
+ function JSXExpressionContainer(expression) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
+ this.expression = expression;
+ }
+ return JSXExpressionContainer;
+ }());
+ exports.JSXExpressionContainer = JSXExpressionContainer;
+ var JSXIdentifier = (function () {
+ function JSXIdentifier(name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
+ this.name = name;
+ }
+ return JSXIdentifier;
+ }());
+ exports.JSXIdentifier = JSXIdentifier;
+ var JSXMemberExpression = (function () {
+ function JSXMemberExpression(object, property) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
+ this.object = object;
+ this.property = property;
+ }
+ return JSXMemberExpression;
+ }());
+ exports.JSXMemberExpression = JSXMemberExpression;
+ var JSXAttribute = (function () {
+ function JSXAttribute(name, value) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
+ this.name = name;
+ this.value = value;
+ }
+ return JSXAttribute;
+ }());
+ exports.JSXAttribute = JSXAttribute;
+ var JSXNamespacedName = (function () {
+ function JSXNamespacedName(namespace, name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
+ this.namespace = namespace;
+ this.name = name;
+ }
+ return JSXNamespacedName;
+ }());
+ exports.JSXNamespacedName = JSXNamespacedName;
+ var JSXOpeningElement = (function () {
+ function JSXOpeningElement(name, selfClosing, attributes) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
+ this.name = name;
+ this.selfClosing = selfClosing;
+ this.attributes = attributes;
+ }
+ return JSXOpeningElement;
+ }());
+ exports.JSXOpeningElement = JSXOpeningElement;
+ var JSXSpreadAttribute = (function () {
+ function JSXSpreadAttribute(argument) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
+ this.argument = argument;
+ }
+ return JSXSpreadAttribute;
+ }());
+ exports.JSXSpreadAttribute = JSXSpreadAttribute;
+ var JSXText = (function () {
+ function JSXText(value, raw) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXText;
+ this.value = value;
+ this.raw = raw;
+ }
+ return JSXText;
+ }());
+ exports.JSXText = JSXText;
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.JSXSyntax = {
+ JSXAttribute: 'JSXAttribute',
+ JSXClosingElement: 'JSXClosingElement',
+ JSXElement: 'JSXElement',
+ JSXEmptyExpression: 'JSXEmptyExpression',
+ JSXExpressionContainer: 'JSXExpressionContainer',
+ JSXIdentifier: 'JSXIdentifier',
+ JSXMemberExpression: 'JSXMemberExpression',
+ JSXNamespacedName: 'JSXNamespacedName',
+ JSXOpeningElement: 'JSXOpeningElement',
+ JSXSpreadAttribute: 'JSXSpreadAttribute',
+ JSXText: 'JSXText'
+ };
+
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var syntax_1 = __webpack_require__(2);
+ /* tslint:disable:max-classes-per-file */
+ var ArrayExpression = (function () {
+ function ArrayExpression(elements) {
+ this.type = syntax_1.Syntax.ArrayExpression;
+ this.elements = elements;
+ }
+ return ArrayExpression;
+ }());
+ exports.ArrayExpression = ArrayExpression;
+ var ArrayPattern = (function () {
+ function ArrayPattern(elements) {
+ this.type = syntax_1.Syntax.ArrayPattern;
+ this.elements = elements;
+ }
+ return ArrayPattern;
+ }());
+ exports.ArrayPattern = ArrayPattern;
+ var ArrowFunctionExpression = (function () {
+ function ArrowFunctionExpression(params, body, expression) {
+ this.type = syntax_1.Syntax.ArrowFunctionExpression;
+ this.id = null;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = expression;
+ this.async = false;
+ }
+ return ArrowFunctionExpression;
+ }());
+ exports.ArrowFunctionExpression = ArrowFunctionExpression;
+ var AssignmentExpression = (function () {
+ function AssignmentExpression(operator, left, right) {
+ this.type = syntax_1.Syntax.AssignmentExpression;
+ this.operator = operator;
+ this.left = left;
+ this.right = right;
+ }
+ return AssignmentExpression;
+ }());
+ exports.AssignmentExpression = AssignmentExpression;
+ var AssignmentPattern = (function () {
+ function AssignmentPattern(left, right) {
+ this.type = syntax_1.Syntax.AssignmentPattern;
+ this.left = left;
+ this.right = right;
+ }
+ return AssignmentPattern;
+ }());
+ exports.AssignmentPattern = AssignmentPattern;
+ var AsyncArrowFunctionExpression = (function () {
+ function AsyncArrowFunctionExpression(params, body, expression) {
+ this.type = syntax_1.Syntax.ArrowFunctionExpression;
+ this.id = null;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = expression;
+ this.async = true;
+ }
+ return AsyncArrowFunctionExpression;
+ }());
+ exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression;
+ var AsyncFunctionDeclaration = (function () {
+ function AsyncFunctionDeclaration(id, params, body) {
+ this.type = syntax_1.Syntax.FunctionDeclaration;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = false;
+ this.async = true;
+ }
+ return AsyncFunctionDeclaration;
+ }());
+ exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration;
+ var AsyncFunctionExpression = (function () {
+ function AsyncFunctionExpression(id, params, body) {
+ this.type = syntax_1.Syntax.FunctionExpression;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = false;
+ this.async = true;
+ }
+ return AsyncFunctionExpression;
+ }());
+ exports.AsyncFunctionExpression = AsyncFunctionExpression;
+ var AwaitExpression = (function () {
+ function AwaitExpression(argument) {
+ this.type = syntax_1.Syntax.AwaitExpression;
+ this.argument = argument;
+ }
+ return AwaitExpression;
+ }());
+ exports.AwaitExpression = AwaitExpression;
+ var BinaryExpression = (function () {
+ function BinaryExpression(operator, left, right) {
+ var logical = (operator === '||' || operator === '&&');
+ this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
+ this.operator = operator;
+ this.left = left;
+ this.right = right;
+ }
+ return BinaryExpression;
+ }());
+ exports.BinaryExpression = BinaryExpression;
+ var BlockStatement = (function () {
+ function BlockStatement(body) {
+ this.type = syntax_1.Syntax.BlockStatement;
+ this.body = body;
+ }
+ return BlockStatement;
+ }());
+ exports.BlockStatement = BlockStatement;
+ var BreakStatement = (function () {
+ function BreakStatement(label) {
+ this.type = syntax_1.Syntax.BreakStatement;
+ this.label = label;
+ }
+ return BreakStatement;
+ }());
+ exports.BreakStatement = BreakStatement;
+ var CallExpression = (function () {
+ function CallExpression(callee, args) {
+ this.type = syntax_1.Syntax.CallExpression;
+ this.callee = callee;
+ this.arguments = args;
+ }
+ return CallExpression;
+ }());
+ exports.CallExpression = CallExpression;
+ var CatchClause = (function () {
+ function CatchClause(param, body) {
+ this.type = syntax_1.Syntax.CatchClause;
+ this.param = param;
+ this.body = body;
+ }
+ return CatchClause;
+ }());
+ exports.CatchClause = CatchClause;
+ var ClassBody = (function () {
+ function ClassBody(body) {
+ this.type = syntax_1.Syntax.ClassBody;
+ this.body = body;
+ }
+ return ClassBody;
+ }());
+ exports.ClassBody = ClassBody;
+ var ClassDeclaration = (function () {
+ function ClassDeclaration(id, superClass, body) {
+ this.type = syntax_1.Syntax.ClassDeclaration;
+ this.id = id;
+ this.superClass = superClass;
+ this.body = body;
+ }
+ return ClassDeclaration;
+ }());
+ exports.ClassDeclaration = ClassDeclaration;
+ var ClassExpression = (function () {
+ function ClassExpression(id, superClass, body) {
+ this.type = syntax_1.Syntax.ClassExpression;
+ this.id = id;
+ this.superClass = superClass;
+ this.body = body;
+ }
+ return ClassExpression;
+ }());
+ exports.ClassExpression = ClassExpression;
+ var ComputedMemberExpression = (function () {
+ function ComputedMemberExpression(object, property) {
+ this.type = syntax_1.Syntax.MemberExpression;
+ this.computed = true;
+ this.object = object;
+ this.property = property;
+ }
+ return ComputedMemberExpression;
+ }());
+ exports.ComputedMemberExpression = ComputedMemberExpression;
+ var ConditionalExpression = (function () {
+ function ConditionalExpression(test, consequent, alternate) {
+ this.type = syntax_1.Syntax.ConditionalExpression;
+ this.test = test;
+ this.consequent = consequent;
+ this.alternate = alternate;
+ }
+ return ConditionalExpression;
+ }());
+ exports.ConditionalExpression = ConditionalExpression;
+ var ContinueStatement = (function () {
+ function ContinueStatement(label) {
+ this.type = syntax_1.Syntax.ContinueStatement;
+ this.label = label;
+ }
+ return ContinueStatement;
+ }());
+ exports.ContinueStatement = ContinueStatement;
+ var DebuggerStatement = (function () {
+ function DebuggerStatement() {
+ this.type = syntax_1.Syntax.DebuggerStatement;
+ }
+ return DebuggerStatement;
+ }());
+ exports.DebuggerStatement = DebuggerStatement;
+ var Directive = (function () {
+ function Directive(expression, directive) {
+ this.type = syntax_1.Syntax.ExpressionStatement;
+ this.expression = expression;
+ this.directive = directive;
+ }
+ return Directive;
+ }());
+ exports.Directive = Directive;
+ var DoWhileStatement = (function () {
+ function DoWhileStatement(body, test) {
+ this.type = syntax_1.Syntax.DoWhileStatement;
+ this.body = body;
+ this.test = test;
+ }
+ return DoWhileStatement;
+ }());
+ exports.DoWhileStatement = DoWhileStatement;
+ var EmptyStatement = (function () {
+ function EmptyStatement() {
+ this.type = syntax_1.Syntax.EmptyStatement;
+ }
+ return EmptyStatement;
+ }());
+ exports.EmptyStatement = EmptyStatement;
+ var ExportAllDeclaration = (function () {
+ function ExportAllDeclaration(source) {
+ this.type = syntax_1.Syntax.ExportAllDeclaration;
+ this.source = source;
+ }
+ return ExportAllDeclaration;
+ }());
+ exports.ExportAllDeclaration = ExportAllDeclaration;
+ var ExportDefaultDeclaration = (function () {
+ function ExportDefaultDeclaration(declaration) {
+ this.type = syntax_1.Syntax.ExportDefaultDeclaration;
+ this.declaration = declaration;
+ }
+ return ExportDefaultDeclaration;
+ }());
+ exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
+ var ExportNamedDeclaration = (function () {
+ function ExportNamedDeclaration(declaration, specifiers, source) {
+ this.type = syntax_1.Syntax.ExportNamedDeclaration;
+ this.declaration = declaration;
+ this.specifiers = specifiers;
+ this.source = source;
+ }
+ return ExportNamedDeclaration;
+ }());
+ exports.ExportNamedDeclaration = ExportNamedDeclaration;
+ var ExportSpecifier = (function () {
+ function ExportSpecifier(local, exported) {
+ this.type = syntax_1.Syntax.ExportSpecifier;
+ this.exported = exported;
+ this.local = local;
+ }
+ return ExportSpecifier;
+ }());
+ exports.ExportSpecifier = ExportSpecifier;
+ var ExpressionStatement = (function () {
+ function ExpressionStatement(expression) {
+ this.type = syntax_1.Syntax.ExpressionStatement;
+ this.expression = expression;
+ }
+ return ExpressionStatement;
+ }());
+ exports.ExpressionStatement = ExpressionStatement;
+ var ForInStatement = (function () {
+ function ForInStatement(left, right, body) {
+ this.type = syntax_1.Syntax.ForInStatement;
+ this.left = left;
+ this.right = right;
+ this.body = body;
+ this.each = false;
+ }
+ return ForInStatement;
+ }());
+ exports.ForInStatement = ForInStatement;
+ var ForOfStatement = (function () {
+ function ForOfStatement(left, right, body) {
+ this.type = syntax_1.Syntax.ForOfStatement;
+ this.left = left;
+ this.right = right;
+ this.body = body;
+ }
+ return ForOfStatement;
+ }());
+ exports.ForOfStatement = ForOfStatement;
+ var ForStatement = (function () {
+ function ForStatement(init, test, update, body) {
+ this.type = syntax_1.Syntax.ForStatement;
+ this.init = init;
+ this.test = test;
+ this.update = update;
+ this.body = body;
+ }
+ return ForStatement;
+ }());
+ exports.ForStatement = ForStatement;
+ var FunctionDeclaration = (function () {
+ function FunctionDeclaration(id, params, body, generator) {
+ this.type = syntax_1.Syntax.FunctionDeclaration;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = generator;
+ this.expression = false;
+ this.async = false;
+ }
+ return FunctionDeclaration;
+ }());
+ exports.FunctionDeclaration = FunctionDeclaration;
+ var FunctionExpression = (function () {
+ function FunctionExpression(id, params, body, generator) {
+ this.type = syntax_1.Syntax.FunctionExpression;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = generator;
+ this.expression = false;
+ this.async = false;
+ }
+ return FunctionExpression;
+ }());
+ exports.FunctionExpression = FunctionExpression;
+ var Identifier = (function () {
+ function Identifier(name) {
+ this.type = syntax_1.Syntax.Identifier;
+ this.name = name;
+ }
+ return Identifier;
+ }());
+ exports.Identifier = Identifier;
+ var IfStatement = (function () {
+ function IfStatement(test, consequent, alternate) {
+ this.type = syntax_1.Syntax.IfStatement;
+ this.test = test;
+ this.consequent = consequent;
+ this.alternate = alternate;
+ }
+ return IfStatement;
+ }());
+ exports.IfStatement = IfStatement;
+ var ImportDeclaration = (function () {
+ function ImportDeclaration(specifiers, source) {
+ this.type = syntax_1.Syntax.ImportDeclaration;
+ this.specifiers = specifiers;
+ this.source = source;
+ }
+ return ImportDeclaration;
+ }());
+ exports.ImportDeclaration = ImportDeclaration;
+ var ImportDefaultSpecifier = (function () {
+ function ImportDefaultSpecifier(local) {
+ this.type = syntax_1.Syntax.ImportDefaultSpecifier;
+ this.local = local;
+ }
+ return ImportDefaultSpecifier;
+ }());
+ exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
+ var ImportNamespaceSpecifier = (function () {
+ function ImportNamespaceSpecifier(local) {
+ this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
+ this.local = local;
+ }
+ return ImportNamespaceSpecifier;
+ }());
+ exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
+ var ImportSpecifier = (function () {
+ function ImportSpecifier(local, imported) {
+ this.type = syntax_1.Syntax.ImportSpecifier;
+ this.local = local;
+ this.imported = imported;
+ }
+ return ImportSpecifier;
+ }());
+ exports.ImportSpecifier = ImportSpecifier;
+ var LabeledStatement = (function () {
+ function LabeledStatement(label, body) {
+ this.type = syntax_1.Syntax.LabeledStatement;
+ this.label = label;
+ this.body = body;
+ }
+ return LabeledStatement;
+ }());
+ exports.LabeledStatement = LabeledStatement;
+ var Literal = (function () {
+ function Literal(value, raw) {
+ this.type = syntax_1.Syntax.Literal;
+ this.value = value;
+ this.raw = raw;
+ }
+ return Literal;
+ }());
+ exports.Literal = Literal;
+ var MetaProperty = (function () {
+ function MetaProperty(meta, property) {
+ this.type = syntax_1.Syntax.MetaProperty;
+ this.meta = meta;
+ this.property = property;
+ }
+ return MetaProperty;
+ }());
+ exports.MetaProperty = MetaProperty;
+ var MethodDefinition = (function () {
+ function MethodDefinition(key, computed, value, kind, isStatic) {
+ this.type = syntax_1.Syntax.MethodDefinition;
+ this.key = key;
+ this.computed = computed;
+ this.value = value;
+ this.kind = kind;
+ this.static = isStatic;
+ }
+ return MethodDefinition;
+ }());
+ exports.MethodDefinition = MethodDefinition;
+ var Module = (function () {
+ function Module(body) {
+ this.type = syntax_1.Syntax.Program;
+ this.body = body;
+ this.sourceType = 'module';
+ }
+ return Module;
+ }());
+ exports.Module = Module;
+ var NewExpression = (function () {
+ function NewExpression(callee, args) {
+ this.type = syntax_1.Syntax.NewExpression;
+ this.callee = callee;
+ this.arguments = args;
+ }
+ return NewExpression;
+ }());
+ exports.NewExpression = NewExpression;
+ var ObjectExpression = (function () {
+ function ObjectExpression(properties) {
+ this.type = syntax_1.Syntax.ObjectExpression;
+ this.properties = properties;
+ }
+ return ObjectExpression;
+ }());
+ exports.ObjectExpression = ObjectExpression;
+ var ObjectPattern = (function () {
+ function ObjectPattern(properties) {
+ this.type = syntax_1.Syntax.ObjectPattern;
+ this.properties = properties;
+ }
+ return ObjectPattern;
+ }());
+ exports.ObjectPattern = ObjectPattern;
+ var Property = (function () {
+ function Property(kind, key, computed, value, method, shorthand) {
+ this.type = syntax_1.Syntax.Property;
+ this.key = key;
+ this.computed = computed;
+ this.value = value;
+ this.kind = kind;
+ this.method = method;
+ this.shorthand = shorthand;
+ }
+ return Property;
+ }());
+ exports.Property = Property;
+ var RegexLiteral = (function () {
+ function RegexLiteral(value, raw, pattern, flags) {
+ this.type = syntax_1.Syntax.Literal;
+ this.value = value;
+ this.raw = raw;
+ this.regex = { pattern: pattern, flags: flags };
+ }
+ return RegexLiteral;
+ }());
+ exports.RegexLiteral = RegexLiteral;
+ var RestElement = (function () {
+ function RestElement(argument) {
+ this.type = syntax_1.Syntax.RestElement;
+ this.argument = argument;
+ }
+ return RestElement;
+ }());
+ exports.RestElement = RestElement;
+ var ReturnStatement = (function () {
+ function ReturnStatement(argument) {
+ this.type = syntax_1.Syntax.ReturnStatement;
+ this.argument = argument;
+ }
+ return ReturnStatement;
+ }());
+ exports.ReturnStatement = ReturnStatement;
+ var Script = (function () {
+ function Script(body) {
+ this.type = syntax_1.Syntax.Program;
+ this.body = body;
+ this.sourceType = 'script';
+ }
+ return Script;
+ }());
+ exports.Script = Script;
+ var SequenceExpression = (function () {
+ function SequenceExpression(expressions) {
+ this.type = syntax_1.Syntax.SequenceExpression;
+ this.expressions = expressions;
+ }
+ return SequenceExpression;
+ }());
+ exports.SequenceExpression = SequenceExpression;
+ var SpreadElement = (function () {
+ function SpreadElement(argument) {
+ this.type = syntax_1.Syntax.SpreadElement;
+ this.argument = argument;
+ }
+ return SpreadElement;
+ }());
+ exports.SpreadElement = SpreadElement;
+ var StaticMemberExpression = (function () {
+ function StaticMemberExpression(object, property) {
+ this.type = syntax_1.Syntax.MemberExpression;
+ this.computed = false;
+ this.object = object;
+ this.property = property;
+ }
+ return StaticMemberExpression;
+ }());
+ exports.StaticMemberExpression = StaticMemberExpression;
+ var Super = (function () {
+ function Super() {
+ this.type = syntax_1.Syntax.Super;
+ }
+ return Super;
+ }());
+ exports.Super = Super;
+ var SwitchCase = (function () {
+ function SwitchCase(test, consequent) {
+ this.type = syntax_1.Syntax.SwitchCase;
+ this.test = test;
+ this.consequent = consequent;
+ }
+ return SwitchCase;
+ }());
+ exports.SwitchCase = SwitchCase;
+ var SwitchStatement = (function () {
+ function SwitchStatement(discriminant, cases) {
+ this.type = syntax_1.Syntax.SwitchStatement;
+ this.discriminant = discriminant;
+ this.cases = cases;
+ }
+ return SwitchStatement;
+ }());
+ exports.SwitchStatement = SwitchStatement;
+ var TaggedTemplateExpression = (function () {
+ function TaggedTemplateExpression(tag, quasi) {
+ this.type = syntax_1.Syntax.TaggedTemplateExpression;
+ this.tag = tag;
+ this.quasi = quasi;
+ }
+ return TaggedTemplateExpression;
+ }());
+ exports.TaggedTemplateExpression = TaggedTemplateExpression;
+ var TemplateElement = (function () {
+ function TemplateElement(value, tail) {
+ this.type = syntax_1.Syntax.TemplateElement;
+ this.value = value;
+ this.tail = tail;
+ }
+ return TemplateElement;
+ }());
+ exports.TemplateElement = TemplateElement;
+ var TemplateLiteral = (function () {
+ function TemplateLiteral(quasis, expressions) {
+ this.type = syntax_1.Syntax.TemplateLiteral;
+ this.quasis = quasis;
+ this.expressions = expressions;
+ }
+ return TemplateLiteral;
+ }());
+ exports.TemplateLiteral = TemplateLiteral;
+ var ThisExpression = (function () {
+ function ThisExpression() {
+ this.type = syntax_1.Syntax.ThisExpression;
+ }
+ return ThisExpression;
+ }());
+ exports.ThisExpression = ThisExpression;
+ var ThrowStatement = (function () {
+ function ThrowStatement(argument) {
+ this.type = syntax_1.Syntax.ThrowStatement;
+ this.argument = argument;
+ }
+ return ThrowStatement;
+ }());
+ exports.ThrowStatement = ThrowStatement;
+ var TryStatement = (function () {
+ function TryStatement(block, handler, finalizer) {
+ this.type = syntax_1.Syntax.TryStatement;
+ this.block = block;
+ this.handler = handler;
+ this.finalizer = finalizer;
+ }
+ return TryStatement;
+ }());
+ exports.TryStatement = TryStatement;
+ var UnaryExpression = (function () {
+ function UnaryExpression(operator, argument) {
+ this.type = syntax_1.Syntax.UnaryExpression;
+ this.operator = operator;
+ this.argument = argument;
+ this.prefix = true;
+ }
+ return UnaryExpression;
+ }());
+ exports.UnaryExpression = UnaryExpression;
+ var UpdateExpression = (function () {
+ function UpdateExpression(operator, argument, prefix) {
+ this.type = syntax_1.Syntax.UpdateExpression;
+ this.operator = operator;
+ this.argument = argument;
+ this.prefix = prefix;
+ }
+ return UpdateExpression;
+ }());
+ exports.UpdateExpression = UpdateExpression;
+ var VariableDeclaration = (function () {
+ function VariableDeclaration(declarations, kind) {
+ this.type = syntax_1.Syntax.VariableDeclaration;
+ this.declarations = declarations;
+ this.kind = kind;
+ }
+ return VariableDeclaration;
+ }());
+ exports.VariableDeclaration = VariableDeclaration;
+ var VariableDeclarator = (function () {
+ function VariableDeclarator(id, init) {
+ this.type = syntax_1.Syntax.VariableDeclarator;
+ this.id = id;
+ this.init = init;
+ }
+ return VariableDeclarator;
+ }());
+ exports.VariableDeclarator = VariableDeclarator;
+ var WhileStatement = (function () {
+ function WhileStatement(test, body) {
+ this.type = syntax_1.Syntax.WhileStatement;
+ this.test = test;
+ this.body = body;
+ }
+ return WhileStatement;
+ }());
+ exports.WhileStatement = WhileStatement;
+ var WithStatement = (function () {
+ function WithStatement(object, body) {
+ this.type = syntax_1.Syntax.WithStatement;
+ this.object = object;
+ this.body = body;
+ }
+ return WithStatement;
+ }());
+ exports.WithStatement = WithStatement;
+ var YieldExpression = (function () {
+ function YieldExpression(argument, delegate) {
+ this.type = syntax_1.Syntax.YieldExpression;
+ this.argument = argument;
+ this.delegate = delegate;
+ }
+ return YieldExpression;
+ }());
+ exports.YieldExpression = YieldExpression;
+
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var assert_1 = __webpack_require__(9);
+ var error_handler_1 = __webpack_require__(10);
+ var messages_1 = __webpack_require__(11);
+ var Node = __webpack_require__(7);
+ var scanner_1 = __webpack_require__(12);
+ var syntax_1 = __webpack_require__(2);
+ var token_1 = __webpack_require__(13);
+ var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
+ var Parser = (function () {
+ function Parser(code, options, delegate) {
+ if (options === void 0) { options = {}; }
+ this.config = {
+ range: (typeof options.range === 'boolean') && options.range,
+ loc: (typeof options.loc === 'boolean') && options.loc,
+ source: null,
+ tokens: (typeof options.tokens === 'boolean') && options.tokens,
+ comment: (typeof options.comment === 'boolean') && options.comment,
+ tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
+ };
+ if (this.config.loc && options.source && options.source !== null) {
+ this.config.source = String(options.source);
+ }
+ this.delegate = delegate;
+ this.errorHandler = new error_handler_1.ErrorHandler();
+ this.errorHandler.tolerant = this.config.tolerant;
+ this.scanner = new scanner_1.Scanner(code, this.errorHandler);
+ this.scanner.trackComment = this.config.comment;
+ this.operatorPrecedence = {
+ ')': 0,
+ ';': 0,
+ ',': 0,
+ '=': 0,
+ ']': 0,
+ '||': 1,
+ '&&': 2,
+ '|': 3,
+ '^': 4,
+ '&': 5,
+ '==': 6,
+ '!=': 6,
+ '===': 6,
+ '!==': 6,
+ '<': 7,
+ '>': 7,
+ '<=': 7,
+ '>=': 7,
+ '<<': 8,
+ '>>': 8,
+ '>>>': 8,
+ '+': 9,
+ '-': 9,
+ '*': 11,
+ '/': 11,
+ '%': 11
+ };
+ this.lookahead = {
+ type: 2 /* EOF */,
+ value: '',
+ lineNumber: this.scanner.lineNumber,
+ lineStart: 0,
+ start: 0,
+ end: 0
+ };
+ this.hasLineTerminator = false;
+ this.context = {
+ isModule: false,
+ await: false,
+ allowIn: true,
+ allowStrictDirective: true,
+ allowYield: true,
+ firstCoverInitializedNameError: null,
+ isAssignmentTarget: false,
+ isBindingElement: false,
+ inFunctionBody: false,
+ inIteration: false,
+ inSwitch: false,
+ labelSet: {},
+ strict: false
+ };
+ this.tokens = [];
+ this.startMarker = {
+ index: 0,
+ line: this.scanner.lineNumber,
+ column: 0
+ };
+ this.lastMarker = {
+ index: 0,
+ line: this.scanner.lineNumber,
+ column: 0
+ };
+ this.nextToken();
+ this.lastMarker = {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ }
+ Parser.prototype.throwError = function (messageFormat) {
+ var values = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ values[_i - 1] = arguments[_i];
+ }
+ var args = Array.prototype.slice.call(arguments, 1);
+ var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
+ assert_1.assert(idx < args.length, 'Message reference must be in range');
+ return args[idx];
+ });
+ var index = this.lastMarker.index;
+ var line = this.lastMarker.line;
+ var column = this.lastMarker.column + 1;
+ throw this.errorHandler.createError(index, line, column, msg);
+ };
+ Parser.prototype.tolerateError = function (messageFormat) {
+ var values = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ values[_i - 1] = arguments[_i];
+ }
+ var args = Array.prototype.slice.call(arguments, 1);
+ var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
+ assert_1.assert(idx < args.length, 'Message reference must be in range');
+ return args[idx];
+ });
+ var index = this.lastMarker.index;
+ var line = this.scanner.lineNumber;
+ var column = this.lastMarker.column + 1;
+ this.errorHandler.tolerateError(index, line, column, msg);
+ };
+ // Throw an exception because of the token.
+ Parser.prototype.unexpectedTokenError = function (token, message) {
+ var msg = message || messages_1.Messages.UnexpectedToken;
+ var value;
+ if (token) {
+ if (!message) {
+ msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS :
+ (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier :
+ (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber :
+ (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString :
+ (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate :
+ messages_1.Messages.UnexpectedToken;
+ if (token.type === 4 /* Keyword */) {
+ if (this.scanner.isFutureReservedWord(token.value)) {
+ msg = messages_1.Messages.UnexpectedReserved;
+ }
+ else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
+ msg = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ value = token.value;
+ }
+ else {
+ value = 'ILLEGAL';
+ }
+ msg = msg.replace('%0', value);
+ if (token && typeof token.lineNumber === 'number') {
+ var index = token.start;
+ var line = token.lineNumber;
+ var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column;
+ var column = token.start - lastMarkerLineStart + 1;
+ return this.errorHandler.createError(index, line, column, msg);
+ }
+ else {
+ var index = this.lastMarker.index;
+ var line = this.lastMarker.line;
+ var column = this.lastMarker.column + 1;
+ return this.errorHandler.createError(index, line, column, msg);
+ }
+ };
+ Parser.prototype.throwUnexpectedToken = function (token, message) {
+ throw this.unexpectedTokenError(token, message);
+ };
+ Parser.prototype.tolerateUnexpectedToken = function (token, message) {
+ this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
+ };
+ Parser.prototype.collectComments = function () {
+ if (!this.config.comment) {
+ this.scanner.scanComments();
+ }
+ else {
+ var comments = this.scanner.scanComments();
+ if (comments.length > 0 && this.delegate) {
+ for (var i = 0; i < comments.length; ++i) {
+ var e = comments[i];
+ var node = void 0;
+ node = {
+ type: e.multiLine ? 'BlockComment' : 'LineComment',
+ value: this.scanner.source.slice(e.slice[0], e.slice[1])
+ };
+ if (this.config.range) {
+ node.range = e.range;
+ }
+ if (this.config.loc) {
+ node.loc = e.loc;
+ }
+ var metadata = {
+ start: {
+ line: e.loc.start.line,
+ column: e.loc.start.column,
+ offset: e.range[0]
+ },
+ end: {
+ line: e.loc.end.line,
+ column: e.loc.end.column,
+ offset: e.range[1]
+ }
+ };
+ this.delegate(node, metadata);
+ }
+ }
+ }
+ };
+ // From internal representation to an external structure
+ Parser.prototype.getTokenRaw = function (token) {
+ return this.scanner.source.slice(token.start, token.end);
+ };
+ Parser.prototype.convertToken = function (token) {
+ var t = {
+ type: token_1.TokenName[token.type],
+ value: this.getTokenRaw(token)
+ };
+ if (this.config.range) {
+ t.range = [token.start, token.end];
+ }
+ if (this.config.loc) {
+ t.loc = {
+ start: {
+ line: this.startMarker.line,
+ column: this.startMarker.column
+ },
+ end: {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ }
+ };
+ }
+ if (token.type === 9 /* RegularExpression */) {
+ var pattern = token.pattern;
+ var flags = token.flags;
+ t.regex = { pattern: pattern, flags: flags };
+ }
+ return t;
+ };
+ Parser.prototype.nextToken = function () {
+ var token = this.lookahead;
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ this.collectComments();
+ if (this.scanner.index !== this.startMarker.index) {
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ }
+ var next = this.scanner.lex();
+ this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
+ if (next && this.context.strict && next.type === 3 /* Identifier */) {
+ if (this.scanner.isStrictModeReservedWord(next.value)) {
+ next.type = 4 /* Keyword */;
+ }
+ }
+ this.lookahead = next;
+ if (this.config.tokens && next.type !== 2 /* EOF */) {
+ this.tokens.push(this.convertToken(next));
+ }
+ return token;
+ };
+ Parser.prototype.nextRegexToken = function () {
+ this.collectComments();
+ var token = this.scanner.scanRegExp();
+ if (this.config.tokens) {
+ // Pop the previous token, '/' or '/='
+ // This is added from the lookahead token.
+ this.tokens.pop();
+ this.tokens.push(this.convertToken(token));
+ }
+ // Prime the next lookahead.
+ this.lookahead = token;
+ this.nextToken();
+ return token;
+ };
+ Parser.prototype.createNode = function () {
+ return {
+ index: this.startMarker.index,
+ line: this.startMarker.line,
+ column: this.startMarker.column
+ };
+ };
+ Parser.prototype.startNode = function (token, lastLineStart) {
+ if (lastLineStart === void 0) { lastLineStart = 0; }
+ var column = token.start - token.lineStart;
+ var line = token.lineNumber;
+ if (column < 0) {
+ column += lastLineStart;
+ line--;
+ }
+ return {
+ index: token.start,
+ line: line,
+ column: column
+ };
+ };
+ Parser.prototype.finalize = function (marker, node) {
+ if (this.config.range) {
+ node.range = [marker.index, this.lastMarker.index];
+ }
+ if (this.config.loc) {
+ node.loc = {
+ start: {
+ line: marker.line,
+ column: marker.column,
+ },
+ end: {
+ line: this.lastMarker.line,
+ column: this.lastMarker.column
+ }
+ };
+ if (this.config.source) {
+ node.loc.source = this.config.source;
+ }
+ }
+ if (this.delegate) {
+ var metadata = {
+ start: {
+ line: marker.line,
+ column: marker.column,
+ offset: marker.index
+ },
+ end: {
+ line: this.lastMarker.line,
+ column: this.lastMarker.column,
+ offset: this.lastMarker.index
+ }
+ };
+ this.delegate(node, metadata);
+ }
+ return node;
+ };
+ // Expect the next token to match the specified punctuator.
+ // If not, an exception will be thrown.
+ Parser.prototype.expect = function (value) {
+ var token = this.nextToken();
+ if (token.type !== 7 /* Punctuator */ || token.value !== value) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
+ Parser.prototype.expectCommaSeparator = function () {
+ if (this.config.tolerant) {
+ var token = this.lookahead;
+ if (token.type === 7 /* Punctuator */ && token.value === ',') {
+ this.nextToken();
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === ';') {
+ this.nextToken();
+ this.tolerateUnexpectedToken(token);
+ }
+ else {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
+ }
+ }
+ else {
+ this.expect(',');
+ }
+ };
+ // Expect the next token to match the specified keyword.
+ // If not, an exception will be thrown.
+ Parser.prototype.expectKeyword = function (keyword) {
+ var token = this.nextToken();
+ if (token.type !== 4 /* Keyword */ || token.value !== keyword) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Return true if the next token matches the specified punctuator.
+ Parser.prototype.match = function (value) {
+ return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value;
+ };
+ // Return true if the next token matches the specified keyword
+ Parser.prototype.matchKeyword = function (keyword) {
+ return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword;
+ };
+ // Return true if the next token matches the specified contextual keyword
+ // (where an identifier is sometimes a keyword depending on the context)
+ Parser.prototype.matchContextualKeyword = function (keyword) {
+ return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword;
+ };
+ // Return true if the next token is an assignment operator
+ Parser.prototype.matchAssign = function () {
+ if (this.lookahead.type !== 7 /* Punctuator */) {
+ return false;
+ }
+ var op = this.lookahead.value;
+ return op === '=' ||
+ op === '*=' ||
+ op === '**=' ||
+ op === '/=' ||
+ op === '%=' ||
+ op === '+=' ||
+ op === '-=' ||
+ op === '<<=' ||
+ op === '>>=' ||
+ op === '>>>=' ||
+ op === '&=' ||
+ op === '^=' ||
+ op === '|=';
+ };
+ // Cover grammar support.
+ //
+ // When an assignment expression position starts with an left parenthesis, the determination of the type
+ // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
+ // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
+ //
+ // There are three productions that can be parsed in a parentheses pair that needs to be determined
+ // after the outermost pair is closed. They are:
+ //
+ // 1. AssignmentExpression
+ // 2. BindingElements
+ // 3. AssignmentTargets
+ //
+ // In order to avoid exponential backtracking, we use two flags to denote if the production can be
+ // binding element or assignment target.
+ //
+ // The three productions have the relationship:
+ //
+ // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
+ //
+ // with a single exception that CoverInitializedName when used directly in an Expression, generates
+ // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
+ // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
+ //
+ // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
+ // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
+ // the CoverInitializedName check is conducted.
+ //
+ // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
+ // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
+ // pattern. The CoverInitializedName check is deferred.
+ Parser.prototype.isolateCoverGrammar = function (parseFunction) {
+ var previousIsBindingElement = this.context.isBindingElement;
+ var previousIsAssignmentTarget = this.context.isAssignmentTarget;
+ var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
+ this.context.isBindingElement = true;
+ this.context.isAssignmentTarget = true;
+ this.context.firstCoverInitializedNameError = null;
+ var result = parseFunction.call(this);
+ if (this.context.firstCoverInitializedNameError !== null) {
+ this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
+ }
+ this.context.isBindingElement = previousIsBindingElement;
+ this.context.isAssignmentTarget = previousIsAssignmentTarget;
+ this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
+ return result;
+ };
+ Parser.prototype.inheritCoverGrammar = function (parseFunction) {
+ var previousIsBindingElement = this.context.isBindingElement;
+ var previousIsAssignmentTarget = this.context.isAssignmentTarget;
+ var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
+ this.context.isBindingElement = true;
+ this.context.isAssignmentTarget = true;
+ this.context.firstCoverInitializedNameError = null;
+ var result = parseFunction.call(this);
+ this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
+ this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
+ this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
+ return result;
+ };
+ Parser.prototype.consumeSemicolon = function () {
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else if (!this.hasLineTerminator) {
+ if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ this.lastMarker.index = this.startMarker.index;
+ this.lastMarker.line = this.startMarker.line;
+ this.lastMarker.column = this.startMarker.column;
+ }
+ };
+ // https://tc39.github.io/ecma262/#sec-primary-expression
+ Parser.prototype.parsePrimaryExpression = function () {
+ var node = this.createNode();
+ var expr;
+ var token, raw;
+ switch (this.lookahead.type) {
+ case 3 /* Identifier */:
+ if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') {
+ this.tolerateUnexpectedToken(this.lookahead);
+ }
+ expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value));
+ break;
+ case 6 /* NumericLiteral */:
+ case 8 /* StringLiteral */:
+ if (this.context.strict && this.lookahead.octal) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(token.value, raw));
+ break;
+ case 1 /* BooleanLiteral */:
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(token.value === 'true', raw));
+ break;
+ case 5 /* NullLiteral */:
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(null, raw));
+ break;
+ case 10 /* Template */:
+ expr = this.parseTemplateLiteral();
+ break;
+ case 7 /* Punctuator */:
+ switch (this.lookahead.value) {
+ case '(':
+ this.context.isBindingElement = false;
+ expr = this.inheritCoverGrammar(this.parseGroupExpression);
+ break;
+ case '[':
+ expr = this.inheritCoverGrammar(this.parseArrayInitializer);
+ break;
+ case '{':
+ expr = this.inheritCoverGrammar(this.parseObjectInitializer);
+ break;
+ case '/':
+ case '/=':
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ this.scanner.index = this.startMarker.index;
+ token = this.nextRegexToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags));
+ break;
+ default:
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ break;
+ case 4 /* Keyword */:
+ if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
+ expr = this.parseIdentifierName();
+ }
+ else if (!this.context.strict && this.matchKeyword('let')) {
+ expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
+ }
+ else {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ if (this.matchKeyword('function')) {
+ expr = this.parseFunctionExpression();
+ }
+ else if (this.matchKeyword('this')) {
+ this.nextToken();
+ expr = this.finalize(node, new Node.ThisExpression());
+ }
+ else if (this.matchKeyword('class')) {
+ expr = this.parseClassExpression();
+ }
+ else {
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ break;
+ default:
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-array-initializer
+ Parser.prototype.parseSpreadElement = function () {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ return this.finalize(node, new Node.SpreadElement(arg));
+ };
+ Parser.prototype.parseArrayInitializer = function () {
+ var node = this.createNode();
+ var elements = [];
+ this.expect('[');
+ while (!this.match(']')) {
+ if (this.match(',')) {
+ this.nextToken();
+ elements.push(null);
+ }
+ else if (this.match('...')) {
+ var element = this.parseSpreadElement();
+ if (!this.match(']')) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ this.expect(',');
+ }
+ elements.push(element);
+ }
+ else {
+ elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
+ if (!this.match(']')) {
+ this.expect(',');
+ }
+ }
+ }
+ this.expect(']');
+ return this.finalize(node, new Node.ArrayExpression(elements));
+ };
+ // https://tc39.github.io/ecma262/#sec-object-initializer
+ Parser.prototype.parsePropertyMethod = function (params) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = params.simple;
+ var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
+ if (this.context.strict && params.firstRestricted) {
+ this.tolerateUnexpectedToken(params.firstRestricted, params.message);
+ }
+ if (this.context.strict && params.stricted) {
+ this.tolerateUnexpectedToken(params.stricted, params.message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ return body;
+ };
+ Parser.prototype.parsePropertyMethodFunction = function () {
+ var isGenerator = false;
+ var node = this.createNode();
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = true;
+ var params = this.parseFormalParameters();
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
+ };
+ Parser.prototype.parsePropertyMethodAsyncFunction = function () {
+ var node = this.createNode();
+ var previousAllowYield = this.context.allowYield;
+ var previousAwait = this.context.await;
+ this.context.allowYield = false;
+ this.context.await = true;
+ var params = this.parseFormalParameters();
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ this.context.await = previousAwait;
+ return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method));
+ };
+ Parser.prototype.parseObjectPropertyKey = function () {
+ var node = this.createNode();
+ var token = this.nextToken();
+ var key;
+ switch (token.type) {
+ case 8 /* StringLiteral */:
+ case 6 /* NumericLiteral */:
+ if (this.context.strict && token.octal) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
+ }
+ var raw = this.getTokenRaw(token);
+ key = this.finalize(node, new Node.Literal(token.value, raw));
+ break;
+ case 3 /* Identifier */:
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 4 /* Keyword */:
+ key = this.finalize(node, new Node.Identifier(token.value));
+ break;
+ case 7 /* Punctuator */:
+ if (token.value === '[') {
+ key = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.expect(']');
+ }
+ else {
+ key = this.throwUnexpectedToken(token);
+ }
+ break;
+ default:
+ key = this.throwUnexpectedToken(token);
+ }
+ return key;
+ };
+ Parser.prototype.isPropertyKey = function (key, value) {
+ return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
+ (key.type === syntax_1.Syntax.Literal && key.value === value);
+ };
+ Parser.prototype.parseObjectProperty = function (hasProto) {
+ var node = this.createNode();
+ var token = this.lookahead;
+ var kind;
+ var key = null;
+ var value = null;
+ var computed = false;
+ var method = false;
+ var shorthand = false;
+ var isAsync = false;
+ if (token.type === 3 /* Identifier */) {
+ var id = token.value;
+ this.nextToken();
+ computed = this.match('[');
+ isAsync = !this.hasLineTerminator && (id === 'async') &&
+ !this.match(':') && !this.match('(') && !this.match('*') && !this.match(',');
+ key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id));
+ }
+ else if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ }
+ var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
+ if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) {
+ kind = 'get';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.context.allowYield = false;
+ value = this.parseGetterMethod();
+ }
+ else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) {
+ kind = 'set';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseSetterMethod();
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
+ kind = 'init';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseGeneratorMethod();
+ method = true;
+ }
+ else {
+ if (!key) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ kind = 'init';
+ if (this.match(':') && !isAsync) {
+ if (!computed && this.isPropertyKey(key, '__proto__')) {
+ if (hasProto.value) {
+ this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
+ }
+ hasProto.value = true;
+ }
+ this.nextToken();
+ value = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ }
+ else if (this.match('(')) {
+ value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
+ method = true;
+ }
+ else if (token.type === 3 /* Identifier */) {
+ var id = this.finalize(node, new Node.Identifier(token.value));
+ if (this.match('=')) {
+ this.context.firstCoverInitializedNameError = this.lookahead;
+ this.nextToken();
+ shorthand = true;
+ var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ value = this.finalize(node, new Node.AssignmentPattern(id, init));
+ }
+ else {
+ shorthand = true;
+ value = id;
+ }
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
+ };
+ Parser.prototype.parseObjectInitializer = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var properties = [];
+ var hasProto = { value: false };
+ while (!this.match('}')) {
+ properties.push(this.parseObjectProperty(hasProto));
+ if (!this.match('}')) {
+ this.expectCommaSeparator();
+ }
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.ObjectExpression(properties));
+ };
+ // https://tc39.github.io/ecma262/#sec-template-literals
+ Parser.prototype.parseTemplateHead = function () {
+ assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
+ var node = this.createNode();
+ var token = this.nextToken();
+ var raw = token.value;
+ var cooked = token.cooked;
+ return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
+ };
+ Parser.prototype.parseTemplateElement = function () {
+ if (this.lookahead.type !== 10 /* Template */) {
+ this.throwUnexpectedToken();
+ }
+ var node = this.createNode();
+ var token = this.nextToken();
+ var raw = token.value;
+ var cooked = token.cooked;
+ return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
+ };
+ Parser.prototype.parseTemplateLiteral = function () {
+ var node = this.createNode();
+ var expressions = [];
+ var quasis = [];
+ var quasi = this.parseTemplateHead();
+ quasis.push(quasi);
+ while (!quasi.tail) {
+ expressions.push(this.parseExpression());
+ quasi = this.parseTemplateElement();
+ quasis.push(quasi);
+ }
+ return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
+ };
+ // https://tc39.github.io/ecma262/#sec-grouping-operator
+ Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
+ switch (expr.type) {
+ case syntax_1.Syntax.Identifier:
+ case syntax_1.Syntax.MemberExpression:
+ case syntax_1.Syntax.RestElement:
+ case syntax_1.Syntax.AssignmentPattern:
+ break;
+ case syntax_1.Syntax.SpreadElement:
+ expr.type = syntax_1.Syntax.RestElement;
+ this.reinterpretExpressionAsPattern(expr.argument);
+ break;
+ case syntax_1.Syntax.ArrayExpression:
+ expr.type = syntax_1.Syntax.ArrayPattern;
+ for (var i = 0; i < expr.elements.length; i++) {
+ if (expr.elements[i] !== null) {
+ this.reinterpretExpressionAsPattern(expr.elements[i]);
+ }
+ }
+ break;
+ case syntax_1.Syntax.ObjectExpression:
+ expr.type = syntax_1.Syntax.ObjectPattern;
+ for (var i = 0; i < expr.properties.length; i++) {
+ this.reinterpretExpressionAsPattern(expr.properties[i].value);
+ }
+ break;
+ case syntax_1.Syntax.AssignmentExpression:
+ expr.type = syntax_1.Syntax.AssignmentPattern;
+ delete expr.operator;
+ this.reinterpretExpressionAsPattern(expr.left);
+ break;
+ default:
+ // Allow other node type for tolerant parsing.
+ break;
+ }
+ };
+ Parser.prototype.parseGroupExpression = function () {
+ var expr;
+ this.expect('(');
+ if (this.match(')')) {
+ this.nextToken();
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [],
+ async: false
+ };
+ }
+ else {
+ var startToken = this.lookahead;
+ var params = [];
+ if (this.match('...')) {
+ expr = this.parseRestElement(params);
+ this.expect(')');
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [expr],
+ async: false
+ };
+ }
+ else {
+ var arrow = false;
+ this.context.isBindingElement = true;
+ expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ if (this.match(',')) {
+ var expressions = [];
+ this.context.isAssignmentTarget = false;
+ expressions.push(expr);
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (!this.match(',')) {
+ break;
+ }
+ this.nextToken();
+ if (this.match(')')) {
+ this.nextToken();
+ for (var i = 0; i < expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expressions[i]);
+ }
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: expressions,
+ async: false
+ };
+ }
+ else if (this.match('...')) {
+ if (!this.context.isBindingElement) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ expressions.push(this.parseRestElement(params));
+ this.expect(')');
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ this.context.isBindingElement = false;
+ for (var i = 0; i < expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expressions[i]);
+ }
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: expressions,
+ async: false
+ };
+ }
+ else {
+ expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
+ }
+ if (arrow) {
+ break;
+ }
+ }
+ if (!arrow) {
+ expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
+ }
+ }
+ if (!arrow) {
+ this.expect(')');
+ if (this.match('=>')) {
+ if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [expr],
+ async: false
+ };
+ }
+ if (!arrow) {
+ if (!this.context.isBindingElement) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ if (expr.type === syntax_1.Syntax.SequenceExpression) {
+ for (var i = 0; i < expr.expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expr.expressions[i]);
+ }
+ }
+ else {
+ this.reinterpretExpressionAsPattern(expr);
+ }
+ var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: parameters,
+ async: false
+ };
+ }
+ }
+ this.context.isBindingElement = false;
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions
+ Parser.prototype.parseArguments = function () {
+ this.expect('(');
+ var args = [];
+ if (!this.match(')')) {
+ while (true) {
+ var expr = this.match('...') ? this.parseSpreadElement() :
+ this.isolateCoverGrammar(this.parseAssignmentExpression);
+ args.push(expr);
+ if (this.match(')')) {
+ break;
+ }
+ this.expectCommaSeparator();
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return args;
+ };
+ Parser.prototype.isIdentifierName = function (token) {
+ return token.type === 3 /* Identifier */ ||
+ token.type === 4 /* Keyword */ ||
+ token.type === 1 /* BooleanLiteral */ ||
+ token.type === 5 /* NullLiteral */;
+ };
+ Parser.prototype.parseIdentifierName = function () {
+ var node = this.createNode();
+ var token = this.nextToken();
+ if (!this.isIdentifierName(token)) {
+ this.throwUnexpectedToken(token);
+ }
+ return this.finalize(node, new Node.Identifier(token.value));
+ };
+ Parser.prototype.parseNewExpression = function () {
+ var node = this.createNode();
+ var id = this.parseIdentifierName();
+ assert_1.assert(id.name === 'new', 'New expression must start with `new`');
+ var expr;
+ if (this.match('.')) {
+ this.nextToken();
+ if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') {
+ var property = this.parseIdentifierName();
+ expr = new Node.MetaProperty(id, property);
+ }
+ else {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ else {
+ var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
+ var args = this.match('(') ? this.parseArguments() : [];
+ expr = new Node.NewExpression(callee, args);
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ return this.finalize(node, expr);
+ };
+ Parser.prototype.parseAsyncArgument = function () {
+ var arg = this.parseAssignmentExpression();
+ this.context.firstCoverInitializedNameError = null;
+ return arg;
+ };
+ Parser.prototype.parseAsyncArguments = function () {
+ this.expect('(');
+ var args = [];
+ if (!this.match(')')) {
+ while (true) {
+ var expr = this.match('...') ? this.parseSpreadElement() :
+ this.isolateCoverGrammar(this.parseAsyncArgument);
+ args.push(expr);
+ if (this.match(')')) {
+ break;
+ }
+ this.expectCommaSeparator();
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return args;
+ };
+ Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
+ var startToken = this.lookahead;
+ var maybeAsync = this.matchContextualKeyword('async');
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ var expr;
+ if (this.matchKeyword('super') && this.context.inFunctionBody) {
+ expr = this.createNode();
+ this.nextToken();
+ expr = this.finalize(expr, new Node.Super());
+ if (!this.match('(') && !this.match('.') && !this.match('[')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ else {
+ expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
+ }
+ while (true) {
+ if (this.match('.')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('.');
+ var property = this.parseIdentifierName();
+ expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
+ }
+ else if (this.match('(')) {
+ var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber);
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = false;
+ var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments();
+ expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
+ if (asyncArrow && this.match('=>')) {
+ for (var i = 0; i < args.length; ++i) {
+ this.reinterpretExpressionAsPattern(args[i]);
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: args,
+ async: true
+ };
+ }
+ }
+ else if (this.match('[')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('[');
+ var property = this.isolateCoverGrammar(this.parseExpression);
+ this.expect(']');
+ expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
+ }
+ else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
+ var quasi = this.parseTemplateLiteral();
+ expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
+ }
+ else {
+ break;
+ }
+ }
+ this.context.allowIn = previousAllowIn;
+ return expr;
+ };
+ Parser.prototype.parseSuper = function () {
+ var node = this.createNode();
+ this.expectKeyword('super');
+ if (!this.match('[') && !this.match('.')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ return this.finalize(node, new Node.Super());
+ };
+ Parser.prototype.parseLeftHandSideExpression = function () {
+ assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
+ var node = this.startNode(this.lookahead);
+ var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
+ this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
+ while (true) {
+ if (this.match('[')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('[');
+ var property = this.isolateCoverGrammar(this.parseExpression);
+ this.expect(']');
+ expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
+ }
+ else if (this.match('.')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('.');
+ var property = this.parseIdentifierName();
+ expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
+ }
+ else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
+ var quasi = this.parseTemplateLiteral();
+ expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
+ }
+ else {
+ break;
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-update-expressions
+ Parser.prototype.parseUpdateExpression = function () {
+ var expr;
+ var startToken = this.lookahead;
+ if (this.match('++') || this.match('--')) {
+ var node = this.startNode(startToken);
+ var token = this.nextToken();
+ expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
+ this.tolerateError(messages_1.Messages.StrictLHSPrefix);
+ }
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ var prefix = true;
+ expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else {
+ expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) {
+ if (this.match('++') || this.match('--')) {
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
+ this.tolerateError(messages_1.Messages.StrictLHSPostfix);
+ }
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var operator = this.nextToken().value;
+ var prefix = false;
+ expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-unary-operators
+ Parser.prototype.parseAwaitExpression = function () {
+ var node = this.createNode();
+ this.nextToken();
+ var argument = this.parseUnaryExpression();
+ return this.finalize(node, new Node.AwaitExpression(argument));
+ };
+ Parser.prototype.parseUnaryExpression = function () {
+ var expr;
+ if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
+ this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
+ var node = this.startNode(this.lookahead);
+ var token = this.nextToken();
+ expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
+ if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
+ this.tolerateError(messages_1.Messages.StrictDelete);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else if (this.context.await && this.matchContextualKeyword('await')) {
+ expr = this.parseAwaitExpression();
+ }
+ else {
+ expr = this.parseUpdateExpression();
+ }
+ return expr;
+ };
+ Parser.prototype.parseExponentiationExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
+ this.nextToken();
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var left = expr;
+ var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-exp-operator
+ // https://tc39.github.io/ecma262/#sec-multiplicative-operators
+ // https://tc39.github.io/ecma262/#sec-additive-operators
+ // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators
+ // https://tc39.github.io/ecma262/#sec-relational-operators
+ // https://tc39.github.io/ecma262/#sec-equality-operators
+ // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators
+ // https://tc39.github.io/ecma262/#sec-binary-logical-operators
+ Parser.prototype.binaryPrecedence = function (token) {
+ var op = token.value;
+ var precedence;
+ if (token.type === 7 /* Punctuator */) {
+ precedence = this.operatorPrecedence[op] || 0;
+ }
+ else if (token.type === 4 /* Keyword */) {
+ precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
+ }
+ else {
+ precedence = 0;
+ }
+ return precedence;
+ };
+ Parser.prototype.parseBinaryExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
+ var token = this.lookahead;
+ var prec = this.binaryPrecedence(token);
+ if (prec > 0) {
+ this.nextToken();
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var markers = [startToken, this.lookahead];
+ var left = expr;
+ var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
+ var stack = [left, token.value, right];
+ var precedences = [prec];
+ while (true) {
+ prec = this.binaryPrecedence(this.lookahead);
+ if (prec <= 0) {
+ break;
+ }
+ // Reduce: make a binary expression from the three topmost entries.
+ while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) {
+ right = stack.pop();
+ var operator = stack.pop();
+ precedences.pop();
+ left = stack.pop();
+ markers.pop();
+ var node = this.startNode(markers[markers.length - 1]);
+ stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
+ }
+ // Shift.
+ stack.push(this.nextToken().value);
+ precedences.push(prec);
+ markers.push(this.lookahead);
+ stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
+ }
+ // Final reduce to clean-up the stack.
+ var i = stack.length - 1;
+ expr = stack[i];
+ var lastMarker = markers.pop();
+ while (i > 1) {
+ var marker = markers.pop();
+ var lastLineStart = lastMarker && lastMarker.lineStart;
+ var node = this.startNode(marker, lastLineStart);
+ var operator = stack[i - 1];
+ expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr));
+ i -= 2;
+ lastMarker = marker;
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-conditional-operator
+ Parser.prototype.parseConditionalExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
+ if (this.match('?')) {
+ this.nextToken();
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowIn = previousAllowIn;
+ this.expect(':');
+ var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-assignment-operators
+ Parser.prototype.checkPatternParam = function (options, param) {
+ switch (param.type) {
+ case syntax_1.Syntax.Identifier:
+ this.validateParam(options, param, param.name);
+ break;
+ case syntax_1.Syntax.RestElement:
+ this.checkPatternParam(options, param.argument);
+ break;
+ case syntax_1.Syntax.AssignmentPattern:
+ this.checkPatternParam(options, param.left);
+ break;
+ case syntax_1.Syntax.ArrayPattern:
+ for (var i = 0; i < param.elements.length; i++) {
+ if (param.elements[i] !== null) {
+ this.checkPatternParam(options, param.elements[i]);
+ }
+ }
+ break;
+ case syntax_1.Syntax.ObjectPattern:
+ for (var i = 0; i < param.properties.length; i++) {
+ this.checkPatternParam(options, param.properties[i].value);
+ }
+ break;
+ default:
+ break;
+ }
+ options.simple = options.simple && (param instanceof Node.Identifier);
+ };
+ Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
+ var params = [expr];
+ var options;
+ var asyncArrow = false;
+ switch (expr.type) {
+ case syntax_1.Syntax.Identifier:
+ break;
+ case ArrowParameterPlaceHolder:
+ params = expr.params;
+ asyncArrow = expr.async;
+ break;
+ default:
+ return null;
+ }
+ options = {
+ simple: true,
+ paramSet: {}
+ };
+ for (var i = 0; i < params.length; ++i) {
+ var param = params[i];
+ if (param.type === syntax_1.Syntax.AssignmentPattern) {
+ if (param.right.type === syntax_1.Syntax.YieldExpression) {
+ if (param.right.argument) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ param.right.type = syntax_1.Syntax.Identifier;
+ param.right.name = 'yield';
+ delete param.right.argument;
+ delete param.right.delegate;
+ }
+ }
+ else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ this.checkPatternParam(options, param);
+ params[i] = param;
+ }
+ if (this.context.strict || !this.context.allowYield) {
+ for (var i = 0; i < params.length; ++i) {
+ var param = params[i];
+ if (param.type === syntax_1.Syntax.YieldExpression) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ }
+ if (options.message === messages_1.Messages.StrictParamDupe) {
+ var token = this.context.strict ? options.stricted : options.firstRestricted;
+ this.throwUnexpectedToken(token, options.message);
+ }
+ return {
+ simple: options.simple,
+ params: params,
+ stricted: options.stricted,
+ firstRestricted: options.firstRestricted,
+ message: options.message
+ };
+ };
+ Parser.prototype.parseAssignmentExpression = function () {
+ var expr;
+ if (!this.context.allowYield && this.matchKeyword('yield')) {
+ expr = this.parseYieldExpression();
+ }
+ else {
+ var startToken = this.lookahead;
+ var token = startToken;
+ expr = this.parseConditionalExpression();
+ if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') {
+ if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) {
+ var arg = this.parsePrimaryExpression();
+ this.reinterpretExpressionAsPattern(arg);
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [arg],
+ async: true
+ };
+ }
+ }
+ if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
+ // https://tc39.github.io/ecma262/#sec-arrow-function-definitions
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var isAsync = expr.async;
+ var list = this.reinterpretAsCoverFormalsList(expr);
+ if (list) {
+ if (this.hasLineTerminator) {
+ this.tolerateUnexpectedToken(this.lookahead);
+ }
+ this.context.firstCoverInitializedNameError = null;
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = list.simple;
+ var previousAllowYield = this.context.allowYield;
+ var previousAwait = this.context.await;
+ this.context.allowYield = true;
+ this.context.await = isAsync;
+ var node = this.startNode(startToken);
+ this.expect('=>');
+ var body = void 0;
+ if (this.match('{')) {
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ body = this.parseFunctionSourceElements();
+ this.context.allowIn = previousAllowIn;
+ }
+ else {
+ body = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ var expression = body.type !== syntax_1.Syntax.BlockStatement;
+ if (this.context.strict && list.firstRestricted) {
+ this.throwUnexpectedToken(list.firstRestricted, list.message);
+ }
+ if (this.context.strict && list.stricted) {
+ this.tolerateUnexpectedToken(list.stricted, list.message);
+ }
+ expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) :
+ this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.allowYield = previousAllowYield;
+ this.context.await = previousAwait;
+ }
+ }
+ else {
+ if (this.matchAssign()) {
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
+ var id = expr;
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
+ }
+ if (this.scanner.isStrictModeReservedWord(id.name)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ }
+ if (!this.match('=')) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else {
+ this.reinterpretExpressionAsPattern(expr);
+ }
+ token = this.nextToken();
+ var operator = token.value;
+ var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right));
+ this.context.firstCoverInitializedNameError = null;
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-comma-operator
+ Parser.prototype.parseExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ if (this.match(',')) {
+ var expressions = [];
+ expressions.push(expr);
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (!this.match(',')) {
+ break;
+ }
+ this.nextToken();
+ expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
+ }
+ expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-block
+ Parser.prototype.parseStatementListItem = function () {
+ var statement;
+ this.context.isAssignmentTarget = true;
+ this.context.isBindingElement = true;
+ if (this.lookahead.type === 4 /* Keyword */) {
+ switch (this.lookahead.value) {
+ case 'export':
+ if (!this.context.isModule) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
+ }
+ statement = this.parseExportDeclaration();
+ break;
+ case 'import':
+ if (!this.context.isModule) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
+ }
+ statement = this.parseImportDeclaration();
+ break;
+ case 'const':
+ statement = this.parseLexicalDeclaration({ inFor: false });
+ break;
+ case 'function':
+ statement = this.parseFunctionDeclaration();
+ break;
+ case 'class':
+ statement = this.parseClassDeclaration();
+ break;
+ case 'let':
+ statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
+ break;
+ default:
+ statement = this.parseStatement();
+ break;
+ }
+ }
+ else {
+ statement = this.parseStatement();
+ }
+ return statement;
+ };
+ Parser.prototype.parseBlock = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var block = [];
+ while (true) {
+ if (this.match('}')) {
+ break;
+ }
+ block.push(this.parseStatementListItem());
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.BlockStatement(block));
+ };
+ // https://tc39.github.io/ecma262/#sec-let-and-const-declarations
+ Parser.prototype.parseLexicalBinding = function (kind, options) {
+ var node = this.createNode();
+ var params = [];
+ var id = this.parsePattern(params, kind);
+ if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateError(messages_1.Messages.StrictVarName);
+ }
+ }
+ var init = null;
+ if (kind === 'const') {
+ if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
+ if (this.match('=')) {
+ this.nextToken();
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ else {
+ this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const');
+ }
+ }
+ }
+ else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
+ this.expect('=');
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ return this.finalize(node, new Node.VariableDeclarator(id, init));
+ };
+ Parser.prototype.parseBindingList = function (kind, options) {
+ var list = [this.parseLexicalBinding(kind, options)];
+ while (this.match(',')) {
+ this.nextToken();
+ list.push(this.parseLexicalBinding(kind, options));
+ }
+ return list;
+ };
+ Parser.prototype.isLexicalDeclaration = function () {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.scanner.lex();
+ this.scanner.restoreState(state);
+ return (next.type === 3 /* Identifier */) ||
+ (next.type === 7 /* Punctuator */ && next.value === '[') ||
+ (next.type === 7 /* Punctuator */ && next.value === '{') ||
+ (next.type === 4 /* Keyword */ && next.value === 'let') ||
+ (next.type === 4 /* Keyword */ && next.value === 'yield');
+ };
+ Parser.prototype.parseLexicalDeclaration = function (options) {
+ var node = this.createNode();
+ var kind = this.nextToken().value;
+ assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
+ var declarations = this.parseBindingList(kind, options);
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
+ };
+ // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns
+ Parser.prototype.parseBindingRestElement = function (params, kind) {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.parsePattern(params, kind);
+ return this.finalize(node, new Node.RestElement(arg));
+ };
+ Parser.prototype.parseArrayPattern = function (params, kind) {
+ var node = this.createNode();
+ this.expect('[');
+ var elements = [];
+ while (!this.match(']')) {
+ if (this.match(',')) {
+ this.nextToken();
+ elements.push(null);
+ }
+ else {
+ if (this.match('...')) {
+ elements.push(this.parseBindingRestElement(params, kind));
+ break;
+ }
+ else {
+ elements.push(this.parsePatternWithDefault(params, kind));
+ }
+ if (!this.match(']')) {
+ this.expect(',');
+ }
+ }
+ }
+ this.expect(']');
+ return this.finalize(node, new Node.ArrayPattern(elements));
+ };
+ Parser.prototype.parsePropertyPattern = function (params, kind) {
+ var node = this.createNode();
+ var computed = false;
+ var shorthand = false;
+ var method = false;
+ var key;
+ var value;
+ if (this.lookahead.type === 3 /* Identifier */) {
+ var keyToken = this.lookahead;
+ key = this.parseVariableIdentifier();
+ var init = this.finalize(node, new Node.Identifier(keyToken.value));
+ if (this.match('=')) {
+ params.push(keyToken);
+ shorthand = true;
+ this.nextToken();
+ var expr = this.parseAssignmentExpression();
+ value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
+ }
+ else if (!this.match(':')) {
+ params.push(keyToken);
+ shorthand = true;
+ value = init;
+ }
+ else {
+ this.expect(':');
+ value = this.parsePatternWithDefault(params, kind);
+ }
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.expect(':');
+ value = this.parsePatternWithDefault(params, kind);
+ }
+ return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
+ };
+ Parser.prototype.parseObjectPattern = function (params, kind) {
+ var node = this.createNode();
+ var properties = [];
+ this.expect('{');
+ while (!this.match('}')) {
+ properties.push(this.parsePropertyPattern(params, kind));
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.ObjectPattern(properties));
+ };
+ Parser.prototype.parsePattern = function (params, kind) {
+ var pattern;
+ if (this.match('[')) {
+ pattern = this.parseArrayPattern(params, kind);
+ }
+ else if (this.match('{')) {
+ pattern = this.parseObjectPattern(params, kind);
+ }
+ else {
+ if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding);
+ }
+ params.push(this.lookahead);
+ pattern = this.parseVariableIdentifier(kind);
+ }
+ return pattern;
+ };
+ Parser.prototype.parsePatternWithDefault = function (params, kind) {
+ var startToken = this.lookahead;
+ var pattern = this.parsePattern(params, kind);
+ if (this.match('=')) {
+ this.nextToken();
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = true;
+ var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowYield = previousAllowYield;
+ pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
+ }
+ return pattern;
+ };
+ // https://tc39.github.io/ecma262/#sec-variable-statement
+ Parser.prototype.parseVariableIdentifier = function (kind) {
+ var node = this.createNode();
+ var token = this.nextToken();
+ if (token.type === 4 /* Keyword */ && token.value === 'yield') {
+ if (this.context.strict) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ else if (!this.context.allowYield) {
+ this.throwUnexpectedToken(token);
+ }
+ }
+ else if (token.type !== 3 /* Identifier */) {
+ if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ else {
+ if (this.context.strict || token.value !== 'let' || kind !== 'var') {
+ this.throwUnexpectedToken(token);
+ }
+ }
+ }
+ else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') {
+ this.tolerateUnexpectedToken(token);
+ }
+ return this.finalize(node, new Node.Identifier(token.value));
+ };
+ Parser.prototype.parseVariableDeclaration = function (options) {
+ var node = this.createNode();
+ var params = [];
+ var id = this.parsePattern(params, 'var');
+ if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateError(messages_1.Messages.StrictVarName);
+ }
+ }
+ var init = null;
+ if (this.match('=')) {
+ this.nextToken();
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
+ this.expect('=');
+ }
+ return this.finalize(node, new Node.VariableDeclarator(id, init));
+ };
+ Parser.prototype.parseVariableDeclarationList = function (options) {
+ var opt = { inFor: options.inFor };
+ var list = [];
+ list.push(this.parseVariableDeclaration(opt));
+ while (this.match(',')) {
+ this.nextToken();
+ list.push(this.parseVariableDeclaration(opt));
+ }
+ return list;
+ };
+ Parser.prototype.parseVariableStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('var');
+ var declarations = this.parseVariableDeclarationList({ inFor: false });
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
+ };
+ // https://tc39.github.io/ecma262/#sec-empty-statement
+ Parser.prototype.parseEmptyStatement = function () {
+ var node = this.createNode();
+ this.expect(';');
+ return this.finalize(node, new Node.EmptyStatement());
+ };
+ // https://tc39.github.io/ecma262/#sec-expression-statement
+ Parser.prototype.parseExpressionStatement = function () {
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ExpressionStatement(expr));
+ };
+ // https://tc39.github.io/ecma262/#sec-if-statement
+ Parser.prototype.parseIfClause = function () {
+ if (this.context.strict && this.matchKeyword('function')) {
+ this.tolerateError(messages_1.Messages.StrictFunction);
+ }
+ return this.parseStatement();
+ };
+ Parser.prototype.parseIfStatement = function () {
+ var node = this.createNode();
+ var consequent;
+ var alternate = null;
+ this.expectKeyword('if');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ consequent = this.parseIfClause();
+ if (this.matchKeyword('else')) {
+ this.nextToken();
+ alternate = this.parseIfClause();
+ }
+ }
+ return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
+ };
+ // https://tc39.github.io/ecma262/#sec-do-while-statement
+ Parser.prototype.parseDoWhileStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('do');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ var body = this.parseStatement();
+ this.context.inIteration = previousInIteration;
+ this.expectKeyword('while');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ }
+ else {
+ this.expect(')');
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ }
+ return this.finalize(node, new Node.DoWhileStatement(body, test));
+ };
+ // https://tc39.github.io/ecma262/#sec-while-statement
+ Parser.prototype.parseWhileStatement = function () {
+ var node = this.createNode();
+ var body;
+ this.expectKeyword('while');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ body = this.parseStatement();
+ this.context.inIteration = previousInIteration;
+ }
+ return this.finalize(node, new Node.WhileStatement(test, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-for-statement
+ // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements
+ Parser.prototype.parseForStatement = function () {
+ var init = null;
+ var test = null;
+ var update = null;
+ var forIn = true;
+ var left, right;
+ var node = this.createNode();
+ this.expectKeyword('for');
+ this.expect('(');
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else {
+ if (this.matchKeyword('var')) {
+ init = this.createNode();
+ this.nextToken();
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ var declarations = this.parseVariableDeclarationList({ inFor: true });
+ this.context.allowIn = previousAllowIn;
+ if (declarations.length === 1 && this.matchKeyword('in')) {
+ var decl = declarations[0];
+ if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
+ this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
+ }
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.nextToken();
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.expect(';');
+ }
+ }
+ else if (this.matchKeyword('const') || this.matchKeyword('let')) {
+ init = this.createNode();
+ var kind = this.nextToken().value;
+ if (!this.context.strict && this.lookahead.value === 'in') {
+ init = this.finalize(init, new Node.Identifier(kind));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else {
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ var declarations = this.parseBindingList(kind, { inFor: true });
+ this.context.allowIn = previousAllowIn;
+ if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ this.nextToken();
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ this.consumeSemicolon();
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ }
+ }
+ }
+ else {
+ var initStartToken = this.lookahead;
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ init = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowIn = previousAllowIn;
+ if (this.matchKeyword('in')) {
+ if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
+ }
+ this.nextToken();
+ this.reinterpretExpressionAsPattern(init);
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (this.matchContextualKeyword('of')) {
+ if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
+ }
+ this.nextToken();
+ this.reinterpretExpressionAsPattern(init);
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ if (this.match(',')) {
+ var initSeq = [init];
+ while (this.match(',')) {
+ this.nextToken();
+ initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
+ }
+ init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
+ }
+ this.expect(';');
+ }
+ }
+ }
+ if (typeof left === 'undefined') {
+ if (!this.match(';')) {
+ test = this.parseExpression();
+ }
+ this.expect(';');
+ if (!this.match(')')) {
+ update = this.parseExpression();
+ }
+ }
+ var body;
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ body = this.isolateCoverGrammar(this.parseStatement);
+ this.context.inIteration = previousInIteration;
+ }
+ return (typeof left === 'undefined') ?
+ this.finalize(node, new Node.ForStatement(init, test, update, body)) :
+ forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
+ this.finalize(node, new Node.ForOfStatement(left, right, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-continue-statement
+ Parser.prototype.parseContinueStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('continue');
+ var label = null;
+ if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
+ var id = this.parseVariableIdentifier();
+ label = id;
+ var key = '$' + id.name;
+ if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.UnknownLabel, id.name);
+ }
+ }
+ this.consumeSemicolon();
+ if (label === null && !this.context.inIteration) {
+ this.throwError(messages_1.Messages.IllegalContinue);
+ }
+ return this.finalize(node, new Node.ContinueStatement(label));
+ };
+ // https://tc39.github.io/ecma262/#sec-break-statement
+ Parser.prototype.parseBreakStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('break');
+ var label = null;
+ if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
+ var id = this.parseVariableIdentifier();
+ var key = '$' + id.name;
+ if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.UnknownLabel, id.name);
+ }
+ label = id;
+ }
+ this.consumeSemicolon();
+ if (label === null && !this.context.inIteration && !this.context.inSwitch) {
+ this.throwError(messages_1.Messages.IllegalBreak);
+ }
+ return this.finalize(node, new Node.BreakStatement(label));
+ };
+ // https://tc39.github.io/ecma262/#sec-return-statement
+ Parser.prototype.parseReturnStatement = function () {
+ if (!this.context.inFunctionBody) {
+ this.tolerateError(messages_1.Messages.IllegalReturn);
+ }
+ var node = this.createNode();
+ this.expectKeyword('return');
+ var hasArgument = (!this.match(';') && !this.match('}') &&
+ !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) ||
+ this.lookahead.type === 8 /* StringLiteral */ ||
+ this.lookahead.type === 10 /* Template */;
+ var argument = hasArgument ? this.parseExpression() : null;
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ReturnStatement(argument));
+ };
+ // https://tc39.github.io/ecma262/#sec-with-statement
+ Parser.prototype.parseWithStatement = function () {
+ if (this.context.strict) {
+ this.tolerateError(messages_1.Messages.StrictModeWith);
+ }
+ var node = this.createNode();
+ var body;
+ this.expectKeyword('with');
+ this.expect('(');
+ var object = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ body = this.parseStatement();
+ }
+ return this.finalize(node, new Node.WithStatement(object, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-switch-statement
+ Parser.prototype.parseSwitchCase = function () {
+ var node = this.createNode();
+ var test;
+ if (this.matchKeyword('default')) {
+ this.nextToken();
+ test = null;
+ }
+ else {
+ this.expectKeyword('case');
+ test = this.parseExpression();
+ }
+ this.expect(':');
+ var consequent = [];
+ while (true) {
+ if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
+ break;
+ }
+ consequent.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.SwitchCase(test, consequent));
+ };
+ Parser.prototype.parseSwitchStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('switch');
+ this.expect('(');
+ var discriminant = this.parseExpression();
+ this.expect(')');
+ var previousInSwitch = this.context.inSwitch;
+ this.context.inSwitch = true;
+ var cases = [];
+ var defaultFound = false;
+ this.expect('{');
+ while (true) {
+ if (this.match('}')) {
+ break;
+ }
+ var clause = this.parseSwitchCase();
+ if (clause.test === null) {
+ if (defaultFound) {
+ this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
+ }
+ defaultFound = true;
+ }
+ cases.push(clause);
+ }
+ this.expect('}');
+ this.context.inSwitch = previousInSwitch;
+ return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
+ };
+ // https://tc39.github.io/ecma262/#sec-labelled-statements
+ Parser.prototype.parseLabelledStatement = function () {
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ var statement;
+ if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
+ this.nextToken();
+ var id = expr;
+ var key = '$' + id.name;
+ if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
+ }
+ this.context.labelSet[key] = true;
+ var body = void 0;
+ if (this.matchKeyword('class')) {
+ this.tolerateUnexpectedToken(this.lookahead);
+ body = this.parseClassDeclaration();
+ }
+ else if (this.matchKeyword('function')) {
+ var token = this.lookahead;
+ var declaration = this.parseFunctionDeclaration();
+ if (this.context.strict) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction);
+ }
+ else if (declaration.generator) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext);
+ }
+ body = declaration;
+ }
+ else {
+ body = this.parseStatement();
+ }
+ delete this.context.labelSet[key];
+ statement = new Node.LabeledStatement(id, body);
+ }
+ else {
+ this.consumeSemicolon();
+ statement = new Node.ExpressionStatement(expr);
+ }
+ return this.finalize(node, statement);
+ };
+ // https://tc39.github.io/ecma262/#sec-throw-statement
+ Parser.prototype.parseThrowStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('throw');
+ if (this.hasLineTerminator) {
+ this.throwError(messages_1.Messages.NewlineAfterThrow);
+ }
+ var argument = this.parseExpression();
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ThrowStatement(argument));
+ };
+ // https://tc39.github.io/ecma262/#sec-try-statement
+ Parser.prototype.parseCatchClause = function () {
+ var node = this.createNode();
+ this.expectKeyword('catch');
+ this.expect('(');
+ if (this.match(')')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ var params = [];
+ var param = this.parsePattern(params);
+ var paramMap = {};
+ for (var i = 0; i < params.length; i++) {
+ var key = '$' + params[i].value;
+ if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
+ this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
+ }
+ paramMap[key] = true;
+ }
+ if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(param.name)) {
+ this.tolerateError(messages_1.Messages.StrictCatchVariable);
+ }
+ }
+ this.expect(')');
+ var body = this.parseBlock();
+ return this.finalize(node, new Node.CatchClause(param, body));
+ };
+ Parser.prototype.parseFinallyClause = function () {
+ this.expectKeyword('finally');
+ return this.parseBlock();
+ };
+ Parser.prototype.parseTryStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('try');
+ var block = this.parseBlock();
+ var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
+ var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
+ if (!handler && !finalizer) {
+ this.throwError(messages_1.Messages.NoCatchOrFinally);
+ }
+ return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
+ };
+ // https://tc39.github.io/ecma262/#sec-debugger-statement
+ Parser.prototype.parseDebuggerStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('debugger');
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.DebuggerStatement());
+ };
+ // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
+ Parser.prototype.parseStatement = function () {
+ var statement;
+ switch (this.lookahead.type) {
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 6 /* NumericLiteral */:
+ case 8 /* StringLiteral */:
+ case 10 /* Template */:
+ case 9 /* RegularExpression */:
+ statement = this.parseExpressionStatement();
+ break;
+ case 7 /* Punctuator */:
+ var value = this.lookahead.value;
+ if (value === '{') {
+ statement = this.parseBlock();
+ }
+ else if (value === '(') {
+ statement = this.parseExpressionStatement();
+ }
+ else if (value === ';') {
+ statement = this.parseEmptyStatement();
+ }
+ else {
+ statement = this.parseExpressionStatement();
+ }
+ break;
+ case 3 /* Identifier */:
+ statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement();
+ break;
+ case 4 /* Keyword */:
+ switch (this.lookahead.value) {
+ case 'break':
+ statement = this.parseBreakStatement();
+ break;
+ case 'continue':
+ statement = this.parseContinueStatement();
+ break;
+ case 'debugger':
+ statement = this.parseDebuggerStatement();
+ break;
+ case 'do':
+ statement = this.parseDoWhileStatement();
+ break;
+ case 'for':
+ statement = this.parseForStatement();
+ break;
+ case 'function':
+ statement = this.parseFunctionDeclaration();
+ break;
+ case 'if':
+ statement = this.parseIfStatement();
+ break;
+ case 'return':
+ statement = this.parseReturnStatement();
+ break;
+ case 'switch':
+ statement = this.parseSwitchStatement();
+ break;
+ case 'throw':
+ statement = this.parseThrowStatement();
+ break;
+ case 'try':
+ statement = this.parseTryStatement();
+ break;
+ case 'var':
+ statement = this.parseVariableStatement();
+ break;
+ case 'while':
+ statement = this.parseWhileStatement();
+ break;
+ case 'with':
+ statement = this.parseWithStatement();
+ break;
+ default:
+ statement = this.parseExpressionStatement();
+ break;
+ }
+ break;
+ default:
+ statement = this.throwUnexpectedToken(this.lookahead);
+ }
+ return statement;
+ };
+ // https://tc39.github.io/ecma262/#sec-function-definitions
+ Parser.prototype.parseFunctionSourceElements = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var body = this.parseDirectivePrologues();
+ var previousLabelSet = this.context.labelSet;
+ var previousInIteration = this.context.inIteration;
+ var previousInSwitch = this.context.inSwitch;
+ var previousInFunctionBody = this.context.inFunctionBody;
+ this.context.labelSet = {};
+ this.context.inIteration = false;
+ this.context.inSwitch = false;
+ this.context.inFunctionBody = true;
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (this.match('}')) {
+ break;
+ }
+ body.push(this.parseStatementListItem());
+ }
+ this.expect('}');
+ this.context.labelSet = previousLabelSet;
+ this.context.inIteration = previousInIteration;
+ this.context.inSwitch = previousInSwitch;
+ this.context.inFunctionBody = previousInFunctionBody;
+ return this.finalize(node, new Node.BlockStatement(body));
+ };
+ Parser.prototype.validateParam = function (options, param, name) {
+ var key = '$' + name;
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(name)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamName;
+ }
+ if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamDupe;
+ }
+ }
+ else if (!options.firstRestricted) {
+ if (this.scanner.isRestrictedWord(name)) {
+ options.firstRestricted = param;
+ options.message = messages_1.Messages.StrictParamName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(name)) {
+ options.firstRestricted = param;
+ options.message = messages_1.Messages.StrictReservedWord;
+ }
+ else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamDupe;
+ }
+ }
+ /* istanbul ignore next */
+ if (typeof Object.defineProperty === 'function') {
+ Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
+ }
+ else {
+ options.paramSet[key] = true;
+ }
+ };
+ Parser.prototype.parseRestElement = function (params) {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.parsePattern(params);
+ if (this.match('=')) {
+ this.throwError(messages_1.Messages.DefaultRestParameter);
+ }
+ if (!this.match(')')) {
+ this.throwError(messages_1.Messages.ParameterAfterRestParameter);
+ }
+ return this.finalize(node, new Node.RestElement(arg));
+ };
+ Parser.prototype.parseFormalParameter = function (options) {
+ var params = [];
+ var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
+ for (var i = 0; i < params.length; i++) {
+ this.validateParam(options, params[i], params[i].value);
+ }
+ options.simple = options.simple && (param instanceof Node.Identifier);
+ options.params.push(param);
+ };
+ Parser.prototype.parseFormalParameters = function (firstRestricted) {
+ var options;
+ options = {
+ simple: true,
+ params: [],
+ firstRestricted: firstRestricted
+ };
+ this.expect('(');
+ if (!this.match(')')) {
+ options.paramSet = {};
+ while (this.lookahead.type !== 2 /* EOF */) {
+ this.parseFormalParameter(options);
+ if (this.match(')')) {
+ break;
+ }
+ this.expect(',');
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return {
+ simple: options.simple,
+ params: options.params,
+ stricted: options.stricted,
+ firstRestricted: options.firstRestricted,
+ message: options.message
+ };
+ };
+ Parser.prototype.matchAsyncFunction = function () {
+ var match = this.matchContextualKeyword('async');
+ if (match) {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.scanner.lex();
+ this.scanner.restoreState(state);
+ match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function');
+ }
+ return match;
+ };
+ Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
+ var node = this.createNode();
+ var isAsync = this.matchContextualKeyword('async');
+ if (isAsync) {
+ this.nextToken();
+ }
+ this.expectKeyword('function');
+ var isGenerator = isAsync ? false : this.match('*');
+ if (isGenerator) {
+ this.nextToken();
+ }
+ var message;
+ var id = null;
+ var firstRestricted = null;
+ if (!identifierIsOptional || !this.match('(')) {
+ var token = this.lookahead;
+ id = this.parseVariableIdentifier();
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
+ }
+ }
+ else {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictFunctionName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ var previousAllowAwait = this.context.await;
+ var previousAllowYield = this.context.allowYield;
+ this.context.await = isAsync;
+ this.context.allowYield = !isGenerator;
+ var formalParameters = this.parseFormalParameters(firstRestricted);
+ var params = formalParameters.params;
+ var stricted = formalParameters.stricted;
+ firstRestricted = formalParameters.firstRestricted;
+ if (formalParameters.message) {
+ message = formalParameters.message;
+ }
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = formalParameters.simple;
+ var body = this.parseFunctionSourceElements();
+ if (this.context.strict && firstRestricted) {
+ this.throwUnexpectedToken(firstRestricted, message);
+ }
+ if (this.context.strict && stricted) {
+ this.tolerateUnexpectedToken(stricted, message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.await = previousAllowAwait;
+ this.context.allowYield = previousAllowYield;
+ return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) :
+ this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
+ };
+ Parser.prototype.parseFunctionExpression = function () {
+ var node = this.createNode();
+ var isAsync = this.matchContextualKeyword('async');
+ if (isAsync) {
+ this.nextToken();
+ }
+ this.expectKeyword('function');
+ var isGenerator = isAsync ? false : this.match('*');
+ if (isGenerator) {
+ this.nextToken();
+ }
+ var message;
+ var id = null;
+ var firstRestricted;
+ var previousAllowAwait = this.context.await;
+ var previousAllowYield = this.context.allowYield;
+ this.context.await = isAsync;
+ this.context.allowYield = !isGenerator;
+ if (!this.match('(')) {
+ var token = this.lookahead;
+ id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
+ }
+ }
+ else {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictFunctionName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ var formalParameters = this.parseFormalParameters(firstRestricted);
+ var params = formalParameters.params;
+ var stricted = formalParameters.stricted;
+ firstRestricted = formalParameters.firstRestricted;
+ if (formalParameters.message) {
+ message = formalParameters.message;
+ }
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = formalParameters.simple;
+ var body = this.parseFunctionSourceElements();
+ if (this.context.strict && firstRestricted) {
+ this.throwUnexpectedToken(firstRestricted, message);
+ }
+ if (this.context.strict && stricted) {
+ this.tolerateUnexpectedToken(stricted, message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.await = previousAllowAwait;
+ this.context.allowYield = previousAllowYield;
+ return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) :
+ this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
+ };
+ // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
+ Parser.prototype.parseDirective = function () {
+ var token = this.lookahead;
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
+ this.consumeSemicolon();
+ return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
+ };
+ Parser.prototype.parseDirectivePrologues = function () {
+ var firstRestricted = null;
+ var body = [];
+ while (true) {
+ var token = this.lookahead;
+ if (token.type !== 8 /* StringLiteral */) {
+ break;
+ }
+ var statement = this.parseDirective();
+ body.push(statement);
+ var directive = statement.directive;
+ if (typeof directive !== 'string') {
+ break;
+ }
+ if (directive === 'use strict') {
+ this.context.strict = true;
+ if (firstRestricted) {
+ this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
+ }
+ if (!this.context.allowStrictDirective) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective);
+ }
+ }
+ else {
+ if (!firstRestricted && token.octal) {
+ firstRestricted = token;
+ }
+ }
+ }
+ return body;
+ };
+ // https://tc39.github.io/ecma262/#sec-method-definitions
+ Parser.prototype.qualifiedPropertyName = function (token) {
+ switch (token.type) {
+ case 3 /* Identifier */:
+ case 8 /* StringLiteral */:
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 6 /* NumericLiteral */:
+ case 4 /* Keyword */:
+ return true;
+ case 7 /* Punctuator */:
+ return token.value === '[';
+ default:
+ break;
+ }
+ return false;
+ };
+ Parser.prototype.parseGetterMethod = function () {
+ var node = this.createNode();
+ var isGenerator = false;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = !isGenerator;
+ var formalParameters = this.parseFormalParameters();
+ if (formalParameters.params.length > 0) {
+ this.tolerateError(messages_1.Messages.BadGetterArity);
+ }
+ var method = this.parsePropertyMethod(formalParameters);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
+ };
+ Parser.prototype.parseSetterMethod = function () {
+ var node = this.createNode();
+ var isGenerator = false;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = !isGenerator;
+ var formalParameters = this.parseFormalParameters();
+ if (formalParameters.params.length !== 1) {
+ this.tolerateError(messages_1.Messages.BadSetterArity);
+ }
+ else if (formalParameters.params[0] instanceof Node.RestElement) {
+ this.tolerateError(messages_1.Messages.BadSetterRestParameter);
+ }
+ var method = this.parsePropertyMethod(formalParameters);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
+ };
+ Parser.prototype.parseGeneratorMethod = function () {
+ var node = this.createNode();
+ var isGenerator = true;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = true;
+ var params = this.parseFormalParameters();
+ this.context.allowYield = false;
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
+ };
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions
+ Parser.prototype.isStartOfExpression = function () {
+ var start = true;
+ var value = this.lookahead.value;
+ switch (this.lookahead.type) {
+ case 7 /* Punctuator */:
+ start = (value === '[') || (value === '(') || (value === '{') ||
+ (value === '+') || (value === '-') ||
+ (value === '!') || (value === '~') ||
+ (value === '++') || (value === '--') ||
+ (value === '/') || (value === '/='); // regular expression literal
+ break;
+ case 4 /* Keyword */:
+ start = (value === 'class') || (value === 'delete') ||
+ (value === 'function') || (value === 'let') || (value === 'new') ||
+ (value === 'super') || (value === 'this') || (value === 'typeof') ||
+ (value === 'void') || (value === 'yield');
+ break;
+ default:
+ break;
+ }
+ return start;
+ };
+ Parser.prototype.parseYieldExpression = function () {
+ var node = this.createNode();
+ this.expectKeyword('yield');
+ var argument = null;
+ var delegate = false;
+ if (!this.hasLineTerminator) {
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = false;
+ delegate = this.match('*');
+ if (delegate) {
+ this.nextToken();
+ argument = this.parseAssignmentExpression();
+ }
+ else if (this.isStartOfExpression()) {
+ argument = this.parseAssignmentExpression();
+ }
+ this.context.allowYield = previousAllowYield;
+ }
+ return this.finalize(node, new Node.YieldExpression(argument, delegate));
+ };
+ // https://tc39.github.io/ecma262/#sec-class-definitions
+ Parser.prototype.parseClassElement = function (hasConstructor) {
+ var token = this.lookahead;
+ var node = this.createNode();
+ var kind = '';
+ var key = null;
+ var value = null;
+ var computed = false;
+ var method = false;
+ var isStatic = false;
+ var isAsync = false;
+ if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ var id = key;
+ if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
+ token = this.lookahead;
+ isStatic = true;
+ computed = this.match('[');
+ if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ key = this.parseObjectPropertyKey();
+ }
+ }
+ if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) {
+ var punctuator = this.lookahead.value;
+ if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') {
+ isAsync = true;
+ token = this.lookahead;
+ key = this.parseObjectPropertyKey();
+ if (token.type === 3 /* Identifier */ && token.value === 'constructor') {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync);
+ }
+ }
+ }
+ }
+ var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
+ if (token.type === 3 /* Identifier */) {
+ if (token.value === 'get' && lookaheadPropertyKey) {
+ kind = 'get';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.context.allowYield = false;
+ value = this.parseGetterMethod();
+ }
+ else if (token.value === 'set' && lookaheadPropertyKey) {
+ kind = 'set';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseSetterMethod();
+ }
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
+ kind = 'init';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseGeneratorMethod();
+ method = true;
+ }
+ if (!kind && key && this.match('(')) {
+ kind = 'init';
+ value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
+ method = true;
+ }
+ if (!kind) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ if (kind === 'init') {
+ kind = 'method';
+ }
+ if (!computed) {
+ if (isStatic && this.isPropertyKey(key, 'prototype')) {
+ this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
+ }
+ if (!isStatic && this.isPropertyKey(key, 'constructor')) {
+ if (kind !== 'method' || !method || (value && value.generator)) {
+ this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
+ }
+ if (hasConstructor.value) {
+ this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
+ }
+ else {
+ hasConstructor.value = true;
+ }
+ kind = 'constructor';
+ }
+ }
+ return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
+ };
+ Parser.prototype.parseClassElementList = function () {
+ var body = [];
+ var hasConstructor = { value: false };
+ this.expect('{');
+ while (!this.match('}')) {
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else {
+ body.push(this.parseClassElement(hasConstructor));
+ }
+ }
+ this.expect('}');
+ return body;
+ };
+ Parser.prototype.parseClassBody = function () {
+ var node = this.createNode();
+ var elementList = this.parseClassElementList();
+ return this.finalize(node, new Node.ClassBody(elementList));
+ };
+ Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
+ var node = this.createNode();
+ var previousStrict = this.context.strict;
+ this.context.strict = true;
+ this.expectKeyword('class');
+ var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier();
+ var superClass = null;
+ if (this.matchKeyword('extends')) {
+ this.nextToken();
+ superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ }
+ var classBody = this.parseClassBody();
+ this.context.strict = previousStrict;
+ return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
+ };
+ Parser.prototype.parseClassExpression = function () {
+ var node = this.createNode();
+ var previousStrict = this.context.strict;
+ this.context.strict = true;
+ this.expectKeyword('class');
+ var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null;
+ var superClass = null;
+ if (this.matchKeyword('extends')) {
+ this.nextToken();
+ superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ }
+ var classBody = this.parseClassBody();
+ this.context.strict = previousStrict;
+ return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
+ };
+ // https://tc39.github.io/ecma262/#sec-scripts
+ // https://tc39.github.io/ecma262/#sec-modules
+ Parser.prototype.parseModule = function () {
+ this.context.strict = true;
+ this.context.isModule = true;
+ this.scanner.isModule = true;
+ var node = this.createNode();
+ var body = this.parseDirectivePrologues();
+ while (this.lookahead.type !== 2 /* EOF */) {
+ body.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.Module(body));
+ };
+ Parser.prototype.parseScript = function () {
+ var node = this.createNode();
+ var body = this.parseDirectivePrologues();
+ while (this.lookahead.type !== 2 /* EOF */) {
+ body.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.Script(body));
+ };
+ // https://tc39.github.io/ecma262/#sec-imports
+ Parser.prototype.parseModuleSpecifier = function () {
+ var node = this.createNode();
+ if (this.lookahead.type !== 8 /* StringLiteral */) {
+ this.throwError(messages_1.Messages.InvalidModuleSpecifier);
+ }
+ var token = this.nextToken();
+ var raw = this.getTokenRaw(token);
+ return this.finalize(node, new Node.Literal(token.value, raw));
+ };
+ // import {<foo as bar>} ...;
+ Parser.prototype.parseImportSpecifier = function () {
+ var node = this.createNode();
+ var imported;
+ var local;
+ if (this.lookahead.type === 3 /* Identifier */) {
+ imported = this.parseVariableIdentifier();
+ local = imported;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ local = this.parseVariableIdentifier();
+ }
+ }
+ else {
+ imported = this.parseIdentifierName();
+ local = imported;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ local = this.parseVariableIdentifier();
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ return this.finalize(node, new Node.ImportSpecifier(local, imported));
+ };
+ // {foo, bar as bas}
+ Parser.prototype.parseNamedImports = function () {
+ this.expect('{');
+ var specifiers = [];
+ while (!this.match('}')) {
+ specifiers.push(this.parseImportSpecifier());
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ return specifiers;
+ };
+ // import <foo> ...;
+ Parser.prototype.parseImportDefaultSpecifier = function () {
+ var node = this.createNode();
+ var local = this.parseIdentifierName();
+ return this.finalize(node, new Node.ImportDefaultSpecifier(local));
+ };
+ // import <* as foo> ...;
+ Parser.prototype.parseImportNamespaceSpecifier = function () {
+ var node = this.createNode();
+ this.expect('*');
+ if (!this.matchContextualKeyword('as')) {
+ this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
+ }
+ this.nextToken();
+ var local = this.parseIdentifierName();
+ return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
+ };
+ Parser.prototype.parseImportDeclaration = function () {
+ if (this.context.inFunctionBody) {
+ this.throwError(messages_1.Messages.IllegalImportDeclaration);
+ }
+ var node = this.createNode();
+ this.expectKeyword('import');
+ var src;
+ var specifiers = [];
+ if (this.lookahead.type === 8 /* StringLiteral */) {
+ // import 'foo';
+ src = this.parseModuleSpecifier();
+ }
+ else {
+ if (this.match('{')) {
+ // import {bar}
+ specifiers = specifiers.concat(this.parseNamedImports());
+ }
+ else if (this.match('*')) {
+ // import * as foo
+ specifiers.push(this.parseImportNamespaceSpecifier());
+ }
+ else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
+ // import foo
+ specifiers.push(this.parseImportDefaultSpecifier());
+ if (this.match(',')) {
+ this.nextToken();
+ if (this.match('*')) {
+ // import foo, * as foo
+ specifiers.push(this.parseImportNamespaceSpecifier());
+ }
+ else if (this.match('{')) {
+ // import foo, {bar}
+ specifiers = specifiers.concat(this.parseNamedImports());
+ }
+ else {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ if (!this.matchContextualKeyword('from')) {
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ this.nextToken();
+ src = this.parseModuleSpecifier();
+ }
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
+ };
+ // https://tc39.github.io/ecma262/#sec-exports
+ Parser.prototype.parseExportSpecifier = function () {
+ var node = this.createNode();
+ var local = this.parseIdentifierName();
+ var exported = local;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ exported = this.parseIdentifierName();
+ }
+ return this.finalize(node, new Node.ExportSpecifier(local, exported));
+ };
+ Parser.prototype.parseExportDeclaration = function () {
+ if (this.context.inFunctionBody) {
+ this.throwError(messages_1.Messages.IllegalExportDeclaration);
+ }
+ var node = this.createNode();
+ this.expectKeyword('export');
+ var exportDeclaration;
+ if (this.matchKeyword('default')) {
+ // export default ...
+ this.nextToken();
+ if (this.matchKeyword('function')) {
+ // export default function foo () {}
+ // export default function () {}
+ var declaration = this.parseFunctionDeclaration(true);
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else if (this.matchKeyword('class')) {
+ // export default class foo {}
+ var declaration = this.parseClassDeclaration(true);
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else if (this.matchContextualKeyword('async')) {
+ // export default async function f () {}
+ // export default async function () {}
+ // export default async x => x
+ var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression();
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else {
+ if (this.matchContextualKeyword('from')) {
+ this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
+ }
+ // export default {};
+ // export default [];
+ // export default (1 + 2);
+ var declaration = this.match('{') ? this.parseObjectInitializer() :
+ this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
+ this.consumeSemicolon();
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ }
+ else if (this.match('*')) {
+ // export * from 'foo';
+ this.nextToken();
+ if (!this.matchContextualKeyword('from')) {
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ this.nextToken();
+ var src = this.parseModuleSpecifier();
+ this.consumeSemicolon();
+ exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
+ }
+ else if (this.lookahead.type === 4 /* Keyword */) {
+ // export var f = 1;
+ var declaration = void 0;
+ switch (this.lookahead.value) {
+ case 'let':
+ case 'const':
+ declaration = this.parseLexicalDeclaration({ inFor: false });
+ break;
+ case 'var':
+ case 'class':
+ case 'function':
+ declaration = this.parseStatementListItem();
+ break;
+ default:
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
+ }
+ else if (this.matchAsyncFunction()) {
+ var declaration = this.parseFunctionDeclaration();
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
+ }
+ else {
+ var specifiers = [];
+ var source = null;
+ var isExportFromIdentifier = false;
+ this.expect('{');
+ while (!this.match('}')) {
+ isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
+ specifiers.push(this.parseExportSpecifier());
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ if (this.matchContextualKeyword('from')) {
+ // export {default} from 'foo';
+ // export {foo} from 'foo';
+ this.nextToken();
+ source = this.parseModuleSpecifier();
+ this.consumeSemicolon();
+ }
+ else if (isExportFromIdentifier) {
+ // export {default}; // missing fromClause
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ else {
+ // export {foo};
+ this.consumeSemicolon();
+ }
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
+ }
+ return exportDeclaration;
+ };
+ return Parser;
+ }());
+ exports.Parser = Parser;
+
+
+/***/ },
+/* 9 */
+/***/ function(module, exports) {
+
+ "use strict";
+ // Ensure the condition is true, otherwise throw an error.
+ // This is only to have a better contract semantic, i.e. another safety net
+ // to catch a logic error. The condition shall be fulfilled in normal case.
+ // Do NOT use this to enforce a certain condition on any user input.
+ Object.defineProperty(exports, "__esModule", { value: true });
+ function assert(condition, message) {
+ /* istanbul ignore if */
+ if (!condition) {
+ throw new Error('ASSERT: ' + message);
+ }
+ }
+ exports.assert = assert;
+
+
+/***/ },
+/* 10 */
+/***/ function(module, exports) {
+
+ "use strict";
+ /* tslint:disable:max-classes-per-file */
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var ErrorHandler = (function () {
+ function ErrorHandler() {
+ this.errors = [];
+ this.tolerant = false;
+ }
+ ErrorHandler.prototype.recordError = function (error) {
+ this.errors.push(error);
+ };
+ ErrorHandler.prototype.tolerate = function (error) {
+ if (this.tolerant) {
+ this.recordError(error);
+ }
+ else {
+ throw error;
+ }
+ };
+ ErrorHandler.prototype.constructError = function (msg, column) {
+ var error = new Error(msg);
+ try {
+ throw error;
+ }
+ catch (base) {
+ /* istanbul ignore else */
+ if (Object.create && Object.defineProperty) {
+ error = Object.create(base);
+ Object.defineProperty(error, 'column', { value: column });
+ }
+ }
+ /* istanbul ignore next */
+ return error;
+ };
+ ErrorHandler.prototype.createError = function (index, line, col, description) {
+ var msg = 'Line ' + line + ': ' + description;
+ var error = this.constructError(msg, col);
+ error.index = index;
+ error.lineNumber = line;
+ error.description = description;
+ return error;
+ };
+ ErrorHandler.prototype.throwError = function (index, line, col, description) {
+ throw this.createError(index, line, col, description);
+ };
+ ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
+ var error = this.createError(index, line, col, description);
+ if (this.tolerant) {
+ this.recordError(error);
+ }
+ else {
+ throw error;
+ }
+ };
+ return ErrorHandler;
+ }());
+ exports.ErrorHandler = ErrorHandler;
+
+
+/***/ },
+/* 11 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ // Error messages should be identical to V8.
+ exports.Messages = {
+ BadGetterArity: 'Getter must not have any formal parameters',
+ BadSetterArity: 'Setter must have exactly one formal parameter',
+ BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
+ ConstructorIsAsync: 'Class constructor may not be an async method',
+ ConstructorSpecialMethod: 'Class constructor may not be an accessor',
+ DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
+ DefaultRestParameter: 'Unexpected token =',
+ DuplicateBinding: 'Duplicate binding %0',
+ DuplicateConstructor: 'A class may only have one constructor',
+ DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
+ ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer',
+ GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts',
+ IllegalBreak: 'Illegal break statement',
+ IllegalContinue: 'Illegal continue statement',
+ IllegalExportDeclaration: 'Unexpected token',
+ IllegalImportDeclaration: 'Unexpected token',
+ IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ IllegalReturn: 'Illegal return statement',
+ InvalidEscapedReservedWord: 'Keyword must not contain escaped characters',
+ InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence',
+ InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
+ InvalidLHSInForIn: 'Invalid left-hand side in for-in',
+ InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
+ InvalidModuleSpecifier: 'Unexpected token',
+ InvalidRegExp: 'Invalid regular expression',
+ LetInLexicalBinding: 'let is disallowed as a lexically bound name',
+ MissingFromClause: 'Unexpected token',
+ MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
+ NewlineAfterThrow: 'Illegal newline after throw',
+ NoAsAfterImportNamespace: 'Unexpected token',
+ NoCatchOrFinally: 'Missing catch or finally after try',
+ ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
+ Redeclaration: '%0 \'%1\' has already been declared',
+ StaticPrototype: 'Classes may not have static property named prototype',
+ StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
+ StrictDelete: 'Delete of an unqualified identifier in strict mode.',
+ StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block',
+ StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
+ StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
+ StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
+ StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
+ StrictModeWith: 'Strict mode code may not include a with statement',
+ StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
+ StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
+ StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
+ StrictReservedWord: 'Use of future reserved word in strict mode',
+ StrictVarName: 'Variable name may not be eval or arguments in strict mode',
+ TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
+ UnexpectedEOS: 'Unexpected end of input',
+ UnexpectedIdentifier: 'Unexpected identifier',
+ UnexpectedNumber: 'Unexpected number',
+ UnexpectedReserved: 'Unexpected reserved word',
+ UnexpectedString: 'Unexpected string',
+ UnexpectedTemplate: 'Unexpected quasi %0',
+ UnexpectedToken: 'Unexpected token %0',
+ UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
+ UnknownLabel: 'Undefined label \'%0\'',
+ UnterminatedRegExp: 'Invalid regular expression: missing /'
+ };
+
+
+/***/ },
+/* 12 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var assert_1 = __webpack_require__(9);
+ var character_1 = __webpack_require__(4);
+ var messages_1 = __webpack_require__(11);
+ function hexValue(ch) {
+ return '0123456789abcdef'.indexOf(ch.toLowerCase());
+ }
+ function octalValue(ch) {
+ return '01234567'.indexOf(ch);
+ }
+ var Scanner = (function () {
+ function Scanner(code, handler) {
+ this.source = code;
+ this.errorHandler = handler;
+ this.trackComment = false;
+ this.isModule = false;
+ this.length = code.length;
+ this.index = 0;
+ this.lineNumber = (code.length > 0) ? 1 : 0;
+ this.lineStart = 0;
+ this.curlyStack = [];
+ }
+ Scanner.prototype.saveState = function () {
+ return {
+ index: this.index,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart
+ };
+ };
+ Scanner.prototype.restoreState = function (state) {
+ this.index = state.index;
+ this.lineNumber = state.lineNumber;
+ this.lineStart = state.lineStart;
+ };
+ Scanner.prototype.eof = function () {
+ return this.index >= this.length;
+ };
+ Scanner.prototype.throwUnexpectedToken = function (message) {
+ if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
+ return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
+ };
+ Scanner.prototype.tolerateUnexpectedToken = function (message) {
+ if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
+ this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
+ };
+ // https://tc39.github.io/ecma262/#sec-comments
+ Scanner.prototype.skipSingleLineComment = function (offset) {
+ var comments = [];
+ var start, loc;
+ if (this.trackComment) {
+ comments = [];
+ start = this.index - offset;
+ loc = {
+ start: {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - offset
+ },
+ end: {}
+ };
+ }
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ ++this.index;
+ if (character_1.Character.isLineTerminator(ch)) {
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - 1
+ };
+ var entry = {
+ multiLine: false,
+ slice: [start + offset, this.index - 1],
+ range: [start, this.index - 1],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ this.lineStart = this.index;
+ return comments;
+ }
+ }
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: false,
+ slice: [start + offset, this.index],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ return comments;
+ };
+ Scanner.prototype.skipMultiLineComment = function () {
+ var comments = [];
+ var start, loc;
+ if (this.trackComment) {
+ comments = [];
+ start = this.index - 2;
+ loc = {
+ start: {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - 2
+ },
+ end: {}
+ };
+ }
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (character_1.Character.isLineTerminator(ch)) {
+ if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ ++this.index;
+ this.lineStart = this.index;
+ }
+ else if (ch === 0x2A) {
+ // Block comment ends with '*/'.
+ if (this.source.charCodeAt(this.index + 1) === 0x2F) {
+ this.index += 2;
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: true,
+ slice: [start + 2, this.index - 2],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ return comments;
+ }
+ ++this.index;
+ }
+ else {
+ ++this.index;
+ }
+ }
+ // Ran off the end of the file - the whole thing is a comment
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: true,
+ slice: [start + 2, this.index],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ this.tolerateUnexpectedToken();
+ return comments;
+ };
+ Scanner.prototype.scanComments = function () {
+ var comments;
+ if (this.trackComment) {
+ comments = [];
+ }
+ var start = (this.index === 0);
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (character_1.Character.isWhiteSpace(ch)) {
+ ++this.index;
+ }
+ else if (character_1.Character.isLineTerminator(ch)) {
+ ++this.index;
+ if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ this.lineStart = this.index;
+ start = true;
+ }
+ else if (ch === 0x2F) {
+ ch = this.source.charCodeAt(this.index + 1);
+ if (ch === 0x2F) {
+ this.index += 2;
+ var comment = this.skipSingleLineComment(2);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ start = true;
+ }
+ else if (ch === 0x2A) {
+ this.index += 2;
+ var comment = this.skipMultiLineComment();
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else if (start && ch === 0x2D) {
+ // U+003E is '>'
+ if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
+ // '-->' is a single-line comment
+ this.index += 3;
+ var comment = this.skipSingleLineComment(3);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else if (ch === 0x3C && !this.isModule) {
+ if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
+ this.index += 4; // `<!--`
+ var comment = this.skipSingleLineComment(4);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ return comments;
+ };
+ // https://tc39.github.io/ecma262/#sec-future-reserved-words
+ Scanner.prototype.isFutureReservedWord = function (id) {
+ switch (id) {
+ case 'enum':
+ case 'export':
+ case 'import':
+ case 'super':
+ return true;
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.isStrictModeReservedWord = function (id) {
+ switch (id) {
+ case 'implements':
+ case 'interface':
+ case 'package':
+ case 'private':
+ case 'protected':
+ case 'public':
+ case 'static':
+ case 'yield':
+ case 'let':
+ return true;
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.isRestrictedWord = function (id) {
+ return id === 'eval' || id === 'arguments';
+ };
+ // https://tc39.github.io/ecma262/#sec-keywords
+ Scanner.prototype.isKeyword = function (id) {
+ switch (id.length) {
+ case 2:
+ return (id === 'if') || (id === 'in') || (id === 'do');
+ case 3:
+ return (id === 'var') || (id === 'for') || (id === 'new') ||
+ (id === 'try') || (id === 'let');
+ case 4:
+ return (id === 'this') || (id === 'else') || (id === 'case') ||
+ (id === 'void') || (id === 'with') || (id === 'enum');
+ case 5:
+ return (id === 'while') || (id === 'break') || (id === 'catch') ||
+ (id === 'throw') || (id === 'const') || (id === 'yield') ||
+ (id === 'class') || (id === 'super');
+ case 6:
+ return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
+ (id === 'switch') || (id === 'export') || (id === 'import');
+ case 7:
+ return (id === 'default') || (id === 'finally') || (id === 'extends');
+ case 8:
+ return (id === 'function') || (id === 'continue') || (id === 'debugger');
+ case 10:
+ return (id === 'instanceof');
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.codePointAt = function (i) {
+ var cp = this.source.charCodeAt(i);
+ if (cp >= 0xD800 && cp <= 0xDBFF) {
+ var second = this.source.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) {
+ var first = cp;
+ cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return cp;
+ };
+ Scanner.prototype.scanHexEscape = function (prefix) {
+ var len = (prefix === 'u') ? 4 : 2;
+ var code = 0;
+ for (var i = 0; i < len; ++i) {
+ if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
+ code = code * 16 + hexValue(this.source[this.index++]);
+ }
+ else {
+ return null;
+ }
+ }
+ return String.fromCharCode(code);
+ };
+ Scanner.prototype.scanUnicodeCodePointEscape = function () {
+ var ch = this.source[this.index];
+ var code = 0;
+ // At least, one hex digit is required.
+ if (ch === '}') {
+ this.throwUnexpectedToken();
+ }
+ while (!this.eof()) {
+ ch = this.source[this.index++];
+ if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
+ break;
+ }
+ code = code * 16 + hexValue(ch);
+ }
+ if (code > 0x10FFFF || ch !== '}') {
+ this.throwUnexpectedToken();
+ }
+ return character_1.Character.fromCodePoint(code);
+ };
+ Scanner.prototype.getIdentifier = function () {
+ var start = this.index++;
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (ch === 0x5C) {
+ // Blackslash (U+005C) marks Unicode escape sequence.
+ this.index = start;
+ return this.getComplexIdentifier();
+ }
+ else if (ch >= 0xD800 && ch < 0xDFFF) {
+ // Need to handle surrogate pairs.
+ this.index = start;
+ return this.getComplexIdentifier();
+ }
+ if (character_1.Character.isIdentifierPart(ch)) {
+ ++this.index;
+ }
+ else {
+ break;
+ }
+ }
+ return this.source.slice(start, this.index);
+ };
+ Scanner.prototype.getComplexIdentifier = function () {
+ var cp = this.codePointAt(this.index);
+ var id = character_1.Character.fromCodePoint(cp);
+ this.index += id.length;
+ // '\u' (U+005C, U+0075) denotes an escaped character.
+ var ch;
+ if (cp === 0x5C) {
+ if (this.source.charCodeAt(this.index) !== 0x75) {
+ this.throwUnexpectedToken();
+ }
+ ++this.index;
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ ch = this.scanUnicodeCodePointEscape();
+ }
+ else {
+ ch = this.scanHexEscape('u');
+ if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken();
+ }
+ }
+ id = ch;
+ }
+ while (!this.eof()) {
+ cp = this.codePointAt(this.index);
+ if (!character_1.Character.isIdentifierPart(cp)) {
+ break;
+ }
+ ch = character_1.Character.fromCodePoint(cp);
+ id += ch;
+ this.index += ch.length;
+ // '\u' (U+005C, U+0075) denotes an escaped character.
+ if (cp === 0x5C) {
+ id = id.substr(0, id.length - 1);
+ if (this.source.charCodeAt(this.index) !== 0x75) {
+ this.throwUnexpectedToken();
+ }
+ ++this.index;
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ ch = this.scanUnicodeCodePointEscape();
+ }
+ else {
+ ch = this.scanHexEscape('u');
+ if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken();
+ }
+ }
+ id += ch;
+ }
+ }
+ return id;
+ };
+ Scanner.prototype.octalToDecimal = function (ch) {
+ // \0 is not octal escape sequence
+ var octal = (ch !== '0');
+ var code = octalValue(ch);
+ if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ octal = true;
+ code = code * 8 + octalValue(this.source[this.index++]);
+ // 3 digits are only allowed when string starts
+ // with 0, 1, 2, 3
+ if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ code = code * 8 + octalValue(this.source[this.index++]);
+ }
+ }
+ return {
+ code: code,
+ octal: octal
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-names-and-keywords
+ Scanner.prototype.scanIdentifier = function () {
+ var type;
+ var start = this.index;
+ // Backslash (U+005C) starts an escaped character.
+ var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
+ // There is no keyword or literal with only one character.
+ // Thus, it must be an identifier.
+ if (id.length === 1) {
+ type = 3 /* Identifier */;
+ }
+ else if (this.isKeyword(id)) {
+ type = 4 /* Keyword */;
+ }
+ else if (id === 'null') {
+ type = 5 /* NullLiteral */;
+ }
+ else if (id === 'true' || id === 'false') {
+ type = 1 /* BooleanLiteral */;
+ }
+ else {
+ type = 3 /* Identifier */;
+ }
+ if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) {
+ var restore = this.index;
+ this.index = start;
+ this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord);
+ this.index = restore;
+ }
+ return {
+ type: type,
+ value: id,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-punctuators
+ Scanner.prototype.scanPunctuator = function () {
+ var start = this.index;
+ // Check for most common single-character punctuators.
+ var str = this.source[this.index];
+ switch (str) {
+ case '(':
+ case '{':
+ if (str === '{') {
+ this.curlyStack.push('{');
+ }
+ ++this.index;
+ break;
+ case '.':
+ ++this.index;
+ if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
+ // Spread operator: ...
+ this.index += 2;
+ str = '...';
+ }
+ break;
+ case '}':
+ ++this.index;
+ this.curlyStack.pop();
+ break;
+ case ')':
+ case ';':
+ case ',':
+ case '[':
+ case ']':
+ case ':':
+ case '?':
+ case '~':
+ ++this.index;
+ break;
+ default:
+ // 4-character punctuator.
+ str = this.source.substr(this.index, 4);
+ if (str === '>>>=') {
+ this.index += 4;
+ }
+ else {
+ // 3-character punctuators.
+ str = str.substr(0, 3);
+ if (str === '===' || str === '!==' || str === '>>>' ||
+ str === '<<=' || str === '>>=' || str === '**=') {
+ this.index += 3;
+ }
+ else {
+ // 2-character punctuators.
+ str = str.substr(0, 2);
+ if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
+ str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
+ str === '++' || str === '--' || str === '<<' || str === '>>' ||
+ str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
+ str === '<=' || str === '>=' || str === '=>' || str === '**') {
+ this.index += 2;
+ }
+ else {
+ // 1-character punctuators.
+ str = this.source[this.index];
+ if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
+ ++this.index;
+ }
+ }
+ }
+ }
+ }
+ if (this.index === start) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 7 /* Punctuator */,
+ value: str,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
+ Scanner.prototype.scanHexLiteral = function (start) {
+ var num = '';
+ while (!this.eof()) {
+ if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (num.length === 0) {
+ this.throwUnexpectedToken();
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt('0x' + num, 16),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.scanBinaryLiteral = function (start) {
+ var num = '';
+ var ch;
+ while (!this.eof()) {
+ ch = this.source[this.index];
+ if (ch !== '0' && ch !== '1') {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (num.length === 0) {
+ // only 0b or 0B
+ this.throwUnexpectedToken();
+ }
+ if (!this.eof()) {
+ ch = this.source.charCodeAt(this.index);
+ /* istanbul ignore else */
+ if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
+ this.throwUnexpectedToken();
+ }
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt(num, 2),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.scanOctalLiteral = function (prefix, start) {
+ var num = '';
+ var octal = false;
+ if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
+ octal = true;
+ num = '0' + this.source[this.index++];
+ }
+ else {
+ ++this.index;
+ }
+ while (!this.eof()) {
+ if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (!octal && num.length === 0) {
+ // only 0o or 0O
+ this.throwUnexpectedToken();
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt(num, 8),
+ octal: octal,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.isImplicitOctalLiteral = function () {
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ for (var i = this.index + 1; i < this.length; ++i) {
+ var ch = this.source[i];
+ if (ch === '8' || ch === '9') {
+ return false;
+ }
+ if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ return true;
+ }
+ }
+ return true;
+ };
+ Scanner.prototype.scanNumericLiteral = function () {
+ var start = this.index;
+ var ch = this.source[start];
+ assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
+ var num = '';
+ if (ch !== '.') {
+ num = this.source[this.index++];
+ ch = this.source[this.index];
+ // Hex number starts with '0x'.
+ // Octal number starts with '0'.
+ // Octal number in ES6 starts with '0o'.
+ // Binary number in ES6 starts with '0b'.
+ if (num === '0') {
+ if (ch === 'x' || ch === 'X') {
+ ++this.index;
+ return this.scanHexLiteral(start);
+ }
+ if (ch === 'b' || ch === 'B') {
+ ++this.index;
+ return this.scanBinaryLiteral(start);
+ }
+ if (ch === 'o' || ch === 'O') {
+ return this.scanOctalLiteral(ch, start);
+ }
+ if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ if (this.isImplicitOctalLiteral()) {
+ return this.scanOctalLiteral(ch, start);
+ }
+ }
+ }
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ ch = this.source[this.index];
+ }
+ if (ch === '.') {
+ num += this.source[this.index++];
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ ch = this.source[this.index];
+ }
+ if (ch === 'e' || ch === 'E') {
+ num += this.source[this.index++];
+ ch = this.source[this.index];
+ if (ch === '+' || ch === '-') {
+ num += this.source[this.index++];
+ }
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ }
+ else {
+ this.throwUnexpectedToken();
+ }
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseFloat(num),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-string-literals
+ Scanner.prototype.scanStringLiteral = function () {
+ var start = this.index;
+ var quote = this.source[start];
+ assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
+ ++this.index;
+ var octal = false;
+ var str = '';
+ while (!this.eof()) {
+ var ch = this.source[this.index++];
+ if (ch === quote) {
+ quote = '';
+ break;
+ }
+ else if (ch === '\\') {
+ ch = this.source[this.index++];
+ if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ switch (ch) {
+ case 'u':
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ str += this.scanUnicodeCodePointEscape();
+ }
+ else {
+ var unescaped_1 = this.scanHexEscape(ch);
+ if (unescaped_1 === null) {
+ this.throwUnexpectedToken();
+ }
+ str += unescaped_1;
+ }
+ break;
+ case 'x':
+ var unescaped = this.scanHexEscape(ch);
+ if (unescaped === null) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
+ }
+ str += unescaped;
+ break;
+ case 'n':
+ str += '\n';
+ break;
+ case 'r':
+ str += '\r';
+ break;
+ case 't':
+ str += '\t';
+ break;
+ case 'b':
+ str += '\b';
+ break;
+ case 'f':
+ str += '\f';
+ break;
+ case 'v':
+ str += '\x0B';
+ break;
+ case '8':
+ case '9':
+ str += ch;
+ this.tolerateUnexpectedToken();
+ break;
+ default:
+ if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ var octToDec = this.octalToDecimal(ch);
+ octal = octToDec.octal || octal;
+ str += String.fromCharCode(octToDec.code);
+ }
+ else {
+ str += ch;
+ }
+ break;
+ }
+ }
+ else {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ }
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ break;
+ }
+ else {
+ str += ch;
+ }
+ }
+ if (quote !== '') {
+ this.index = start;
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 8 /* StringLiteral */,
+ value: str,
+ octal: octal,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-template-literal-lexical-components
+ Scanner.prototype.scanTemplate = function () {
+ var cooked = '';
+ var terminated = false;
+ var start = this.index;
+ var head = (this.source[start] === '`');
+ var tail = false;
+ var rawOffset = 2;
+ ++this.index;
+ while (!this.eof()) {
+ var ch = this.source[this.index++];
+ if (ch === '`') {
+ rawOffset = 1;
+ tail = true;
+ terminated = true;
+ break;
+ }
+ else if (ch === '$') {
+ if (this.source[this.index] === '{') {
+ this.curlyStack.push('${');
+ ++this.index;
+ terminated = true;
+ break;
+ }
+ cooked += ch;
+ }
+ else if (ch === '\\') {
+ ch = this.source[this.index++];
+ if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ switch (ch) {
+ case 'n':
+ cooked += '\n';
+ break;
+ case 'r':
+ cooked += '\r';
+ break;
+ case 't':
+ cooked += '\t';
+ break;
+ case 'u':
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ cooked += this.scanUnicodeCodePointEscape();
+ }
+ else {
+ var restore = this.index;
+ var unescaped_2 = this.scanHexEscape(ch);
+ if (unescaped_2 !== null) {
+ cooked += unescaped_2;
+ }
+ else {
+ this.index = restore;
+ cooked += ch;
+ }
+ }
+ break;
+ case 'x':
+ var unescaped = this.scanHexEscape(ch);
+ if (unescaped === null) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
+ }
+ cooked += unescaped;
+ break;
+ case 'b':
+ cooked += '\b';
+ break;
+ case 'f':
+ cooked += '\f';
+ break;
+ case 'v':
+ cooked += '\v';
+ break;
+ default:
+ if (ch === '0') {
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ // Illegal: \01 \02 and so on
+ this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
+ }
+ cooked += '\0';
+ }
+ else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ // Illegal: \1 \2
+ this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
+ }
+ else {
+ cooked += ch;
+ }
+ break;
+ }
+ }
+ else {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ }
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ cooked += '\n';
+ }
+ else {
+ cooked += ch;
+ }
+ }
+ if (!terminated) {
+ this.throwUnexpectedToken();
+ }
+ if (!head) {
+ this.curlyStack.pop();
+ }
+ return {
+ type: 10 /* Template */,
+ value: this.source.slice(start + 1, this.index - rawOffset),
+ cooked: cooked,
+ head: head,
+ tail: tail,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
+ Scanner.prototype.testRegExp = function (pattern, flags) {
+ // The BMP character to use as a replacement for astral symbols when
+ // translating an ES6 "u"-flagged pattern to an ES5-compatible
+ // approximation.
+ // Note: replacing with '\uFFFF' enables false positives in unlikely
+ // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
+ // pattern that would not be detected by this substitution.
+ var astralSubstitute = '\uFFFF';
+ var tmp = pattern;
+ var self = this;
+ if (flags.indexOf('u') >= 0) {
+ tmp = tmp
+ .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
+ var codePoint = parseInt($1 || $2, 16);
+ if (codePoint > 0x10FFFF) {
+ self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
+ }
+ if (codePoint <= 0xFFFF) {
+ return String.fromCharCode(codePoint);
+ }
+ return astralSubstitute;
+ })
+ .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
+ }
+ // First, detect invalid regular expressions.
+ try {
+ RegExp(tmp);
+ }
+ catch (e) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
+ }
+ // Return a regular expression object for this pattern-flag pair, or
+ // `null` in case the current environment doesn't support the flags it
+ // uses.
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (exception) {
+ /* istanbul ignore next */
+ return null;
+ }
+ };
+ Scanner.prototype.scanRegExpBody = function () {
+ var ch = this.source[this.index];
+ assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
+ var str = this.source[this.index++];
+ var classMarker = false;
+ var terminated = false;
+ while (!this.eof()) {
+ ch = this.source[this.index++];
+ str += ch;
+ if (ch === '\\') {
+ ch = this.source[this.index++];
+ // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
+ if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ str += ch;
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ else if (classMarker) {
+ if (ch === ']') {
+ classMarker = false;
+ }
+ }
+ else {
+ if (ch === '/') {
+ terminated = true;
+ break;
+ }
+ else if (ch === '[') {
+ classMarker = true;
+ }
+ }
+ }
+ if (!terminated) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ // Exclude leading and trailing slash.
+ return str.substr(1, str.length - 2);
+ };
+ Scanner.prototype.scanRegExpFlags = function () {
+ var str = '';
+ var flags = '';
+ while (!this.eof()) {
+ var ch = this.source[this.index];
+ if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
+ break;
+ }
+ ++this.index;
+ if (ch === '\\' && !this.eof()) {
+ ch = this.source[this.index];
+ if (ch === 'u') {
+ ++this.index;
+ var restore = this.index;
+ var char = this.scanHexEscape('u');
+ if (char !== null) {
+ flags += char;
+ for (str += '\\u'; restore < this.index; ++restore) {
+ str += this.source[restore];
+ }
+ }
+ else {
+ this.index = restore;
+ flags += 'u';
+ str += '\\u';
+ }
+ this.tolerateUnexpectedToken();
+ }
+ else {
+ str += '\\';
+ this.tolerateUnexpectedToken();
+ }
+ }
+ else {
+ flags += ch;
+ str += ch;
+ }
+ }
+ return flags;
+ };
+ Scanner.prototype.scanRegExp = function () {
+ var start = this.index;
+ var pattern = this.scanRegExpBody();
+ var flags = this.scanRegExpFlags();
+ var value = this.testRegExp(pattern, flags);
+ return {
+ type: 9 /* RegularExpression */,
+ value: '',
+ pattern: pattern,
+ flags: flags,
+ regex: value,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.lex = function () {
+ if (this.eof()) {
+ return {
+ type: 2 /* EOF */,
+ value: '',
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: this.index,
+ end: this.index
+ };
+ }
+ var cp = this.source.charCodeAt(this.index);
+ if (character_1.Character.isIdentifierStart(cp)) {
+ return this.scanIdentifier();
+ }
+ // Very common: ( and ) and ;
+ if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
+ return this.scanPunctuator();
+ }
+ // String literal starts with single quote (U+0027) or double quote (U+0022).
+ if (cp === 0x27 || cp === 0x22) {
+ return this.scanStringLiteral();
+ }
+ // Dot (.) U+002E can also start a floating-point number, hence the need
+ // to check the next character.
+ if (cp === 0x2E) {
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
+ return this.scanNumericLiteral();
+ }
+ return this.scanPunctuator();
+ }
+ if (character_1.Character.isDecimalDigit(cp)) {
+ return this.scanNumericLiteral();
+ }
+ // Template literals start with ` (U+0060) for template head
+ // or } (U+007D) for template middle or template tail.
+ if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
+ return this.scanTemplate();
+ }
+ // Possible identifier start in a surrogate pair.
+ if (cp >= 0xD800 && cp < 0xDFFF) {
+ if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
+ return this.scanIdentifier();
+ }
+ }
+ return this.scanPunctuator();
+ };
+ return Scanner;
+ }());
+ exports.Scanner = Scanner;
+
+
+/***/ },
+/* 13 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.TokenName = {};
+ exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
+ exports.TokenName[2 /* EOF */] = '<end>';
+ exports.TokenName[3 /* Identifier */] = 'Identifier';
+ exports.TokenName[4 /* Keyword */] = 'Keyword';
+ exports.TokenName[5 /* NullLiteral */] = 'Null';
+ exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
+ exports.TokenName[7 /* Punctuator */] = 'Punctuator';
+ exports.TokenName[8 /* StringLiteral */] = 'String';
+ exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
+ exports.TokenName[10 /* Template */] = 'Template';
+
+
+/***/ },
+/* 14 */
+/***/ function(module, exports) {
+
+ "use strict";
+ // Generated by generate-xhtml-entities.js. DO NOT MODIFY!
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.XHTMLEntities = {
+ quot: '\u0022',
+ amp: '\u0026',
+ apos: '\u0027',
+ gt: '\u003E',
+ nbsp: '\u00A0',
+ iexcl: '\u00A1',
+ cent: '\u00A2',
+ pound: '\u00A3',
+ curren: '\u00A4',
+ yen: '\u00A5',
+ brvbar: '\u00A6',
+ sect: '\u00A7',
+ uml: '\u00A8',
+ copy: '\u00A9',
+ ordf: '\u00AA',
+ laquo: '\u00AB',
+ not: '\u00AC',
+ shy: '\u00AD',
+ reg: '\u00AE',
+ macr: '\u00AF',
+ deg: '\u00B0',
+ plusmn: '\u00B1',
+ sup2: '\u00B2',
+ sup3: '\u00B3',
+ acute: '\u00B4',
+ micro: '\u00B5',
+ para: '\u00B6',
+ middot: '\u00B7',
+ cedil: '\u00B8',
+ sup1: '\u00B9',
+ ordm: '\u00BA',
+ raquo: '\u00BB',
+ frac14: '\u00BC',
+ frac12: '\u00BD',
+ frac34: '\u00BE',
+ iquest: '\u00BF',
+ Agrave: '\u00C0',
+ Aacute: '\u00C1',
+ Acirc: '\u00C2',
+ Atilde: '\u00C3',
+ Auml: '\u00C4',
+ Aring: '\u00C5',
+ AElig: '\u00C6',
+ Ccedil: '\u00C7',
+ Egrave: '\u00C8',
+ Eacute: '\u00C9',
+ Ecirc: '\u00CA',
+ Euml: '\u00CB',
+ Igrave: '\u00CC',
+ Iacute: '\u00CD',
+ Icirc: '\u00CE',
+ Iuml: '\u00CF',
+ ETH: '\u00D0',
+ Ntilde: '\u00D1',
+ Ograve: '\u00D2',
+ Oacute: '\u00D3',
+ Ocirc: '\u00D4',
+ Otilde: '\u00D5',
+ Ouml: '\u00D6',
+ times: '\u00D7',
+ Oslash: '\u00D8',
+ Ugrave: '\u00D9',
+ Uacute: '\u00DA',
+ Ucirc: '\u00DB',
+ Uuml: '\u00DC',
+ Yacute: '\u00DD',
+ THORN: '\u00DE',
+ szlig: '\u00DF',
+ agrave: '\u00E0',
+ aacute: '\u00E1',
+ acirc: '\u00E2',
+ atilde: '\u00E3',
+ auml: '\u00E4',
+ aring: '\u00E5',
+ aelig: '\u00E6',
+ ccedil: '\u00E7',
+ egrave: '\u00E8',
+ eacute: '\u00E9',
+ ecirc: '\u00EA',
+ euml: '\u00EB',
+ igrave: '\u00EC',
+ iacute: '\u00ED',
+ icirc: '\u00EE',
+ iuml: '\u00EF',
+ eth: '\u00F0',
+ ntilde: '\u00F1',
+ ograve: '\u00F2',
+ oacute: '\u00F3',
+ ocirc: '\u00F4',
+ otilde: '\u00F5',
+ ouml: '\u00F6',
+ divide: '\u00F7',
+ oslash: '\u00F8',
+ ugrave: '\u00F9',
+ uacute: '\u00FA',
+ ucirc: '\u00FB',
+ uuml: '\u00FC',
+ yacute: '\u00FD',
+ thorn: '\u00FE',
+ yuml: '\u00FF',
+ OElig: '\u0152',
+ oelig: '\u0153',
+ Scaron: '\u0160',
+ scaron: '\u0161',
+ Yuml: '\u0178',
+ fnof: '\u0192',
+ circ: '\u02C6',
+ tilde: '\u02DC',
+ Alpha: '\u0391',
+ Beta: '\u0392',
+ Gamma: '\u0393',
+ Delta: '\u0394',
+ Epsilon: '\u0395',
+ Zeta: '\u0396',
+ Eta: '\u0397',
+ Theta: '\u0398',
+ Iota: '\u0399',
+ Kappa: '\u039A',
+ Lambda: '\u039B',
+ Mu: '\u039C',
+ Nu: '\u039D',
+ Xi: '\u039E',
+ Omicron: '\u039F',
+ Pi: '\u03A0',
+ Rho: '\u03A1',
+ Sigma: '\u03A3',
+ Tau: '\u03A4',
+ Upsilon: '\u03A5',
+ Phi: '\u03A6',
+ Chi: '\u03A7',
+ Psi: '\u03A8',
+ Omega: '\u03A9',
+ alpha: '\u03B1',
+ beta: '\u03B2',
+ gamma: '\u03B3',
+ delta: '\u03B4',
+ epsilon: '\u03B5',
+ zeta: '\u03B6',
+ eta: '\u03B7',
+ theta: '\u03B8',
+ iota: '\u03B9',
+ kappa: '\u03BA',
+ lambda: '\u03BB',
+ mu: '\u03BC',
+ nu: '\u03BD',
+ xi: '\u03BE',
+ omicron: '\u03BF',
+ pi: '\u03C0',
+ rho: '\u03C1',
+ sigmaf: '\u03C2',
+ sigma: '\u03C3',
+ tau: '\u03C4',
+ upsilon: '\u03C5',
+ phi: '\u03C6',
+ chi: '\u03C7',
+ psi: '\u03C8',
+ omega: '\u03C9',
+ thetasym: '\u03D1',
+ upsih: '\u03D2',
+ piv: '\u03D6',
+ ensp: '\u2002',
+ emsp: '\u2003',
+ thinsp: '\u2009',
+ zwnj: '\u200C',
+ zwj: '\u200D',
+ lrm: '\u200E',
+ rlm: '\u200F',
+ ndash: '\u2013',
+ mdash: '\u2014',
+ lsquo: '\u2018',
+ rsquo: '\u2019',
+ sbquo: '\u201A',
+ ldquo: '\u201C',
+ rdquo: '\u201D',
+ bdquo: '\u201E',
+ dagger: '\u2020',
+ Dagger: '\u2021',
+ bull: '\u2022',
+ hellip: '\u2026',
+ permil: '\u2030',
+ prime: '\u2032',
+ Prime: '\u2033',
+ lsaquo: '\u2039',
+ rsaquo: '\u203A',
+ oline: '\u203E',
+ frasl: '\u2044',
+ euro: '\u20AC',
+ image: '\u2111',
+ weierp: '\u2118',
+ real: '\u211C',
+ trade: '\u2122',
+ alefsym: '\u2135',
+ larr: '\u2190',
+ uarr: '\u2191',
+ rarr: '\u2192',
+ darr: '\u2193',
+ harr: '\u2194',
+ crarr: '\u21B5',
+ lArr: '\u21D0',
+ uArr: '\u21D1',
+ rArr: '\u21D2',
+ dArr: '\u21D3',
+ hArr: '\u21D4',
+ forall: '\u2200',
+ part: '\u2202',
+ exist: '\u2203',
+ empty: '\u2205',
+ nabla: '\u2207',
+ isin: '\u2208',
+ notin: '\u2209',
+ ni: '\u220B',
+ prod: '\u220F',
+ sum: '\u2211',
+ minus: '\u2212',
+ lowast: '\u2217',
+ radic: '\u221A',
+ prop: '\u221D',
+ infin: '\u221E',
+ ang: '\u2220',
+ and: '\u2227',
+ or: '\u2228',
+ cap: '\u2229',
+ cup: '\u222A',
+ int: '\u222B',
+ there4: '\u2234',
+ sim: '\u223C',
+ cong: '\u2245',
+ asymp: '\u2248',
+ ne: '\u2260',
+ equiv: '\u2261',
+ le: '\u2264',
+ ge: '\u2265',
+ sub: '\u2282',
+ sup: '\u2283',
+ nsub: '\u2284',
+ sube: '\u2286',
+ supe: '\u2287',
+ oplus: '\u2295',
+ otimes: '\u2297',
+ perp: '\u22A5',
+ sdot: '\u22C5',
+ lceil: '\u2308',
+ rceil: '\u2309',
+ lfloor: '\u230A',
+ rfloor: '\u230B',
+ loz: '\u25CA',
+ spades: '\u2660',
+ clubs: '\u2663',
+ hearts: '\u2665',
+ diams: '\u2666',
+ lang: '\u27E8',
+ rang: '\u27E9'
+ };
+
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var error_handler_1 = __webpack_require__(10);
+ var scanner_1 = __webpack_require__(12);
+ var token_1 = __webpack_require__(13);
+ var Reader = (function () {
+ function Reader() {
+ this.values = [];
+ this.curly = this.paren = -1;
+ }
+ // A function following one of those tokens is an expression.
+ Reader.prototype.beforeFunctionExpression = function (t) {
+ return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
+ 'return', 'case', 'delete', 'throw', 'void',
+ // assignment operators
+ '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
+ '&=', '|=', '^=', ',',
+ // binary/unary operators
+ '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
+ '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
+ '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
+ };
+ // Determine if forward slash (/) is an operator or part of a regular expression
+ // https://github.com/mozilla/sweet.js/wiki/design
+ Reader.prototype.isRegexStart = function () {
+ var previous = this.values[this.values.length - 1];
+ var regex = (previous !== null);
+ switch (previous) {
+ case 'this':
+ case ']':
+ regex = false;
+ break;
+ case ')':
+ var keyword = this.values[this.paren - 1];
+ regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with');
+ break;
+ case '}':
+ // Dividing a function by anything makes little sense,
+ // but we have to check for that.
+ regex = false;
+ if (this.values[this.curly - 3] === 'function') {
+ // Anonymous function, e.g. function(){} /42
+ var check = this.values[this.curly - 4];
+ regex = check ? !this.beforeFunctionExpression(check) : false;
+ }
+ else if (this.values[this.curly - 4] === 'function') {
+ // Named function, e.g. function f(){} /42/
+ var check = this.values[this.curly - 5];
+ regex = check ? !this.beforeFunctionExpression(check) : true;
+ }
+ break;
+ default:
+ break;
+ }
+ return regex;
+ };
+ Reader.prototype.push = function (token) {
+ if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) {
+ if (token.value === '{') {
+ this.curly = this.values.length;
+ }
+ else if (token.value === '(') {
+ this.paren = this.values.length;
+ }
+ this.values.push(token.value);
+ }
+ else {
+ this.values.push(null);
+ }
+ };
+ return Reader;
+ }());
+ var Tokenizer = (function () {
+ function Tokenizer(code, config) {
+ this.errorHandler = new error_handler_1.ErrorHandler();
+ this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
+ this.scanner = new scanner_1.Scanner(code, this.errorHandler);
+ this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
+ this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
+ this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
+ this.buffer = [];
+ this.reader = new Reader();
+ }
+ Tokenizer.prototype.errors = function () {
+ return this.errorHandler.errors;
+ };
+ Tokenizer.prototype.getNextToken = function () {
+ if (this.buffer.length === 0) {
+ var comments = this.scanner.scanComments();
+ if (this.scanner.trackComment) {
+ for (var i = 0; i < comments.length; ++i) {
+ var e = comments[i];
+ var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
+ var comment = {
+ type: e.multiLine ? 'BlockComment' : 'LineComment',
+ value: value
+ };
+ if (this.trackRange) {
+ comment.range = e.range;
+ }
+ if (this.trackLoc) {
+ comment.loc = e.loc;
+ }
+ this.buffer.push(comment);
+ }
+ }
+ if (!this.scanner.eof()) {
+ var loc = void 0;
+ if (this.trackLoc) {
+ loc = {
+ start: {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ },
+ end: {}
+ };
+ }
+ var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart();
+ var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex();
+ this.reader.push(token);
+ var entry = {
+ type: token_1.TokenName[token.type],
+ value: this.scanner.source.slice(token.start, token.end)
+ };
+ if (this.trackRange) {
+ entry.range = [token.start, token.end];
+ }
+ if (this.trackLoc) {
+ loc.end = {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ entry.loc = loc;
+ }
+ if (token.type === 9 /* RegularExpression */) {
+ var pattern = token.pattern;
+ var flags = token.flags;
+ entry.regex = { pattern: pattern, flags: flags };
+ }
+ this.buffer.push(entry);
+ }
+ }
+ return this.buffer.shift();
+ };
+ return Tokenizer;
+ }());
+ exports.Tokenizer = Tokenizer;
+
+
+/***/ }
+/******/ ])
+});
+;
+
+/***/ }),
+/* 36 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+/*eslint-disable no-use-before-define*/
+
+var common = __webpack_require__(8);
+var YAMLException = __webpack_require__(9);
+var DEFAULT_FULL_SCHEMA = __webpack_require__(31);
+var DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
+
+var _toString = Object.prototype.toString;
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var CHAR_TAB = 0x09; /* Tab */
+var CHAR_LINE_FEED = 0x0A; /* LF */
+var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
+var CHAR_SPACE = 0x20; /* Space */
+var CHAR_EXCLAMATION = 0x21; /* ! */
+var CHAR_DOUBLE_QUOTE = 0x22; /* " */
+var CHAR_SHARP = 0x23; /* # */
+var CHAR_PERCENT = 0x25; /* % */
+var CHAR_AMPERSAND = 0x26; /* & */
+var CHAR_SINGLE_QUOTE = 0x27; /* ' */
+var CHAR_ASTERISK = 0x2A; /* * */
+var CHAR_COMMA = 0x2C; /* , */
+var CHAR_MINUS = 0x2D; /* - */
+var CHAR_COLON = 0x3A; /* : */
+var CHAR_EQUALS = 0x3D; /* = */
+var CHAR_GREATER_THAN = 0x3E; /* > */
+var CHAR_QUESTION = 0x3F; /* ? */
+var CHAR_COMMERCIAL_AT = 0x40; /* @ */
+var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
+var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
+var CHAR_GRAVE_ACCENT = 0x60; /* ` */
+var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
+var CHAR_VERTICAL_LINE = 0x7C; /* | */
+var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
+
+var ESCAPE_SEQUENCES = {};
+
+ESCAPE_SEQUENCES[0x00] = '\\0';
+ESCAPE_SEQUENCES[0x07] = '\\a';
+ESCAPE_SEQUENCES[0x08] = '\\b';
+ESCAPE_SEQUENCES[0x09] = '\\t';
+ESCAPE_SEQUENCES[0x0A] = '\\n';
+ESCAPE_SEQUENCES[0x0B] = '\\v';
+ESCAPE_SEQUENCES[0x0C] = '\\f';
+ESCAPE_SEQUENCES[0x0D] = '\\r';
+ESCAPE_SEQUENCES[0x1B] = '\\e';
+ESCAPE_SEQUENCES[0x22] = '\\"';
+ESCAPE_SEQUENCES[0x5C] = '\\\\';
+ESCAPE_SEQUENCES[0x85] = '\\N';
+ESCAPE_SEQUENCES[0xA0] = '\\_';
+ESCAPE_SEQUENCES[0x2028] = '\\L';
+ESCAPE_SEQUENCES[0x2029] = '\\P';
+
+var DEPRECATED_BOOLEANS_SYNTAX = [
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
+];
+
+function compileStyleMap(schema, map) {
+ var result, keys, index, length, tag, style, type;
+
+ if (map === null) return {};
+
+ result = {};
+ keys = Object.keys(map);
+
+ for (index = 0, length = keys.length; index < length; index += 1) {
+ tag = keys[index];
+ style = String(map[tag]);
+
+ if (tag.slice(0, 2) === '!!') {
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
+ }
+ type = schema.compiledTypeMap['fallback'][tag];
+
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
+ style = type.styleAliases[style];
+ }
+
+ result[tag] = style;
+ }
+
+ return result;
+}
+
+function encodeHex(character) {
+ var string, handle, length;
+
+ string = character.toString(16).toUpperCase();
+
+ if (character <= 0xFF) {
+ handle = 'x';
+ length = 2;
+ } else if (character <= 0xFFFF) {
+ handle = 'u';
+ length = 4;
+ } else if (character <= 0xFFFFFFFF) {
+ handle = 'U';
+ length = 8;
+ } else {
+ throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
+ }
+
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
+}
+
+function State(options) {
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.indent = Math.max(1, (options['indent'] || 2));
+ this.noArrayIndent = options['noArrayIndent'] || false;
+ this.skipInvalid = options['skipInvalid'] || false;
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
+ this.sortKeys = options['sortKeys'] || false;
+ this.lineWidth = options['lineWidth'] || 80;
+ this.noRefs = options['noRefs'] || false;
+ this.noCompatMode = options['noCompatMode'] || false;
+ this.condenseFlow = options['condenseFlow'] || false;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.explicitTypes = this.schema.compiledExplicit;
+
+ this.tag = null;
+ this.result = '';
+
+ this.duplicates = [];
+ this.usedDuplicates = null;
+}
+
+// Indents every line in a string. Empty lines (\n only) are not indented.
+function indentString(string, spaces) {
+ var ind = common.repeat(' ', spaces),
+ position = 0,
+ next = -1,
+ result = '',
+ line,
+ length = string.length;
+
+ while (position < length) {
+ next = string.indexOf('\n', position);
+ if (next === -1) {
+ line = string.slice(position);
+ position = length;
+ } else {
+ line = string.slice(position, next + 1);
+ position = next + 1;
+ }
+
+ if (line.length && line !== '\n') result += ind;
+
+ result += line;
+ }
+
+ return result;
+}
+
+function generateNextLine(state, level) {
+ return '\n' + common.repeat(' ', state.indent * level);
+}
+
+function testImplicitResolving(state, str) {
+ var index, length, type;
+
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
+ type = state.implicitTypes[index];
+
+ if (type.resolve(str)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// [33] s-white ::= s-space | s-tab
+function isWhitespace(c) {
+ return c === CHAR_SPACE || c === CHAR_TAB;
+}
+
+// Returns true if the character can be printed without escaping.
+// From YAML 1.2: "any allowed characters known to be non-printable
+// should also be escaped. [However,] This isn’t mandatory"
+// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
+function isPrintable(c) {
+ return (0x00020 <= c && c <= 0x00007E)
+ || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
+ || (0x10000 <= c && c <= 0x10FFFF);
+}
+
+// [34] ns-char ::= nb-char - s-white
+// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
+// [26] b-char ::= b-line-feed | b-carriage-return
+// [24] b-line-feed ::= #xA /* LF */
+// [25] b-carriage-return ::= #xD /* CR */
+// [3] c-byte-order-mark ::= #xFEFF
+function isNsChar(c) {
+ return isPrintable(c) && !isWhitespace(c)
+ // byte-order-mark
+ && c !== 0xFEFF
+ // b-char
+ && c !== CHAR_CARRIAGE_RETURN
+ && c !== CHAR_LINE_FEED;
+}
+
+// Simplified test for values allowed after the first character in plain style.
+function isPlainSafe(c, prev) {
+ // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
+ // where nb-char ::= c-printable - b-char - c-byte-order-mark.
+ return isPrintable(c) && c !== 0xFEFF
+ // - c-flow-indicator
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // - ":" - "#"
+ // /* An ns-char preceding */ "#"
+ && c !== CHAR_COLON
+ && ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
+}
+
+// Simplified test for values allowed as the first character in plain style.
+function isPlainSafeFirst(c) {
+ // Uses a subset of ns-char - c-indicator
+ // where ns-char = nb-char - s-white.
+ return isPrintable(c) && c !== 0xFEFF
+ && !isWhitespace(c) // - s-white
+ // - (c-indicator ::=
+ // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
+ && c !== CHAR_MINUS
+ && c !== CHAR_QUESTION
+ && c !== CHAR_COLON
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
+ && c !== CHAR_SHARP
+ && c !== CHAR_AMPERSAND
+ && c !== CHAR_ASTERISK
+ && c !== CHAR_EXCLAMATION
+ && c !== CHAR_VERTICAL_LINE
+ && c !== CHAR_EQUALS
+ && c !== CHAR_GREATER_THAN
+ && c !== CHAR_SINGLE_QUOTE
+ && c !== CHAR_DOUBLE_QUOTE
+ // | “%” | “@” | “`”)
+ && c !== CHAR_PERCENT
+ && c !== CHAR_COMMERCIAL_AT
+ && c !== CHAR_GRAVE_ACCENT;
+}
+
+// Determines whether block indentation indicator is required.
+function needIndentIndicator(string) {
+ var leadingSpaceRe = /^\n* /;
+ return leadingSpaceRe.test(string);
+}
+
+var STYLE_PLAIN = 1,
+ STYLE_SINGLE = 2,
+ STYLE_LITERAL = 3,
+ STYLE_FOLDED = 4,
+ STYLE_DOUBLE = 5;
+
+// Determines which scalar styles are possible and returns the preferred style.
+// lineWidth = -1 => no limit.
+// Pre-conditions: str.length > 0.
+// Post-conditions:
+// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
+// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
+// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
+function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
+ var i;
+ var char, prev_char;
+ var hasLineBreak = false;
+ var hasFoldableLine = false; // only checked if shouldTrackWidth
+ var shouldTrackWidth = lineWidth !== -1;
+ var previousLineBreak = -1; // count the first line correctly
+ var plain = isPlainSafeFirst(string.charCodeAt(0))
+ && !isWhitespace(string.charCodeAt(string.length - 1));
+
+ if (singleLineOnly) {
+ // Case: no block styles.
+ // Check for disallowed characters to rule out plain and single.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
+ plain = plain && isPlainSafe(char, prev_char);
+ }
+ } else {
+ // Case: block styles permitted.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (char === CHAR_LINE_FEED) {
+ hasLineBreak = true;
+ // Check if any line can be folded.
+ if (shouldTrackWidth) {
+ hasFoldableLine = hasFoldableLine ||
+ // Foldable line = too long, and not more-indented.
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' ');
+ previousLineBreak = i;
+ }
+ } else if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
+ plain = plain && isPlainSafe(char, prev_char);
+ }
+ // in case the end is missing a \n
+ hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' '));
+ }
+ // Although every style can represent \n without escaping, prefer block styles
+ // for multiline, since they're more readable and they don't add empty lines.
+ // Also prefer folding a super-long line.
+ if (!hasLineBreak && !hasFoldableLine) {
+ // Strings interpretable as another type have to be quoted;
+ // e.g. the string 'true' vs. the boolean true.
+ return plain && !testAmbiguousType(string)
+ ? STYLE_PLAIN : STYLE_SINGLE;
+ }
+ // Edge case: block indentation indicator can only have one digit.
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
+ return STYLE_DOUBLE;
+ }
+ // At this point we know block styles are valid.
+ // Prefer literal style unless we want to fold.
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
+}
+
+// Note: line breaking/folding is implemented for only the folded style.
+// NB. We drop the last trailing newline (if any) of a returned block scalar
+// since the dumper adds its own newline. This always works:
+// • No ending newline => unaffected; already using strip "-" chomping.
+// • Ending newline => removed then restored.
+// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
+function writeScalar(state, string, level, iskey) {
+ state.dump = (function () {
+ if (string.length === 0) {
+ return "''";
+ }
+ if (!state.noCompatMode &&
+ DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
+ return "'" + string + "'";
+ }
+
+ var indent = state.indent * Math.max(1, level); // no 0-indent scalars
+ // As indentation gets deeper, let the width decrease monotonically
+ // to the lower bound min(state.lineWidth, 40).
+ // Note that this implies
+ // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
+ // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
+ // This behaves better than a constant minimum width which disallows narrower options,
+ // or an indent threshold which causes the width to suddenly increase.
+ var lineWidth = state.lineWidth === -1
+ ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
+
+ // Without knowing if keys are implicit/explicit, assume implicit for safety.
+ var singleLineOnly = iskey
+ // No block styles in flow mode.
+ || (state.flowLevel > -1 && level >= state.flowLevel);
+ function testAmbiguity(string) {
+ return testImplicitResolving(state, string);
+ }
+
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
+ case STYLE_PLAIN:
+ return string;
+ case STYLE_SINGLE:
+ return "'" + string.replace(/'/g, "''") + "'";
+ case STYLE_LITERAL:
+ return '|' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(string, indent));
+ case STYLE_FOLDED:
+ return '>' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
+ case STYLE_DOUBLE:
+ return '"' + escapeString(string, lineWidth) + '"';
+ default:
+ throw new YAMLException('impossible error: invalid scalar style');
+ }
+ }());
+}
+
+// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
+function blockHeader(string, indentPerLevel) {
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
+
+ // note the special case: the string '\n' counts as a "trailing" empty line.
+ var clip = string[string.length - 1] === '\n';
+ var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
+ var chomp = keep ? '+' : (clip ? '' : '-');
+
+ return indentIndicator + chomp + '\n';
+}
+
+// (See the note for writeScalar.)
+function dropEndingNewline(string) {
+ return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
+}
+
+// Note: a long line without a suitable break point will exceed the width limit.
+// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
+function foldString(string, width) {
+ // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
+ // unless they're before or after a more-indented line, or at the very
+ // beginning or end, in which case $k$ maps to $k$.
+ // Therefore, parse each chunk as newline(s) followed by a content line.
+ var lineRe = /(\n+)([^\n]*)/g;
+
+ // first line (possibly an empty line)
+ var result = (function () {
+ var nextLF = string.indexOf('\n');
+ nextLF = nextLF !== -1 ? nextLF : string.length;
+ lineRe.lastIndex = nextLF;
+ return foldLine(string.slice(0, nextLF), width);
+ }());
+ // If we haven't reached the first content line yet, don't add an extra \n.
+ var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
+ var moreIndented;
+
+ // rest of the lines
+ var match;
+ while ((match = lineRe.exec(string))) {
+ var prefix = match[1], line = match[2];
+ moreIndented = (line[0] === ' ');
+ result += prefix
+ + (!prevMoreIndented && !moreIndented && line !== ''
+ ? '\n' : '')
+ + foldLine(line, width);
+ prevMoreIndented = moreIndented;
+ }
+
+ return result;
+}
+
+// Greedy line breaking.
+// Picks the longest line under the limit each time,
+// otherwise settles for the shortest line over the limit.
+// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
+function foldLine(line, width) {
+ if (line === '' || line[0] === ' ') return line;
+
+ // Since a more-indented line adds a \n, breaks can't be followed by a space.
+ var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
+ var match;
+ // start is an inclusive index. end, curr, and next are exclusive.
+ var start = 0, end, curr = 0, next = 0;
+ var result = '';
+
+ // Invariants: 0 <= start <= length-1.
+ // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
+ // Inside the loop:
+ // A match implies length >= 2, so curr and next are <= length-2.
+ while ((match = breakRe.exec(line))) {
+ next = match.index;
+ // maintain invariant: curr - start <= width
+ if (next - start > width) {
+ end = (curr > start) ? curr : next; // derive end <= length-2
+ result += '\n' + line.slice(start, end);
+ // skip the space that was output as \n
+ start = end + 1; // derive start <= length-1
+ }
+ curr = next;
+ }
+
+ // By the invariants, start <= length-1, so there is something left over.
+ // It is either the whole string or a part starting from non-whitespace.
+ result += '\n';
+ // Insert a break if the remainder is too long and there is a break available.
+ if (line.length - start > width && curr > start) {
+ result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
+ } else {
+ result += line.slice(start);
+ }
+
+ return result.slice(1); // drop extra \n joiner
+}
+
+// Escapes a double-quoted string.
+function escapeString(string) {
+ var result = '';
+ var char, nextChar;
+ var escapeSeq;
+
+ for (var i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
+ if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
+ nextChar = string.charCodeAt(i + 1);
+ if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
+ // Combine the surrogate pair and store it escaped.
+ result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
+ // Advance index one extra since we already used that char here.
+ i++; continue;
+ }
+ }
+ escapeSeq = ESCAPE_SEQUENCES[char];
+ result += !escapeSeq && isPrintable(char)
+ ? string[i]
+ : escapeSeq || encodeHex(char);
+ }
+
+ return result;
+}
+
+function writeFlowSequence(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level, object[index], false, false)) {
+ if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = '[' + _result + ']';
+}
+
+function writeBlockSequence(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level + 1, object[index], true, true)) {
+ if (!compact || index !== 0) {
+ _result += generateNextLine(state, level);
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ _result += '-';
+ } else {
+ _result += '- ';
+ }
+
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '[]'; // Empty sequence if no valid values.
+}
+
+function writeFlowMapping(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ pairBuffer;
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+
+ pairBuffer = '';
+ if (index !== 0) pairBuffer += ', ';
+
+ if (state.condenseFlow) pairBuffer += '"';
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level, objectKey, false, false)) {
+ continue; // Skip this pair because of invalid key;
+ }
+
+ if (state.dump.length > 1024) pairBuffer += '? ';
+
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
+
+ if (!writeNode(state, level, objectValue, false, false)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = '{' + _result + '}';
+}
+
+function writeBlockMapping(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ explicitPair,
+ pairBuffer;
+
+ // Allow sorting keys so that the output file is deterministic
+ if (state.sortKeys === true) {
+ // Default sorting
+ objectKeyList.sort();
+ } else if (typeof state.sortKeys === 'function') {
+ // Custom sort function
+ objectKeyList.sort(state.sortKeys);
+ } else if (state.sortKeys) {
+ // Something is wrong
+ throw new YAMLException('sortKeys must be a boolean or a function');
+ }
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ pairBuffer = '';
+
+ if (!compact || index !== 0) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
+ continue; // Skip this pair because of invalid key.
+ }
+
+ explicitPair = (state.tag !== null && state.tag !== '?') ||
+ (state.dump && state.dump.length > 1024);
+
+ if (explicitPair) {
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += '?';
+ } else {
+ pairBuffer += '? ';
+ }
+ }
+
+ pairBuffer += state.dump;
+
+ if (explicitPair) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += ':';
+ } else {
+ pairBuffer += ': ';
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '{}'; // Empty mapping if no valid pairs.
+}
+
+function detectType(state, object, explicit) {
+ var _result, typeList, index, length, type, style;
+
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
+
+ for (index = 0, length = typeList.length; index < length; index += 1) {
+ type = typeList[index];
+
+ if ((type.instanceOf || type.predicate) &&
+ (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
+ (!type.predicate || type.predicate(object))) {
+
+ state.tag = explicit ? type.tag : '?';
+
+ if (type.represent) {
+ style = state.styleMap[type.tag] || type.defaultStyle;
+
+ if (_toString.call(type.represent) === '[object Function]') {
+ _result = type.represent(object, style);
+ } else if (_hasOwnProperty.call(type.represent, style)) {
+ _result = type.represent[style](object, style);
+ } else {
+ throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
+ }
+
+ state.dump = _result;
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Serializes `object` and writes it to global `result`.
+// Returns true on success, or false on invalid object.
+//
+function writeNode(state, level, object, block, compact, iskey) {
+ state.tag = null;
+ state.dump = object;
+
+ if (!detectType(state, object, false)) {
+ detectType(state, object, true);
+ }
+
+ var type = _toString.call(state.dump);
+
+ if (block) {
+ block = (state.flowLevel < 0 || state.flowLevel > level);
+ }
+
+ var objectOrArray = type === '[object Object]' || type === '[object Array]',
+ duplicateIndex,
+ duplicate;
+
+ if (objectOrArray) {
+ duplicateIndex = state.duplicates.indexOf(object);
+ duplicate = duplicateIndex !== -1;
+ }
+
+ if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
+ compact = false;
+ }
+
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
+ state.dump = '*ref_' + duplicateIndex;
+ } else {
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
+ state.usedDuplicates[duplicateIndex] = true;
+ }
+ if (type === '[object Object]') {
+ if (block && (Object.keys(state.dump).length !== 0)) {
+ writeBlockMapping(state, level, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowMapping(state, level, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object Array]') {
+ var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
+ if (block && (state.dump.length !== 0)) {
+ writeBlockSequence(state, arrayLevel, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowSequence(state, arrayLevel, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object String]') {
+ if (state.tag !== '?') {
+ writeScalar(state, state.dump, level, iskey);
+ }
+ } else {
+ if (state.skipInvalid) return false;
+ throw new YAMLException('unacceptable kind of an object to dump ' + type);
+ }
+
+ if (state.tag !== null && state.tag !== '?') {
+ state.dump = '!<' + state.tag + '> ' + state.dump;
+ }
+ }
+
+ return true;
+}
+
+function getDuplicateReferences(object, state) {
+ var objects = [],
+ duplicatesIndexes = [],
+ index,
+ length;
+
+ inspectNode(object, objects, duplicatesIndexes);
+
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
+ }
+ state.usedDuplicates = new Array(length);
+}
+
+function inspectNode(object, objects, duplicatesIndexes) {
+ var objectKeyList,
+ index,
+ length;
+
+ if (object !== null && typeof object === 'object') {
+ index = objects.indexOf(object);
+ if (index !== -1) {
+ if (duplicatesIndexes.indexOf(index) === -1) {
+ duplicatesIndexes.push(index);
+ }
+ } else {
+ objects.push(object);
+
+ if (Array.isArray(object)) {
+ for (index = 0, length = object.length; index < length; index += 1) {
+ inspectNode(object[index], objects, duplicatesIndexes);
+ }
+ } else {
+ objectKeyList = Object.keys(object);
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
+ }
+ }
+ }
+ }
+}
+
+function dump(input, options) {
+ options = options || {};
+
+ var state = new State(options);
+
+ if (!state.noRefs) getDuplicateReferences(input, state);
+
+ if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
+
+ return '';
+}
+
+function safeDump(input, options) {
+ return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+module.exports.dump = dump;
+module.exports.safeDump = safeDump;
+
+
+/***/ }),
+/* 37 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const fs = __webpack_require__(4);
+const path = __webpack_require__(38);
+const { URL } = __webpack_require__(39);
+const markdownIt = __webpack_require__(40);
+const rules = __webpack_require__(107);
+const helpers = __webpack_require__(110);
+const cache = __webpack_require__(115);
+
+const deprecatedRuleNames = [ "MD002", "MD006" ];
+
+
+/**
+ * Validate the list of rules for structure and reuse.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @returns {string} Error message if validation fails.
+ */
+function validateRuleList(ruleList) {
+ let result = null;
+ if (ruleList.length === rules.length) {
+ // No need to validate if only using built-in rules
+ return result;
+ }
+ const allIds = {};
+ ruleList.forEach(function forRule(rule, index) {
+ const customIndex = index - rules.length;
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function newError(property) {
+ return new Error(
+ "Property '" + property + "' of custom rule at index " +
+ customIndex + " is incorrect.");
+ }
+ [ "names", "tags" ].forEach(function forProperty(property) {
+ const value = rule[property];
+ if (!result &&
+ (!value || !Array.isArray(value) || (value.length === 0) ||
+ !value.every(helpers.isString) || value.some(helpers.isEmptyString))) {
+ result = newError(property);
+ }
+ });
+ [
+ [ "description", "string" ],
+ [ "function", "function" ]
+ ].forEach(function forProperty(propertyInfo) {
+ const property = propertyInfo[0];
+ const value = rule[property];
+ if (!result && (!value || (typeof value !== propertyInfo[1]))) {
+ result = newError(property);
+ }
+ });
+ if (!result && rule.information) {
+ if (Object.getPrototypeOf(rule.information) !== URL.prototype) {
+ result = newError("information");
+ }
+ }
+ if (!result) {
+ rule.names.forEach(function forName(name) {
+ const nameUpper = name.toUpperCase();
+ if (!result && (allIds[nameUpper] !== undefined)) {
+ result = new Error("Name '" + name + "' of custom rule at index " +
+ customIndex + " is already used as a name or tag.");
+ }
+ allIds[nameUpper] = true;
+ });
+ rule.tags.forEach(function forTag(tag) {
+ const tagUpper = tag.toUpperCase();
+ if (!result && allIds[tagUpper]) {
+ result = new Error("Tag '" + tag + "' of custom rule at index " +
+ customIndex + " is already used as a name.");
+ }
+ allIds[tagUpper] = false;
+ });
+ }
+ });
+ return result;
+}
+
+/**
+ * Creates a LintResults instance with toString for pretty display.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @returns {LintResults} New LintResults instance.
+ */
+function newResults(ruleList) {
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function Results() {}
+ Results.prototype.toString = function toString(useAlias) {
+ const that = this;
+ let ruleNameToRule = null;
+ const results = [];
+ Object.keys(that).forEach(function forFile(file) {
+ const fileResults = that[file];
+ if (Array.isArray(fileResults)) {
+ fileResults.forEach(function forResult(result) {
+ const ruleMoniker = result.ruleNames ?
+ result.ruleNames.join("/") :
+ (result.ruleName + "/" + result.ruleAlias);
+ results.push(
+ file + ": " +
+ result.lineNumber + ": " +
+ ruleMoniker + " " +
+ result.ruleDescription +
+ (result.errorDetail ?
+ " [" + result.errorDetail + "]" :
+ "") +
+ (result.errorContext ?
+ " [Context: \"" + result.errorContext + "\"]" :
+ ""));
+ });
+ } else {
+ if (!ruleNameToRule) {
+ ruleNameToRule = {};
+ ruleList.forEach(function forRule(rule) {
+ const ruleName = rule.names[0].toUpperCase();
+ ruleNameToRule[ruleName] = rule;
+ });
+ }
+ Object.keys(fileResults).forEach(function forRule(ruleName) {
+ const rule = ruleNameToRule[ruleName.toUpperCase()];
+ const ruleResults = fileResults[ruleName];
+ ruleResults.forEach(function forLine(lineNumber) {
+ const nameIndex = Math.min(useAlias ? 1 : 0, rule.names.length - 1);
+ const result =
+ file + ": " +
+ lineNumber + ": " +
+ rule.names[nameIndex] + " " +
+ rule.description;
+ results.push(result);
+ });
+ });
+ }
+ });
+ return results.join("\n");
+ };
+ // @ts-ignore
+ return new Results();
+}
+
+/**
+ * Remove front matter (if present at beginning of content).
+ *
+ * @param {string} content Markdown content.
+ * @param {RegExp} frontMatter Regular expression to match front matter.
+ * @returns {Object} Trimmed content and front matter lines.
+ */
+function removeFrontMatter(content, frontMatter) {
+ let frontMatterLines = [];
+ if (frontMatter) {
+ const frontMatterMatch = content.match(frontMatter);
+ if (frontMatterMatch && !frontMatterMatch.index) {
+ const contentMatched = frontMatterMatch[0];
+ content = content.slice(contentMatched.length);
+ frontMatterLines = contentMatched.split(helpers.newLineRe);
+ if (frontMatterLines.length &&
+ (frontMatterLines[frontMatterLines.length - 1] === "")) {
+ frontMatterLines.length--;
+ }
+ }
+ }
+ return {
+ "content": content,
+ "frontMatterLines": frontMatterLines
+ };
+}
+
+/**
+ * Annotate tokens with line/lineNumber.
+ *
+ * @param {MarkdownItToken[]} tokens Array of markdown-it tokens.
+ * @param {string[]} lines Lines of Markdown content.
+ * @returns {void}
+ */
+function annotateTokens(tokens, lines) {
+ let tbodyMap = null;
+ tokens.forEach(function forToken(token) {
+ // Handle missing maps for table body
+ if (token.type === "tbody_open") {
+ tbodyMap = token.map.slice();
+ } else if ((token.type === "tr_close") && tbodyMap) {
+ tbodyMap[0]++;
+ } else if (token.type === "tbody_close") {
+ tbodyMap = null;
+ }
+ if (tbodyMap && !token.map) {
+ token.map = tbodyMap.slice();
+ }
+ // Update token metadata
+ if (token.map) {
+ token.line = lines[token.map[0]];
+ token.lineNumber = token.map[0] + 1;
+ // Trim bottom of token to exclude whitespace lines
+ while (token.map[1] && !((lines[token.map[1] - 1] || "").trim())) {
+ token.map[1]--;
+ }
+ // Annotate children with lineNumber
+ let lineNumber = token.lineNumber;
+ const codeSpanExtraLines = [];
+ helpers.forEachInlineCodeSpan(
+ token.content,
+ function handleInlineCodeSpan(code) {
+ codeSpanExtraLines.push(code.split(helpers.newLineRe).length - 1);
+ }
+ );
+ (token.children || []).forEach(function forChild(child) {
+ child.lineNumber = lineNumber;
+ child.line = lines[lineNumber - 1];
+ if ((child.type === "softbreak") || (child.type === "hardbreak")) {
+ lineNumber++;
+ } else if (child.type === "code_inline") {
+ lineNumber += codeSpanExtraLines.shift();
+ }
+ });
+ }
+ });
+}
+
+/**
+ * Map rule names/tags to canonical rule name.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @returns {Object.<string, string[]>} Map of alias to rule name.
+ */
+function mapAliasToRuleNames(ruleList) {
+ const aliasToRuleNames = {};
+ // const tagToRuleNames = {};
+ ruleList.forEach(function forRule(rule) {
+ const ruleName = rule.names[0].toUpperCase();
+ // The following is useful for updating README.md:
+ // console.log(
+ // "* **[" + ruleName + "](doc/Rules.md#" + ruleName.toLowerCase() +
+ // ")** *" + rule.names.slice(1).join("/") + "* - " + rule.description);
+ rule.names.forEach(function forName(name) {
+ const nameUpper = name.toUpperCase();
+ aliasToRuleNames[nameUpper] = [ ruleName ];
+ });
+ rule.tags.forEach(function forTag(tag) {
+ const tagUpper = tag.toUpperCase();
+ const ruleNames = aliasToRuleNames[tagUpper] || [];
+ ruleNames.push(ruleName);
+ aliasToRuleNames[tagUpper] = ruleNames;
+ // tagToRuleNames[tag] = ruleName;
+ });
+ });
+ // The following is useful for updating README.md:
+ // Object.keys(tagToRuleNames).sort().forEach(function forTag(tag) {
+ // console.log("* **" + tag + "** - " +
+ // aliasToRuleNames[tag.toUpperCase()].join(", "));
+ // });
+ // @ts-ignore
+ return aliasToRuleNames;
+}
+
+/**
+ * Apply (and normalize) configuration object.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @param {Configuration} config Configuration object.
+ * @param {Object.<string, string[]>} aliasToRuleNames Map of alias to rule
+ * names.
+ * @returns {Configuration} Effective configuration.
+ */
+function getEffectiveConfig(ruleList, config, aliasToRuleNames) {
+ const defaultKey = Object.keys(config).filter(
+ (key) => key.toUpperCase() === "DEFAULT"
+ );
+ const ruleDefault = (defaultKey.length === 0) || !!config[defaultKey[0]];
+ const effectiveConfig = {};
+ ruleList.forEach((rule) => {
+ const ruleName = rule.names[0].toUpperCase();
+ effectiveConfig[ruleName] = ruleDefault;
+ });
+ deprecatedRuleNames.forEach((ruleName) => {
+ effectiveConfig[ruleName] = false;
+ });
+ Object.keys(config).forEach((key) => {
+ let value = config[key];
+ if (value) {
+ if (!(value instanceof Object)) {
+ value = {};
+ }
+ } else {
+ value = false;
+ }
+ const keyUpper = key.toUpperCase();
+ (aliasToRuleNames[keyUpper] || []).forEach((ruleName) => {
+ effectiveConfig[ruleName] = value;
+ });
+ });
+ return effectiveConfig;
+}
+
+/**
+ * Create a mapping of enabled rules per line.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @param {string[]} lines List of content lines.
+ * @param {string[]} frontMatterLines List of front matter lines.
+ * @param {boolean} noInlineConfig Whether to allow inline configuration.
+ * @param {Configuration} config Configuration object.
+ * @param {Object.<string, string[]>} aliasToRuleNames Map of alias to rule
+ * names.
+ * @returns {Object} Effective configuration and enabled rules per line number.
+ */
+function getEnabledRulesPerLineNumber(
+ ruleList,
+ lines,
+ frontMatterLines,
+ noInlineConfig,
+ config,
+ aliasToRuleNames) {
+ // Shared variables
+ let enabledRules = {};
+ let capturedRules = {};
+ const allRuleNames = [];
+ const enabledRulesPerLineNumber = new Array(1 + frontMatterLines.length);
+ // Helper functions
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function handleInlineConfig(perLine, forEachMatch, forEachLine) {
+ const input = perLine ? lines : [ lines.join("\n") ];
+ input.forEach((line) => {
+ if (!noInlineConfig) {
+ let match = null;
+ while ((match = helpers.inlineCommentRe.exec(line))) {
+ const action = (match[1] || match[3]).toUpperCase();
+ const parameter = match[2] || match[4];
+ forEachMatch(action, parameter);
+ }
+ }
+ if (forEachLine) {
+ forEachLine();
+ }
+ });
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function configureFile(action, parameter) {
+ if (action === "CONFIGURE-FILE") {
+ try {
+ const json = JSON.parse(parameter);
+ config = {
+ ...config,
+ ...json
+ };
+ } catch (ex) {
+ // Ignore parse errors for inline configuration
+ }
+ }
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function applyEnableDisable(action, parameter) {
+ const enabled = (action.startsWith("ENABLE"));
+ const items = parameter ?
+ parameter.trim().toUpperCase().split(/\s+/) :
+ allRuleNames;
+ items.forEach((nameUpper) => {
+ (aliasToRuleNames[nameUpper] || []).forEach((ruleName) => {
+ enabledRules[ruleName] = enabled;
+ });
+ });
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function enableDisableFile(action, parameter) {
+ if ((action === "ENABLE-FILE") || (action === "DISABLE-FILE")) {
+ applyEnableDisable(action, parameter);
+ }
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function captureRestoreEnableDisable(action, parameter) {
+ if (action === "CAPTURE") {
+ capturedRules = { ...enabledRules };
+ } else if (action === "RESTORE") {
+ enabledRules = { ...capturedRules };
+ } else if ((action === "ENABLE") || (action === "DISABLE")) {
+ enabledRules = { ...enabledRules };
+ applyEnableDisable(action, parameter);
+ }
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function updateLineState() {
+ enabledRulesPerLineNumber.push(enabledRules);
+ }
+ // Handle inline comments
+ handleInlineConfig(false, configureFile);
+ const effectiveConfig = getEffectiveConfig(
+ ruleList, config, aliasToRuleNames);
+ ruleList.forEach((rule) => {
+ const ruleName = rule.names[0].toUpperCase();
+ allRuleNames.push(ruleName);
+ enabledRules[ruleName] = !!effectiveConfig[ruleName];
+ });
+ capturedRules = enabledRules;
+ handleInlineConfig(true, enableDisableFile);
+ handleInlineConfig(true, captureRestoreEnableDisable, updateLineState);
+ // Return results
+ return {
+ effectiveConfig,
+ enabledRulesPerLineNumber
+ };
+}
+
+/**
+ * Compare function for Array.prototype.sort for ascending order of errors.
+ *
+ * @param {LintError} a First error.
+ * @param {LintError} b Second error.
+ * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
+ */
+function lineNumberComparison(a, b) {
+ return a.lineNumber - b.lineNumber;
+}
+
+/**
+ * Filter function to include everything.
+ *
+ * @returns {boolean} True.
+ */
+function filterAllValues() {
+ return true;
+}
+
+/**
+ * Function to return unique values from a sorted errors array.
+ *
+ * @param {LintError} value Error instance.
+ * @param {number} index Index in array.
+ * @param {LintError[]} array Array of errors.
+ * @returns {boolean} Filter value.
+ */
+function uniqueFilterForSortedErrors(value, index, array) {
+ return (index === 0) || (value.lineNumber > array[index - 1].lineNumber);
+}
+
+/**
+ * Lints a string containing Markdown content.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @param {string} name Identifier for the content.
+ * @param {string} content Markdown content
+ * @param {Object} md markdown-it instance.
+ * @param {Configuration} config Configuration object.
+ * @param {RegExp} frontMatter Regular expression for front matter.
+ * @param {boolean} handleRuleFailures Whether to handle exceptions in rules.
+ * @param {boolean} noInlineConfig Whether to allow inline configuration.
+ * @param {number} resultVersion Version of the LintResults object to return.
+ * @param {Function} callback Callback (err, result) function.
+ * @returns {void}
+ */
+function lintContent(
+ ruleList,
+ name,
+ content,
+ md,
+ config,
+ frontMatter,
+ handleRuleFailures,
+ noInlineConfig,
+ resultVersion,
+ callback) {
+ // Remove UTF-8 byte order marker (if present)
+ content = content.replace(/^\ufeff/, "");
+ // Remove front matter
+ const removeFrontMatterResult = removeFrontMatter(content, frontMatter);
+ const frontMatterLines = removeFrontMatterResult.frontMatterLines;
+ // Ignore the content of HTML comments
+ content = helpers.clearHtmlCommentText(removeFrontMatterResult.content);
+ // Parse content into tokens and lines
+ const tokens = md.parse(content, {});
+ const lines = content.split(helpers.newLineRe);
+ annotateTokens(tokens, lines);
+ const aliasToRuleNames = mapAliasToRuleNames(ruleList);
+ const { effectiveConfig, enabledRulesPerLineNumber } =
+ getEnabledRulesPerLineNumber(
+ ruleList,
+ lines,
+ frontMatterLines,
+ noInlineConfig,
+ config,
+ aliasToRuleNames
+ );
+ // Create parameters for rules
+ const params = {
+ name,
+ tokens,
+ lines,
+ frontMatterLines
+ };
+ cache.lineMetadata(helpers.getLineMetadata(params));
+ cache.flattenedLists(helpers.flattenLists(params));
+ // Function to run for each rule
+ const result = (resultVersion === 0) ? {} : [];
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function forRule(rule) {
+ // Configure rule
+ const ruleNameFriendly = rule.names[0];
+ const ruleName = ruleNameFriendly.toUpperCase();
+ params.config = effectiveConfig[ruleName];
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function throwError(property) {
+ throw new Error(
+ "Property '" + property + "' of onError parameter is incorrect.");
+ }
+ const errors = [];
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function onError(errorInfo) {
+ if (!errorInfo ||
+ !helpers.isNumber(errorInfo.lineNumber) ||
+ (errorInfo.lineNumber < 1) ||
+ (errorInfo.lineNumber > lines.length)) {
+ throwError("lineNumber");
+ }
+ if (errorInfo.detail &&
+ !helpers.isString(errorInfo.detail)) {
+ throwError("detail");
+ }
+ if (errorInfo.context &&
+ !helpers.isString(errorInfo.context)) {
+ throwError("context");
+ }
+ if (errorInfo.range &&
+ (!Array.isArray(errorInfo.range) ||
+ (errorInfo.range.length !== 2) ||
+ !helpers.isNumber(errorInfo.range[0]) ||
+ (errorInfo.range[0] < 1) ||
+ !helpers.isNumber(errorInfo.range[1]) ||
+ (errorInfo.range[1] < 1) ||
+ ((errorInfo.range[0] + errorInfo.range[1] - 1) >
+ lines[errorInfo.lineNumber - 1].length))) {
+ throwError("range");
+ }
+ const fixInfo = errorInfo.fixInfo;
+ const cleanFixInfo = {};
+ if (fixInfo) {
+ if (!helpers.isObject(fixInfo)) {
+ throwError("fixInfo");
+ }
+ if (fixInfo.lineNumber !== undefined) {
+ if ((!helpers.isNumber(fixInfo.lineNumber) ||
+ (fixInfo.lineNumber < 1) ||
+ (fixInfo.lineNumber > lines.length))) {
+ throwError("fixInfo.lineNumber");
+ }
+ cleanFixInfo.lineNumber =
+ fixInfo.lineNumber + frontMatterLines.length;
+ }
+ const effectiveLineNumber = fixInfo.lineNumber || errorInfo.lineNumber;
+ if (fixInfo.editColumn !== undefined) {
+ if ((!helpers.isNumber(fixInfo.editColumn) ||
+ (fixInfo.editColumn < 1) ||
+ (fixInfo.editColumn >
+ lines[effectiveLineNumber - 1].length + 1))) {
+ throwError("fixInfo.editColumn");
+ }
+ cleanFixInfo.editColumn = fixInfo.editColumn;
+ }
+ if (fixInfo.deleteCount !== undefined) {
+ if ((!helpers.isNumber(fixInfo.deleteCount) ||
+ (fixInfo.deleteCount < -1) ||
+ (fixInfo.deleteCount >
+ lines[effectiveLineNumber - 1].length))) {
+ throwError("fixInfo.deleteCount");
+ }
+ cleanFixInfo.deleteCount = fixInfo.deleteCount;
+ }
+ if (fixInfo.insertText !== undefined) {
+ if (!helpers.isString(fixInfo.insertText)) {
+ throwError("fixInfo.insertText");
+ }
+ cleanFixInfo.insertText = fixInfo.insertText;
+ }
+ }
+ errors.push({
+ "lineNumber": errorInfo.lineNumber + frontMatterLines.length,
+ "detail": errorInfo.detail || null,
+ "context": errorInfo.context || null,
+ "range": errorInfo.range ? [ ...errorInfo.range ] : null,
+ "fixInfo": fixInfo ? cleanFixInfo : null
+ });
+ }
+ // Call (possibly external) rule function
+ if (handleRuleFailures) {
+ try {
+ rule.function(params, onError);
+ } catch (ex) {
+ onError({
+ "lineNumber": 1,
+ "detail": `This rule threw an exception: ${ex.message}`
+ });
+ }
+ } else {
+ rule.function(params, onError);
+ }
+ // Record any errors (significant performance benefit from length check)
+ if (errors.length) {
+ errors.sort(lineNumberComparison);
+ const filteredErrors = errors
+ .filter((resultVersion === 3) ?
+ filterAllValues :
+ uniqueFilterForSortedErrors)
+ .filter(function removeDisabledRules(error) {
+ return enabledRulesPerLineNumber[error.lineNumber][ruleName];
+ })
+ .map(function formatResults(error) {
+ if (resultVersion === 0) {
+ return error.lineNumber;
+ }
+ const errorObject = {};
+ errorObject.lineNumber = error.lineNumber;
+ if (resultVersion === 1) {
+ errorObject.ruleName = ruleNameFriendly;
+ errorObject.ruleAlias = rule.names[1] || rule.names[0];
+ } else {
+ errorObject.ruleNames = rule.names;
+ }
+ errorObject.ruleDescription = rule.description;
+ errorObject.ruleInformation =
+ rule.information ? rule.information.href : null;
+ errorObject.errorDetail = error.detail;
+ errorObject.errorContext = error.context;
+ errorObject.errorRange = error.range;
+ if (resultVersion === 3) {
+ errorObject.fixInfo = error.fixInfo;
+ }
+ return errorObject;
+ });
+ if (filteredErrors.length) {
+ if (resultVersion === 0) {
+ result[ruleNameFriendly] = filteredErrors;
+ } else {
+ Array.prototype.push.apply(result, filteredErrors);
+ }
+ }
+ }
+ }
+ // Run all rules
+ try {
+ ruleList.forEach(forRule);
+ } catch (ex) {
+ cache.clear();
+ return callback(ex);
+ }
+ cache.clear();
+ return callback(null, result);
+}
+
+/**
+ * Lints a file containing Markdown content.
+ *
+ * @param {Rule[]} ruleList List of rules.
+ * @param {string} file Path of file to lint.
+ * @param {Object} md markdown-it instance.
+ * @param {Configuration} config Configuration object.
+ * @param {RegExp} frontMatter Regular expression for front matter.
+ * @param {boolean} handleRuleFailures Whether to handle exceptions in rules.
+ * @param {boolean} noInlineConfig Whether to allow inline configuration.
+ * @param {number} resultVersion Version of the LintResults object to return.
+ * @param {boolean} synchronous Whether to execute synchronously.
+ * @param {Function} callback Callback (err, result) function.
+ * @returns {void}
+ */
+function lintFile(
+ ruleList,
+ file,
+ md,
+ config,
+ frontMatter,
+ handleRuleFailures,
+ noInlineConfig,
+ resultVersion,
+ synchronous,
+ callback) {
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function lintContentWrapper(err, content) {
+ if (err) {
+ return callback(err);
+ }
+ return lintContent(ruleList, file, content, md, config, frontMatter,
+ handleRuleFailures, noInlineConfig, resultVersion, callback);
+ }
+ // Make a/synchronous call to read file
+ if (synchronous) {
+ lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding));
+ } else {
+ fs.readFile(file, helpers.utf8Encoding, lintContentWrapper);
+ }
+}
+
+/**
+ * Lint files and strings specified in the Options object.
+ *
+ * @param {Options} options Options object.
+ * @param {boolean} synchronous Whether to execute synchronously.
+ * @param {Function} callback Callback (err, result) function.
+ * @returns {void}
+ */
+function lintInput(options, synchronous, callback) {
+ // Normalize inputs
+ options = options || {};
+ callback = callback || function noop() {};
+ const ruleList = rules.concat(options.customRules || []);
+ const ruleErr = validateRuleList(ruleList);
+ if (ruleErr) {
+ return callback(ruleErr);
+ }
+ let files = [];
+ if (Array.isArray(options.files)) {
+ files = options.files.slice();
+ } else if (options.files) {
+ files = [ String(options.files) ];
+ }
+ const strings = options.strings || {};
+ const stringsKeys = Object.keys(strings);
+ const config = options.config || { "default": true };
+ const frontMatter = (options.frontMatter === undefined) ?
+ helpers.frontMatterRe : options.frontMatter;
+ const handleRuleFailures = !!options.handleRuleFailures;
+ const noInlineConfig = !!options.noInlineConfig;
+ const resultVersion = (options.resultVersion === undefined) ?
+ 2 : options.resultVersion;
+ const md = markdownIt({ "html": true });
+ const markdownItPlugins = options.markdownItPlugins || [];
+ markdownItPlugins.forEach(function forPlugin(plugin) {
+ // @ts-ignore
+ md.use(...plugin);
+ });
+ const results = newResults(ruleList);
+ // Helper to lint the next string or file
+ /* eslint-disable consistent-return */
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function lintNextItem() {
+ let iterating = true;
+ let item = null;
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function lintNextItemCallback(err, result) {
+ if (err) {
+ iterating = false;
+ return callback(err);
+ }
+ results[item] = result;
+ return iterating || lintNextItem();
+ }
+ while (iterating) {
+ if ((item = stringsKeys.shift())) {
+ lintContent(
+ ruleList,
+ item,
+ strings[item] || "",
+ md,
+ config,
+ frontMatter,
+ handleRuleFailures,
+ noInlineConfig,
+ resultVersion,
+ lintNextItemCallback);
+ } else if ((item = files.shift())) {
+ iterating = synchronous;
+ lintFile(
+ ruleList,
+ item,
+ md,
+ config,
+ frontMatter,
+ handleRuleFailures,
+ noInlineConfig,
+ resultVersion,
+ synchronous,
+ lintNextItemCallback);
+ } else {
+ return callback(null, results);
+ }
+ }
+ }
+ return lintNextItem();
+}
+
+/**
+ * Lint specified Markdown files.
+ *
+ * @param {Options} options Configuration options.
+ * @param {LintCallback} callback Callback (err, result) function.
+ * @returns {void}
+ */
+function markdownlint(options, callback) {
+ return lintInput(options, false, callback);
+}
+
+/**
+ * Lint specified Markdown files synchronously.
+ *
+ * @param {Options} options Configuration options.
+ * @returns {LintResults} Results object.
+ */
+function markdownlintSync(options) {
+ let results = null;
+ lintInput(options, true, function callback(error, res) {
+ if (error) {
+ throw error;
+ }
+ results = res;
+ });
+ return results;
+}
+
+/**
+ * Parse the content of a configuration file.
+ *
+ * @param {string} name Name of the configuration file.
+ * @param {string} content Configuration content.
+ * @param {ConfigurationParser[]} parsers Parsing function(s).
+ * @returns {Object} Configuration object and error message.
+ */
+function parseConfiguration(name, content, parsers) {
+ let config = null;
+ let message = "";
+ const errors = [];
+ // Try each parser
+ (parsers || [ JSON.parse ]).every((parser) => {
+ try {
+ config = parser(content);
+ } catch (ex) {
+ errors.push(ex.message);
+ }
+ return !config;
+ });
+ // Message if unable to parse
+ if (!config) {
+ errors.unshift(`Unable to parse '${name}'`);
+ message = errors.join("; ");
+ }
+ return {
+ config,
+ message
+ };
+}
+
+/**
+ * Read specified configuration file.
+ *
+ * @param {string} file Configuration file name.
+ * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
+ * function(s).
+ * @param {ReadConfigCallback} [callback] Callback (err, result) function.
+ * @returns {void}
+ */
+function readConfig(file, parsers, callback) {
+ if (!callback) {
+ // @ts-ignore
+ callback = parsers;
+ parsers = null;
+ }
+ // Read file
+ fs.readFile(file, helpers.utf8Encoding, (err, content) => {
+ if (err) {
+ return callback(err);
+ }
+ // Try to parse file
+ // @ts-ignore
+ const { config, message } = parseConfiguration(file, content, parsers);
+ if (!config) {
+ return callback(new Error(message));
+ }
+ // Extend configuration
+ const configExtends = config.extends;
+ if (configExtends) {
+ delete config.extends;
+ const extendsFile = path.resolve(path.dirname(file), configExtends);
+ return readConfig(extendsFile, parsers, (errr, extendsConfig) => {
+ if (errr) {
+ return callback(errr);
+ }
+ return callback(null, {
+ ...extendsConfig,
+ ...config
+ });
+ });
+ }
+ return callback(null, config);
+ });
+}
+
+/**
+ * Read specified configuration file synchronously.
+ *
+ * @param {string} file Configuration file name.
+ * @param {ConfigurationParser[]} [parsers] Parsing function(s).
+ * @returns {Configuration} Configuration object.
+ */
+function readConfigSync(file, parsers) {
+ // Read file
+ const content = fs.readFileSync(file, helpers.utf8Encoding);
+ // Try to parse file
+ const { config, message } = parseConfiguration(file, content, parsers);
+ if (!config) {
+ throw new Error(message);
+ }
+ // Extend configuration
+ const configExtends = config.extends;
+ if (configExtends) {
+ delete config.extends;
+ return {
+ ...readConfigSync(
+ path.resolve(path.dirname(file), configExtends),
+ parsers
+ ),
+ ...config
+ };
+ }
+ return config;
+}
+
+// Export a/synchronous APIs
+markdownlint.sync = markdownlintSync;
+markdownlint.readConfig = readConfig;
+markdownlint.readConfigSync = readConfigSync;
+module.exports = markdownlint;
+
+// Type declarations
+
+/**
+ * Function to implement rule logic.
+ *
+ * @callback RuleFunction
+ * @param {RuleParams} params Rule parameters.
+ * @param {RuleOnError} onError Error-reporting callback.
+ * @returns {void}
+ */
+
+/**
+ * Rule parameters.
+ *
+ * @typedef {Object} RuleParams
+ * @property {string} name File/string name.
+ * @property {MarkdownItToken[]} tokens markdown-it token objects.
+ * @property {string[]} lines File/string lines.
+ * @property {string[]} frontMatterLines Front matter lines.
+ * @property {RuleConfiguration} config Rule configuration.
+ */
+
+/**
+ * Markdown-It token.
+ *
+ * @typedef {Object} MarkdownItToken
+ * @property {string[][]} attrs HTML attributes.
+ * @property {boolean} block Block-level token.
+ * @property {MarkdownItToken[]} children Child nodes.
+ * @property {string} content Tag contents.
+ * @property {boolean} hidden Ignore element.
+ * @property {string} info Fence info.
+ * @property {number} level Nesting level.
+ * @property {number[]} map Beginning/ending line numbers.
+ * @property {string} markup Markup text.
+ * @property {Object} meta Arbitrary data.
+ * @property {number} nesting Level change.
+ * @property {string} tag HTML tag name.
+ * @property {string} type Token type.
+ * @property {number} lineNumber Line number (1-based).
+ * @property {string} line Line content.
+ */
+
+/**
+ * Error-reporting callback.
+ *
+ * @callback RuleOnError
+ * @param {RuleOnErrorInfo} onErrorInfo Error information.
+ * @returns {void}
+ */
+
+/**
+ * Fix information for RuleOnError callback.
+ *
+ * @typedef {Object} RuleOnErrorInfo
+ * @property {number} lineNumber Line number (1-based).
+ * @property {string} [details] Details about the error.
+ * @property {string} [context] Context for the error.
+ * @property {number[]} [range] Column number (1-based) and length.
+ * @property {RuleOnErrorFixInfo} [fixInfo] Fix information.
+ */
+
+/**
+ * Fix information for RuleOnErrorInfo.
+ *
+ * @typedef {Object} RuleOnErrorFixInfo
+ * @property {number} [lineNumber] Line number (1-based).
+ * @property {number} [editColumn] Column of the fix (1-based).
+ * @property {number} [deleteCount] Count of characters to delete.
+ * @property {string} [insertText] Text to insert (after deleting).
+ */
+
+/**
+ * Rule definition.
+ *
+ * @typedef {Object} Rule
+ * @property {string[]} names Rule name(s).
+ * @property {string} description Rule description.
+ * @property {URL} [information] Link to more information.
+ * @property {string[]} tags Rule tag(s).
+ * @property {RuleFunction} function Rule implementation.
+ */
+
+/**
+ * Configuration options.
+ *
+ * @typedef {Object} Options
+ * @property {string[] | string} [files] Files to lint.
+ * @property {Object.<string, string>} [strings] Strings to lint.
+ * @property {Configuration} [config] Configuration object.
+ * @property {Rule[] | Rule} [customRules] Custom rules.
+ * @property {RegExp} [frontMatter] Front matter pattern.
+ * @property {boolean} [handleRuleFailures] True to catch exceptions.
+ * @property {boolean} [noInlineConfig] True to ignore HTML directives.
+ * @property {number} [resultVersion] Results object version.
+ * @property {Plugin[]} [markdownItPlugins] Additional plugins.
+ */
+
+/**
+ * markdown-it plugin.
+ *
+ * @typedef {Array} Plugin
+ */
+
+/**
+ * Function to pretty-print lint results.
+ *
+ * @callback ToStringCallback
+ * @param {boolean} [ruleAliases] True to use rule aliases.
+ * @returns {string}
+ */
+
+/**
+ * Lint results (for resultVersion 3).
+ *
+ * @typedef {Object.<string, LintError[]>} LintResults
+ */
+// The following should be part of the LintResults typedef, but that causes
+// TypeScript to "forget" about the string map.
+// * @property {ToStringCallback} toString String representation.
+// https://github.com/microsoft/TypeScript/issues/34911
+
+/**
+ * Lint error.
+ *
+ * @typedef {Object} LintError
+ * @property {number} lineNumber Line number (1-based).
+ * @property {string[]} ruleNames Rule name(s).
+ * @property {string} ruleDescription Rule description.
+ * @property {string} ruleInformation Link to more information.
+ * @property {string} errorDetail Detail about the error.
+ * @property {string} errorContext Context for the error.
+ * @property {number[]} errorRange Column number (1-based) and length.
+ * @property {FixInfo} fixInfo Fix information.
+ */
+
+/**
+ * Fix information.
+ *
+ * @typedef {Object} FixInfo
+ * @property {number} [editColumn] Column of the fix (1-based).
+ * @property {number} [deleteCount] Count of characters to delete.
+ * @property {string} [insertText] Text to insert (after deleting).
+ */
+
+/**
+ * Called with the result of the lint operation.
+ *
+ * @callback LintCallback
+ * @param {Error | null} err Error object or null.
+ * @param {LintResults} [results] Lint results.
+ * @returns {void}
+ */
+
+/**
+ * Configuration object for linting rules. For a detailed schema, see
+ * {@link ../schema/markdownlint-config-schema.json}.
+ *
+ * @typedef {Object.<string, RuleConfiguration>} Configuration
+ */
+
+/**
+ * Rule configuration object.
+ *
+ * @typedef {boolean | Object} RuleConfiguration Rule configuration.
+ */
+
+/**
+ * Parses a configuration string and returns a configuration object.
+ *
+ * @callback ConfigurationParser
+ * @param {string} text Configuration string.
+ * @returns {Configuration}
+ */
+
+/**
+ * Called with the result of the readConfig operation.
+ *
+ * @callback ReadConfigCallback
+ * @param {Error | null} err Error object or null.
+ * @param {Configuration} [config] Configuration object.
+ * @returns {void}
+ */
+
+
+/***/ }),
+/* 38 */
+/***/ (function(module, exports) {
+
+module.exports = require("path");
+
+/***/ }),
+/* 39 */
+/***/ (function(module, exports) {
+
+module.exports = require("url");
+
+/***/ }),
+/* 40 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+module.exports = __webpack_require__(41);
+
+
+/***/ }),
+/* 41 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Main parser class
+
+
+
+
+var utils = __webpack_require__(42);
+var helpers = __webpack_require__(56);
+var Renderer = __webpack_require__(60);
+var ParserCore = __webpack_require__(61);
+var ParserBlock = __webpack_require__(71);
+var ParserInline = __webpack_require__(86);
+var LinkifyIt = __webpack_require__(101);
+var mdurl = __webpack_require__(46);
+var punycode = __webpack_require__(103);
+
+
+var config = {
+ 'default': __webpack_require__(104),
+ zero: __webpack_require__(105),
+ commonmark: __webpack_require__(106)
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// This validator can prohibit more than really needed to prevent XSS. It's a
+// tradeoff to keep code simple and to be secure by default.
+//
+// If you need different setup - override validator method as you wish. Or
+// replace it with dummy function and use external sanitizer.
+//
+
+var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
+var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
+
+function validateLink(url) {
+ // url should be normalized at this point, and existing entities are decoded
+ var str = url.trim().toLowerCase();
+
+ return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];
+
+function normalizeLink(url) {
+ var parsed = mdurl.parse(url, true);
+
+ if (parsed.hostname) {
+ // Encode hostnames in urls like:
+ // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
+ //
+ // We don't encode unknown schemas, because it's likely that we encode
+ // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
+ //
+ if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
+ try {
+ parsed.hostname = punycode.toASCII(parsed.hostname);
+ } catch (er) { /**/ }
+ }
+ }
+
+ return mdurl.encode(mdurl.format(parsed));
+}
+
+function normalizeLinkText(url) {
+ var parsed = mdurl.parse(url, true);
+
+ if (parsed.hostname) {
+ // Encode hostnames in urls like:
+ // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
+ //
+ // We don't encode unknown schemas, because it's likely that we encode
+ // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
+ //
+ if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
+ try {
+ parsed.hostname = punycode.toUnicode(parsed.hostname);
+ } catch (er) { /**/ }
+ }
+ }
+
+ return mdurl.decode(mdurl.format(parsed));
+}
+
+
+/**
+ * class MarkdownIt
+ *
+ * Main parser/renderer class.
+ *
+ * ##### Usage
+ *
+ * ```javascript
+ * // node.js, "classic" way:
+ * var MarkdownIt = require('markdown-it'),
+ * md = new MarkdownIt();
+ * var result = md.render('# markdown-it rulezz!');
+ *
+ * // node.js, the same, but with sugar:
+ * var md = require('markdown-it')();
+ * var result = md.render('# markdown-it rulezz!');
+ *
+ * // browser without AMD, added to "window" on script load
+ * // Note, there are no dash.
+ * var md = window.markdownit();
+ * var result = md.render('# markdown-it rulezz!');
+ * ```
+ *
+ * Single line rendering, without paragraph wrap:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ * var result = md.renderInline('__markdown-it__ rulezz!');
+ * ```
+ **/
+
+/**
+ * new MarkdownIt([presetName, options])
+ * - presetName (String): optional, `commonmark` / `zero`
+ * - options (Object)
+ *
+ * Creates parser instanse with given config. Can be called without `new`.
+ *
+ * ##### presetName
+ *
+ * MarkdownIt provides named presets as a convenience to quickly
+ * enable/disable active syntax rules and options for common use cases.
+ *
+ * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
+ * configures parser to strict [CommonMark](http://commonmark.org/) mode.
+ * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
+ * similar to GFM, used when no preset name given. Enables all available rules,
+ * but still without html, typographer & autolinker.
+ * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
+ * all rules disabled. Useful to quickly setup your config via `.enable()`.
+ * For example, when you need only `bold` and `italic` markup and nothing else.
+ *
+ * ##### options:
+ *
+ * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!
+ * That's not safe! You may need external sanitizer to protect output from XSS.
+ * It's better to extend features via plugins, instead of enabling HTML.
+ * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags
+ * (`<br />`). This is needed only for full CommonMark compatibility. In real
+ * world you will need HTML output.
+ * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.
+ * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
+ * Can be useful for external highlighters.
+ * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
+ * - __typographer__ - `false`. Set `true` to enable [some language-neutral
+ * replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
+ * quotes beautification (smartquotes).
+ * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
+ * pairs, when typographer enabled and smartquotes on. For example, you can
+ * use `'«»„“'` for Russian, `'„“‚‘'` for German, and
+ * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
+ * - __highlight__ - `null`. Highlighter function for fenced code blocks.
+ * Highlighter `function (str, lang)` should return escaped HTML. It can also
+ * return empty string if the source was not changed and should be escaped
+ * externaly. If result starts with <pre... internal wrapper is skipped.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * // commonmark mode
+ * var md = require('markdown-it')('commonmark');
+ *
+ * // default mode
+ * var md = require('markdown-it')();
+ *
+ * // enable everything
+ * var md = require('markdown-it')({
+ * html: true,
+ * linkify: true,
+ * typographer: true
+ * });
+ * ```
+ *
+ * ##### Syntax highlighting
+ *
+ * ```js
+ * var hljs = require('highlight.js') // https://highlightjs.org/
+ *
+ * var md = require('markdown-it')({
+ * highlight: function (str, lang) {
+ * if (lang && hljs.getLanguage(lang)) {
+ * try {
+ * return hljs.highlight(lang, str, true).value;
+ * } catch (__) {}
+ * }
+ *
+ * return ''; // use external default escaping
+ * }
+ * });
+ * ```
+ *
+ * Or with full wrapper override (if you need assign class to `<pre>`):
+ *
+ * ```javascript
+ * var hljs = require('highlight.js') // https://highlightjs.org/
+ *
+ * // Actual default values
+ * var md = require('markdown-it')({
+ * highlight: function (str, lang) {
+ * if (lang && hljs.getLanguage(lang)) {
+ * try {
+ * return '<pre class="hljs"><code>' +
+ * hljs.highlight(lang, str, true).value +
+ * '</code></pre>';
+ * } catch (__) {}
+ * }
+ *
+ * return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
+ * }
+ * });
+ * ```
+ *
+ **/
+function MarkdownIt(presetName, options) {
+ if (!(this instanceof MarkdownIt)) {
+ return new MarkdownIt(presetName, options);
+ }
+
+ if (!options) {
+ if (!utils.isString(presetName)) {
+ options = presetName || {};
+ presetName = 'default';
+ }
+ }
+
+ /**
+ * MarkdownIt#inline -> ParserInline
+ *
+ * Instance of [[ParserInline]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.inline = new ParserInline();
+
+ /**
+ * MarkdownIt#block -> ParserBlock
+ *
+ * Instance of [[ParserBlock]]. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.block = new ParserBlock();
+
+ /**
+ * MarkdownIt#core -> Core
+ *
+ * Instance of [[Core]] chain executor. You may need it to add new rules when
+ * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
+ * [[MarkdownIt.enable]].
+ **/
+ this.core = new ParserCore();
+
+ /**
+ * MarkdownIt#renderer -> Renderer
+ *
+ * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
+ * rules for new token types, generated by plugins.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * function myToken(tokens, idx, options, env, self) {
+ * //...
+ * return result;
+ * };
+ *
+ * md.renderer.rules['my_token'] = myToken
+ * ```
+ *
+ * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
+ **/
+ this.renderer = new Renderer();
+
+ /**
+ * MarkdownIt#linkify -> LinkifyIt
+ *
+ * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
+ * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
+ * rule.
+ **/
+ this.linkify = new LinkifyIt();
+
+ /**
+ * MarkdownIt#validateLink(url) -> Boolean
+ *
+ * Link validation function. CommonMark allows too much in links. By default
+ * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
+ * except some embedded image types.
+ *
+ * You can change this behaviour:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ * // enable everything
+ * md.validateLink = function () { return true; }
+ * ```
+ **/
+ this.validateLink = validateLink;
+
+ /**
+ * MarkdownIt#normalizeLink(url) -> String
+ *
+ * Function used to encode link url to a machine-readable format,
+ * which includes url-encoding, punycode, etc.
+ **/
+ this.normalizeLink = normalizeLink;
+
+ /**
+ * MarkdownIt#normalizeLinkText(url) -> String
+ *
+ * Function used to decode link url to a human-readable format`
+ **/
+ this.normalizeLinkText = normalizeLinkText;
+
+
+ // Expose utils & helpers for easy acces from plugins
+
+ /**
+ * MarkdownIt#utils -> utils
+ *
+ * Assorted utility functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
+ **/
+ this.utils = utils;
+
+ /**
+ * MarkdownIt#helpers -> helpers
+ *
+ * Link components parser functions, useful to write plugins. See details
+ * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
+ **/
+ this.helpers = utils.assign({}, helpers);
+
+
+ this.options = {};
+ this.configure(presetName);
+
+ if (options) { this.set(options); }
+}
+
+
+/** chainable
+ * MarkdownIt.set(options)
+ *
+ * Set parser options (in the same format as in constructor). Probably, you
+ * will never need it, but you can change options after constructor call.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .set({ html: true, breaks: true })
+ * .set({ typographer, true });
+ * ```
+ *
+ * __Note:__ To achieve the best possible performance, don't modify a
+ * `markdown-it` instance options on the fly. If you need multiple configurations
+ * it's best to create multiple instances and initialize each with separate
+ * config.
+ **/
+MarkdownIt.prototype.set = function (options) {
+ utils.assign(this.options, options);
+ return this;
+};
+
+
+/** chainable, internal
+ * MarkdownIt.configure(presets)
+ *
+ * Batch load of all options and compenent settings. This is internal method,
+ * and you probably will not need it. But if you with - see available presets
+ * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
+ *
+ * We strongly recommend to use presets instead of direct config loads. That
+ * will give better compatibility with next versions.
+ **/
+MarkdownIt.prototype.configure = function (presets) {
+ var self = this, presetName;
+
+ if (utils.isString(presets)) {
+ presetName = presets;
+ presets = config[presetName];
+ if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }
+ }
+
+ if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }
+
+ if (presets.options) { self.set(presets.options); }
+
+ if (presets.components) {
+ Object.keys(presets.components).forEach(function (name) {
+ if (presets.components[name].rules) {
+ self[name].ruler.enableOnly(presets.components[name].rules);
+ }
+ if (presets.components[name].rules2) {
+ self[name].ruler2.enableOnly(presets.components[name].rules2);
+ }
+ });
+ }
+ return this;
+};
+
+
+/** chainable
+ * MarkdownIt.enable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to enable
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable list or rules. It will automatically find appropriate components,
+ * containing rules with given names. If rule not found, and `ignoreInvalid`
+ * not set - throws exception.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')()
+ * .enable(['sub', 'sup'])
+ * .disable('smartquotes');
+ * ```
+ **/
+MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
+ var result = [];
+
+ if (!Array.isArray(list)) { list = [ list ]; }
+
+ [ 'core', 'block', 'inline' ].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.enable(list, true));
+ }, this);
+
+ result = result.concat(this.inline.ruler2.enable(list, true));
+
+ var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
+
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
+ }
+
+ return this;
+};
+
+
+/** chainable
+ * MarkdownIt.disable(list, ignoreInvalid)
+ * - list (String|Array): rule name or list of rule names to disable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * The same as [[MarkdownIt.enable]], but turn specified rules off.
+ **/
+MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
+ var result = [];
+
+ if (!Array.isArray(list)) { list = [ list ]; }
+
+ [ 'core', 'block', 'inline' ].forEach(function (chain) {
+ result = result.concat(this[chain].ruler.disable(list, true));
+ }, this);
+
+ result = result.concat(this.inline.ruler2.disable(list, true));
+
+ var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
+
+ if (missed.length && !ignoreInvalid) {
+ throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
+ }
+ return this;
+};
+
+
+/** chainable
+ * MarkdownIt.use(plugin, params)
+ *
+ * Load specified plugin with given params into current parser instance.
+ * It's just a sugar to call `plugin(md, params)` with curring.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var iterator = require('markdown-it-for-inline');
+ * var md = require('markdown-it')()
+ * .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
+ * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
+ * });
+ * ```
+ **/
+MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
+ var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));
+ plugin.apply(plugin, args);
+ return this;
+};
+
+
+/** internal
+ * MarkdownIt.parse(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Parse input string and returns list of block tokens (special token type
+ * "inline" will contain list of inline tokens). You should not call this
+ * method directly, until you write custom renderer (for example, to produce
+ * AST).
+ *
+ * `env` is used to pass data between "distributed" rules and return additional
+ * metadata like reference info, needed for the renderer. It also can be used to
+ * inject data in specific cases. Usually, you will be ok to pass `{}`,
+ * and then pass updated object to renderer.
+ **/
+MarkdownIt.prototype.parse = function (src, env) {
+ if (typeof src !== 'string') {
+ throw new Error('Input data should be a String');
+ }
+
+ var state = new this.core.State(src, this, env);
+
+ this.core.process(state);
+
+ return state.tokens;
+};
+
+
+/**
+ * MarkdownIt.render(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Render markdown string into html. It does all magic for you :).
+ *
+ * `env` can be used to inject additional metadata (`{}` by default).
+ * But you will not need it with high probability. See also comment
+ * in [[MarkdownIt.parse]].
+ **/
+MarkdownIt.prototype.render = function (src, env) {
+ env = env || {};
+
+ return this.renderer.render(this.parse(src, env), this.options, env);
+};
+
+
+/** internal
+ * MarkdownIt.parseInline(src, env) -> Array
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
+ * block tokens list with the single `inline` element, containing parsed inline
+ * tokens in `children` property. Also updates `env` object.
+ **/
+MarkdownIt.prototype.parseInline = function (src, env) {
+ var state = new this.core.State(src, this, env);
+
+ state.inlineMode = true;
+ this.core.process(state);
+
+ return state.tokens;
+};
+
+
+/**
+ * MarkdownIt.renderInline(src [, env]) -> String
+ * - src (String): source string
+ * - env (Object): environment sandbox
+ *
+ * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
+ * will NOT be wrapped into `<p>` tags.
+ **/
+MarkdownIt.prototype.renderInline = function (src, env) {
+ env = env || {};
+
+ return this.renderer.render(this.parseInline(src, env), this.options, env);
+};
+
+
+module.exports = MarkdownIt;
+
+
+/***/ }),
+/* 42 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Utilities
+//
+
+
+
+function _class(obj) { return Object.prototype.toString.call(obj); }
+
+function isString(obj) { return _class(obj) === '[object String]'; }
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function has(object, key) {
+ return _hasOwnProperty.call(object, key);
+}
+
+// Merge objects
+//
+function assign(obj /*from1, from2, from3, ...*/) {
+ var sources = Array.prototype.slice.call(arguments, 1);
+
+ sources.forEach(function (source) {
+ if (!source) { return; }
+
+ if (typeof source !== 'object') {
+ throw new TypeError(source + 'must be object');
+ }
+
+ Object.keys(source).forEach(function (key) {
+ obj[key] = source[key];
+ });
+ });
+
+ return obj;
+}
+
+// Remove element from array and put another array at those position.
+// Useful for some operations with tokens
+function arrayReplaceAt(src, pos, newElements) {
+ return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+function isValidEntityCode(c) {
+ /*eslint no-bitwise:0*/
+ // broken sequence
+ if (c >= 0xD800 && c <= 0xDFFF) { return false; }
+ // never used
+ if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }
+ if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }
+ // control codes
+ if (c >= 0x00 && c <= 0x08) { return false; }
+ if (c === 0x0B) { return false; }
+ if (c >= 0x0E && c <= 0x1F) { return false; }
+ if (c >= 0x7F && c <= 0x9F) { return false; }
+ // out of range
+ if (c > 0x10FFFF) { return false; }
+ return true;
+}
+
+function fromCodePoint(c) {
+ /*eslint no-bitwise:0*/
+ if (c > 0xffff) {
+ c -= 0x10000;
+ var surrogate1 = 0xd800 + (c >> 10),
+ surrogate2 = 0xdc00 + (c & 0x3ff);
+
+ return String.fromCharCode(surrogate1, surrogate2);
+ }
+ return String.fromCharCode(c);
+}
+
+
+var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
+var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
+var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
+
+var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
+
+var entities = __webpack_require__(43);
+
+function replaceEntityPattern(match, name) {
+ var code = 0;
+
+ if (has(entities, name)) {
+ return entities[name];
+ }
+
+ if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {
+ code = name[1].toLowerCase() === 'x' ?
+ parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
+
+ if (isValidEntityCode(code)) {
+ return fromCodePoint(code);
+ }
+ }
+
+ return match;
+}
+
+/*function replaceEntities(str) {
+ if (str.indexOf('&') < 0) { return str; }
+
+ return str.replace(ENTITY_RE, replaceEntityPattern);
+}*/
+
+function unescapeMd(str) {
+ if (str.indexOf('\\') < 0) { return str; }
+ return str.replace(UNESCAPE_MD_RE, '$1');
+}
+
+function unescapeAll(str) {
+ if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; }
+
+ return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {
+ if (escaped) { return escaped; }
+ return replaceEntityPattern(match, entity);
+ });
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+var HTML_ESCAPE_TEST_RE = /[&<>"]/;
+var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
+var HTML_REPLACEMENTS = {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"'
+};
+
+function replaceUnsafeChar(ch) {
+ return HTML_REPLACEMENTS[ch];
+}
+
+function escapeHtml(str) {
+ if (HTML_ESCAPE_TEST_RE.test(str)) {
+ return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
+ }
+ return str;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
+
+function escapeRE(str) {
+ return str.replace(REGEXP_ESCAPE_RE, '\\$&');
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+function isSpace(code) {
+ switch (code) {
+ case 0x09:
+ case 0x20:
+ return true;
+ }
+ return false;
+}
+
+// Zs (unicode class) || [\t\f\v\r\n]
+function isWhiteSpace(code) {
+ if (code >= 0x2000 && code <= 0x200A) { return true; }
+ switch (code) {
+ case 0x09: // \t
+ case 0x0A: // \n
+ case 0x0B: // \v
+ case 0x0C: // \f
+ case 0x0D: // \r
+ case 0x20:
+ case 0xA0:
+ case 0x1680:
+ case 0x202F:
+ case 0x205F:
+ case 0x3000:
+ return true;
+ }
+ return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+/*eslint-disable max-len*/
+var UNICODE_PUNCT_RE = __webpack_require__(45);
+
+// Currently without astral characters support.
+function isPunctChar(ch) {
+ return UNICODE_PUNCT_RE.test(ch);
+}
+
+
+// Markdown ASCII punctuation characters.
+//
+// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
+// http://spec.commonmark.org/0.15/#ascii-punctuation-character
+//
+// Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
+//
+function isMdAsciiPunct(ch) {
+ switch (ch) {
+ case 0x21/* ! */:
+ case 0x22/* " */:
+ case 0x23/* # */:
+ case 0x24/* $ */:
+ case 0x25/* % */:
+ case 0x26/* & */:
+ case 0x27/* ' */:
+ case 0x28/* ( */:
+ case 0x29/* ) */:
+ case 0x2A/* * */:
+ case 0x2B/* + */:
+ case 0x2C/* , */:
+ case 0x2D/* - */:
+ case 0x2E/* . */:
+ case 0x2F/* / */:
+ case 0x3A/* : */:
+ case 0x3B/* ; */:
+ case 0x3C/* < */:
+ case 0x3D/* = */:
+ case 0x3E/* > */:
+ case 0x3F/* ? */:
+ case 0x40/* @ */:
+ case 0x5B/* [ */:
+ case 0x5C/* \ */:
+ case 0x5D/* ] */:
+ case 0x5E/* ^ */:
+ case 0x5F/* _ */:
+ case 0x60/* ` */:
+ case 0x7B/* { */:
+ case 0x7C/* | */:
+ case 0x7D/* } */:
+ case 0x7E/* ~ */:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// Hepler to unify [reference labels].
+//
+function normalizeReference(str) {
+ // Trim and collapse whitespace
+ //
+ str = str.trim().replace(/\s+/g, ' ');
+
+ // In node v10 'ẞ'.toLowerCase() === 'Ṿ', which is presumed to be a bug
+ // fixed in v12 (couldn't find any details).
+ //
+ // So treat this one as a special case
+ // (remove this when node v10 is no longer supported).
+ //
+ if ('ẞ'.toLowerCase() === 'Ṿ') {
+ str = str.replace(/ẞ/g, 'ß');
+ }
+
+ // .toLowerCase().toUpperCase() should get rid of all differences
+ // between letter variants.
+ //
+ // Simple .toLowerCase() doesn't normalize 125 code points correctly,
+ // and .toUpperCase doesn't normalize 6 of them (list of exceptions:
+ // İ, ϴ, ẞ, Ω, K, Å - those are already uppercased, but have differently
+ // uppercased versions).
+ //
+ // Here's an example showing how it happens. Lets take greek letter omega:
+ // uppercase U+0398 (Θ), U+03f4 (ϴ) and lowercase U+03b8 (θ), U+03d1 (ϑ)
+ //
+ // Unicode entries:
+ // 0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;
+ // 03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398
+ // 03D1;GREEK THETA SYMBOL;Ll;0;L;<compat> 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398
+ // 03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L;<compat> 0398;;;;N;;;;03B8;
+ //
+ // Case-insensitive comparison should treat all of them as equivalent.
+ //
+ // But .toLowerCase() doesn't change ϑ (it's already lowercase),
+ // and .toUpperCase() doesn't change ϴ (already uppercase).
+ //
+ // Applying first lower then upper case normalizes any character:
+ // '\u0398\u03f4\u03b8\u03d1'.toLowerCase().toUpperCase() === '\u0398\u0398\u0398\u0398'
+ //
+ // Note: this is equivalent to unicode case folding; unicode normalization
+ // is a different step that is not required here.
+ //
+ // Final result should be uppercased, because it's later stored in an object
+ // (this avoid a conflict with Object.prototype members,
+ // most notably, `__proto__`)
+ //
+ return str.toLowerCase().toUpperCase();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Re-export libraries commonly used in both markdown-it and its plugins,
+// so plugins won't have to depend on them explicitly, which reduces their
+// bundled size (e.g. a browser build).
+//
+exports.lib = {};
+exports.lib.mdurl = __webpack_require__(46);
+exports.lib.ucmicro = __webpack_require__(51);
+
+exports.assign = assign;
+exports.isString = isString;
+exports.has = has;
+exports.unescapeMd = unescapeMd;
+exports.unescapeAll = unescapeAll;
+exports.isValidEntityCode = isValidEntityCode;
+exports.fromCodePoint = fromCodePoint;
+// exports.replaceEntities = replaceEntities;
+exports.escapeHtml = escapeHtml;
+exports.arrayReplaceAt = arrayReplaceAt;
+exports.isSpace = isSpace;
+exports.isWhiteSpace = isWhiteSpace;
+exports.isMdAsciiPunct = isMdAsciiPunct;
+exports.isPunctChar = isPunctChar;
+exports.escapeRE = escapeRE;
+exports.normalizeReference = normalizeReference;
+
+
+/***/ }),
+/* 43 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// HTML5 entities map: { name -> utf16string }
+//
+
+
+/*eslint quotes:0*/
+module.exports = __webpack_require__(44);
+
+
+/***/ }),
+/* 44 */
+/***/ (function(module) {
+
+module.exports = JSON.parse("{\"Aacute\":\"Á\",\"aacute\":\"á\",\"Abreve\":\"Ă\",\"abreve\":\"ă\",\"ac\":\"∾\",\"acd\":\"∿\",\"acE\":\"∾̳\",\"Acirc\":\"Â\",\"acirc\":\"â\",\"acute\":\"´\",\"Acy\":\"А\",\"acy\":\"а\",\"AElig\":\"Æ\",\"aelig\":\"æ\",\"af\":\"\",\"Afr\":\"𝔄\",\"afr\":\"𝔞\",\"Agrave\":\"À\",\"agrave\":\"à\",\"alefsym\":\"ℵ\",\"aleph\":\"ℵ\",\"Alpha\":\"Α\",\"alpha\":\"α\",\"Amacr\":\"Ā\",\"amacr\":\"ā\",\"amalg\":\"⨿\",\"amp\":\"&\",\"AMP\":\"&\",\"andand\":\"⩕\",\"And\":\"⩓\",\"and\":\"∧\",\"andd\":\"⩜\",\"andslope\":\"⩘\",\"andv\":\"⩚\",\"ang\":\"∠\",\"ange\":\"⦤\",\"angle\":\"∠\",\"angmsdaa\":\"⦨\",\"angmsdab\":\"⦩\",\"angmsdac\":\"⦪\",\"angmsdad\":\"⦫\",\"angmsdae\":\"⦬\",\"angmsdaf\":\"⦭\",\"angmsdag\":\"⦮\",\"angmsdah\":\"⦯\",\"angmsd\":\"∡\",\"angrt\":\"∟\",\"angrtvb\":\"⊾\",\"angrtvbd\":\"⦝\",\"angsph\":\"∢\",\"angst\":\"Å\",\"angzarr\":\"⍼\",\"Aogon\":\"Ą\",\"aogon\":\"ą\",\"Aopf\":\"𝔸\",\"aopf\":\"𝕒\",\"apacir\":\"⩯\",\"ap\":\"≈\",\"apE\":\"⩰\",\"ape\":\"≊\",\"apid\":\"≋\",\"apos\":\"'\",\"ApplyFunction\":\"\",\"approx\":\"≈\",\"approxeq\":\"≊\",\"Aring\":\"Å\",\"aring\":\"å\",\"Ascr\":\"𝒜\",\"ascr\":\"𝒶\",\"Assign\":\"≔\",\"ast\":\"*\",\"asymp\":\"≈\",\"asympeq\":\"≍\",\"Atilde\":\"Ã\",\"atilde\":\"ã\",\"Auml\":\"Ä\",\"auml\":\"ä\",\"awconint\":\"∳\",\"awint\":\"⨑\",\"backcong\":\"≌\",\"backepsilon\":\"϶\",\"backprime\":\"‵\",\"backsim\":\"∽\",\"backsimeq\":\"⋍\",\"Backslash\":\"∖\",\"Barv\":\"⫧\",\"barvee\":\"⊽\",\"barwed\":\"⌅\",\"Barwed\":\"⌆\",\"barwedge\":\"⌅\",\"bbrk\":\"⎵\",\"bbrktbrk\":\"⎶\",\"bcong\":\"≌\",\"Bcy\":\"Б\",\"bcy\":\"б\",\"bdquo\":\"„\",\"becaus\":\"∵\",\"because\":\"∵\",\"Because\":\"∵\",\"bemptyv\":\"⦰\",\"bepsi\":\"϶\",\"bernou\":\"ℬ\",\"Bernoullis\":\"ℬ\",\"Beta\":\"Β\",\"beta\":\"β\",\"beth\":\"ℶ\",\"between\":\"≬\",\"Bfr\":\"𝔅\",\"bfr\":\"𝔟\",\"bigcap\":\"⋂\",\"bigcirc\":\"◯\",\"bigcup\":\"⋃\",\"bigodot\":\"⨀\",\"bigoplus\":\"⨁\",\"bigotimes\":\"⨂\",\"bigsqcup\":\"⨆\",\"bigstar\":\"★\",\"bigtriangledown\":\"▽\",\"bigtriangleup\":\"△\",\"biguplus\":\"⨄\",\"bigvee\":\"⋁\",\"bigwedge\":\"⋀\",\"bkarow\":\"⤍\",\"blacklozenge\":\"⧫\",\"blacksquare\":\"▪\",\"blacktriangle\":\"▴\",\"blacktriangledown\":\"▾\",\"blacktriangleleft\":\"◂\",\"blacktriangleright\":\"▸\",\"blank\":\"␣\",\"blk12\":\"▒\",\"blk14\":\"░\",\"blk34\":\"▓\",\"block\":\"█\",\"bne\":\"=⃥\",\"bnequiv\":\"≡⃥\",\"bNot\":\"⫭\",\"bnot\":\"⌐\",\"Bopf\":\"𝔹\",\"bopf\":\"𝕓\",\"bot\":\"⊥\",\"bottom\":\"⊥\",\"bowtie\":\"⋈\",\"boxbox\":\"⧉\",\"boxdl\":\"┐\",\"boxdL\":\"╕\",\"boxDl\":\"╖\",\"boxDL\":\"╗\",\"boxdr\":\"┌\",\"boxdR\":\"╒\",\"boxDr\":\"╓\",\"boxDR\":\"╔\",\"boxh\":\"─\",\"boxH\":\"═\",\"boxhd\":\"┬\",\"boxHd\":\"╤\",\"boxhD\":\"╥\",\"boxHD\":\"╦\",\"boxhu\":\"┴\",\"boxHu\":\"╧\",\"boxhU\":\"╨\",\"boxHU\":\"╩\",\"boxminus\":\"⊟\",\"boxplus\":\"⊞\",\"boxtimes\":\"⊠\",\"boxul\":\"┘\",\"boxuL\":\"╛\",\"boxUl\":\"╜\",\"boxUL\":\"╝\",\"boxur\":\"└\",\"boxuR\":\"╘\",\"boxUr\":\"╙\",\"boxUR\":\"╚\",\"boxv\":\"│\",\"boxV\":\"║\",\"boxvh\":\"┼\",\"boxvH\":\"╪\",\"boxVh\":\"╫\",\"boxVH\":\"╬\",\"boxvl\":\"┤\",\"boxvL\":\"╡\",\"boxVl\":\"╢\",\"boxVL\":\"╣\",\"boxvr\":\"├\",\"boxvR\":\"╞\",\"boxVr\":\"╟\",\"boxVR\":\"╠\",\"bprime\":\"‵\",\"breve\":\"˘\",\"Breve\":\"˘\",\"brvbar\":\"¦\",\"bscr\":\"𝒷\",\"Bscr\":\"ℬ\",\"bsemi\":\"⁏\",\"bsim\":\"∽\",\"bsime\":\"⋍\",\"bsolb\":\"⧅\",\"bsol\":\"\\\\\",\"bsolhsub\":\"⟈\",\"bull\":\"•\",\"bullet\":\"•\",\"bump\":\"≎\",\"bumpE\":\"⪮\",\"bumpe\":\"≏\",\"Bumpeq\":\"≎\",\"bumpeq\":\"≏\",\"Cacute\":\"Ć\",\"cacute\":\"ć\",\"capand\":\"⩄\",\"capbrcup\":\"⩉\",\"capcap\":\"⩋\",\"cap\":\"∩\",\"Cap\":\"⋒\",\"capcup\":\"⩇\",\"capdot\":\"⩀\",\"CapitalDifferentialD\":\"ⅅ\",\"caps\":\"∩︀\",\"caret\":\"⁁\",\"caron\":\"ˇ\",\"Cayleys\":\"ℭ\",\"ccaps\":\"⩍\",\"Ccaron\":\"Č\",\"ccaron\":\"č\",\"Ccedil\":\"Ç\",\"ccedil\":\"ç\",\"Ccirc\":\"Ĉ\",\"ccirc\":\"ĉ\",\"Cconint\":\"∰\",\"ccups\":\"⩌\",\"ccupssm\":\"⩐\",\"Cdot\":\"Ċ\",\"cdot\":\"ċ\",\"cedil\":\"¸\",\"Cedilla\":\"¸\",\"cemptyv\":\"⦲\",\"cent\":\"¢\",\"centerdot\":\"·\",\"CenterDot\":\"·\",\"cfr\":\"𝔠\",\"Cfr\":\"ℭ\",\"CHcy\":\"Ч\",\"chcy\":\"ч\",\"check\":\"✓\",\"checkmark\":\"✓\",\"Chi\":\"Χ\",\"chi\":\"χ\",\"circ\":\"ˆ\",\"circeq\":\"≗\",\"circlearrowleft\":\"↺\",\"circlearrowright\":\"↻\",\"circledast\":\"⊛\",\"circledcirc\":\"⊚\",\"circleddash\":\"⊝\",\"CircleDot\":\"⊙\",\"circledR\":\"®\",\"circledS\":\"Ⓢ\",\"CircleMinus\":\"⊖\",\"CirclePlus\":\"⊕\",\"CircleTimes\":\"⊗\",\"cir\":\"○\",\"cirE\":\"⧃\",\"cire\":\"≗\",\"cirfnint\":\"⨐\",\"cirmid\":\"⫯\",\"cirscir\":\"⧂\",\"ClockwiseContourIntegral\":\"∲\",\"CloseCurlyDoubleQuote\":\"”\",\"CloseCurlyQuote\":\"’\",\"clubs\":\"♣\",\"clubsuit\":\"♣\",\"colon\":\":\",\"Colon\":\"∷\",\"Colone\":\"⩴\",\"colone\":\"≔\",\"coloneq\":\"≔\",\"comma\":\",\",\"commat\":\"@\",\"comp\":\"∁\",\"compfn\":\"∘\",\"complement\":\"∁\",\"complexes\":\"ℂ\",\"cong\":\"≅\",\"congdot\":\"⩭\",\"Congruent\":\"≡\",\"conint\":\"∮\",\"Conint\":\"∯\",\"ContourIntegral\":\"∮\",\"copf\":\"𝕔\",\"Copf\":\"ℂ\",\"coprod\":\"∐\",\"Coproduct\":\"∐\",\"copy\":\"©\",\"COPY\":\"©\",\"copysr\":\"℗\",\"CounterClockwiseContourIntegral\":\"∳\",\"crarr\":\"↵\",\"cross\":\"✗\",\"Cross\":\"⨯\",\"Cscr\":\"𝒞\",\"cscr\":\"𝒸\",\"csub\":\"⫏\",\"csube\":\"⫑\",\"csup\":\"⫐\",\"csupe\":\"⫒\",\"ctdot\":\"⋯\",\"cudarrl\":\"⤸\",\"cudarrr\":\"⤵\",\"cuepr\":\"⋞\",\"cuesc\":\"⋟\",\"cularr\":\"↶\",\"cularrp\":\"⤽\",\"cupbrcap\":\"⩈\",\"cupcap\":\"⩆\",\"CupCap\":\"≍\",\"cup\":\"∪\",\"Cup\":\"⋓\",\"cupcup\":\"⩊\",\"cupdot\":\"⊍\",\"cupor\":\"⩅\",\"cups\":\"∪︀\",\"curarr\":\"↷\",\"curarrm\":\"⤼\",\"curlyeqprec\":\"⋞\",\"curlyeqsucc\":\"⋟\",\"curlyvee\":\"⋎\",\"curlywedge\":\"⋏\",\"curren\":\"¤\",\"curvearrowleft\":\"↶\",\"curvearrowright\":\"↷\",\"cuvee\":\"⋎\",\"cuwed\":\"⋏\",\"cwconint\":\"∲\",\"cwint\":\"∱\",\"cylcty\":\"⌭\",\"dagger\":\"†\",\"Dagger\":\"‡\",\"daleth\":\"ℸ\",\"darr\":\"↓\",\"Darr\":\"↡\",\"dArr\":\"⇓\",\"dash\":\"‐\",\"Dashv\":\"⫤\",\"dashv\":\"⊣\",\"dbkarow\":\"⤏\",\"dblac\":\"˝\",\"Dcaron\":\"Ď\",\"dcaron\":\"ď\",\"Dcy\":\"Д\",\"dcy\":\"д\",\"ddagger\":\"‡\",\"ddarr\":\"⇊\",\"DD\":\"ⅅ\",\"dd\":\"ⅆ\",\"DDotrahd\":\"⤑\",\"ddotseq\":\"⩷\",\"deg\":\"°\",\"Del\":\"∇\",\"Delta\":\"Δ\",\"delta\":\"δ\",\"demptyv\":\"⦱\",\"dfisht\":\"⥿\",\"Dfr\":\"𝔇\",\"dfr\":\"𝔡\",\"dHar\":\"⥥\",\"dharl\":\"⇃\",\"dharr\":\"⇂\",\"DiacriticalAcute\":\"´\",\"DiacriticalDot\":\"˙\",\"DiacriticalDoubleAcute\":\"˝\",\"DiacriticalGrave\":\"`\",\"DiacriticalTilde\":\"˜\",\"diam\":\"⋄\",\"diamond\":\"⋄\",\"Diamond\":\"⋄\",\"diamondsuit\":\"♦\",\"diams\":\"♦\",\"die\":\"¨\",\"DifferentialD\":\"ⅆ\",\"digamma\":\"ϝ\",\"disin\":\"⋲\",\"div\":\"÷\",\"divide\":\"÷\",\"divideontimes\":\"⋇\",\"divonx\":\"⋇\",\"DJcy\":\"Ђ\",\"djcy\":\"ђ\",\"dlcorn\":\"⌞\",\"dlcrop\":\"⌍\",\"dollar\":\"$\",\"Dopf\":\"𝔻\",\"dopf\":\"𝕕\",\"Dot\":\"¨\",\"dot\":\"˙\",\"DotDot\":\"⃜\",\"doteq\":\"≐\",\"doteqdot\":\"≑\",\"DotEqual\":\"≐\",\"dotminus\":\"∸\",\"dotplus\":\"∔\",\"dotsquare\":\"⊡\",\"doublebarwedge\":\"⌆\",\"DoubleContourIntegral\":\"∯\",\"DoubleDot\":\"¨\",\"DoubleDownArrow\":\"⇓\",\"DoubleLeftArrow\":\"⇐\",\"DoubleLeftRightArrow\":\"⇔\",\"DoubleLeftTee\":\"⫤\",\"DoubleLongLeftArrow\":\"⟸\",\"DoubleLongLeftRightArrow\":\"⟺\",\"DoubleLongRightArrow\":\"⟹\",\"DoubleRightArrow\":\"⇒\",\"DoubleRightTee\":\"⊨\",\"DoubleUpArrow\":\"⇑\",\"DoubleUpDownArrow\":\"⇕\",\"DoubleVerticalBar\":\"∥\",\"DownArrowBar\":\"⤓\",\"downarrow\":\"↓\",\"DownArrow\":\"↓\",\"Downarrow\":\"⇓\",\"DownArrowUpArrow\":\"⇵\",\"DownBreve\":\"̑\",\"downdownarrows\":\"⇊\",\"downharpoonleft\":\"⇃\",\"downharpoonright\":\"⇂\",\"DownLeftRightVector\":\"⥐\",\"DownLeftTeeVector\":\"⥞\",\"DownLeftVectorBar\":\"⥖\",\"DownLeftVector\":\"↽\",\"DownRightTeeVector\":\"⥟\",\"DownRightVectorBar\":\"⥗\",\"DownRightVector\":\"⇁\",\"DownTeeArrow\":\"↧\",\"DownTee\":\"⊤\",\"drbkarow\":\"⤐\",\"drcorn\":\"⌟\",\"drcrop\":\"⌌\",\"Dscr\":\"𝒟\",\"dscr\":\"𝒹\",\"DScy\":\"Ѕ\",\"dscy\":\"ѕ\",\"dsol\":\"⧶\",\"Dstrok\":\"Đ\",\"dstrok\":\"đ\",\"dtdot\":\"⋱\",\"dtri\":\"▿\",\"dtrif\":\"▾\",\"duarr\":\"⇵\",\"duhar\":\"⥯\",\"dwangle\":\"⦦\",\"DZcy\":\"Џ\",\"dzcy\":\"џ\",\"dzigrarr\":\"⟿\",\"Eacute\":\"É\",\"eacute\":\"é\",\"easter\":\"⩮\",\"Ecaron\":\"Ě\",\"ecaron\":\"ě\",\"Ecirc\":\"Ê\",\"ecirc\":\"ê\",\"ecir\":\"≖\",\"ecolon\":\"≕\",\"Ecy\":\"Э\",\"ecy\":\"э\",\"eDDot\":\"⩷\",\"Edot\":\"Ė\",\"edot\":\"ė\",\"eDot\":\"≑\",\"ee\":\"ⅇ\",\"efDot\":\"≒\",\"Efr\":\"𝔈\",\"efr\":\"𝔢\",\"eg\":\"⪚\",\"Egrave\":\"È\",\"egrave\":\"è\",\"egs\":\"⪖\",\"egsdot\":\"⪘\",\"el\":\"⪙\",\"Element\":\"∈\",\"elinters\":\"⏧\",\"ell\":\"ℓ\",\"els\":\"⪕\",\"elsdot\":\"⪗\",\"Emacr\":\"Ē\",\"emacr\":\"ē\",\"empty\":\"∅\",\"emptyset\":\"∅\",\"EmptySmallSquare\":\"◻\",\"emptyv\":\"∅\",\"EmptyVerySmallSquare\":\"▫\",\"emsp13\":\" \",\"emsp14\":\" \",\"emsp\":\" \",\"ENG\":\"Ŋ\",\"eng\":\"ŋ\",\"ensp\":\" \",\"Eogon\":\"Ę\",\"eogon\":\"ę\",\"Eopf\":\"𝔼\",\"eopf\":\"𝕖\",\"epar\":\"⋕\",\"eparsl\":\"⧣\",\"eplus\":\"⩱\",\"epsi\":\"ε\",\"Epsilon\":\"Ε\",\"epsilon\":\"ε\",\"epsiv\":\"ϵ\",\"eqcirc\":\"≖\",\"eqcolon\":\"≕\",\"eqsim\":\"≂\",\"eqslantgtr\":\"⪖\",\"eqslantless\":\"⪕\",\"Equal\":\"⩵\",\"equals\":\"=\",\"EqualTilde\":\"≂\",\"equest\":\"≟\",\"Equilibrium\":\"⇌\",\"equiv\":\"≡\",\"equivDD\":\"⩸\",\"eqvparsl\":\"⧥\",\"erarr\":\"⥱\",\"erDot\":\"≓\",\"escr\":\"ℯ\",\"Escr\":\"ℰ\",\"esdot\":\"≐\",\"Esim\":\"⩳\",\"esim\":\"≂\",\"Eta\":\"Η\",\"eta\":\"η\",\"ETH\":\"Ð\",\"eth\":\"ð\",\"Euml\":\"Ë\",\"euml\":\"ë\",\"euro\":\"€\",\"excl\":\"!\",\"exist\":\"∃\",\"Exists\":\"∃\",\"expectation\":\"ℰ\",\"exponentiale\":\"ⅇ\",\"ExponentialE\":\"ⅇ\",\"fallingdotseq\":\"≒\",\"Fcy\":\"Ф\",\"fcy\":\"ф\",\"female\":\"♀\",\"ffilig\":\"ffi\",\"fflig\":\"ff\",\"ffllig\":\"ffl\",\"Ffr\":\"𝔉\",\"ffr\":\"𝔣\",\"filig\":\"fi\",\"FilledSmallSquare\":\"◼\",\"FilledVerySmallSquare\":\"▪\",\"fjlig\":\"fj\",\"flat\":\"♭\",\"fllig\":\"fl\",\"fltns\":\"▱\",\"fnof\":\"ƒ\",\"Fopf\":\"𝔽\",\"fopf\":\"𝕗\",\"forall\":\"∀\",\"ForAll\":\"∀\",\"fork\":\"⋔\",\"forkv\":\"⫙\",\"Fouriertrf\":\"ℱ\",\"fpartint\":\"⨍\",\"frac12\":\"½\",\"frac13\":\"⅓\",\"frac14\":\"¼\",\"frac15\":\"⅕\",\"frac16\":\"⅙\",\"frac18\":\"⅛\",\"frac23\":\"⅔\",\"frac25\":\"⅖\",\"frac34\":\"¾\",\"frac35\":\"⅗\",\"frac38\":\"⅜\",\"frac45\":\"⅘\",\"frac56\":\"⅚\",\"frac58\":\"⅝\",\"frac78\":\"⅞\",\"frasl\":\"⁄\",\"frown\":\"⌢\",\"fscr\":\"𝒻\",\"Fscr\":\"ℱ\",\"gacute\":\"ǵ\",\"Gamma\":\"Γ\",\"gamma\":\"γ\",\"Gammad\":\"Ϝ\",\"gammad\":\"ϝ\",\"gap\":\"⪆\",\"Gbreve\":\"Ğ\",\"gbreve\":\"ğ\",\"Gcedil\":\"Ģ\",\"Gcirc\":\"Ĝ\",\"gcirc\":\"ĝ\",\"Gcy\":\"Г\",\"gcy\":\"г\",\"Gdot\":\"Ġ\",\"gdot\":\"ġ\",\"ge\":\"≥\",\"gE\":\"≧\",\"gEl\":\"⪌\",\"gel\":\"⋛\",\"geq\":\"≥\",\"geqq\":\"≧\",\"geqslant\":\"⩾\",\"gescc\":\"⪩\",\"ges\":\"⩾\",\"gesdot\":\"⪀\",\"gesdoto\":\"⪂\",\"gesdotol\":\"⪄\",\"gesl\":\"⋛︀\",\"gesles\":\"⪔\",\"Gfr\":\"𝔊\",\"gfr\":\"𝔤\",\"gg\":\"≫\",\"Gg\":\"⋙\",\"ggg\":\"⋙\",\"gimel\":\"ℷ\",\"GJcy\":\"Ѓ\",\"gjcy\":\"ѓ\",\"gla\":\"⪥\",\"gl\":\"≷\",\"glE\":\"⪒\",\"glj\":\"⪤\",\"gnap\":\"⪊\",\"gnapprox\":\"⪊\",\"gne\":\"⪈\",\"gnE\":\"≩\",\"gneq\":\"⪈\",\"gneqq\":\"≩\",\"gnsim\":\"⋧\",\"Gopf\":\"𝔾\",\"gopf\":\"𝕘\",\"grave\":\"`\",\"GreaterEqual\":\"≥\",\"GreaterEqualLess\":\"⋛\",\"GreaterFullEqual\":\"≧\",\"GreaterGreater\":\"⪢\",\"GreaterLess\":\"≷\",\"GreaterSlantEqual\":\"⩾\",\"GreaterTilde\":\"≳\",\"Gscr\":\"𝒢\",\"gscr\":\"ℊ\",\"gsim\":\"≳\",\"gsime\":\"⪎\",\"gsiml\":\"⪐\",\"gtcc\":\"⪧\",\"gtcir\":\"⩺\",\"gt\":\">\",\"GT\":\">\",\"Gt\":\"≫\",\"gtdot\":\"⋗\",\"gtlPar\":\"⦕\",\"gtquest\":\"⩼\",\"gtrapprox\":\"⪆\",\"gtrarr\":\"⥸\",\"gtrdot\":\"⋗\",\"gtreqless\":\"⋛\",\"gtreqqless\":\"⪌\",\"gtrless\":\"≷\",\"gtrsim\":\"≳\",\"gvertneqq\":\"≩︀\",\"gvnE\":\"≩︀\",\"Hacek\":\"ˇ\",\"hairsp\":\" \",\"half\":\"½\",\"hamilt\":\"ℋ\",\"HARDcy\":\"Ъ\",\"hardcy\":\"ъ\",\"harrcir\":\"⥈\",\"harr\":\"↔\",\"hArr\":\"⇔\",\"harrw\":\"↭\",\"Hat\":\"^\",\"hbar\":\"ℏ\",\"Hcirc\":\"Ĥ\",\"hcirc\":\"ĥ\",\"hearts\":\"♥\",\"heartsuit\":\"♥\",\"hellip\":\"…\",\"hercon\":\"⊹\",\"hfr\":\"𝔥\",\"Hfr\":\"ℌ\",\"HilbertSpace\":\"ℋ\",\"hksearow\":\"⤥\",\"hkswarow\":\"⤦\",\"hoarr\":\"⇿\",\"homtht\":\"∻\",\"hookleftarrow\":\"↩\",\"hookrightarrow\":\"↪\",\"hopf\":\"𝕙\",\"Hopf\":\"ℍ\",\"horbar\":\"―\",\"HorizontalLine\":\"─\",\"hscr\":\"𝒽\",\"Hscr\":\"ℋ\",\"hslash\":\"ℏ\",\"Hstrok\":\"Ħ\",\"hstrok\":\"ħ\",\"HumpDownHump\":\"≎\",\"HumpEqual\":\"≏\",\"hybull\":\"⁃\",\"hyphen\":\"‐\",\"Iacute\":\"Í\",\"iacute\":\"í\",\"ic\":\"\",\"Icirc\":\"Î\",\"icirc\":\"î\",\"Icy\":\"И\",\"icy\":\"и\",\"Idot\":\"İ\",\"IEcy\":\"Е\",\"iecy\":\"е\",\"iexcl\":\"¡\",\"iff\":\"⇔\",\"ifr\":\"𝔦\",\"Ifr\":\"ℑ\",\"Igrave\":\"Ì\",\"igrave\":\"ì\",\"ii\":\"ⅈ\",\"iiiint\":\"⨌\",\"iiint\":\"∭\",\"iinfin\":\"⧜\",\"iiota\":\"℩\",\"IJlig\":\"IJ\",\"ijlig\":\"ij\",\"Imacr\":\"Ī\",\"imacr\":\"ī\",\"image\":\"ℑ\",\"ImaginaryI\":\"ⅈ\",\"imagline\":\"ℐ\",\"imagpart\":\"ℑ\",\"imath\":\"ı\",\"Im\":\"ℑ\",\"imof\":\"⊷\",\"imped\":\"Ƶ\",\"Implies\":\"⇒\",\"incare\":\"℅\",\"in\":\"∈\",\"infin\":\"∞\",\"infintie\":\"⧝\",\"inodot\":\"ı\",\"intcal\":\"⊺\",\"int\":\"∫\",\"Int\":\"∬\",\"integers\":\"ℤ\",\"Integral\":\"∫\",\"intercal\":\"⊺\",\"Intersection\":\"⋂\",\"intlarhk\":\"⨗\",\"intprod\":\"⨼\",\"InvisibleComma\":\"\",\"InvisibleTimes\":\"\",\"IOcy\":\"Ё\",\"iocy\":\"ё\",\"Iogon\":\"Į\",\"iogon\":\"į\",\"Iopf\":\"𝕀\",\"iopf\":\"𝕚\",\"Iota\":\"Ι\",\"iota\":\"ι\",\"iprod\":\"⨼\",\"iquest\":\"¿\",\"iscr\":\"𝒾\",\"Iscr\":\"ℐ\",\"isin\":\"∈\",\"isindot\":\"⋵\",\"isinE\":\"⋹\",\"isins\":\"⋴\",\"isinsv\":\"⋳\",\"isinv\":\"∈\",\"it\":\"\",\"Itilde\":\"Ĩ\",\"itilde\":\"ĩ\",\"Iukcy\":\"І\",\"iukcy\":\"і\",\"Iuml\":\"Ï\",\"iuml\":\"ï\",\"Jcirc\":\"Ĵ\",\"jcirc\":\"ĵ\",\"Jcy\":\"Й\",\"jcy\":\"й\",\"Jfr\":\"𝔍\",\"jfr\":\"𝔧\",\"jmath\":\"ȷ\",\"Jopf\":\"𝕁\",\"jopf\":\"𝕛\",\"Jscr\":\"𝒥\",\"jscr\":\"𝒿\",\"Jsercy\":\"Ј\",\"jsercy\":\"ј\",\"Jukcy\":\"Є\",\"jukcy\":\"є\",\"Kappa\":\"Κ\",\"kappa\":\"κ\",\"kappav\":\"ϰ\",\"Kcedil\":\"Ķ\",\"kcedil\":\"ķ\",\"Kcy\":\"К\",\"kcy\":\"к\",\"Kfr\":\"𝔎\",\"kfr\":\"𝔨\",\"kgreen\":\"ĸ\",\"KHcy\":\"Х\",\"khcy\":\"х\",\"KJcy\":\"Ќ\",\"kjcy\":\"ќ\",\"Kopf\":\"𝕂\",\"kopf\":\"𝕜\",\"Kscr\":\"𝒦\",\"kscr\":\"𝓀\",\"lAarr\":\"⇚\",\"Lacute\":\"Ĺ\",\"lacute\":\"ĺ\",\"laemptyv\":\"⦴\",\"lagran\":\"ℒ\",\"Lambda\":\"Λ\",\"lambda\":\"λ\",\"lang\":\"⟨\",\"Lang\":\"⟪\",\"langd\":\"⦑\",\"langle\":\"⟨\",\"lap\":\"⪅\",\"Laplacetrf\":\"ℒ\",\"laquo\":\"«\",\"larrb\":\"⇤\",\"larrbfs\":\"⤟\",\"larr\":\"←\",\"Larr\":\"↞\",\"lArr\":\"⇐\",\"larrfs\":\"⤝\",\"larrhk\":\"↩\",\"larrlp\":\"↫\",\"larrpl\":\"⤹\",\"larrsim\":\"⥳\",\"larrtl\":\"↢\",\"latail\":\"⤙\",\"lAtail\":\"⤛\",\"lat\":\"⪫\",\"late\":\"⪭\",\"lates\":\"⪭︀\",\"lbarr\":\"⤌\",\"lBarr\":\"⤎\",\"lbbrk\":\"❲\",\"lbrace\":\"{\",\"lbrack\":\"[\",\"lbrke\":\"⦋\",\"lbrksld\":\"⦏\",\"lbrkslu\":\"⦍\",\"Lcaron\":\"Ľ\",\"lcaron\":\"ľ\",\"Lcedil\":\"Ļ\",\"lcedil\":\"ļ\",\"lceil\":\"⌈\",\"lcub\":\"{\",\"Lcy\":\"Л\",\"lcy\":\"л\",\"ldca\":\"⤶\",\"ldquo\":\"“\",\"ldquor\":\"„\",\"ldrdhar\":\"⥧\",\"ldrushar\":\"⥋\",\"ldsh\":\"↲\",\"le\":\"≤\",\"lE\":\"≦\",\"LeftAngleBracket\":\"⟨\",\"LeftArrowBar\":\"⇤\",\"leftarrow\":\"←\",\"LeftArrow\":\"←\",\"Leftarrow\":\"⇐\",\"LeftArrowRightArrow\":\"⇆\",\"leftarrowtail\":\"↢\",\"LeftCeiling\":\"⌈\",\"LeftDoubleBracket\":\"⟦\",\"LeftDownTeeVector\":\"⥡\",\"LeftDownVectorBar\":\"⥙\",\"LeftDownVector\":\"⇃\",\"LeftFloor\":\"⌊\",\"leftharpoondown\":\"↽\",\"leftharpoonup\":\"↼\",\"leftleftarrows\":\"⇇\",\"leftrightarrow\":\"↔\",\"LeftRightArrow\":\"↔\",\"Leftrightarrow\":\"⇔\",\"leftrightarrows\":\"⇆\",\"leftrightharpoons\":\"⇋\",\"leftrightsquigarrow\":\"↭\",\"LeftRightVector\":\"⥎\",\"LeftTeeArrow\":\"↤\",\"LeftTee\":\"⊣\",\"LeftTeeVector\":\"⥚\",\"leftthreetimes\":\"⋋\",\"LeftTriangleBar\":\"⧏\",\"LeftTriangle\":\"⊲\",\"LeftTriangleEqual\":\"⊴\",\"LeftUpDownVector\":\"⥑\",\"LeftUpTeeVector\":\"⥠\",\"LeftUpVectorBar\":\"⥘\",\"LeftUpVector\":\"↿\",\"LeftVectorBar\":\"⥒\",\"LeftVector\":\"↼\",\"lEg\":\"⪋\",\"leg\":\"⋚\",\"leq\":\"≤\",\"leqq\":\"≦\",\"leqslant\":\"⩽\",\"lescc\":\"⪨\",\"les\":\"⩽\",\"lesdot\":\"⩿\",\"lesdoto\":\"⪁\",\"lesdotor\":\"⪃\",\"lesg\":\"⋚︀\",\"lesges\":\"⪓\",\"lessapprox\":\"⪅\",\"lessdot\":\"⋖\",\"lesseqgtr\":\"⋚\",\"lesseqqgtr\":\"⪋\",\"LessEqualGreater\":\"⋚\",\"LessFullEqual\":\"≦\",\"LessGreater\":\"≶\",\"lessgtr\":\"≶\",\"LessLess\":\"⪡\",\"lesssim\":\"≲\",\"LessSlantEqual\":\"⩽\",\"LessTilde\":\"≲\",\"lfisht\":\"⥼\",\"lfloor\":\"⌊\",\"Lfr\":\"𝔏\",\"lfr\":\"𝔩\",\"lg\":\"≶\",\"lgE\":\"⪑\",\"lHar\":\"⥢\",\"lhard\":\"↽\",\"lharu\":\"↼\",\"lharul\":\"⥪\",\"lhblk\":\"▄\",\"LJcy\":\"Љ\",\"ljcy\":\"љ\",\"llarr\":\"⇇\",\"ll\":\"≪\",\"Ll\":\"⋘\",\"llcorner\":\"⌞\",\"Lleftarrow\":\"⇚\",\"llhard\":\"⥫\",\"lltri\":\"◺\",\"Lmidot\":\"Ŀ\",\"lmidot\":\"ŀ\",\"lmoustache\":\"⎰\",\"lmoust\":\"⎰\",\"lnap\":\"⪉\",\"lnapprox\":\"⪉\",\"lne\":\"⪇\",\"lnE\":\"≨\",\"lneq\":\"⪇\",\"lneqq\":\"≨\",\"lnsim\":\"⋦\",\"loang\":\"⟬\",\"loarr\":\"⇽\",\"lobrk\":\"⟦\",\"longleftarrow\":\"⟵\",\"LongLeftArrow\":\"⟵\",\"Longleftarrow\":\"⟸\",\"longleftrightarrow\":\"⟷\",\"LongLeftRightArrow\":\"⟷\",\"Longleftrightarrow\":\"⟺\",\"longmapsto\":\"⟼\",\"longrightarrow\":\"⟶\",\"LongRightArrow\":\"⟶\",\"Longrightarrow\":\"⟹\",\"looparrowleft\":\"↫\",\"looparrowright\":\"↬\",\"lopar\":\"⦅\",\"Lopf\":\"𝕃\",\"lopf\":\"𝕝\",\"loplus\":\"⨭\",\"lotimes\":\"⨴\",\"lowast\":\"∗\",\"lowbar\":\"_\",\"LowerLeftArrow\":\"↙\",\"LowerRightArrow\":\"↘\",\"loz\":\"◊\",\"lozenge\":\"◊\",\"lozf\":\"⧫\",\"lpar\":\"(\",\"lparlt\":\"⦓\",\"lrarr\":\"⇆\",\"lrcorner\":\"⌟\",\"lrhar\":\"⇋\",\"lrhard\":\"⥭\",\"lrm\":\"\",\"lrtri\":\"⊿\",\"lsaquo\":\"‹\",\"lscr\":\"𝓁\",\"Lscr\":\"ℒ\",\"lsh\":\"↰\",\"Lsh\":\"↰\",\"lsim\":\"≲\",\"lsime\":\"⪍\",\"lsimg\":\"⪏\",\"lsqb\":\"[\",\"lsquo\":\"‘\",\"lsquor\":\"‚\",\"Lstrok\":\"Ł\",\"lstrok\":\"ł\",\"ltcc\":\"⪦\",\"ltcir\":\"⩹\",\"lt\":\"<\",\"LT\":\"<\",\"Lt\":\"≪\",\"ltdot\":\"⋖\",\"lthree\":\"⋋\",\"ltimes\":\"⋉\",\"ltlarr\":\"⥶\",\"ltquest\":\"⩻\",\"ltri\":\"◃\",\"ltrie\":\"⊴\",\"ltrif\":\"◂\",\"ltrPar\":\"⦖\",\"lurdshar\":\"⥊\",\"luruhar\":\"⥦\",\"lvertneqq\":\"≨︀\",\"lvnE\":\"≨︀\",\"macr\":\"¯\",\"male\":\"♂\",\"malt\":\"✠\",\"maltese\":\"✠\",\"Map\":\"⤅\",\"map\":\"↦\",\"mapsto\":\"↦\",\"mapstodown\":\"↧\",\"mapstoleft\":\"↤\",\"mapstoup\":\"↥\",\"marker\":\"▮\",\"mcomma\":\"⨩\",\"Mcy\":\"М\",\"mcy\":\"м\",\"mdash\":\"—\",\"mDDot\":\"∺\",\"measuredangle\":\"∡\",\"MediumSpace\":\" \",\"Mellintrf\":\"ℳ\",\"Mfr\":\"𝔐\",\"mfr\":\"𝔪\",\"mho\":\"℧\",\"micro\":\"µ\",\"midast\":\"*\",\"midcir\":\"⫰\",\"mid\":\"∣\",\"middot\":\"·\",\"minusb\":\"⊟\",\"minus\":\"−\",\"minusd\":\"∸\",\"minusdu\":\"⨪\",\"MinusPlus\":\"∓\",\"mlcp\":\"⫛\",\"mldr\":\"…\",\"mnplus\":\"∓\",\"models\":\"⊧\",\"Mopf\":\"𝕄\",\"mopf\":\"𝕞\",\"mp\":\"∓\",\"mscr\":\"𝓂\",\"Mscr\":\"ℳ\",\"mstpos\":\"∾\",\"Mu\":\"Μ\",\"mu\":\"μ\",\"multimap\":\"⊸\",\"mumap\":\"⊸\",\"nabla\":\"∇\",\"Nacute\":\"Ń\",\"nacute\":\"ń\",\"nang\":\"∠⃒\",\"nap\":\"≉\",\"napE\":\"⩰̸\",\"napid\":\"≋̸\",\"napos\":\"ʼn\",\"napprox\":\"≉\",\"natural\":\"♮\",\"naturals\":\"ℕ\",\"natur\":\"♮\",\"nbsp\":\" \",\"nbump\":\"≎̸\",\"nbumpe\":\"≏̸\",\"ncap\":\"⩃\",\"Ncaron\":\"Ň\",\"ncaron\":\"ň\",\"Ncedil\":\"Ņ\",\"ncedil\":\"ņ\",\"ncong\":\"≇\",\"ncongdot\":\"⩭̸\",\"ncup\":\"⩂\",\"Ncy\":\"Н\",\"ncy\":\"н\",\"ndash\":\"–\",\"nearhk\":\"⤤\",\"nearr\":\"↗\",\"neArr\":\"⇗\",\"nearrow\":\"↗\",\"ne\":\"≠\",\"nedot\":\"≐̸\",\"NegativeMediumSpace\":\"\",\"NegativeThickSpace\":\"\",\"NegativeThinSpace\":\"\",\"NegativeVeryThinSpace\":\"\",\"nequiv\":\"≢\",\"nesear\":\"⤨\",\"nesim\":\"≂̸\",\"NestedGreaterGreater\":\"≫\",\"NestedLessLess\":\"≪\",\"NewLine\":\"\\n\",\"nexist\":\"∄\",\"nexists\":\"∄\",\"Nfr\":\"𝔑\",\"nfr\":\"𝔫\",\"ngE\":\"≧̸\",\"nge\":\"≱\",\"ngeq\":\"≱\",\"ngeqq\":\"≧̸\",\"ngeqslant\":\"⩾̸\",\"nges\":\"⩾̸\",\"nGg\":\"⋙̸\",\"ngsim\":\"≵\",\"nGt\":\"≫⃒\",\"ngt\":\"≯\",\"ngtr\":\"≯\",\"nGtv\":\"≫̸\",\"nharr\":\"↮\",\"nhArr\":\"⇎\",\"nhpar\":\"⫲\",\"ni\":\"∋\",\"nis\":\"⋼\",\"nisd\":\"⋺\",\"niv\":\"∋\",\"NJcy\":\"Њ\",\"njcy\":\"њ\",\"nlarr\":\"↚\",\"nlArr\":\"⇍\",\"nldr\":\"‥\",\"nlE\":\"≦̸\",\"nle\":\"≰\",\"nleftarrow\":\"↚\",\"nLeftarrow\":\"⇍\",\"nleftrightarrow\":\"↮\",\"nLeftrightarrow\":\"⇎\",\"nleq\":\"≰\",\"nleqq\":\"≦̸\",\"nleqslant\":\"⩽̸\",\"nles\":\"⩽̸\",\"nless\":\"≮\",\"nLl\":\"⋘̸\",\"nlsim\":\"≴\",\"nLt\":\"≪⃒\",\"nlt\":\"≮\",\"nltri\":\"⋪\",\"nltrie\":\"⋬\",\"nLtv\":\"≪̸\",\"nmid\":\"∤\",\"NoBreak\":\"\",\"NonBreakingSpace\":\" \",\"nopf\":\"𝕟\",\"Nopf\":\"ℕ\",\"Not\":\"⫬\",\"not\":\"¬\",\"NotCongruent\":\"≢\",\"NotCupCap\":\"≭\",\"NotDoubleVerticalBar\":\"∦\",\"NotElement\":\"∉\",\"NotEqual\":\"≠\",\"NotEqualTilde\":\"≂̸\",\"NotExists\":\"∄\",\"NotGreater\":\"≯\",\"NotGreaterEqual\":\"≱\",\"NotGreaterFullEqual\":\"≧̸\",\"NotGreaterGreater\":\"≫̸\",\"NotGreaterLess\":\"≹\",\"NotGreaterSlantEqual\":\"⩾̸\",\"NotGreaterTilde\":\"≵\",\"NotHumpDownHump\":\"≎̸\",\"NotHumpEqual\":\"≏̸\",\"notin\":\"∉\",\"notindot\":\"⋵̸\",\"notinE\":\"⋹̸\",\"notinva\":\"∉\",\"notinvb\":\"⋷\",\"notinvc\":\"⋶\",\"NotLeftTriangleBar\":\"⧏̸\",\"NotLeftTriangle\":\"⋪\",\"NotLeftTriangleEqual\":\"⋬\",\"NotLess\":\"≮\",\"NotLessEqual\":\"≰\",\"NotLessGreater\":\"≸\",\"NotLessLess\":\"≪̸\",\"NotLessSlantEqual\":\"⩽̸\",\"NotLessTilde\":\"≴\",\"NotNestedGreaterGreater\":\"⪢̸\",\"NotNestedLessLess\":\"⪡̸\",\"notni\":\"∌\",\"notniva\":\"∌\",\"notnivb\":\"⋾\",\"notnivc\":\"⋽\",\"NotPrecedes\":\"⊀\",\"NotPrecedesEqual\":\"⪯̸\",\"NotPrecedesSlantEqual\":\"⋠\",\"NotReverseElement\":\"∌\",\"NotRightTriangleBar\":\"⧐̸\",\"NotRightTriangle\":\"⋫\",\"NotRightTriangleEqual\":\"⋭\",\"NotSquareSubset\":\"⊏̸\",\"NotSquareSubsetEqual\":\"⋢\",\"NotSquareSuperset\":\"⊐̸\",\"NotSquareSupersetEqual\":\"⋣\",\"NotSubset\":\"⊂⃒\",\"NotSubsetEqual\":\"⊈\",\"NotSucceeds\":\"⊁\",\"NotSucceedsEqual\":\"⪰̸\",\"NotSucceedsSlantEqual\":\"⋡\",\"NotSucceedsTilde\":\"≿̸\",\"NotSuperset\":\"⊃⃒\",\"NotSupersetEqual\":\"⊉\",\"NotTilde\":\"≁\",\"NotTildeEqual\":\"≄\",\"NotTildeFullEqual\":\"≇\",\"NotTildeTilde\":\"≉\",\"NotVerticalBar\":\"∤\",\"nparallel\":\"∦\",\"npar\":\"∦\",\"nparsl\":\"⫽⃥\",\"npart\":\"∂̸\",\"npolint\":\"⨔\",\"npr\":\"⊀\",\"nprcue\":\"⋠\",\"nprec\":\"⊀\",\"npreceq\":\"⪯̸\",\"npre\":\"⪯̸\",\"nrarrc\":\"⤳̸\",\"nrarr\":\"↛\",\"nrArr\":\"⇏\",\"nrarrw\":\"↝̸\",\"nrightarrow\":\"↛\",\"nRightarrow\":\"⇏\",\"nrtri\":\"⋫\",\"nrtrie\":\"⋭\",\"nsc\":\"⊁\",\"nsccue\":\"⋡\",\"nsce\":\"⪰̸\",\"Nscr\":\"𝒩\",\"nscr\":\"𝓃\",\"nshortmid\":\"∤\",\"nshortparallel\":\"∦\",\"nsim\":\"≁\",\"nsime\":\"≄\",\"nsimeq\":\"≄\",\"nsmid\":\"∤\",\"nspar\":\"∦\",\"nsqsube\":\"⋢\",\"nsqsupe\":\"⋣\",\"nsub\":\"⊄\",\"nsubE\":\"⫅̸\",\"nsube\":\"⊈\",\"nsubset\":\"⊂⃒\",\"nsubseteq\":\"⊈\",\"nsubseteqq\":\"⫅̸\",\"nsucc\":\"⊁\",\"nsucceq\":\"⪰̸\",\"nsup\":\"⊅\",\"nsupE\":\"⫆̸\",\"nsupe\":\"⊉\",\"nsupset\":\"⊃⃒\",\"nsupseteq\":\"⊉\",\"nsupseteqq\":\"⫆̸\",\"ntgl\":\"≹\",\"Ntilde\":\"Ñ\",\"ntilde\":\"ñ\",\"ntlg\":\"≸\",\"ntriangleleft\":\"⋪\",\"ntrianglelefteq\":\"⋬\",\"ntriangleright\":\"⋫\",\"ntrianglerighteq\":\"⋭\",\"Nu\":\"Ν\",\"nu\":\"ν\",\"num\":\"#\",\"numero\":\"№\",\"numsp\":\" \",\"nvap\":\"≍⃒\",\"nvdash\":\"⊬\",\"nvDash\":\"⊭\",\"nVdash\":\"⊮\",\"nVDash\":\"⊯\",\"nvge\":\"≥⃒\",\"nvgt\":\">⃒\",\"nvHarr\":\"⤄\",\"nvinfin\":\"⧞\",\"nvlArr\":\"⤂\",\"nvle\":\"≤⃒\",\"nvlt\":\"<⃒\",\"nvltrie\":\"⊴⃒\",\"nvrArr\":\"⤃\",\"nvrtrie\":\"⊵⃒\",\"nvsim\":\"∼⃒\",\"nwarhk\":\"⤣\",\"nwarr\":\"↖\",\"nwArr\":\"⇖\",\"nwarrow\":\"↖\",\"nwnear\":\"⤧\",\"Oacute\":\"Ó\",\"oacute\":\"ó\",\"oast\":\"⊛\",\"Ocirc\":\"Ô\",\"ocirc\":\"ô\",\"ocir\":\"⊚\",\"Ocy\":\"О\",\"ocy\":\"о\",\"odash\":\"⊝\",\"Odblac\":\"Ő\",\"odblac\":\"ő\",\"odiv\":\"⨸\",\"odot\":\"⊙\",\"odsold\":\"⦼\",\"OElig\":\"Œ\",\"oelig\":\"œ\",\"ofcir\":\"⦿\",\"Ofr\":\"𝔒\",\"ofr\":\"𝔬\",\"ogon\":\"˛\",\"Ograve\":\"Ò\",\"ograve\":\"ò\",\"ogt\":\"⧁\",\"ohbar\":\"⦵\",\"ohm\":\"Ω\",\"oint\":\"∮\",\"olarr\":\"↺\",\"olcir\":\"⦾\",\"olcross\":\"⦻\",\"oline\":\"‾\",\"olt\":\"⧀\",\"Omacr\":\"Ō\",\"omacr\":\"ō\",\"Omega\":\"Ω\",\"omega\":\"ω\",\"Omicron\":\"Ο\",\"omicron\":\"ο\",\"omid\":\"⦶\",\"ominus\":\"⊖\",\"Oopf\":\"𝕆\",\"oopf\":\"𝕠\",\"opar\":\"⦷\",\"OpenCurlyDoubleQuote\":\"“\",\"OpenCurlyQuote\":\"‘\",\"operp\":\"⦹\",\"oplus\":\"⊕\",\"orarr\":\"↻\",\"Or\":\"⩔\",\"or\":\"∨\",\"ord\":\"⩝\",\"order\":\"ℴ\",\"orderof\":\"ℴ\",\"ordf\":\"ª\",\"ordm\":\"º\",\"origof\":\"⊶\",\"oror\":\"⩖\",\"orslope\":\"⩗\",\"orv\":\"⩛\",\"oS\":\"Ⓢ\",\"Oscr\":\"𝒪\",\"oscr\":\"ℴ\",\"Oslash\":\"Ø\",\"oslash\":\"ø\",\"osol\":\"⊘\",\"Otilde\":\"Õ\",\"otilde\":\"õ\",\"otimesas\":\"⨶\",\"Otimes\":\"⨷\",\"otimes\":\"⊗\",\"Ouml\":\"Ö\",\"ouml\":\"ö\",\"ovbar\":\"⌽\",\"OverBar\":\"‾\",\"OverBrace\":\"⏞\",\"OverBracket\":\"⎴\",\"OverParenthesis\":\"⏜\",\"para\":\"¶\",\"parallel\":\"∥\",\"par\":\"∥\",\"parsim\":\"⫳\",\"parsl\":\"⫽\",\"part\":\"∂\",\"PartialD\":\"∂\",\"Pcy\":\"П\",\"pcy\":\"п\",\"percnt\":\"%\",\"period\":\".\",\"permil\":\"‰\",\"perp\":\"⊥\",\"pertenk\":\"‱\",\"Pfr\":\"𝔓\",\"pfr\":\"𝔭\",\"Phi\":\"Φ\",\"phi\":\"φ\",\"phiv\":\"ϕ\",\"phmmat\":\"ℳ\",\"phone\":\"☎\",\"Pi\":\"Π\",\"pi\":\"π\",\"pitchfork\":\"⋔\",\"piv\":\"ϖ\",\"planck\":\"ℏ\",\"planckh\":\"ℎ\",\"plankv\":\"ℏ\",\"plusacir\":\"⨣\",\"plusb\":\"⊞\",\"pluscir\":\"⨢\",\"plus\":\"+\",\"plusdo\":\"∔\",\"plusdu\":\"⨥\",\"pluse\":\"⩲\",\"PlusMinus\":\"±\",\"plusmn\":\"±\",\"plussim\":\"⨦\",\"plustwo\":\"⨧\",\"pm\":\"±\",\"Poincareplane\":\"ℌ\",\"pointint\":\"⨕\",\"popf\":\"𝕡\",\"Popf\":\"ℙ\",\"pound\":\"£\",\"prap\":\"⪷\",\"Pr\":\"⪻\",\"pr\":\"≺\",\"prcue\":\"≼\",\"precapprox\":\"⪷\",\"prec\":\"≺\",\"preccurlyeq\":\"≼\",\"Precedes\":\"≺\",\"PrecedesEqual\":\"⪯\",\"PrecedesSlantEqual\":\"≼\",\"PrecedesTilde\":\"≾\",\"preceq\":\"⪯\",\"precnapprox\":\"⪹\",\"precneqq\":\"⪵\",\"precnsim\":\"⋨\",\"pre\":\"⪯\",\"prE\":\"⪳\",\"precsim\":\"≾\",\"prime\":\"′\",\"Prime\":\"″\",\"primes\":\"ℙ\",\"prnap\":\"⪹\",\"prnE\":\"⪵\",\"prnsim\":\"⋨\",\"prod\":\"∏\",\"Product\":\"∏\",\"profalar\":\"⌮\",\"profline\":\"⌒\",\"profsurf\":\"⌓\",\"prop\":\"∝\",\"Proportional\":\"∝\",\"Proportion\":\"∷\",\"propto\":\"∝\",\"prsim\":\"≾\",\"prurel\":\"⊰\",\"Pscr\":\"𝒫\",\"pscr\":\"𝓅\",\"Psi\":\"Ψ\",\"psi\":\"ψ\",\"puncsp\":\" \",\"Qfr\":\"𝔔\",\"qfr\":\"𝔮\",\"qint\":\"⨌\",\"qopf\":\"𝕢\",\"Qopf\":\"ℚ\",\"qprime\":\"⁗\",\"Qscr\":\"𝒬\",\"qscr\":\"𝓆\",\"quaternions\":\"ℍ\",\"quatint\":\"⨖\",\"quest\":\"?\",\"questeq\":\"≟\",\"quot\":\"\\\"\",\"QUOT\":\"\\\"\",\"rAarr\":\"⇛\",\"race\":\"∽̱\",\"Racute\":\"Ŕ\",\"racute\":\"ŕ\",\"radic\":\"√\",\"raemptyv\":\"⦳\",\"rang\":\"⟩\",\"Rang\":\"⟫\",\"rangd\":\"⦒\",\"range\":\"⦥\",\"rangle\":\"⟩\",\"raquo\":\"»\",\"rarrap\":\"⥵\",\"rarrb\":\"⇥\",\"rarrbfs\":\"⤠\",\"rarrc\":\"⤳\",\"rarr\":\"→\",\"Rarr\":\"↠\",\"rArr\":\"⇒\",\"rarrfs\":\"⤞\",\"rarrhk\":\"↪\",\"rarrlp\":\"↬\",\"rarrpl\":\"⥅\",\"rarrsim\":\"⥴\",\"Rarrtl\":\"⤖\",\"rarrtl\":\"↣\",\"rarrw\":\"↝\",\"ratail\":\"⤚\",\"rAtail\":\"⤜\",\"ratio\":\"∶\",\"rationals\":\"ℚ\",\"rbarr\":\"⤍\",\"rBarr\":\"⤏\",\"RBarr\":\"⤐\",\"rbbrk\":\"❳\",\"rbrace\":\"}\",\"rbrack\":\"]\",\"rbrke\":\"⦌\",\"rbrksld\":\"⦎\",\"rbrkslu\":\"⦐\",\"Rcaron\":\"Ř\",\"rcaron\":\"ř\",\"Rcedil\":\"Ŗ\",\"rcedil\":\"ŗ\",\"rceil\":\"⌉\",\"rcub\":\"}\",\"Rcy\":\"Р\",\"rcy\":\"р\",\"rdca\":\"⤷\",\"rdldhar\":\"⥩\",\"rdquo\":\"”\",\"rdquor\":\"”\",\"rdsh\":\"↳\",\"real\":\"ℜ\",\"realine\":\"ℛ\",\"realpart\":\"ℜ\",\"reals\":\"ℝ\",\"Re\":\"ℜ\",\"rect\":\"▭\",\"reg\":\"®\",\"REG\":\"®\",\"ReverseElement\":\"∋\",\"ReverseEquilibrium\":\"⇋\",\"ReverseUpEquilibrium\":\"⥯\",\"rfisht\":\"⥽\",\"rfloor\":\"⌋\",\"rfr\":\"𝔯\",\"Rfr\":\"ℜ\",\"rHar\":\"⥤\",\"rhard\":\"⇁\",\"rharu\":\"⇀\",\"rharul\":\"⥬\",\"Rho\":\"Ρ\",\"rho\":\"ρ\",\"rhov\":\"ϱ\",\"RightAngleBracket\":\"⟩\",\"RightArrowBar\":\"⇥\",\"rightarrow\":\"→\",\"RightArrow\":\"→\",\"Rightarrow\":\"⇒\",\"RightArrowLeftArrow\":\"⇄\",\"rightarrowtail\":\"↣\",\"RightCeiling\":\"⌉\",\"RightDoubleBracket\":\"⟧\",\"RightDownTeeVector\":\"⥝\",\"RightDownVectorBar\":\"⥕\",\"RightDownVector\":\"⇂\",\"RightFloor\":\"⌋\",\"rightharpoondown\":\"⇁\",\"rightharpoonup\":\"⇀\",\"rightleftarrows\":\"⇄\",\"rightleftharpoons\":\"⇌\",\"rightrightarrows\":\"⇉\",\"rightsquigarrow\":\"↝\",\"RightTeeArrow\":\"↦\",\"RightTee\":\"⊢\",\"RightTeeVector\":\"⥛\",\"rightthreetimes\":\"⋌\",\"RightTriangleBar\":\"⧐\",\"RightTriangle\":\"⊳\",\"RightTriangleEqual\":\"⊵\",\"RightUpDownVector\":\"⥏\",\"RightUpTeeVector\":\"⥜\",\"RightUpVectorBar\":\"⥔\",\"RightUpVector\":\"↾\",\"RightVectorBar\":\"⥓\",\"RightVector\":\"⇀\",\"ring\":\"˚\",\"risingdotseq\":\"≓\",\"rlarr\":\"⇄\",\"rlhar\":\"⇌\",\"rlm\":\"\",\"rmoustache\":\"⎱\",\"rmoust\":\"⎱\",\"rnmid\":\"⫮\",\"roang\":\"⟭\",\"roarr\":\"⇾\",\"robrk\":\"⟧\",\"ropar\":\"⦆\",\"ropf\":\"𝕣\",\"Ropf\":\"ℝ\",\"roplus\":\"⨮\",\"rotimes\":\"⨵\",\"RoundImplies\":\"⥰\",\"rpar\":\")\",\"rpargt\":\"⦔\",\"rppolint\":\"⨒\",\"rrarr\":\"⇉\",\"Rrightarrow\":\"⇛\",\"rsaquo\":\"›\",\"rscr\":\"𝓇\",\"Rscr\":\"ℛ\",\"rsh\":\"↱\",\"Rsh\":\"↱\",\"rsqb\":\"]\",\"rsquo\":\"’\",\"rsquor\":\"’\",\"rthree\":\"⋌\",\"rtimes\":\"⋊\",\"rtri\":\"▹\",\"rtrie\":\"⊵\",\"rtrif\":\"▸\",\"rtriltri\":\"⧎\",\"RuleDelayed\":\"⧴\",\"ruluhar\":\"⥨\",\"rx\":\"℞\",\"Sacute\":\"Ś\",\"sacute\":\"ś\",\"sbquo\":\"‚\",\"scap\":\"⪸\",\"Scaron\":\"Š\",\"scaron\":\"š\",\"Sc\":\"⪼\",\"sc\":\"≻\",\"sccue\":\"≽\",\"sce\":\"⪰\",\"scE\":\"⪴\",\"Scedil\":\"Ş\",\"scedil\":\"ş\",\"Scirc\":\"Ŝ\",\"scirc\":\"ŝ\",\"scnap\":\"⪺\",\"scnE\":\"⪶\",\"scnsim\":\"⋩\",\"scpolint\":\"⨓\",\"scsim\":\"≿\",\"Scy\":\"С\",\"scy\":\"с\",\"sdotb\":\"⊡\",\"sdot\":\"⋅\",\"sdote\":\"⩦\",\"searhk\":\"⤥\",\"searr\":\"↘\",\"seArr\":\"⇘\",\"searrow\":\"↘\",\"sect\":\"§\",\"semi\":\";\",\"seswar\":\"⤩\",\"setminus\":\"∖\",\"setmn\":\"∖\",\"sext\":\"✶\",\"Sfr\":\"𝔖\",\"sfr\":\"𝔰\",\"sfrown\":\"⌢\",\"sharp\":\"♯\",\"SHCHcy\":\"Щ\",\"shchcy\":\"щ\",\"SHcy\":\"Ш\",\"shcy\":\"ш\",\"ShortDownArrow\":\"↓\",\"ShortLeftArrow\":\"←\",\"shortmid\":\"∣\",\"shortparallel\":\"∥\",\"ShortRightArrow\":\"→\",\"ShortUpArrow\":\"↑\",\"shy\":\"\",\"Sigma\":\"Σ\",\"sigma\":\"σ\",\"sigmaf\":\"ς\",\"sigmav\":\"ς\",\"sim\":\"∼\",\"simdot\":\"⩪\",\"sime\":\"≃\",\"simeq\":\"≃\",\"simg\":\"⪞\",\"simgE\":\"⪠\",\"siml\":\"⪝\",\"simlE\":\"⪟\",\"simne\":\"≆\",\"simplus\":\"⨤\",\"simrarr\":\"⥲\",\"slarr\":\"←\",\"SmallCircle\":\"∘\",\"smallsetminus\":\"∖\",\"smashp\":\"⨳\",\"smeparsl\":\"⧤\",\"smid\":\"∣\",\"smile\":\"⌣\",\"smt\":\"⪪\",\"smte\":\"⪬\",\"smtes\":\"⪬︀\",\"SOFTcy\":\"Ь\",\"softcy\":\"ь\",\"solbar\":\"⌿\",\"solb\":\"⧄\",\"sol\":\"/\",\"Sopf\":\"𝕊\",\"sopf\":\"𝕤\",\"spades\":\"♠\",\"spadesuit\":\"♠\",\"spar\":\"∥\",\"sqcap\":\"⊓\",\"sqcaps\":\"⊓︀\",\"sqcup\":\"⊔\",\"sqcups\":\"⊔︀\",\"Sqrt\":\"√\",\"sqsub\":\"⊏\",\"sqsube\":\"⊑\",\"sqsubset\":\"⊏\",\"sqsubseteq\":\"⊑\",\"sqsup\":\"⊐\",\"sqsupe\":\"⊒\",\"sqsupset\":\"⊐\",\"sqsupseteq\":\"⊒\",\"square\":\"□\",\"Square\":\"□\",\"SquareIntersection\":\"⊓\",\"SquareSubset\":\"⊏\",\"SquareSubsetEqual\":\"⊑\",\"SquareSuperset\":\"⊐\",\"SquareSupersetEqual\":\"⊒\",\"SquareUnion\":\"⊔\",\"squarf\":\"▪\",\"squ\":\"□\",\"squf\":\"▪\",\"srarr\":\"→\",\"Sscr\":\"𝒮\",\"sscr\":\"𝓈\",\"ssetmn\":\"∖\",\"ssmile\":\"⌣\",\"sstarf\":\"⋆\",\"Star\":\"⋆\",\"star\":\"☆\",\"starf\":\"★\",\"straightepsilon\":\"ϵ\",\"straightphi\":\"ϕ\",\"strns\":\"¯\",\"sub\":\"⊂\",\"Sub\":\"⋐\",\"subdot\":\"⪽\",\"subE\":\"⫅\",\"sube\":\"⊆\",\"subedot\":\"⫃\",\"submult\":\"⫁\",\"subnE\":\"⫋\",\"subne\":\"⊊\",\"subplus\":\"⪿\",\"subrarr\":\"⥹\",\"subset\":\"⊂\",\"Subset\":\"⋐\",\"subseteq\":\"⊆\",\"subseteqq\":\"⫅\",\"SubsetEqual\":\"⊆\",\"subsetneq\":\"⊊\",\"subsetneqq\":\"⫋\",\"subsim\":\"⫇\",\"subsub\":\"⫕\",\"subsup\":\"⫓\",\"succapprox\":\"⪸\",\"succ\":\"≻\",\"succcurlyeq\":\"≽\",\"Succeeds\":\"≻\",\"SucceedsEqual\":\"⪰\",\"SucceedsSlantEqual\":\"≽\",\"SucceedsTilde\":\"≿\",\"succeq\":\"⪰\",\"succnapprox\":\"⪺\",\"succneqq\":\"⪶\",\"succnsim\":\"⋩\",\"succsim\":\"≿\",\"SuchThat\":\"∋\",\"sum\":\"∑\",\"Sum\":\"∑\",\"sung\":\"♪\",\"sup1\":\"¹\",\"sup2\":\"²\",\"sup3\":\"³\",\"sup\":\"⊃\",\"Sup\":\"⋑\",\"supdot\":\"⪾\",\"supdsub\":\"⫘\",\"supE\":\"⫆\",\"supe\":\"⊇\",\"supedot\":\"⫄\",\"Superset\":\"⊃\",\"SupersetEqual\":\"⊇\",\"suphsol\":\"⟉\",\"suphsub\":\"⫗\",\"suplarr\":\"⥻\",\"supmult\":\"⫂\",\"supnE\":\"⫌\",\"supne\":\"⊋\",\"supplus\":\"⫀\",\"supset\":\"⊃\",\"Supset\":\"⋑\",\"supseteq\":\"⊇\",\"supseteqq\":\"⫆\",\"supsetneq\":\"⊋\",\"supsetneqq\":\"⫌\",\"supsim\":\"⫈\",\"supsub\":\"⫔\",\"supsup\":\"⫖\",\"swarhk\":\"⤦\",\"swarr\":\"↙\",\"swArr\":\"⇙\",\"swarrow\":\"↙\",\"swnwar\":\"⤪\",\"szlig\":\"ß\",\"Tab\":\"\\t\",\"target\":\"⌖\",\"Tau\":\"Τ\",\"tau\":\"τ\",\"tbrk\":\"⎴\",\"Tcaron\":\"Ť\",\"tcaron\":\"ť\",\"Tcedil\":\"Ţ\",\"tcedil\":\"ţ\",\"Tcy\":\"Т\",\"tcy\":\"т\",\"tdot\":\"⃛\",\"telrec\":\"⌕\",\"Tfr\":\"𝔗\",\"tfr\":\"𝔱\",\"there4\":\"∴\",\"therefore\":\"∴\",\"Therefore\":\"∴\",\"Theta\":\"Θ\",\"theta\":\"θ\",\"thetasym\":\"ϑ\",\"thetav\":\"ϑ\",\"thickapprox\":\"≈\",\"thicksim\":\"∼\",\"ThickSpace\":\" \",\"ThinSpace\":\" \",\"thinsp\":\" \",\"thkap\":\"≈\",\"thksim\":\"∼\",\"THORN\":\"Þ\",\"thorn\":\"þ\",\"tilde\":\"˜\",\"Tilde\":\"∼\",\"TildeEqual\":\"≃\",\"TildeFullEqual\":\"≅\",\"TildeTilde\":\"≈\",\"timesbar\":\"⨱\",\"timesb\":\"⊠\",\"times\":\"×\",\"timesd\":\"⨰\",\"tint\":\"∭\",\"toea\":\"⤨\",\"topbot\":\"⌶\",\"topcir\":\"⫱\",\"top\":\"⊤\",\"Topf\":\"𝕋\",\"topf\":\"𝕥\",\"topfork\":\"⫚\",\"tosa\":\"⤩\",\"tprime\":\"‴\",\"trade\":\"™\",\"TRADE\":\"™\",\"triangle\":\"▵\",\"triangledown\":\"▿\",\"triangleleft\":\"◃\",\"trianglelefteq\":\"⊴\",\"triangleq\":\"≜\",\"triangleright\":\"▹\",\"trianglerighteq\":\"⊵\",\"tridot\":\"◬\",\"trie\":\"≜\",\"triminus\":\"⨺\",\"TripleDot\":\"⃛\",\"triplus\":\"⨹\",\"trisb\":\"⧍\",\"tritime\":\"⨻\",\"trpezium\":\"⏢\",\"Tscr\":\"𝒯\",\"tscr\":\"𝓉\",\"TScy\":\"Ц\",\"tscy\":\"ц\",\"TSHcy\":\"Ћ\",\"tshcy\":\"ћ\",\"Tstrok\":\"Ŧ\",\"tstrok\":\"ŧ\",\"twixt\":\"≬\",\"twoheadleftarrow\":\"↞\",\"twoheadrightarrow\":\"↠\",\"Uacute\":\"Ú\",\"uacute\":\"ú\",\"uarr\":\"↑\",\"Uarr\":\"↟\",\"uArr\":\"⇑\",\"Uarrocir\":\"⥉\",\"Ubrcy\":\"Ў\",\"ubrcy\":\"ў\",\"Ubreve\":\"Ŭ\",\"ubreve\":\"ŭ\",\"Ucirc\":\"Û\",\"ucirc\":\"û\",\"Ucy\":\"У\",\"ucy\":\"у\",\"udarr\":\"⇅\",\"Udblac\":\"Ű\",\"udblac\":\"ű\",\"udhar\":\"⥮\",\"ufisht\":\"⥾\",\"Ufr\":\"𝔘\",\"ufr\":\"𝔲\",\"Ugrave\":\"Ù\",\"ugrave\":\"ù\",\"uHar\":\"⥣\",\"uharl\":\"↿\",\"uharr\":\"↾\",\"uhblk\":\"▀\",\"ulcorn\":\"⌜\",\"ulcorner\":\"⌜\",\"ulcrop\":\"⌏\",\"ultri\":\"◸\",\"Umacr\":\"Ū\",\"umacr\":\"ū\",\"uml\":\"¨\",\"UnderBar\":\"_\",\"UnderBrace\":\"⏟\",\"UnderBracket\":\"⎵\",\"UnderParenthesis\":\"⏝\",\"Union\":\"⋃\",\"UnionPlus\":\"⊎\",\"Uogon\":\"Ų\",\"uogon\":\"ų\",\"Uopf\":\"𝕌\",\"uopf\":\"𝕦\",\"UpArrowBar\":\"⤒\",\"uparrow\":\"↑\",\"UpArrow\":\"↑\",\"Uparrow\":\"⇑\",\"UpArrowDownArrow\":\"⇅\",\"updownarrow\":\"↕\",\"UpDownArrow\":\"↕\",\"Updownarrow\":\"⇕\",\"UpEquilibrium\":\"⥮\",\"upharpoonleft\":\"↿\",\"upharpoonright\":\"↾\",\"uplus\":\"⊎\",\"UpperLeftArrow\":\"↖\",\"UpperRightArrow\":\"↗\",\"upsi\":\"υ\",\"Upsi\":\"ϒ\",\"upsih\":\"ϒ\",\"Upsilon\":\"Υ\",\"upsilon\":\"υ\",\"UpTeeArrow\":\"↥\",\"UpTee\":\"⊥\",\"upuparrows\":\"⇈\",\"urcorn\":\"⌝\",\"urcorner\":\"⌝\",\"urcrop\":\"⌎\",\"Uring\":\"Ů\",\"uring\":\"ů\",\"urtri\":\"◹\",\"Uscr\":\"𝒰\",\"uscr\":\"𝓊\",\"utdot\":\"⋰\",\"Utilde\":\"Ũ\",\"utilde\":\"ũ\",\"utri\":\"▵\",\"utrif\":\"▴\",\"uuarr\":\"⇈\",\"Uuml\":\"Ü\",\"uuml\":\"ü\",\"uwangle\":\"⦧\",\"vangrt\":\"⦜\",\"varepsilon\":\"ϵ\",\"varkappa\":\"ϰ\",\"varnothing\":\"∅\",\"varphi\":\"ϕ\",\"varpi\":\"ϖ\",\"varpropto\":\"∝\",\"varr\":\"↕\",\"vArr\":\"⇕\",\"varrho\":\"ϱ\",\"varsigma\":\"ς\",\"varsubsetneq\":\"⊊︀\",\"varsubsetneqq\":\"⫋︀\",\"varsupsetneq\":\"⊋︀\",\"varsupsetneqq\":\"⫌︀\",\"vartheta\":\"ϑ\",\"vartriangleleft\":\"⊲\",\"vartriangleright\":\"⊳\",\"vBar\":\"⫨\",\"Vbar\":\"⫫\",\"vBarv\":\"⫩\",\"Vcy\":\"В\",\"vcy\":\"в\",\"vdash\":\"⊢\",\"vDash\":\"⊨\",\"Vdash\":\"⊩\",\"VDash\":\"⊫\",\"Vdashl\":\"⫦\",\"veebar\":\"⊻\",\"vee\":\"∨\",\"Vee\":\"⋁\",\"veeeq\":\"≚\",\"vellip\":\"⋮\",\"verbar\":\"|\",\"Verbar\":\"‖\",\"vert\":\"|\",\"Vert\":\"‖\",\"VerticalBar\":\"∣\",\"VerticalLine\":\"|\",\"VerticalSeparator\":\"❘\",\"VerticalTilde\":\"≀\",\"VeryThinSpace\":\" \",\"Vfr\":\"𝔙\",\"vfr\":\"𝔳\",\"vltri\":\"⊲\",\"vnsub\":\"⊂⃒\",\"vnsup\":\"⊃⃒\",\"Vopf\":\"𝕍\",\"vopf\":\"𝕧\",\"vprop\":\"∝\",\"vrtri\":\"⊳\",\"Vscr\":\"𝒱\",\"vscr\":\"𝓋\",\"vsubnE\":\"⫋︀\",\"vsubne\":\"⊊︀\",\"vsupnE\":\"⫌︀\",\"vsupne\":\"⊋︀\",\"Vvdash\":\"⊪\",\"vzigzag\":\"⦚\",\"Wcirc\":\"Ŵ\",\"wcirc\":\"ŵ\",\"wedbar\":\"⩟\",\"wedge\":\"∧\",\"Wedge\":\"⋀\",\"wedgeq\":\"≙\",\"weierp\":\"℘\",\"Wfr\":\"𝔚\",\"wfr\":\"𝔴\",\"Wopf\":\"𝕎\",\"wopf\":\"𝕨\",\"wp\":\"℘\",\"wr\":\"≀\",\"wreath\":\"≀\",\"Wscr\":\"𝒲\",\"wscr\":\"𝓌\",\"xcap\":\"⋂\",\"xcirc\":\"◯\",\"xcup\":\"⋃\",\"xdtri\":\"▽\",\"Xfr\":\"𝔛\",\"xfr\":\"𝔵\",\"xharr\":\"⟷\",\"xhArr\":\"⟺\",\"Xi\":\"Ξ\",\"xi\":\"ξ\",\"xlarr\":\"⟵\",\"xlArr\":\"⟸\",\"xmap\":\"⟼\",\"xnis\":\"⋻\",\"xodot\":\"⨀\",\"Xopf\":\"𝕏\",\"xopf\":\"𝕩\",\"xoplus\":\"⨁\",\"xotime\":\"⨂\",\"xrarr\":\"⟶\",\"xrArr\":\"⟹\",\"Xscr\":\"𝒳\",\"xscr\":\"𝓍\",\"xsqcup\":\"⨆\",\"xuplus\":\"⨄\",\"xutri\":\"△\",\"xvee\":\"⋁\",\"xwedge\":\"⋀\",\"Yacute\":\"Ý\",\"yacute\":\"ý\",\"YAcy\":\"Я\",\"yacy\":\"я\",\"Ycirc\":\"Ŷ\",\"ycirc\":\"ŷ\",\"Ycy\":\"Ы\",\"ycy\":\"ы\",\"yen\":\"¥\",\"Yfr\":\"𝔜\",\"yfr\":\"𝔶\",\"YIcy\":\"Ї\",\"yicy\":\"ї\",\"Yopf\":\"𝕐\",\"yopf\":\"𝕪\",\"Yscr\":\"𝒴\",\"yscr\":\"𝓎\",\"YUcy\":\"Ю\",\"yucy\":\"ю\",\"yuml\":\"ÿ\",\"Yuml\":\"Ÿ\",\"Zacute\":\"Ź\",\"zacute\":\"ź\",\"Zcaron\":\"Ž\",\"zcaron\":\"ž\",\"Zcy\":\"З\",\"zcy\":\"з\",\"Zdot\":\"Ż\",\"zdot\":\"ż\",\"zeetrf\":\"ℨ\",\"ZeroWidthSpace\":\"\",\"Zeta\":\"Ζ\",\"zeta\":\"ζ\",\"zfr\":\"𝔷\",\"Zfr\":\"ℨ\",\"ZHcy\":\"Ж\",\"zhcy\":\"ж\",\"zigrarr\":\"⇝\",\"zopf\":\"𝕫\",\"Zopf\":\"ℤ\",\"Zscr\":\"𝒵\",\"zscr\":\"𝓏\",\"zwj\":\"\",\"zwnj\":\"\"}");
+
+/***/ }),
+/* 45 */
+/***/ (function(module, exports) {
+
+module.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/
+
+/***/ }),
+/* 46 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+module.exports.encode = __webpack_require__(47);
+module.exports.decode = __webpack_require__(48);
+module.exports.format = __webpack_require__(49);
+module.exports.parse = __webpack_require__(50);
+
+
+/***/ }),
+/* 47 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+
+var encodeCache = {};
+
+
+// Create a lookup array where anything but characters in `chars` string
+// and alphanumeric chars is percent-encoded.
+//
+function getEncodeCache(exclude) {
+ var i, ch, cache = encodeCache[exclude];
+ if (cache) { return cache; }
+
+ cache = encodeCache[exclude] = [];
+
+ for (i = 0; i < 128; i++) {
+ ch = String.fromCharCode(i);
+
+ if (/^[0-9a-z]$/i.test(ch)) {
+ // always allow unencoded alphanumeric characters
+ cache.push(ch);
+ } else {
+ cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
+ }
+ }
+
+ for (i = 0; i < exclude.length; i++) {
+ cache[exclude.charCodeAt(i)] = exclude[i];
+ }
+
+ return cache;
+}
+
+
+// Encode unsafe characters with percent-encoding, skipping already
+// encoded sequences.
+//
+// - string - string to encode
+// - exclude - list of characters to ignore (in addition to a-zA-Z0-9)
+// - keepEscaped - don't encode '%' in a correct escape sequence (default: true)
+//
+function encode(string, exclude, keepEscaped) {
+ var i, l, code, nextCode, cache,
+ result = '';
+
+ if (typeof exclude !== 'string') {
+ // encode(string, keepEscaped)
+ keepEscaped = exclude;
+ exclude = encode.defaultChars;
+ }
+
+ if (typeof keepEscaped === 'undefined') {
+ keepEscaped = true;
+ }
+
+ cache = getEncodeCache(exclude);
+
+ for (i = 0, l = string.length; i < l; i++) {
+ code = string.charCodeAt(i);
+
+ if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
+ if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
+ result += string.slice(i, i + 3);
+ i += 2;
+ continue;
+ }
+ }
+
+ if (code < 128) {
+ result += cache[code];
+ continue;
+ }
+
+ if (code >= 0xD800 && code <= 0xDFFF) {
+ if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
+ nextCode = string.charCodeAt(i + 1);
+ if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
+ result += encodeURIComponent(string[i] + string[i + 1]);
+ i++;
+ continue;
+ }
+ }
+ result += '%EF%BF%BD';
+ continue;
+ }
+
+ result += encodeURIComponent(string[i]);
+ }
+
+ return result;
+}
+
+encode.defaultChars = ";/?:@&=+$,-_.!~*'()#";
+encode.componentChars = "-_.!~*'()";
+
+
+module.exports = encode;
+
+
+/***/ }),
+/* 48 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+
+/* eslint-disable no-bitwise */
+
+var decodeCache = {};
+
+function getDecodeCache(exclude) {
+ var i, ch, cache = decodeCache[exclude];
+ if (cache) { return cache; }
+
+ cache = decodeCache[exclude] = [];
+
+ for (i = 0; i < 128; i++) {
+ ch = String.fromCharCode(i);
+ cache.push(ch);
+ }
+
+ for (i = 0; i < exclude.length; i++) {
+ ch = exclude.charCodeAt(i);
+ cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
+ }
+
+ return cache;
+}
+
+
+// Decode percent-encoded string.
+//
+function decode(string, exclude) {
+ var cache;
+
+ if (typeof exclude !== 'string') {
+ exclude = decode.defaultChars;
+ }
+
+ cache = getDecodeCache(exclude);
+
+ return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
+ var i, l, b1, b2, b3, b4, chr,
+ result = '';
+
+ for (i = 0, l = seq.length; i < l; i += 3) {
+ b1 = parseInt(seq.slice(i + 1, i + 3), 16);
+
+ if (b1 < 0x80) {
+ result += cache[b1];
+ continue;
+ }
+
+ if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
+ // 110xxxxx 10xxxxxx
+ b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+
+ if ((b2 & 0xC0) === 0x80) {
+ chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);
+
+ if (chr < 0x80) {
+ result += '\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+
+ i += 3;
+ continue;
+ }
+ }
+
+ if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
+ // 1110xxxx 10xxxxxx 10xxxxxx
+ b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
+ chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);
+
+ if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
+ result += '\ufffd\ufffd\ufffd';
+ } else {
+ result += String.fromCharCode(chr);
+ }
+
+ i += 6;
+ continue;
+ }
+ }
+
+ if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
+ // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
+ b2 = parseInt(seq.slice(i + 4, i + 6), 16);
+ b3 = parseInt(seq.slice(i + 7, i + 9), 16);
+ b4 = parseInt(seq.slice(i + 10, i + 12), 16);
+
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
+ chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);
+
+ if (chr < 0x10000 || chr > 0x10FFFF) {
+ result += '\ufffd\ufffd\ufffd\ufffd';
+ } else {
+ chr -= 0x10000;
+ result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
+ }
+
+ i += 9;
+ continue;
+ }
+ }
+
+ result += '\ufffd';
+ }
+
+ return result;
+ });
+}
+
+
+decode.defaultChars = ';/?:@&=+$,#';
+decode.componentChars = '';
+
+
+module.exports = decode;
+
+
+/***/ }),
+/* 49 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+
+module.exports = function format(url) {
+ var result = '';
+
+ result += url.protocol || '';
+ result += url.slashes ? '//' : '';
+ result += url.auth ? url.auth + '@' : '';
+
+ if (url.hostname && url.hostname.indexOf(':') !== -1) {
+ // ipv6 address
+ result += '[' + url.hostname + ']';
+ } else {
+ result += url.hostname || '';
+ }
+
+ result += url.port ? ':' + url.port : '';
+ result += url.pathname || '';
+ result += url.search || '';
+ result += url.hash || '';
+
+ return result;
+};
+
+
+/***/ }),
+/* 50 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+//
+// Changes from joyent/node:
+//
+// 1. No leading slash in paths,
+// e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
+//
+// 2. Backslashes are not replaced with slashes,
+// so `http:\\example.org\` is treated like a relative path
+//
+// 3. Trailing colon is treated like a part of the path,
+// i.e. in `http://example.org:foo` pathname is `:foo`
+//
+// 4. Nothing is URL-encoded in the resulting object,
+// (in joyent/node some chars in auth and paths are encoded)
+//
+// 5. `url.parse()` does not have `parseQueryString` argument
+//
+// 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
+// which can be constructed using other parts of the url.
+//
+
+
+function Url() {
+ this.protocol = null;
+ this.slashes = null;
+ this.auth = null;
+ this.port = null;
+ this.hostname = null;
+ this.hash = null;
+ this.search = null;
+ this.pathname = null;
+}
+
+// Reference: RFC 3986, RFC 1808, RFC 2396
+
+// define these here so at least they only have to be
+// compiled once on the first module load.
+var protocolPattern = /^([a-z0-9.+-]+:)/i,
+ portPattern = /:[0-9]*$/,
+
+ // Special case for a simple path URL
+ simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
+
+ // RFC 2396: characters reserved for delimiting URLs.
+ // We actually just auto-escape these.
+ delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],
+
+ // RFC 2396: characters not allowed for various reasons.
+ unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),
+
+ // Allowed by RFCs, but cause of XSS attacks. Always escape these.
+ autoEscape = [ '\'' ].concat(unwise),
+ // Characters that are never ever allowed in a hostname.
+ // Note that any invalid chars are also handled, but these
+ // are the ones that are *expected* to be seen, so we fast-path
+ // them.
+ nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),
+ hostEndingChars = [ '/', '?', '#' ],
+ hostnameMaxLen = 255,
+ hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
+ hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
+ // protocols that can allow "unsafe" and "unwise" chars.
+ /* eslint-disable no-script-url */
+ // protocols that never have a hostname.
+ hostlessProtocol = {
+ 'javascript': true,
+ 'javascript:': true
+ },
+ // protocols that always contain a // bit.
+ slashedProtocol = {
+ 'http': true,
+ 'https': true,
+ 'ftp': true,
+ 'gopher': true,
+ 'file': true,
+ 'http:': true,
+ 'https:': true,
+ 'ftp:': true,
+ 'gopher:': true,
+ 'file:': true
+ };
+ /* eslint-enable no-script-url */
+
+function urlParse(url, slashesDenoteHost) {
+ if (url && url instanceof Url) { return url; }
+
+ var u = new Url();
+ u.parse(url, slashesDenoteHost);
+ return u;
+}
+
+Url.prototype.parse = function(url, slashesDenoteHost) {
+ var i, l, lowerProto, hec, slashes,
+ rest = url;
+
+ // trim before proceeding.
+ // This is to support parse stuff like " http://foo.com \n"
+ rest = rest.trim();
+
+ if (!slashesDenoteHost && url.split('#').length === 1) {
+ // Try fast path regexp
+ var simplePath = simplePathPattern.exec(rest);
+ if (simplePath) {
+ this.pathname = simplePath[1];
+ if (simplePath[2]) {
+ this.search = simplePath[2];
+ }
+ return this;
+ }
+ }
+
+ var proto = protocolPattern.exec(rest);
+ if (proto) {
+ proto = proto[0];
+ lowerProto = proto.toLowerCase();
+ this.protocol = proto;
+ rest = rest.substr(proto.length);
+ }
+
+ // figure out if it's got a host
+ // user@server is *always* interpreted as a hostname, and url
+ // resolution will treat //foo/bar as host=foo,path=bar because that's
+ // how the browser resolves relative URLs.
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
+ slashes = rest.substr(0, 2) === '//';
+ if (slashes && !(proto && hostlessProtocol[proto])) {
+ rest = rest.substr(2);
+ this.slashes = true;
+ }
+ }
+
+ if (!hostlessProtocol[proto] &&
+ (slashes || (proto && !slashedProtocol[proto]))) {
+
+ // there's a hostname.
+ // the first instance of /, ?, ;, or # ends the host.
+ //
+ // If there is an @ in the hostname, then non-host chars *are* allowed
+ // to the left of the last @ sign, unless some host-ending character
+ // comes *before* the @-sign.
+ // URLs are obnoxious.
+ //
+ // ex:
+ // http://a@b@c/ => user:a@b host:c
+ // http://a@b?@c => user:a host:c path:/?@c
+
+ // v0.12 TODO(isaacs): This is not quite how Chrome does things.
+ // Review our test case against browsers more comprehensively.
+
+ // find the first instance of any hostEndingChars
+ var hostEnd = -1;
+ for (i = 0; i < hostEndingChars.length; i++) {
+ hec = rest.indexOf(hostEndingChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
+ }
+
+ // at this point, either we have an explicit point where the
+ // auth portion cannot go past, or the last @ char is the decider.
+ var auth, atSign;
+ if (hostEnd === -1) {
+ // atSign can be anywhere.
+ atSign = rest.lastIndexOf('@');
+ } else {
+ // atSign must be in auth portion.
+ // http://a@b/c@d => host:b auth:a path:/c@d
+ atSign = rest.lastIndexOf('@', hostEnd);
+ }
+
+ // Now we have a portion which is definitely the auth.
+ // Pull that off.
+ if (atSign !== -1) {
+ auth = rest.slice(0, atSign);
+ rest = rest.slice(atSign + 1);
+ this.auth = auth;
+ }
+
+ // the host is the remaining to the left of the first non-host char
+ hostEnd = -1;
+ for (i = 0; i < nonHostChars.length; i++) {
+ hec = rest.indexOf(nonHostChars[i]);
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
+ hostEnd = hec;
+ }
+ }
+ // if we still have not hit it, then the entire thing is a host.
+ if (hostEnd === -1) {
+ hostEnd = rest.length;
+ }
+
+ if (rest[hostEnd - 1] === ':') { hostEnd--; }
+ var host = rest.slice(0, hostEnd);
+ rest = rest.slice(hostEnd);
+
+ // pull out port.
+ this.parseHost(host);
+
+ // we've indicated that there is a hostname,
+ // so even if it's empty, it has to be present.
+ this.hostname = this.hostname || '';
+
+ // if hostname begins with [ and ends with ]
+ // assume that it's an IPv6 address.
+ var ipv6Hostname = this.hostname[0] === '[' &&
+ this.hostname[this.hostname.length - 1] === ']';
+
+ // validate a little.
+ if (!ipv6Hostname) {
+ var hostparts = this.hostname.split(/\./);
+ for (i = 0, l = hostparts.length; i < l; i++) {
+ var part = hostparts[i];
+ if (!part) { continue; }
+ if (!part.match(hostnamePartPattern)) {
+ var newpart = '';
+ for (var j = 0, k = part.length; j < k; j++) {
+ if (part.charCodeAt(j) > 127) {
+ // we replace non-ASCII char with a temporary placeholder
+ // we need this to make sure size of hostname is not
+ // broken by replacing non-ASCII by nothing
+ newpart += 'x';
+ } else {
+ newpart += part[j];
+ }
+ }
+ // we test again with ASCII char only
+ if (!newpart.match(hostnamePartPattern)) {
+ var validParts = hostparts.slice(0, i);
+ var notHost = hostparts.slice(i + 1);
+ var bit = part.match(hostnamePartStart);
+ if (bit) {
+ validParts.push(bit[1]);
+ notHost.unshift(bit[2]);
+ }
+ if (notHost.length) {
+ rest = notHost.join('.') + rest;
+ }
+ this.hostname = validParts.join('.');
+ break;
+ }
+ }
+ }
+ }
+
+ if (this.hostname.length > hostnameMaxLen) {
+ this.hostname = '';
+ }
+
+ // strip [ and ] from the hostname
+ // the host field still retains them, though
+ if (ipv6Hostname) {
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
+ }
+ }
+
+ // chop off from the tail first.
+ var hash = rest.indexOf('#');
+ if (hash !== -1) {
+ // got a fragment string.
+ this.hash = rest.substr(hash);
+ rest = rest.slice(0, hash);
+ }
+ var qm = rest.indexOf('?');
+ if (qm !== -1) {
+ this.search = rest.substr(qm);
+ rest = rest.slice(0, qm);
+ }
+ if (rest) { this.pathname = rest; }
+ if (slashedProtocol[lowerProto] &&
+ this.hostname && !this.pathname) {
+ this.pathname = '';
+ }
+
+ return this;
+};
+
+Url.prototype.parseHost = function(host) {
+ var port = portPattern.exec(host);
+ if (port) {
+ port = port[0];
+ if (port !== ':') {
+ this.port = port.substr(1);
+ }
+ host = host.substr(0, host.length - port.length);
+ }
+ if (host) { this.hostname = host; }
+};
+
+module.exports = urlParse;
+
+
+/***/ }),
+/* 51 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+exports.Any = __webpack_require__(52);
+exports.Cc = __webpack_require__(53);
+exports.Cf = __webpack_require__(54);
+exports.P = __webpack_require__(45);
+exports.Z = __webpack_require__(55);
+
+
+/***/ }),
+/* 52 */
+/***/ (function(module, exports) {
+
+module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
+
+/***/ }),
+/* 53 */
+/***/ (function(module, exports) {
+
+module.exports=/[\0-\x1F\x7F-\x9F]/
+
+/***/ }),
+/* 54 */
+/***/ (function(module, exports) {
+
+module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/
+
+/***/ }),
+/* 55 */
+/***/ (function(module, exports) {
+
+module.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/
+
+/***/ }),
+/* 56 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Just a shortcut for bulk export
+
+
+
+exports.parseLinkLabel = __webpack_require__(57);
+exports.parseLinkDestination = __webpack_require__(58);
+exports.parseLinkTitle = __webpack_require__(59);
+
+
+/***/ }),
+/* 57 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Parse link label
+//
+// this function assumes that first character ("[") already matches;
+// returns the end of the label
+//
+
+
+module.exports = function parseLinkLabel(state, start, disableNested) {
+ var level, found, marker, prevPos,
+ labelEnd = -1,
+ max = state.posMax,
+ oldPos = state.pos;
+
+ state.pos = start + 1;
+ level = 1;
+
+ while (state.pos < max) {
+ marker = state.src.charCodeAt(state.pos);
+ if (marker === 0x5D /* ] */) {
+ level--;
+ if (level === 0) {
+ found = true;
+ break;
+ }
+ }
+
+ prevPos = state.pos;
+ state.md.inline.skipToken(state);
+ if (marker === 0x5B /* [ */) {
+ if (prevPos === state.pos - 1) {
+ // increase level if we find text `[`, which is not a part of any token
+ level++;
+ } else if (disableNested) {
+ state.pos = oldPos;
+ return -1;
+ }
+ }
+ }
+
+ if (found) {
+ labelEnd = state.pos;
+ }
+
+ // restore old state
+ state.pos = oldPos;
+
+ return labelEnd;
+};
+
+
+/***/ }),
+/* 58 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Parse link destination
+//
+
+
+
+var unescapeAll = __webpack_require__(42).unescapeAll;
+
+
+module.exports = function parseLinkDestination(str, pos, max) {
+ var code, level,
+ lines = 0,
+ start = pos,
+ result = {
+ ok: false,
+ pos: 0,
+ lines: 0,
+ str: ''
+ };
+
+ if (str.charCodeAt(pos) === 0x3C /* < */) {
+ pos++;
+ while (pos < max) {
+ code = str.charCodeAt(pos);
+ if (code === 0x0A /* \n */) { return result; }
+ if (code === 0x3E /* > */) {
+ result.pos = pos + 1;
+ result.str = unescapeAll(str.slice(start + 1, pos));
+ result.ok = true;
+ return result;
+ }
+ if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos += 2;
+ continue;
+ }
+
+ pos++;
+ }
+
+ // no closing '>'
+ return result;
+ }
+
+ // this should be ... } else { ... branch
+
+ level = 0;
+ while (pos < max) {
+ code = str.charCodeAt(pos);
+
+ if (code === 0x20) { break; }
+
+ // ascii control characters
+ if (code < 0x20 || code === 0x7F) { break; }
+
+ if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos += 2;
+ continue;
+ }
+
+ if (code === 0x28 /* ( */) {
+ level++;
+ }
+
+ if (code === 0x29 /* ) */) {
+ if (level === 0) { break; }
+ level--;
+ }
+
+ pos++;
+ }
+
+ if (start === pos) { return result; }
+ if (level !== 0) { return result; }
+
+ result.str = unescapeAll(str.slice(start, pos));
+ result.lines = lines;
+ result.pos = pos;
+ result.ok = true;
+ return result;
+};
+
+
+/***/ }),
+/* 59 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Parse link title
+//
+
+
+
+var unescapeAll = __webpack_require__(42).unescapeAll;
+
+
+module.exports = function parseLinkTitle(str, pos, max) {
+ var code,
+ marker,
+ lines = 0,
+ start = pos,
+ result = {
+ ok: false,
+ pos: 0,
+ lines: 0,
+ str: ''
+ };
+
+ if (pos >= max) { return result; }
+
+ marker = str.charCodeAt(pos);
+
+ if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }
+
+ pos++;
+
+ // if opening marker is "(", switch it to closing marker ")"
+ if (marker === 0x28) { marker = 0x29; }
+
+ while (pos < max) {
+ code = str.charCodeAt(pos);
+ if (code === marker) {
+ result.pos = pos + 1;
+ result.lines = lines;
+ result.str = unescapeAll(str.slice(start + 1, pos));
+ result.ok = true;
+ return result;
+ } else if (code === 0x0A) {
+ lines++;
+ } else if (code === 0x5C /* \ */ && pos + 1 < max) {
+ pos++;
+ if (str.charCodeAt(pos) === 0x0A) {
+ lines++;
+ }
+ }
+
+ pos++;
+ }
+
+ return result;
+};
+
+
+/***/ }),
+/* 60 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * class Renderer
+ *
+ * Generates HTML from parsed token stream. Each instance has independent
+ * copy of rules. Those can be rewritten with ease. Also, you can add new
+ * rules if you create plugin and adds new token types.
+ **/
+
+
+
+var assign = __webpack_require__(42).assign;
+var unescapeAll = __webpack_require__(42).unescapeAll;
+var escapeHtml = __webpack_require__(42).escapeHtml;
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+var default_rules = {};
+
+
+default_rules.code_inline = function (tokens, idx, options, env, slf) {
+ var token = tokens[idx];
+
+ return '<code' + slf.renderAttrs(token) + '>' +
+ escapeHtml(tokens[idx].content) +
+ '</code>';
+};
+
+
+default_rules.code_block = function (tokens, idx, options, env, slf) {
+ var token = tokens[idx];
+
+ return '<pre' + slf.renderAttrs(token) + '><code>' +
+ escapeHtml(tokens[idx].content) +
+ '</code></pre>\n';
+};
+
+
+default_rules.fence = function (tokens, idx, options, env, slf) {
+ var token = tokens[idx],
+ info = token.info ? unescapeAll(token.info).trim() : '',
+ langName = '',
+ highlighted, i, tmpAttrs, tmpToken;
+
+ if (info) {
+ langName = info.split(/\s+/g)[0];
+ }
+
+ if (options.highlight) {
+ highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
+ } else {
+ highlighted = escapeHtml(token.content);
+ }
+
+ if (highlighted.indexOf('<pre') === 0) {
+ return highlighted + '\n';
+ }
+
+ // If language exists, inject class gently, without modifying original token.
+ // May be, one day we will add .clone() for token and simplify this part, but
+ // now we prefer to keep things local.
+ if (info) {
+ i = token.attrIndex('class');
+ tmpAttrs = token.attrs ? token.attrs.slice() : [];
+
+ if (i < 0) {
+ tmpAttrs.push([ 'class', options.langPrefix + langName ]);
+ } else {
+ tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
+ }
+
+ // Fake token just to render attributes
+ tmpToken = {
+ attrs: tmpAttrs
+ };
+
+ return '<pre><code' + slf.renderAttrs(tmpToken) + '>'
+ + highlighted
+ + '</code></pre>\n';
+ }
+
+
+ return '<pre><code' + slf.renderAttrs(token) + '>'
+ + highlighted
+ + '</code></pre>\n';
+};
+
+
+default_rules.image = function (tokens, idx, options, env, slf) {
+ var token = tokens[idx];
+
+ // "alt" attr MUST be set, even if empty. Because it's mandatory and
+ // should be placed on proper position for tests.
+ //
+ // Replace content with actual value
+
+ token.attrs[token.attrIndex('alt')][1] =
+ slf.renderInlineAsText(token.children, options, env);
+
+ return slf.renderToken(tokens, idx, options);
+};
+
+
+default_rules.hardbreak = function (tokens, idx, options /*, env */) {
+ return options.xhtmlOut ? '<br />\n' : '<br>\n';
+};
+default_rules.softbreak = function (tokens, idx, options /*, env */) {
+ return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';
+};
+
+
+default_rules.text = function (tokens, idx /*, options, env */) {
+ return escapeHtml(tokens[idx].content);
+};
+
+
+default_rules.html_block = function (tokens, idx /*, options, env */) {
+ return tokens[idx].content;
+};
+default_rules.html_inline = function (tokens, idx /*, options, env */) {
+ return tokens[idx].content;
+};
+
+
+/**
+ * new Renderer()
+ *
+ * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
+ **/
+function Renderer() {
+
+ /**
+ * Renderer#rules -> Object
+ *
+ * Contains render rules for tokens. Can be updated and extended.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.renderer.rules.strong_open = function () { return '<b>'; };
+ * md.renderer.rules.strong_close = function () { return '</b>'; };
+ *
+ * var result = md.renderInline(...);
+ * ```
+ *
+ * Each rule is called as independent static function with fixed signature:
+ *
+ * ```javascript
+ * function my_token_render(tokens, idx, options, env, renderer) {
+ * // ...
+ * return renderedHTML;
+ * }
+ * ```
+ *
+ * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
+ * for more details and examples.
+ **/
+ this.rules = assign({}, default_rules);
+}
+
+
+/**
+ * Renderer.renderAttrs(token) -> String
+ *
+ * Render token attributes to string.
+ **/
+Renderer.prototype.renderAttrs = function renderAttrs(token) {
+ var i, l, result;
+
+ if (!token.attrs) { return ''; }
+
+ result = '';
+
+ for (i = 0, l = token.attrs.length; i < l; i++) {
+ result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
+ }
+
+ return result;
+};
+
+
+/**
+ * Renderer.renderToken(tokens, idx, options) -> String
+ * - tokens (Array): list of tokens
+ * - idx (Numbed): token index to render
+ * - options (Object): params of parser instance
+ *
+ * Default token renderer. Can be overriden by custom function
+ * in [[Renderer#rules]].
+ **/
+Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
+ var nextToken,
+ result = '',
+ needLf = false,
+ token = tokens[idx];
+
+ // Tight list paragraphs
+ if (token.hidden) {
+ return '';
+ }
+
+ // Insert a newline between hidden paragraph and subsequent opening
+ // block-level tag.
+ //
+ // For example, here we should insert a newline before blockquote:
+ // - a
+ // >
+ //
+ if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
+ result += '\n';
+ }
+
+ // Add token name, e.g. `<img`
+ result += (token.nesting === -1 ? '</' : '<') + token.tag;
+
+ // Encode attributes, e.g. `<img src="foo"`
+ result += this.renderAttrs(token);
+
+ // Add a slash for self-closing tags, e.g. `<img src="foo" /`
+ if (token.nesting === 0 && options.xhtmlOut) {
+ result += ' /';
+ }
+
+ // Check if we need to add a newline after this tag
+ if (token.block) {
+ needLf = true;
+
+ if (token.nesting === 1) {
+ if (idx + 1 < tokens.length) {
+ nextToken = tokens[idx + 1];
+
+ if (nextToken.type === 'inline' || nextToken.hidden) {
+ // Block-level tag containing an inline tag.
+ //
+ needLf = false;
+
+ } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
+ // Opening tag + closing tag of the same type. E.g. `<li></li>`.
+ //
+ needLf = false;
+ }
+ }
+ }
+ }
+
+ result += needLf ? '>\n' : '>';
+
+ return result;
+};
+
+
+/**
+ * Renderer.renderInline(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to renter
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * The same as [[Renderer.render]], but for single token of `inline` type.
+ **/
+Renderer.prototype.renderInline = function (tokens, options, env) {
+ var type,
+ result = '',
+ rules = this.rules;
+
+ for (var i = 0, len = tokens.length; i < len; i++) {
+ type = tokens[i].type;
+
+ if (typeof rules[type] !== 'undefined') {
+ result += rules[type](tokens, i, options, env, this);
+ } else {
+ result += this.renderToken(tokens, i, options);
+ }
+ }
+
+ return result;
+};
+
+
+/** internal
+ * Renderer.renderInlineAsText(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to renter
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * Special kludge for image `alt` attributes to conform CommonMark spec.
+ * Don't try to use it! Spec requires to show `alt` content with stripped markup,
+ * instead of simple escaping.
+ **/
+Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
+ var result = '';
+
+ for (var i = 0, len = tokens.length; i < len; i++) {
+ if (tokens[i].type === 'text') {
+ result += tokens[i].content;
+ } else if (tokens[i].type === 'image') {
+ result += this.renderInlineAsText(tokens[i].children, options, env);
+ }
+ }
+
+ return result;
+};
+
+
+/**
+ * Renderer.render(tokens, options, env) -> String
+ * - tokens (Array): list on block tokens to renter
+ * - options (Object): params of parser instance
+ * - env (Object): additional data from parsed input (references, for example)
+ *
+ * Takes token stream and generates HTML. Probably, you will never need to call
+ * this method directly.
+ **/
+Renderer.prototype.render = function (tokens, options, env) {
+ var i, len, type,
+ result = '',
+ rules = this.rules;
+
+ for (i = 0, len = tokens.length; i < len; i++) {
+ type = tokens[i].type;
+
+ if (type === 'inline') {
+ result += this.renderInline(tokens[i].children, options, env);
+ } else if (typeof rules[type] !== 'undefined') {
+ result += rules[tokens[i].type](tokens, i, options, env, this);
+ } else {
+ result += this.renderToken(tokens, i, options, env);
+ }
+ }
+
+ return result;
+};
+
+module.exports = Renderer;
+
+
+/***/ }),
+/* 61 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/** internal
+ * class Core
+ *
+ * Top-level rules executor. Glues block/inline parsers and does intermediate
+ * transformations.
+ **/
+
+
+
+var Ruler = __webpack_require__(62);
+
+
+var _rules = [
+ [ 'normalize', __webpack_require__(63) ],
+ [ 'block', __webpack_require__(64) ],
+ [ 'inline', __webpack_require__(65) ],
+ [ 'linkify', __webpack_require__(66) ],
+ [ 'replacements', __webpack_require__(67) ],
+ [ 'smartquotes', __webpack_require__(68) ]
+];
+
+
+/**
+ * new Core()
+ **/
+function Core() {
+ /**
+ * Core#ruler -> Ruler
+ *
+ * [[Ruler]] instance. Keep configuration of core rules.
+ **/
+ this.ruler = new Ruler();
+
+ for (var i = 0; i < _rules.length; i++) {
+ this.ruler.push(_rules[i][0], _rules[i][1]);
+ }
+}
+
+
+/**
+ * Core.process(state)
+ *
+ * Executes core chain rules.
+ **/
+Core.prototype.process = function (state) {
+ var i, l, rules;
+
+ rules = this.ruler.getRules('');
+
+ for (i = 0, l = rules.length; i < l; i++) {
+ rules[i](state);
+ }
+};
+
+Core.prototype.State = __webpack_require__(69);
+
+
+module.exports = Core;
+
+
+/***/ }),
+/* 62 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * class Ruler
+ *
+ * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
+ * [[MarkdownIt#inline]] to manage sequences of functions (rules):
+ *
+ * - keep rules in defined order
+ * - assign the name to each rule
+ * - enable/disable rules
+ * - add/replace rules
+ * - allow assign rules to additional named chains (in the same)
+ * - cacheing lists of active rules
+ *
+ * You will not need use this class directly until write plugins. For simple
+ * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
+ * [[MarkdownIt.use]].
+ **/
+
+
+
+/**
+ * new Ruler()
+ **/
+function Ruler() {
+ // List of added rules. Each element is:
+ //
+ // {
+ // name: XXX,
+ // enabled: Boolean,
+ // fn: Function(),
+ // alt: [ name2, name3 ]
+ // }
+ //
+ this.__rules__ = [];
+
+ // Cached rule chains.
+ //
+ // First level - chain name, '' for default.
+ // Second level - diginal anchor for fast filtering by charcodes.
+ //
+ this.__cache__ = null;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Helper methods, should not be used directly
+
+
+// Find rule index by name
+//
+Ruler.prototype.__find__ = function (name) {
+ for (var i = 0; i < this.__rules__.length; i++) {
+ if (this.__rules__[i].name === name) {
+ return i;
+ }
+ }
+ return -1;
+};
+
+
+// Build rules lookup cache
+//
+Ruler.prototype.__compile__ = function () {
+ var self = this;
+ var chains = [ '' ];
+
+ // collect unique names
+ self.__rules__.forEach(function (rule) {
+ if (!rule.enabled) { return; }
+
+ rule.alt.forEach(function (altName) {
+ if (chains.indexOf(altName) < 0) {
+ chains.push(altName);
+ }
+ });
+ });
+
+ self.__cache__ = {};
+
+ chains.forEach(function (chain) {
+ self.__cache__[chain] = [];
+ self.__rules__.forEach(function (rule) {
+ if (!rule.enabled) { return; }
+
+ if (chain && rule.alt.indexOf(chain) < 0) { return; }
+
+ self.__cache__[chain].push(rule.fn);
+ });
+ });
+};
+
+
+/**
+ * Ruler.at(name, fn [, options])
+ * - name (String): rule name to replace.
+ * - fn (Function): new rule function.
+ * - options (Object): new rule options (not mandatory).
+ *
+ * Replace rule by name with new function & options. Throws error if name not
+ * found.
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * Replace existing typographer replacement rule with new one:
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.core.ruler.at('replacements', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.at = function (name, fn, options) {
+ var index = this.__find__(name);
+ var opt = options || {};
+
+ if (index === -1) { throw new Error('Parser rule not found: ' + name); }
+
+ this.__rules__[index].fn = fn;
+ this.__rules__[index].alt = opt.alt || [];
+ this.__cache__ = null;
+};
+
+
+/**
+ * Ruler.before(beforeName, ruleName, fn [, options])
+ * - beforeName (String): new rule will be added before this one.
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Add new rule to chain before one with given name. See also
+ * [[Ruler.after]], [[Ruler.push]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
+ var index = this.__find__(beforeName);
+ var opt = options || {};
+
+ if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }
+
+ this.__rules__.splice(index, 0, {
+ name: ruleName,
+ enabled: true,
+ fn: fn,
+ alt: opt.alt || []
+ });
+
+ this.__cache__ = null;
+};
+
+
+/**
+ * Ruler.after(afterName, ruleName, fn [, options])
+ * - afterName (String): new rule will be added after this one.
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Add new rule to chain after one with given name. See also
+ * [[Ruler.before]], [[Ruler.push]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.inline.ruler.after('text', 'my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.after = function (afterName, ruleName, fn, options) {
+ var index = this.__find__(afterName);
+ var opt = options || {};
+
+ if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }
+
+ this.__rules__.splice(index + 1, 0, {
+ name: ruleName,
+ enabled: true,
+ fn: fn,
+ alt: opt.alt || []
+ });
+
+ this.__cache__ = null;
+};
+
+/**
+ * Ruler.push(ruleName, fn [, options])
+ * - ruleName (String): name of added rule.
+ * - fn (Function): rule function.
+ * - options (Object): rule options (not mandatory).
+ *
+ * Push new rule to the end of chain. See also
+ * [[Ruler.before]], [[Ruler.after]].
+ *
+ * ##### Options:
+ *
+ * - __alt__ - array with names of "alternate" chains.
+ *
+ * ##### Example
+ *
+ * ```javascript
+ * var md = require('markdown-it')();
+ *
+ * md.core.ruler.push('my_rule', function replace(state) {
+ * //...
+ * });
+ * ```
+ **/
+Ruler.prototype.push = function (ruleName, fn, options) {
+ var opt = options || {};
+
+ this.__rules__.push({
+ name: ruleName,
+ enabled: true,
+ fn: fn,
+ alt: opt.alt || []
+ });
+
+ this.__cache__ = null;
+};
+
+
+/**
+ * Ruler.enable(list [, ignoreInvalid]) -> Array
+ * - list (String|Array): list of rule names to enable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable rules with given names. If any rule name not found - throw Error.
+ * Errors can be disabled by second param.
+ *
+ * Returns list of found rule names (if no exception happened).
+ *
+ * See also [[Ruler.disable]], [[Ruler.enableOnly]].
+ **/
+Ruler.prototype.enable = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) { list = [ list ]; }
+
+ var result = [];
+
+ // Search by name and enable
+ list.forEach(function (name) {
+ var idx = this.__find__(name);
+
+ if (idx < 0) {
+ if (ignoreInvalid) { return; }
+ throw new Error('Rules manager: invalid rule name ' + name);
+ }
+ this.__rules__[idx].enabled = true;
+ result.push(name);
+ }, this);
+
+ this.__cache__ = null;
+ return result;
+};
+
+
+/**
+ * Ruler.enableOnly(list [, ignoreInvalid])
+ * - list (String|Array): list of rule names to enable (whitelist).
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Enable rules with given names, and disable everything else. If any rule name
+ * not found - throw Error. Errors can be disabled by second param.
+ *
+ * See also [[Ruler.disable]], [[Ruler.enable]].
+ **/
+Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) { list = [ list ]; }
+
+ this.__rules__.forEach(function (rule) { rule.enabled = false; });
+
+ this.enable(list, ignoreInvalid);
+};
+
+
+/**
+ * Ruler.disable(list [, ignoreInvalid]) -> Array
+ * - list (String|Array): list of rule names to disable.
+ * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
+ *
+ * Disable rules with given names. If any rule name not found - throw Error.
+ * Errors can be disabled by second param.
+ *
+ * Returns list of found rule names (if no exception happened).
+ *
+ * See also [[Ruler.enable]], [[Ruler.enableOnly]].
+ **/
+Ruler.prototype.disable = function (list, ignoreInvalid) {
+ if (!Array.isArray(list)) { list = [ list ]; }
+
+ var result = [];
+
+ // Search by name and disable
+ list.forEach(function (name) {
+ var idx = this.__find__(name);
+
+ if (idx < 0) {
+ if (ignoreInvalid) { return; }
+ throw new Error('Rules manager: invalid rule name ' + name);
+ }
+ this.__rules__[idx].enabled = false;
+ result.push(name);
+ }, this);
+
+ this.__cache__ = null;
+ return result;
+};
+
+
+/**
+ * Ruler.getRules(chainName) -> Array
+ *
+ * Return array of active functions (rules) for given chain name. It analyzes
+ * rules configuration, compiles caches if not exists and returns result.
+ *
+ * Default chain name is `''` (empty string). It can't be skipped. That's
+ * done intentionally, to keep signature monomorphic for high speed.
+ **/
+Ruler.prototype.getRules = function (chainName) {
+ if (this.__cache__ === null) {
+ this.__compile__();
+ }
+
+ // Chain can be empty, if rules disabled. But we still have to return Array.
+ return this.__cache__[chainName] || [];
+};
+
+module.exports = Ruler;
+
+
+/***/ }),
+/* 63 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Normalize input string
+
+
+
+
+// https://spec.commonmark.org/0.29/#line-ending
+var NEWLINES_RE = /\r\n?|\n/g;
+var NULL_RE = /\0/g;
+
+
+module.exports = function normalize(state) {
+ var str;
+
+ // Normalize newlines
+ str = state.src.replace(NEWLINES_RE, '\n');
+
+ // Replace NULL characters
+ str = str.replace(NULL_RE, '\uFFFD');
+
+ state.src = str;
+};
+
+
+/***/ }),
+/* 64 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+module.exports = function block(state) {
+ var token;
+
+ if (state.inlineMode) {
+ token = new state.Token('inline', '', 0);
+ token.content = state.src;
+ token.map = [ 0, 1 ];
+ token.children = [];
+ state.tokens.push(token);
+ } else {
+ state.md.block.parse(state.src, state.md, state.env, state.tokens);
+ }
+};
+
+
+/***/ }),
+/* 65 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+module.exports = function inline(state) {
+ var tokens = state.tokens, tok, i, l;
+
+ // Parse inlines
+ for (i = 0, l = tokens.length; i < l; i++) {
+ tok = tokens[i];
+ if (tok.type === 'inline') {
+ state.md.inline.parse(tok.content, state.md, state.env, tok.children);
+ }
+ }
+};
+
+
+/***/ }),
+/* 66 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Replace link-like texts with link nodes.
+//
+// Currently restricted by `md.validateLink()` to http/https/ftp
+//
+
+
+
+var arrayReplaceAt = __webpack_require__(42).arrayReplaceAt;
+
+
+function isLinkOpen(str) {
+ return /^<a[>\s]/i.test(str);
+}
+function isLinkClose(str) {
+ return /^<\/a\s*>/i.test(str);
+}
+
+
+module.exports = function linkify(state) {
+ var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
+ level, htmlLinkLevel, url, fullUrl, urlText,
+ blockTokens = state.tokens,
+ links;
+
+ if (!state.md.options.linkify) { return; }
+
+ for (j = 0, l = blockTokens.length; j < l; j++) {
+ if (blockTokens[j].type !== 'inline' ||
+ !state.md.linkify.pretest(blockTokens[j].content)) {
+ continue;
+ }
+
+ tokens = blockTokens[j].children;
+
+ htmlLinkLevel = 0;
+
+ // We scan from the end, to keep position when new tags added.
+ // Use reversed logic in links start/end match
+ for (i = tokens.length - 1; i >= 0; i--) {
+ currentToken = tokens[i];
+
+ // Skip content of markdown links
+ if (currentToken.type === 'link_close') {
+ i--;
+ while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
+ i--;
+ }
+ continue;
+ }
+
+ // Skip content of html tag links
+ if (currentToken.type === 'html_inline') {
+ if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
+ htmlLinkLevel--;
+ }
+ if (isLinkClose(currentToken.content)) {
+ htmlLinkLevel++;
+ }
+ }
+ if (htmlLinkLevel > 0) { continue; }
+
+ if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
+
+ text = currentToken.content;
+ links = state.md.linkify.match(text);
+
+ // Now split string to nodes
+ nodes = [];
+ level = currentToken.level;
+ lastPos = 0;
+
+ for (ln = 0; ln < links.length; ln++) {
+
+ url = links[ln].url;
+ fullUrl = state.md.normalizeLink(url);
+ if (!state.md.validateLink(fullUrl)) { continue; }
+
+ urlText = links[ln].text;
+
+ // Linkifier might send raw hostnames like "example.com", where url
+ // starts with domain name. So we prepend http:// in those cases,
+ // and remove it afterwards.
+ //
+ if (!links[ln].schema) {
+ urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
+ } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
+ urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
+ } else {
+ urlText = state.md.normalizeLinkText(urlText);
+ }
+
+ pos = links[ln].index;
+
+ if (pos > lastPos) {
+ token = new state.Token('text', '', 0);
+ token.content = text.slice(lastPos, pos);
+ token.level = level;
+ nodes.push(token);
+ }
+
+ token = new state.Token('link_open', 'a', 1);
+ token.attrs = [ [ 'href', fullUrl ] ];
+ token.level = level++;
+ token.markup = 'linkify';
+ token.info = 'auto';
+ nodes.push(token);
+
+ token = new state.Token('text', '', 0);
+ token.content = urlText;
+ token.level = level;
+ nodes.push(token);
+
+ token = new state.Token('link_close', 'a', -1);
+ token.level = --level;
+ token.markup = 'linkify';
+ token.info = 'auto';
+ nodes.push(token);
+
+ lastPos = links[ln].lastIndex;
+ }
+ if (lastPos < text.length) {
+ token = new state.Token('text', '', 0);
+ token.content = text.slice(lastPos);
+ token.level = level;
+ nodes.push(token);
+ }
+
+ // replace current node
+ blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
+ }
+ }
+ }
+};
+
+
+/***/ }),
+/* 67 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Simple typographic replacements
+//
+// (c) (C) → ©
+// (tm) (TM) → ™
+// (r) (R) → ®
+// +- → ±
+// (p) (P) -> §
+// ... → … (also ?.... → ?.., !.... → !..)
+// ???????? → ???, !!!!! → !!!, `,,` → `,`
+// -- → –, --- → —
+//
+
+
+// TODO:
+// - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
+// - miltiplication 2 x 4 -> 2 × 4
+
+var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
+
+// Workaround for phantomjs - need regex without /g flag,
+// or root check will fail every second time
+var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;
+
+var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
+var SCOPED_ABBR = {
+ c: '©',
+ r: '®',
+ p: '§',
+ tm: '™'
+};
+
+function replaceFn(match, name) {
+ return SCOPED_ABBR[name.toLowerCase()];
+}
+
+function replace_scoped(inlineTokens) {
+ var i, token, inside_autolink = 0;
+
+ for (i = inlineTokens.length - 1; i >= 0; i--) {
+ token = inlineTokens[i];
+
+ if (token.type === 'text' && !inside_autolink) {
+ token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
+ }
+
+ if (token.type === 'link_open' && token.info === 'auto') {
+ inside_autolink--;
+ }
+
+ if (token.type === 'link_close' && token.info === 'auto') {
+ inside_autolink++;
+ }
+ }
+}
+
+function replace_rare(inlineTokens) {
+ var i, token, inside_autolink = 0;
+
+ for (i = inlineTokens.length - 1; i >= 0; i--) {
+ token = inlineTokens[i];
+
+ if (token.type === 'text' && !inside_autolink) {
+ if (RARE_RE.test(token.content)) {
+ token.content = token.content
+ .replace(/\+-/g, '±')
+ // .., ..., ....... -> …
+ // but ?..... & !..... -> ?.. & !..
+ .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
+ .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
+ // em-dash
+ .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
+ // en-dash
+ .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
+ .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
+ }
+ }
+
+ if (token.type === 'link_open' && token.info === 'auto') {
+ inside_autolink--;
+ }
+
+ if (token.type === 'link_close' && token.info === 'auto') {
+ inside_autolink++;
+ }
+ }
+}
+
+
+module.exports = function replace(state) {
+ var blkIdx;
+
+ if (!state.md.options.typographer) { return; }
+
+ for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
+
+ if (state.tokens[blkIdx].type !== 'inline') { continue; }
+
+ if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
+ replace_scoped(state.tokens[blkIdx].children);
+ }
+
+ if (RARE_RE.test(state.tokens[blkIdx].content)) {
+ replace_rare(state.tokens[blkIdx].children);
+ }
+
+ }
+};
+
+
+/***/ }),
+/* 68 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Convert straight quotation marks to typographic ones
+//
+
+
+
+var isWhiteSpace = __webpack_require__(42).isWhiteSpace;
+var isPunctChar = __webpack_require__(42).isPunctChar;
+var isMdAsciiPunct = __webpack_require__(42).isMdAsciiPunct;
+
+var QUOTE_TEST_RE = /['"]/;
+var QUOTE_RE = /['"]/g;
+var APOSTROPHE = '\u2019'; /* ’ */
+
+
+function replaceAt(str, index, ch) {
+ return str.substr(0, index) + ch + str.substr(index + 1);
+}
+
+function process_inlines(tokens, state) {
+ var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,
+ isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,
+ canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;
+
+ stack = [];
+
+ for (i = 0; i < tokens.length; i++) {
+ token = tokens[i];
+
+ thisLevel = tokens[i].level;
+
+ for (j = stack.length - 1; j >= 0; j--) {
+ if (stack[j].level <= thisLevel) { break; }
+ }
+ stack.length = j + 1;
+
+ if (token.type !== 'text') { continue; }
+
+ text = token.content;
+ pos = 0;
+ max = text.length;
+
+ /*eslint no-labels:0,block-scoped-var:0*/
+ OUTER:
+ while (pos < max) {
+ QUOTE_RE.lastIndex = pos;
+ t = QUOTE_RE.exec(text);
+ if (!t) { break; }
+
+ canOpen = canClose = true;
+ pos = t.index + 1;
+ isSingle = (t[0] === "'");
+
+ // Find previous character,
+ // default to space if it's the beginning of the line
+ //
+ lastChar = 0x20;
+
+ if (t.index - 1 >= 0) {
+ lastChar = text.charCodeAt(t.index - 1);
+ } else {
+ for (j = i - 1; j >= 0; j--) {
+ if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20
+ if (tokens[j].type !== 'text') continue;
+
+ lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
+ break;
+ }
+ }
+
+ // Find next character,
+ // default to space if it's the end of the line
+ //
+ nextChar = 0x20;
+
+ if (pos < max) {
+ nextChar = text.charCodeAt(pos);
+ } else {
+ for (j = i + 1; j < tokens.length; j++) {
+ if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20
+ if (tokens[j].type !== 'text') continue;
+
+ nextChar = tokens[j].content.charCodeAt(0);
+ break;
+ }
+ }
+
+ isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
+ isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
+
+ isLastWhiteSpace = isWhiteSpace(lastChar);
+ isNextWhiteSpace = isWhiteSpace(nextChar);
+
+ if (isNextWhiteSpace) {
+ canOpen = false;
+ } else if (isNextPunctChar) {
+ if (!(isLastWhiteSpace || isLastPunctChar)) {
+ canOpen = false;
+ }
+ }
+
+ if (isLastWhiteSpace) {
+ canClose = false;
+ } else if (isLastPunctChar) {
+ if (!(isNextWhiteSpace || isNextPunctChar)) {
+ canClose = false;
+ }
+ }
+
+ if (nextChar === 0x22 /* " */ && t[0] === '"') {
+ if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
+ // special case: 1"" - count first quote as an inch
+ canClose = canOpen = false;
+ }
+ }
+
+ if (canOpen && canClose) {
+ // treat this as the middle of the word
+ canOpen = false;
+ canClose = isNextPunctChar;
+ }
+
+ if (!canOpen && !canClose) {
+ // middle of word
+ if (isSingle) {
+ token.content = replaceAt(token.content, t.index, APOSTROPHE);
+ }
+ continue;
+ }
+
+ if (canClose) {
+ // this could be a closing quote, rewind the stack to get a match
+ for (j = stack.length - 1; j >= 0; j--) {
+ item = stack[j];
+ if (stack[j].level < thisLevel) { break; }
+ if (item.single === isSingle && stack[j].level === thisLevel) {
+ item = stack[j];
+
+ if (isSingle) {
+ openQuote = state.md.options.quotes[2];
+ closeQuote = state.md.options.quotes[3];
+ } else {
+ openQuote = state.md.options.quotes[0];
+ closeQuote = state.md.options.quotes[1];
+ }
+
+ // replace token.content *before* tokens[item.token].content,
+ // because, if they are pointing at the same token, replaceAt
+ // could mess up indices when quote length != 1
+ token.content = replaceAt(token.content, t.index, closeQuote);
+ tokens[item.token].content = replaceAt(
+ tokens[item.token].content, item.pos, openQuote);
+
+ pos += closeQuote.length - 1;
+ if (item.token === i) { pos += openQuote.length - 1; }
+
+ text = token.content;
+ max = text.length;
+
+ stack.length = j;
+ continue OUTER;
+ }
+ }
+ }
+
+ if (canOpen) {
+ stack.push({
+ token: i,
+ pos: t.index,
+ single: isSingle,
+ level: thisLevel
+ });
+ } else if (canClose && isSingle) {
+ token.content = replaceAt(token.content, t.index, APOSTROPHE);
+ }
+ }
+ }
+}
+
+
+module.exports = function smartquotes(state) {
+ /*eslint max-depth:0*/
+ var blkIdx;
+
+ if (!state.md.options.typographer) { return; }
+
+ for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
+
+ if (state.tokens[blkIdx].type !== 'inline' ||
+ !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
+ continue;
+ }
+
+ process_inlines(state.tokens[blkIdx].children, state);
+ }
+};
+
+
+/***/ }),
+/* 69 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Core state object
+//
+
+
+var Token = __webpack_require__(70);
+
+
+function StateCore(src, md, env) {
+ this.src = src;
+ this.env = env;
+ this.tokens = [];
+ this.inlineMode = false;
+ this.md = md; // link to parser instance
+}
+
+// re-export Token class to use in core rules
+StateCore.prototype.Token = Token;
+
+
+module.exports = StateCore;
+
+
+/***/ }),
+/* 70 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Token class
+
+
+
+
+/**
+ * class Token
+ **/
+
+/**
+ * new Token(type, tag, nesting)
+ *
+ * Create new token and fill passed properties.
+ **/
+function Token(type, tag, nesting) {
+ /**
+ * Token#type -> String
+ *
+ * Type of the token (string, e.g. "paragraph_open")
+ **/
+ this.type = type;
+
+ /**
+ * Token#tag -> String
+ *
+ * html tag name, e.g. "p"
+ **/
+ this.tag = tag;
+
+ /**
+ * Token#attrs -> Array
+ *
+ * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
+ **/
+ this.attrs = null;
+
+ /**
+ * Token#map -> Array
+ *
+ * Source map info. Format: `[ line_begin, line_end ]`
+ **/
+ this.map = null;
+
+ /**
+ * Token#nesting -> Number
+ *
+ * Level change (number in {-1, 0, 1} set), where:
+ *
+ * - `1` means the tag is opening
+ * - `0` means the tag is self-closing
+ * - `-1` means the tag is closing
+ **/
+ this.nesting = nesting;
+
+ /**
+ * Token#level -> Number
+ *
+ * nesting level, the same as `state.level`
+ **/
+ this.level = 0;
+
+ /**
+ * Token#children -> Array
+ *
+ * An array of child nodes (inline and img tokens)
+ **/
+ this.children = null;
+
+ /**
+ * Token#content -> String
+ *
+ * In a case of self-closing tag (code, html, fence, etc.),
+ * it has contents of this tag.
+ **/
+ this.content = '';
+
+ /**
+ * Token#markup -> String
+ *
+ * '*' or '_' for emphasis, fence string for fence, etc.
+ **/
+ this.markup = '';
+
+ /**
+ * Token#info -> String
+ *
+ * fence infostring
+ **/
+ this.info = '';
+
+ /**
+ * Token#meta -> Object
+ *
+ * A place for plugins to store an arbitrary data
+ **/
+ this.meta = null;
+
+ /**
+ * Token#block -> Boolean
+ *
+ * True for block-level tokens, false for inline tokens.
+ * Used in renderer to calculate line breaks
+ **/
+ this.block = false;
+
+ /**
+ * Token#hidden -> Boolean
+ *
+ * If it's true, ignore this element when rendering. Used for tight lists
+ * to hide paragraphs.
+ **/
+ this.hidden = false;
+}
+
+
+/**
+ * Token.attrIndex(name) -> Number
+ *
+ * Search attribute index by name.
+ **/
+Token.prototype.attrIndex = function attrIndex(name) {
+ var attrs, i, len;
+
+ if (!this.attrs) { return -1; }
+
+ attrs = this.attrs;
+
+ for (i = 0, len = attrs.length; i < len; i++) {
+ if (attrs[i][0] === name) { return i; }
+ }
+ return -1;
+};
+
+
+/**
+ * Token.attrPush(attrData)
+ *
+ * Add `[ name, value ]` attribute to list. Init attrs if necessary
+ **/
+Token.prototype.attrPush = function attrPush(attrData) {
+ if (this.attrs) {
+ this.attrs.push(attrData);
+ } else {
+ this.attrs = [ attrData ];
+ }
+};
+
+
+/**
+ * Token.attrSet(name, value)
+ *
+ * Set `name` attribute to `value`. Override old value if exists.
+ **/
+Token.prototype.attrSet = function attrSet(name, value) {
+ var idx = this.attrIndex(name),
+ attrData = [ name, value ];
+
+ if (idx < 0) {
+ this.attrPush(attrData);
+ } else {
+ this.attrs[idx] = attrData;
+ }
+};
+
+
+/**
+ * Token.attrGet(name)
+ *
+ * Get the value of attribute `name`, or null if it does not exist.
+ **/
+Token.prototype.attrGet = function attrGet(name) {
+ var idx = this.attrIndex(name), value = null;
+ if (idx >= 0) {
+ value = this.attrs[idx][1];
+ }
+ return value;
+};
+
+
+/**
+ * Token.attrJoin(name, value)
+ *
+ * Join value to existing attribute via space. Or create new attribute if not
+ * exists. Useful to operate with token classes.
+ **/
+Token.prototype.attrJoin = function attrJoin(name, value) {
+ var idx = this.attrIndex(name);
+
+ if (idx < 0) {
+ this.attrPush([ name, value ]);
+ } else {
+ this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
+ }
+};
+
+
+module.exports = Token;
+
+
+/***/ }),
+/* 71 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/** internal
+ * class ParserBlock
+ *
+ * Block-level tokenizer.
+ **/
+
+
+
+var Ruler = __webpack_require__(62);
+
+
+var _rules = [
+ // First 2 params - rule name & source. Secondary array - list of rules,
+ // which can be terminated by this one.
+ [ 'table', __webpack_require__(72), [ 'paragraph', 'reference' ] ],
+ [ 'code', __webpack_require__(73) ],
+ [ 'fence', __webpack_require__(74), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
+ [ 'blockquote', __webpack_require__(75), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
+ [ 'hr', __webpack_require__(76), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
+ [ 'list', __webpack_require__(77), [ 'paragraph', 'reference', 'blockquote' ] ],
+ [ 'reference', __webpack_require__(78) ],
+ [ 'heading', __webpack_require__(79), [ 'paragraph', 'reference', 'blockquote' ] ],
+ [ 'lheading', __webpack_require__(80) ],
+ [ 'html_block', __webpack_require__(81), [ 'paragraph', 'reference', 'blockquote' ] ],
+ [ 'paragraph', __webpack_require__(84) ]
+];
+
+
+/**
+ * new ParserBlock()
+ **/
+function ParserBlock() {
+ /**
+ * ParserBlock#ruler -> Ruler
+ *
+ * [[Ruler]] instance. Keep configuration of block rules.
+ **/
+ this.ruler = new Ruler();
+
+ for (var i = 0; i < _rules.length; i++) {
+ this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
+ }
+}
+
+
+// Generate tokens for input range
+//
+ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
+ var ok, i,
+ rules = this.ruler.getRules(''),
+ len = rules.length,
+ line = startLine,
+ hasEmptyLines = false,
+ maxNesting = state.md.options.maxNesting;
+
+ while (line < endLine) {
+ state.line = line = state.skipEmptyLines(line);
+ if (line >= endLine) { break; }
+
+ // Termination condition for nested calls.
+ // Nested calls currently used for blockquotes & lists
+ if (state.sCount[line] < state.blkIndent) { break; }
+
+ // If nesting level exceeded - skip tail to the end. That's not ordinary
+ // situation and we should not care about content.
+ if (state.level >= maxNesting) {
+ state.line = endLine;
+ break;
+ }
+
+ // Try all possible rules.
+ // On success, rule should:
+ //
+ // - update `state.line`
+ // - update `state.tokens`
+ // - return true
+
+ for (i = 0; i < len; i++) {
+ ok = rules[i](state, line, endLine, false);
+ if (ok) { break; }
+ }
+
+ // set state.tight if we had an empty line before current tag
+ // i.e. latest empty line should not count
+ state.tight = !hasEmptyLines;
+
+ // paragraph might "eat" one newline after it in nested lists
+ if (state.isEmpty(state.line - 1)) {
+ hasEmptyLines = true;
+ }
+
+ line = state.line;
+
+ if (line < endLine && state.isEmpty(line)) {
+ hasEmptyLines = true;
+ line++;
+ state.line = line;
+ }
+ }
+};
+
+
+/**
+ * ParserBlock.parse(str, md, env, outTokens)
+ *
+ * Process input string and push block tokens into `outTokens`
+ **/
+ParserBlock.prototype.parse = function (src, md, env, outTokens) {
+ var state;
+
+ if (!src) { return; }
+
+ state = new this.State(src, md, env, outTokens);
+
+ this.tokenize(state, state.line, state.lineMax);
+};
+
+
+ParserBlock.prototype.State = __webpack_require__(85);
+
+
+module.exports = ParserBlock;
+
+
+/***/ }),
+/* 72 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// GFM table, non-standard
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+function getLine(state, line) {
+ var pos = state.bMarks[line] + state.blkIndent,
+ max = state.eMarks[line];
+
+ return state.src.substr(pos, max - pos);
+}
+
+function escapedSplit(str) {
+ var result = [],
+ pos = 0,
+ max = str.length,
+ ch,
+ escapes = 0,
+ lastPos = 0,
+ backTicked = false,
+ lastBackTick = 0;
+
+ ch = str.charCodeAt(pos);
+
+ while (pos < max) {
+ if (ch === 0x60/* ` */) {
+ if (backTicked) {
+ // make \` close code sequence, but not open it;
+ // the reason is: `\` is correct code block
+ backTicked = false;
+ lastBackTick = pos;
+ } else if (escapes % 2 === 0) {
+ backTicked = true;
+ lastBackTick = pos;
+ }
+ } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {
+ result.push(str.substring(lastPos, pos));
+ lastPos = pos + 1;
+ }
+
+ if (ch === 0x5c/* \ */) {
+ escapes++;
+ } else {
+ escapes = 0;
+ }
+
+ pos++;
+
+ // If there was an un-closed backtick, go back to just after
+ // the last backtick, but as if it was a normal character
+ if (pos === max && backTicked) {
+ backTicked = false;
+ pos = lastBackTick + 1;
+ }
+
+ ch = str.charCodeAt(pos);
+ }
+
+ result.push(str.substring(lastPos));
+
+ return result;
+}
+
+
+module.exports = function table(state, startLine, endLine, silent) {
+ var ch, lineText, pos, i, nextLine, columns, columnCount, token,
+ aligns, t, tableLines, tbodyLines;
+
+ // should have at least two lines
+ if (startLine + 2 > endLine) { return false; }
+
+ nextLine = startLine + 1;
+
+ if (state.sCount[nextLine] < state.blkIndent) { return false; }
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }
+
+ // first character of the second line should be '|', '-', ':',
+ // and no other characters are allowed but spaces;
+ // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
+
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ if (pos >= state.eMarks[nextLine]) { return false; }
+
+ ch = state.src.charCodeAt(pos++);
+ if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }
+
+ while (pos < state.eMarks[nextLine]) {
+ ch = state.src.charCodeAt(pos);
+
+ if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }
+
+ pos++;
+ }
+
+ lineText = getLine(state, startLine + 1);
+
+ columns = lineText.split('|');
+ aligns = [];
+ for (i = 0; i < columns.length; i++) {
+ t = columns[i].trim();
+ if (!t) {
+ // allow empty columns before and after table, but not in between columns;
+ // e.g. allow ` |---| `, disallow ` ---||--- `
+ if (i === 0 || i === columns.length - 1) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+
+ if (!/^:?-+:?$/.test(t)) { return false; }
+ if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {
+ aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');
+ } else if (t.charCodeAt(0) === 0x3A/* : */) {
+ aligns.push('left');
+ } else {
+ aligns.push('');
+ }
+ }
+
+ lineText = getLine(state, startLine).trim();
+ if (lineText.indexOf('|') === -1) { return false; }
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+ columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
+
+ // header row will define an amount of columns in the entire table,
+ // and align row shouldn't be smaller than that (the rest of the rows can)
+ columnCount = columns.length;
+ if (columnCount > aligns.length) { return false; }
+
+ if (silent) { return true; }
+
+ token = state.push('table_open', 'table', 1);
+ token.map = tableLines = [ startLine, 0 ];
+
+ token = state.push('thead_open', 'thead', 1);
+ token.map = [ startLine, startLine + 1 ];
+
+ token = state.push('tr_open', 'tr', 1);
+ token.map = [ startLine, startLine + 1 ];
+
+ for (i = 0; i < columns.length; i++) {
+ token = state.push('th_open', 'th', 1);
+ token.map = [ startLine, startLine + 1 ];
+ if (aligns[i]) {
+ token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
+ }
+
+ token = state.push('inline', '', 0);
+ token.content = columns[i].trim();
+ token.map = [ startLine, startLine + 1 ];
+ token.children = [];
+
+ token = state.push('th_close', 'th', -1);
+ }
+
+ token = state.push('tr_close', 'tr', -1);
+ token = state.push('thead_close', 'thead', -1);
+
+ token = state.push('tbody_open', 'tbody', 1);
+ token.map = tbodyLines = [ startLine + 2, 0 ];
+
+ for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
+ if (state.sCount[nextLine] < state.blkIndent) { break; }
+
+ lineText = getLine(state, nextLine).trim();
+ if (lineText.indexOf('|') === -1) { break; }
+ if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
+ columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
+
+ token = state.push('tr_open', 'tr', 1);
+ for (i = 0; i < columnCount; i++) {
+ token = state.push('td_open', 'td', 1);
+ if (aligns[i]) {
+ token.attrs = [ [ 'style', 'text-align:' + aligns[i] ] ];
+ }
+
+ token = state.push('inline', '', 0);
+ token.content = columns[i] ? columns[i].trim() : '';
+ token.children = [];
+
+ token = state.push('td_close', 'td', -1);
+ }
+ token = state.push('tr_close', 'tr', -1);
+ }
+ token = state.push('tbody_close', 'tbody', -1);
+ token = state.push('table_close', 'table', -1);
+
+ tableLines[1] = tbodyLines[1] = nextLine;
+ state.line = nextLine;
+ return true;
+};
+
+
+/***/ }),
+/* 73 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Code block (4 spaces padded)
+
+
+
+
+module.exports = function code(state, startLine, endLine/*, silent*/) {
+ var nextLine, last, token;
+
+ if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
+
+ last = nextLine = startLine + 1;
+
+ while (nextLine < endLine) {
+ if (state.isEmpty(nextLine)) {
+ nextLine++;
+ continue;
+ }
+
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ nextLine++;
+ last = nextLine;
+ continue;
+ }
+ break;
+ }
+
+ state.line = last;
+
+ token = state.push('code_block', 'code', 0);
+ token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
+ token.map = [ startLine, state.line ];
+
+ return true;
+};
+
+
+/***/ }),
+/* 74 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// fences (``` lang, ~~~ lang)
+
+
+
+
+module.exports = function fence(state, startLine, endLine, silent) {
+ var marker, len, params, nextLine, mem, token, markup,
+ haveEndMarker = false,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ if (pos + 3 > max) { return false; }
+
+ marker = state.src.charCodeAt(pos);
+
+ if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
+ return false;
+ }
+
+ // scan marker length
+ mem = pos;
+ pos = state.skipChars(pos, marker);
+
+ len = pos - mem;
+
+ if (len < 3) { return false; }
+
+ markup = state.src.slice(mem, pos);
+ params = state.src.slice(pos, max);
+
+ if (marker === 0x60 /* ` */) {
+ if (params.indexOf(String.fromCharCode(marker)) >= 0) {
+ return false;
+ }
+ }
+
+ // Since start is found, we can report success here in validation mode
+ if (silent) { return true; }
+
+ // search end of block
+ nextLine = startLine;
+
+ for (;;) {
+ nextLine++;
+ if (nextLine >= endLine) {
+ // unclosed block should be autoclosed by end of document.
+ // also block seems to be autoclosed by end of parent
+ break;
+ }
+
+ pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+
+ if (pos < max && state.sCount[nextLine] < state.blkIndent) {
+ // non-empty line with negative indent should stop the list:
+ // - ```
+ // test
+ break;
+ }
+
+ if (state.src.charCodeAt(pos) !== marker) { continue; }
+
+ if (state.sCount[nextLine] - state.blkIndent >= 4) {
+ // closing fence should be indented less than 4 spaces
+ continue;
+ }
+
+ pos = state.skipChars(pos, marker);
+
+ // closing code fence must be at least as long as the opening one
+ if (pos - mem < len) { continue; }
+
+ // make sure tail has spaces only
+ pos = state.skipSpaces(pos);
+
+ if (pos < max) { continue; }
+
+ haveEndMarker = true;
+ // found!
+ break;
+ }
+
+ // If a fence has heading spaces, they should be removed from its inner block
+ len = state.sCount[startLine];
+
+ state.line = nextLine + (haveEndMarker ? 1 : 0);
+
+ token = state.push('fence', 'code', 0);
+ token.info = params;
+ token.content = state.getLines(startLine + 1, nextLine, len, true);
+ token.markup = markup;
+ token.map = [ startLine, state.line ];
+
+ return true;
+};
+
+
+/***/ }),
+/* 75 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Block quotes
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function blockquote(state, startLine, endLine, silent) {
+ var adjustTab,
+ ch,
+ i,
+ initial,
+ l,
+ lastLineEmpty,
+ lines,
+ nextLine,
+ offset,
+ oldBMarks,
+ oldBSCount,
+ oldIndent,
+ oldParentType,
+ oldSCount,
+ oldTShift,
+ spaceAfterMarker,
+ terminate,
+ terminatorRules,
+ token,
+ wasOutdented,
+ oldLineMax = state.lineMax,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ // check the block quote marker
+ if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
+
+ // we know that it's going to be a valid blockquote,
+ // so no point trying to find the end of it in silent mode
+ if (silent) { return true; }
+
+ // skip spaces after ">" and re-calculate offset
+ initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
+
+ // skip one optional space after '>'
+ if (state.src.charCodeAt(pos) === 0x20 /* space */) {
+ // ' > test '
+ // ^ -- position start of line here:
+ pos++;
+ initial++;
+ offset++;
+ adjustTab = false;
+ spaceAfterMarker = true;
+ } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
+ spaceAfterMarker = true;
+
+ if ((state.bsCount[startLine] + offset) % 4 === 3) {
+ // ' >\t test '
+ // ^ -- position start of line here (tab has width===1)
+ pos++;
+ initial++;
+ offset++;
+ adjustTab = false;
+ } else {
+ // ' >\t test '
+ // ^ -- position start of line here + shift bsCount slightly
+ // to make extra space appear
+ adjustTab = true;
+ }
+ } else {
+ spaceAfterMarker = false;
+ }
+
+ oldBMarks = [ state.bMarks[startLine] ];
+ state.bMarks[startLine] = pos;
+
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (isSpace(ch)) {
+ if (ch === 0x09) {
+ offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
+ } else {
+ offset++;
+ }
+ } else {
+ break;
+ }
+
+ pos++;
+ }
+
+ oldBSCount = [ state.bsCount[startLine] ];
+ state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
+
+ lastLineEmpty = pos >= max;
+
+ oldSCount = [ state.sCount[startLine] ];
+ state.sCount[startLine] = offset - initial;
+
+ oldTShift = [ state.tShift[startLine] ];
+ state.tShift[startLine] = pos - state.bMarks[startLine];
+
+ terminatorRules = state.md.block.ruler.getRules('blockquote');
+
+ oldParentType = state.parentType;
+ state.parentType = 'blockquote';
+ wasOutdented = false;
+
+ // Search the end of the block
+ //
+ // Block ends with either:
+ // 1. an empty line outside:
+ // ```
+ // > test
+ //
+ // ```
+ // 2. an empty line inside:
+ // ```
+ // >
+ // test
+ // ```
+ // 3. another tag:
+ // ```
+ // > test
+ // - - -
+ // ```
+ for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
+ // check if it's outdented, i.e. it's inside list item and indented
+ // less than said list item:
+ //
+ // ```
+ // 1. anything
+ // > current blockquote
+ // 2. checking this line
+ // ```
+ if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;
+
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+
+ if (pos >= max) {
+ // Case 1: line is not inside the blockquote, and this line is empty.
+ break;
+ }
+
+ if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {
+ // This line is inside the blockquote.
+
+ // skip spaces after ">" and re-calculate offset
+ initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);
+
+ // skip one optional space after '>'
+ if (state.src.charCodeAt(pos) === 0x20 /* space */) {
+ // ' > test '
+ // ^ -- position start of line here:
+ pos++;
+ initial++;
+ offset++;
+ adjustTab = false;
+ spaceAfterMarker = true;
+ } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
+ spaceAfterMarker = true;
+
+ if ((state.bsCount[nextLine] + offset) % 4 === 3) {
+ // ' >\t test '
+ // ^ -- position start of line here (tab has width===1)
+ pos++;
+ initial++;
+ offset++;
+ adjustTab = false;
+ } else {
+ // ' >\t test '
+ // ^ -- position start of line here + shift bsCount slightly
+ // to make extra space appear
+ adjustTab = true;
+ }
+ } else {
+ spaceAfterMarker = false;
+ }
+
+ oldBMarks.push(state.bMarks[nextLine]);
+ state.bMarks[nextLine] = pos;
+
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (isSpace(ch)) {
+ if (ch === 0x09) {
+ offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
+ } else {
+ offset++;
+ }
+ } else {
+ break;
+ }
+
+ pos++;
+ }
+
+ lastLineEmpty = pos >= max;
+
+ oldBSCount.push(state.bsCount[nextLine]);
+ state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
+
+ oldSCount.push(state.sCount[nextLine]);
+ state.sCount[nextLine] = offset - initial;
+
+ oldTShift.push(state.tShift[nextLine]);
+ state.tShift[nextLine] = pos - state.bMarks[nextLine];
+ continue;
+ }
+
+ // Case 2: line is not inside the blockquote, and the last line was empty.
+ if (lastLineEmpty) { break; }
+
+ // Case 3: another tag found.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+
+ if (terminate) {
+ // Quirk to enforce "hard termination mode" for paragraphs;
+ // normally if you call `tokenize(state, startLine, nextLine)`,
+ // paragraphs will look below nextLine for paragraph continuation,
+ // but if blockquote is terminated by another tag, they shouldn't
+ state.lineMax = nextLine;
+
+ if (state.blkIndent !== 0) {
+ // state.blkIndent was non-zero, we now set it to zero,
+ // so we need to re-calculate all offsets to appear as
+ // if indent wasn't changed
+ oldBMarks.push(state.bMarks[nextLine]);
+ oldBSCount.push(state.bsCount[nextLine]);
+ oldTShift.push(state.tShift[nextLine]);
+ oldSCount.push(state.sCount[nextLine]);
+ state.sCount[nextLine] -= state.blkIndent;
+ }
+
+ break;
+ }
+
+ oldBMarks.push(state.bMarks[nextLine]);
+ oldBSCount.push(state.bsCount[nextLine]);
+ oldTShift.push(state.tShift[nextLine]);
+ oldSCount.push(state.sCount[nextLine]);
+
+ // A negative indentation means that this is a paragraph continuation
+ //
+ state.sCount[nextLine] = -1;
+ }
+
+ oldIndent = state.blkIndent;
+ state.blkIndent = 0;
+
+ token = state.push('blockquote_open', 'blockquote', 1);
+ token.markup = '>';
+ token.map = lines = [ startLine, 0 ];
+
+ state.md.block.tokenize(state, startLine, nextLine);
+
+ token = state.push('blockquote_close', 'blockquote', -1);
+ token.markup = '>';
+
+ state.lineMax = oldLineMax;
+ state.parentType = oldParentType;
+ lines[1] = state.line;
+
+ // Restore original tShift; this might not be necessary since the parser
+ // has already been here, but just to make sure we can do that.
+ for (i = 0; i < oldTShift.length; i++) {
+ state.bMarks[i + startLine] = oldBMarks[i];
+ state.tShift[i + startLine] = oldTShift[i];
+ state.sCount[i + startLine] = oldSCount[i];
+ state.bsCount[i + startLine] = oldBSCount[i];
+ }
+ state.blkIndent = oldIndent;
+
+ return true;
+};
+
+
+/***/ }),
+/* 76 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Horizontal rule
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function hr(state, startLine, endLine, silent) {
+ var marker, cnt, ch, token,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ marker = state.src.charCodeAt(pos++);
+
+ // Check hr marker
+ if (marker !== 0x2A/* * */ &&
+ marker !== 0x2D/* - */ &&
+ marker !== 0x5F/* _ */) {
+ return false;
+ }
+
+ // markers can be mixed with spaces, but there should be at least 3 of them
+
+ cnt = 1;
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos++);
+ if (ch !== marker && !isSpace(ch)) { return false; }
+ if (ch === marker) { cnt++; }
+ }
+
+ if (cnt < 3) { return false; }
+
+ if (silent) { return true; }
+
+ state.line = startLine + 1;
+
+ token = state.push('hr', 'hr', 0);
+ token.map = [ startLine, state.line ];
+ token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
+
+ return true;
+};
+
+
+/***/ }),
+/* 77 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Lists
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+// Search `[-+*][\n ]`, returns next pos after marker on success
+// or -1 on fail.
+function skipBulletListMarker(state, startLine) {
+ var marker, pos, max, ch;
+
+ pos = state.bMarks[startLine] + state.tShift[startLine];
+ max = state.eMarks[startLine];
+
+ marker = state.src.charCodeAt(pos++);
+ // Check bullet
+ if (marker !== 0x2A/* * */ &&
+ marker !== 0x2D/* - */ &&
+ marker !== 0x2B/* + */) {
+ return -1;
+ }
+
+ if (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (!isSpace(ch)) {
+ // " -test " - is not a list item
+ return -1;
+ }
+ }
+
+ return pos;
+}
+
+// Search `\d+[.)][\n ]`, returns next pos after marker on success
+// or -1 on fail.
+function skipOrderedListMarker(state, startLine) {
+ var ch,
+ start = state.bMarks[startLine] + state.tShift[startLine],
+ pos = start,
+ max = state.eMarks[startLine];
+
+ // List marker should have at least 2 chars (digit + dot)
+ if (pos + 1 >= max) { return -1; }
+
+ ch = state.src.charCodeAt(pos++);
+
+ if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
+
+ for (;;) {
+ // EOL -> fail
+ if (pos >= max) { return -1; }
+
+ ch = state.src.charCodeAt(pos++);
+
+ if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
+
+ // List marker should have no more than 9 digits
+ // (prevents integer overflow in browsers)
+ if (pos - start >= 10) { return -1; }
+
+ continue;
+ }
+
+ // found valid marker
+ if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
+ break;
+ }
+
+ return -1;
+ }
+
+
+ if (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (!isSpace(ch)) {
+ // " 1.test " - is not a list item
+ return -1;
+ }
+ }
+ return pos;
+}
+
+function markTightParagraphs(state, idx) {
+ var i, l,
+ level = state.level + 2;
+
+ for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
+ if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
+ state.tokens[i + 2].hidden = true;
+ state.tokens[i].hidden = true;
+ i += 2;
+ }
+ }
+}
+
+
+module.exports = function list(state, startLine, endLine, silent) {
+ var ch,
+ contentStart,
+ i,
+ indent,
+ indentAfterMarker,
+ initial,
+ isOrdered,
+ itemLines,
+ l,
+ listLines,
+ listTokIdx,
+ markerCharCode,
+ markerValue,
+ max,
+ nextLine,
+ offset,
+ oldListIndent,
+ oldParentType,
+ oldSCount,
+ oldTShift,
+ oldTight,
+ pos,
+ posAfterMarker,
+ prevEmptyEnd,
+ start,
+ terminate,
+ terminatorRules,
+ token,
+ isTerminatingParagraph = false,
+ tight = true;
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ // Special case:
+ // - item 1
+ // - item 2
+ // - item 3
+ // - item 4
+ // - this one is a paragraph continuation
+ if (state.listIndent >= 0 &&
+ state.sCount[startLine] - state.listIndent >= 4 &&
+ state.sCount[startLine] < state.blkIndent) {
+ return false;
+ }
+
+ // limit conditions when list can interrupt
+ // a paragraph (validation mode only)
+ if (silent && state.parentType === 'paragraph') {
+ // Next list item should still terminate previous list item;
+ //
+ // This code can fail if plugins use blkIndent as well as lists,
+ // but I hope the spec gets fixed long before that happens.
+ //
+ if (state.tShift[startLine] >= state.blkIndent) {
+ isTerminatingParagraph = true;
+ }
+ }
+
+ // Detect list type and position after marker
+ if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
+ isOrdered = true;
+ start = state.bMarks[startLine] + state.tShift[startLine];
+ markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
+
+ // If we're starting a new ordered list right after
+ // a paragraph, it should start with 1.
+ if (isTerminatingParagraph && markerValue !== 1) return false;
+
+ } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
+ isOrdered = false;
+
+ } else {
+ return false;
+ }
+
+ // If we're starting a new unordered list right after
+ // a paragraph, first line should not be empty.
+ if (isTerminatingParagraph) {
+ if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;
+ }
+
+ // We should terminate list on style change. Remember first one to compare.
+ markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
+
+ // For validation mode we can terminate immediately
+ if (silent) { return true; }
+
+ // Start list
+ listTokIdx = state.tokens.length;
+
+ if (isOrdered) {
+ token = state.push('ordered_list_open', 'ol', 1);
+ if (markerValue !== 1) {
+ token.attrs = [ [ 'start', markerValue ] ];
+ }
+
+ } else {
+ token = state.push('bullet_list_open', 'ul', 1);
+ }
+
+ token.map = listLines = [ startLine, 0 ];
+ token.markup = String.fromCharCode(markerCharCode);
+
+ //
+ // Iterate list items
+ //
+
+ nextLine = startLine;
+ prevEmptyEnd = false;
+ terminatorRules = state.md.block.ruler.getRules('list');
+
+ oldParentType = state.parentType;
+ state.parentType = 'list';
+
+ while (nextLine < endLine) {
+ pos = posAfterMarker;
+ max = state.eMarks[nextLine];
+
+ initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
+
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (ch === 0x09) {
+ offset += 4 - (offset + state.bsCount[nextLine]) % 4;
+ } else if (ch === 0x20) {
+ offset++;
+ } else {
+ break;
+ }
+
+ pos++;
+ }
+
+ contentStart = pos;
+
+ if (contentStart >= max) {
+ // trimming space in "- \n 3" case, indent is 1 here
+ indentAfterMarker = 1;
+ } else {
+ indentAfterMarker = offset - initial;
+ }
+
+ // If we have more than 4 spaces, the indent is 1
+ // (the rest is just indented code block)
+ if (indentAfterMarker > 4) { indentAfterMarker = 1; }
+
+ // " - test"
+ // ^^^^^ - calculating total length of this thing
+ indent = initial + indentAfterMarker;
+
+ // Run subparser & write tokens
+ token = state.push('list_item_open', 'li', 1);
+ token.markup = String.fromCharCode(markerCharCode);
+ token.map = itemLines = [ startLine, 0 ];
+
+ // change current state, then restore it after parser subcall
+ oldTight = state.tight;
+ oldTShift = state.tShift[startLine];
+ oldSCount = state.sCount[startLine];
+
+ // - example list
+ // ^ listIndent position will be here
+ // ^ blkIndent position will be here
+ //
+ oldListIndent = state.listIndent;
+ state.listIndent = state.blkIndent;
+ state.blkIndent = indent;
+
+ state.tight = true;
+ state.tShift[startLine] = contentStart - state.bMarks[startLine];
+ state.sCount[startLine] = offset;
+
+ if (contentStart >= max && state.isEmpty(startLine + 1)) {
+ // workaround for this case
+ // (list item is empty, list terminates before "foo"):
+ // ~~~~~~~~
+ // -
+ //
+ // foo
+ // ~~~~~~~~
+ state.line = Math.min(state.line + 2, endLine);
+ } else {
+ state.md.block.tokenize(state, startLine, endLine, true);
+ }
+
+ // If any of list item is tight, mark list as tight
+ if (!state.tight || prevEmptyEnd) {
+ tight = false;
+ }
+ // Item become loose if finish with empty line,
+ // but we should filter last element, because it means list finish
+ prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);
+
+ state.blkIndent = state.listIndent;
+ state.listIndent = oldListIndent;
+ state.tShift[startLine] = oldTShift;
+ state.sCount[startLine] = oldSCount;
+ state.tight = oldTight;
+
+ token = state.push('list_item_close', 'li', -1);
+ token.markup = String.fromCharCode(markerCharCode);
+
+ nextLine = startLine = state.line;
+ itemLines[1] = nextLine;
+ contentStart = state.bMarks[startLine];
+
+ if (nextLine >= endLine) { break; }
+
+ //
+ // Try to check if list is terminated or continued.
+ //
+ if (state.sCount[nextLine] < state.blkIndent) { break; }
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { break; }
+
+ // fail if terminating block found
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+ if (terminate) { break; }
+
+ // fail if list has another type
+ if (isOrdered) {
+ posAfterMarker = skipOrderedListMarker(state, nextLine);
+ if (posAfterMarker < 0) { break; }
+ } else {
+ posAfterMarker = skipBulletListMarker(state, nextLine);
+ if (posAfterMarker < 0) { break; }
+ }
+
+ if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
+ }
+
+ // Finalize list
+ if (isOrdered) {
+ token = state.push('ordered_list_close', 'ol', -1);
+ } else {
+ token = state.push('bullet_list_close', 'ul', -1);
+ }
+ token.markup = String.fromCharCode(markerCharCode);
+
+ listLines[1] = nextLine;
+ state.line = nextLine;
+
+ state.parentType = oldParentType;
+
+ // mark paragraphs tight if needed
+ if (tight) {
+ markTightParagraphs(state, listTokIdx);
+ }
+
+ return true;
+};
+
+
+/***/ }),
+/* 78 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+var normalizeReference = __webpack_require__(42).normalizeReference;
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function reference(state, startLine, _endLine, silent) {
+ var ch,
+ destEndPos,
+ destEndLineNo,
+ endLine,
+ href,
+ i,
+ l,
+ label,
+ labelEnd,
+ oldParentType,
+ res,
+ start,
+ str,
+ terminate,
+ terminatorRules,
+ title,
+ lines = 0,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine],
+ nextLine = startLine + 1;
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
+
+ // Simple check to quickly interrupt scan on [link](url) at the start of line.
+ // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
+ while (++pos < max) {
+ if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
+ state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
+ if (pos + 1 === max) { return false; }
+ if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
+ break;
+ }
+ }
+
+ endLine = state.lineMax;
+
+ // jump line-by-line until empty one or EOF
+ terminatorRules = state.md.block.ruler.getRules('reference');
+
+ oldParentType = state.parentType;
+ state.parentType = 'reference';
+
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) { continue; }
+
+ // Some tags can terminate paragraph without empty line.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+ if (terminate) { break; }
+ }
+
+ str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
+ max = str.length;
+
+ for (pos = 1; pos < max; pos++) {
+ ch = str.charCodeAt(pos);
+ if (ch === 0x5B /* [ */) {
+ return false;
+ } else if (ch === 0x5D /* ] */) {
+ labelEnd = pos;
+ break;
+ } else if (ch === 0x0A /* \n */) {
+ lines++;
+ } else if (ch === 0x5C /* \ */) {
+ pos++;
+ if (pos < max && str.charCodeAt(pos) === 0x0A) {
+ lines++;
+ }
+ }
+ }
+
+ if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
+
+ // [label]: destination 'title'
+ // ^^^ skip optional whitespace here
+ for (pos = labelEnd + 2; pos < max; pos++) {
+ ch = str.charCodeAt(pos);
+ if (ch === 0x0A) {
+ lines++;
+ } else if (isSpace(ch)) {
+ /*eslint no-empty:0*/
+ } else {
+ break;
+ }
+ }
+
+ // [label]: destination 'title'
+ // ^^^^^^^^^^^ parse this
+ res = state.md.helpers.parseLinkDestination(str, pos, max);
+ if (!res.ok) { return false; }
+
+ href = state.md.normalizeLink(res.str);
+ if (!state.md.validateLink(href)) { return false; }
+
+ pos = res.pos;
+ lines += res.lines;
+
+ // save cursor state, we could require to rollback later
+ destEndPos = pos;
+ destEndLineNo = lines;
+
+ // [label]: destination 'title'
+ // ^^^ skipping those spaces
+ start = pos;
+ for (; pos < max; pos++) {
+ ch = str.charCodeAt(pos);
+ if (ch === 0x0A) {
+ lines++;
+ } else if (isSpace(ch)) {
+ /*eslint no-empty:0*/
+ } else {
+ break;
+ }
+ }
+
+ // [label]: destination 'title'
+ // ^^^^^^^ parse this
+ res = state.md.helpers.parseLinkTitle(str, pos, max);
+ if (pos < max && start !== pos && res.ok) {
+ title = res.str;
+ pos = res.pos;
+ lines += res.lines;
+ } else {
+ title = '';
+ pos = destEndPos;
+ lines = destEndLineNo;
+ }
+
+ // skip trailing spaces until the rest of the line
+ while (pos < max) {
+ ch = str.charCodeAt(pos);
+ if (!isSpace(ch)) { break; }
+ pos++;
+ }
+
+ if (pos < max && str.charCodeAt(pos) !== 0x0A) {
+ if (title) {
+ // garbage at the end of the line after title,
+ // but it could still be a valid reference if we roll back
+ title = '';
+ pos = destEndPos;
+ lines = destEndLineNo;
+ while (pos < max) {
+ ch = str.charCodeAt(pos);
+ if (!isSpace(ch)) { break; }
+ pos++;
+ }
+ }
+ }
+
+ if (pos < max && str.charCodeAt(pos) !== 0x0A) {
+ // garbage at the end of the line
+ return false;
+ }
+
+ label = normalizeReference(str.slice(1, labelEnd));
+ if (!label) {
+ // CommonMark 0.20 disallows empty labels
+ return false;
+ }
+
+ // Reference can not terminate anything. This check is for safety only.
+ /*istanbul ignore if*/
+ if (silent) { return true; }
+
+ if (typeof state.env.references === 'undefined') {
+ state.env.references = {};
+ }
+ if (typeof state.env.references[label] === 'undefined') {
+ state.env.references[label] = { title: title, href: href };
+ }
+
+ state.parentType = oldParentType;
+
+ state.line = startLine + lines + 1;
+ return true;
+};
+
+
+/***/ }),
+/* 79 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// heading (#, ##, ...)
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function heading(state, startLine, endLine, silent) {
+ var ch, level, tmp, token,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ ch = state.src.charCodeAt(pos);
+
+ if (ch !== 0x23/* # */ || pos >= max) { return false; }
+
+ // count heading level
+ level = 1;
+ ch = state.src.charCodeAt(++pos);
+ while (ch === 0x23/* # */ && pos < max && level <= 6) {
+ level++;
+ ch = state.src.charCodeAt(++pos);
+ }
+
+ if (level > 6 || (pos < max && !isSpace(ch))) { return false; }
+
+ if (silent) { return true; }
+
+ // Let's cut tails like ' ### ' from the end of string
+
+ max = state.skipSpacesBack(max, pos);
+ tmp = state.skipCharsBack(max, 0x23, pos); // #
+ if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
+ max = tmp;
+ }
+
+ state.line = startLine + 1;
+
+ token = state.push('heading_open', 'h' + String(level), 1);
+ token.markup = '########'.slice(0, level);
+ token.map = [ startLine, state.line ];
+
+ token = state.push('inline', '', 0);
+ token.content = state.src.slice(pos, max).trim();
+ token.map = [ startLine, state.line ];
+ token.children = [];
+
+ token = state.push('heading_close', 'h' + String(level), -1);
+ token.markup = '########'.slice(0, level);
+
+ return true;
+};
+
+
+/***/ }),
+/* 80 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// lheading (---, ===)
+
+
+
+
+module.exports = function lheading(state, startLine, endLine/*, silent*/) {
+ var content, terminate, i, l, token, pos, max, level, marker,
+ nextLine = startLine + 1, oldParentType,
+ terminatorRules = state.md.block.ruler.getRules('paragraph');
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ oldParentType = state.parentType;
+ state.parentType = 'paragraph'; // use paragraph to match terminatorRules
+
+ // jump line-by-line until empty one or EOF
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
+
+ //
+ // Check for underline in setext header
+ //
+ if (state.sCount[nextLine] >= state.blkIndent) {
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+
+ if (pos < max) {
+ marker = state.src.charCodeAt(pos);
+
+ if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {
+ pos = state.skipChars(pos, marker);
+ pos = state.skipSpaces(pos);
+
+ if (pos >= max) {
+ level = (marker === 0x3D/* = */ ? 1 : 2);
+ break;
+ }
+ }
+ }
+ }
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) { continue; }
+
+ // Some tags can terminate paragraph without empty line.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+ if (terminate) { break; }
+ }
+
+ if (!level) {
+ // Didn't find valid underline
+ return false;
+ }
+
+ content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
+
+ state.line = nextLine + 1;
+
+ token = state.push('heading_open', 'h' + String(level), 1);
+ token.markup = String.fromCharCode(marker);
+ token.map = [ startLine, state.line ];
+
+ token = state.push('inline', '', 0);
+ token.content = content;
+ token.map = [ startLine, state.line - 1 ];
+ token.children = [];
+
+ token = state.push('heading_close', 'h' + String(level), -1);
+ token.markup = String.fromCharCode(marker);
+
+ state.parentType = oldParentType;
+
+ return true;
+};
+
+
+/***/ }),
+/* 81 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// HTML block
+
+
+
+
+var block_names = __webpack_require__(82);
+var HTML_OPEN_CLOSE_TAG_RE = __webpack_require__(83).HTML_OPEN_CLOSE_TAG_RE;
+
+// An array of opening and corresponding closing sequences for html tags,
+// last argument defines whether it can terminate a paragraph or not
+//
+var HTML_SEQUENCES = [
+ [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],
+ [ /^<!--/, /-->/, true ],
+ [ /^<\?/, /\?>/, true ],
+ [ /^<![A-Z]/, />/, true ],
+ [ /^<!\[CDATA\[/, /\]\]>/, true ],
+ [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],
+ [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false ]
+];
+
+
+module.exports = function html_block(state, startLine, endLine, silent) {
+ var i, nextLine, token, lineText,
+ pos = state.bMarks[startLine] + state.tShift[startLine],
+ max = state.eMarks[startLine];
+
+ // if it's indented more than 3 spaces, it should be a code block
+ if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
+
+ if (!state.md.options.html) { return false; }
+
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
+
+ lineText = state.src.slice(pos, max);
+
+ for (i = 0; i < HTML_SEQUENCES.length; i++) {
+ if (HTML_SEQUENCES[i][0].test(lineText)) { break; }
+ }
+
+ if (i === HTML_SEQUENCES.length) { return false; }
+
+ if (silent) {
+ // true if this sequence can be a terminator, false otherwise
+ return HTML_SEQUENCES[i][2];
+ }
+
+ nextLine = startLine + 1;
+
+ // If we are here - we detected HTML block.
+ // Let's roll down till block end.
+ if (!HTML_SEQUENCES[i][1].test(lineText)) {
+ for (; nextLine < endLine; nextLine++) {
+ if (state.sCount[nextLine] < state.blkIndent) { break; }
+
+ pos = state.bMarks[nextLine] + state.tShift[nextLine];
+ max = state.eMarks[nextLine];
+ lineText = state.src.slice(pos, max);
+
+ if (HTML_SEQUENCES[i][1].test(lineText)) {
+ if (lineText.length !== 0) { nextLine++; }
+ break;
+ }
+ }
+ }
+
+ state.line = nextLine;
+
+ token = state.push('html_block', '', 0);
+ token.map = [ startLine, nextLine ];
+ token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
+
+ return true;
+};
+
+
+/***/ }),
+/* 82 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// List of valid html blocks names, accorting to commonmark spec
+// http://jgm.github.io/CommonMark/spec.html#html-blocks
+
+
+
+
+module.exports = [
+ 'address',
+ 'article',
+ 'aside',
+ 'base',
+ 'basefont',
+ 'blockquote',
+ 'body',
+ 'caption',
+ 'center',
+ 'col',
+ 'colgroup',
+ 'dd',
+ 'details',
+ 'dialog',
+ 'dir',
+ 'div',
+ 'dl',
+ 'dt',
+ 'fieldset',
+ 'figcaption',
+ 'figure',
+ 'footer',
+ 'form',
+ 'frame',
+ 'frameset',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'head',
+ 'header',
+ 'hr',
+ 'html',
+ 'iframe',
+ 'legend',
+ 'li',
+ 'link',
+ 'main',
+ 'menu',
+ 'menuitem',
+ 'meta',
+ 'nav',
+ 'noframes',
+ 'ol',
+ 'optgroup',
+ 'option',
+ 'p',
+ 'param',
+ 'section',
+ 'source',
+ 'summary',
+ 'table',
+ 'tbody',
+ 'td',
+ 'tfoot',
+ 'th',
+ 'thead',
+ 'title',
+ 'tr',
+ 'track',
+ 'ul'
+];
+
+
+/***/ }),
+/* 83 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Regexps to match html elements
+
+
+
+var attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
+
+var unquoted = '[^"\'=<>`\\x00-\\x20]+';
+var single_quoted = "'[^']*'";
+var double_quoted = '"[^"]*"';
+
+var attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
+
+var attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
+
+var open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
+
+var close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
+var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
+var processing = '<[?].*?[?]>';
+var declaration = '<![A-Z]+\\s+[^>]*>';
+var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
+
+var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
+ '|' + processing + '|' + declaration + '|' + cdata + ')');
+var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
+
+module.exports.HTML_TAG_RE = HTML_TAG_RE;
+module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
+
+
+/***/ }),
+/* 84 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Paragraph
+
+
+
+
+module.exports = function paragraph(state, startLine/*, endLine*/) {
+ var content, terminate, i, l, token, oldParentType,
+ nextLine = startLine + 1,
+ terminatorRules = state.md.block.ruler.getRules('paragraph'),
+ endLine = state.lineMax;
+
+ oldParentType = state.parentType;
+ state.parentType = 'paragraph';
+
+ // jump line-by-line until empty one or EOF
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
+ // this would be a code block normally, but after paragraph
+ // it's considered a lazy continuation regardless of what's there
+ if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
+
+ // quirk for blockquotes, this line should already be checked by that rule
+ if (state.sCount[nextLine] < 0) { continue; }
+
+ // Some tags can terminate paragraph without empty line.
+ terminate = false;
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
+ terminate = true;
+ break;
+ }
+ }
+ if (terminate) { break; }
+ }
+
+ content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
+
+ state.line = nextLine;
+
+ token = state.push('paragraph_open', 'p', 1);
+ token.map = [ startLine, state.line ];
+
+ token = state.push('inline', '', 0);
+ token.content = content;
+ token.map = [ startLine, state.line ];
+ token.children = [];
+
+ token = state.push('paragraph_close', 'p', -1);
+
+ state.parentType = oldParentType;
+
+ return true;
+};
+
+
+/***/ }),
+/* 85 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Parser state class
+
+
+
+var Token = __webpack_require__(70);
+var isSpace = __webpack_require__(42).isSpace;
+
+
+function StateBlock(src, md, env, tokens) {
+ var ch, s, start, pos, len, indent, offset, indent_found;
+
+ this.src = src;
+
+ // link to parser instance
+ this.md = md;
+
+ this.env = env;
+
+ //
+ // Internal state vartiables
+ //
+
+ this.tokens = tokens;
+
+ this.bMarks = []; // line begin offsets for fast jumps
+ this.eMarks = []; // line end offsets for fast jumps
+ this.tShift = []; // offsets of the first non-space characters (tabs not expanded)
+ this.sCount = []; // indents for each line (tabs expanded)
+
+ // An amount of virtual spaces (tabs expanded) between beginning
+ // of each line (bMarks) and real beginning of that line.
+ //
+ // It exists only as a hack because blockquotes override bMarks
+ // losing information in the process.
+ //
+ // It's used only when expanding tabs, you can think about it as
+ // an initial tab length, e.g. bsCount=21 applied to string `\t123`
+ // means first tab should be expanded to 4-21%4 === 3 spaces.
+ //
+ this.bsCount = [];
+
+ // block parser variables
+ this.blkIndent = 0; // required block content indent (for example, if we are
+ // inside a list, it would be positioned after list marker)
+ this.line = 0; // line index in src
+ this.lineMax = 0; // lines count
+ this.tight = false; // loose/tight mode for lists
+ this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
+ this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
+
+ // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
+ // used in lists to determine if they interrupt a paragraph
+ this.parentType = 'root';
+
+ this.level = 0;
+
+ // renderer
+ this.result = '';
+
+ // Create caches
+ // Generate markers.
+ s = this.src;
+ indent_found = false;
+
+ for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {
+ ch = s.charCodeAt(pos);
+
+ if (!indent_found) {
+ if (isSpace(ch)) {
+ indent++;
+
+ if (ch === 0x09) {
+ offset += 4 - offset % 4;
+ } else {
+ offset++;
+ }
+ continue;
+ } else {
+ indent_found = true;
+ }
+ }
+
+ if (ch === 0x0A || pos === len - 1) {
+ if (ch !== 0x0A) { pos++; }
+ this.bMarks.push(start);
+ this.eMarks.push(pos);
+ this.tShift.push(indent);
+ this.sCount.push(offset);
+ this.bsCount.push(0);
+
+ indent_found = false;
+ indent = 0;
+ offset = 0;
+ start = pos + 1;
+ }
+ }
+
+ // Push fake entry to simplify cache bounds checks
+ this.bMarks.push(s.length);
+ this.eMarks.push(s.length);
+ this.tShift.push(0);
+ this.sCount.push(0);
+ this.bsCount.push(0);
+
+ this.lineMax = this.bMarks.length - 1; // don't count last fake line
+}
+
+// Push new token to "stream".
+//
+StateBlock.prototype.push = function (type, tag, nesting) {
+ var token = new Token(type, tag, nesting);
+ token.block = true;
+
+ if (nesting < 0) this.level--; // closing tag
+ token.level = this.level;
+ if (nesting > 0) this.level++; // opening tag
+
+ this.tokens.push(token);
+ return token;
+};
+
+StateBlock.prototype.isEmpty = function isEmpty(line) {
+ return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
+};
+
+StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
+ for (var max = this.lineMax; from < max; from++) {
+ if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
+ break;
+ }
+ }
+ return from;
+};
+
+// Skip spaces from given position.
+StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
+ var ch;
+
+ for (var max = this.src.length; pos < max; pos++) {
+ ch = this.src.charCodeAt(pos);
+ if (!isSpace(ch)) { break; }
+ }
+ return pos;
+};
+
+// Skip spaces from given position in reverse.
+StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
+ if (pos <= min) { return pos; }
+
+ while (pos > min) {
+ if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }
+ }
+ return pos;
+};
+
+// Skip char codes from given position
+StateBlock.prototype.skipChars = function skipChars(pos, code) {
+ for (var max = this.src.length; pos < max; pos++) {
+ if (this.src.charCodeAt(pos) !== code) { break; }
+ }
+ return pos;
+};
+
+// Skip char codes reverse from given position - 1
+StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
+ if (pos <= min) { return pos; }
+
+ while (pos > min) {
+ if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }
+ }
+ return pos;
+};
+
+// cut lines range from source.
+StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
+ var i, lineIndent, ch, first, last, queue, lineStart,
+ line = begin;
+
+ if (begin >= end) {
+ return '';
+ }
+
+ queue = new Array(end - begin);
+
+ for (i = 0; line < end; line++, i++) {
+ lineIndent = 0;
+ lineStart = first = this.bMarks[line];
+
+ if (line + 1 < end || keepLastLF) {
+ // No need for bounds check because we have fake entry on tail.
+ last = this.eMarks[line] + 1;
+ } else {
+ last = this.eMarks[line];
+ }
+
+ while (first < last && lineIndent < indent) {
+ ch = this.src.charCodeAt(first);
+
+ if (isSpace(ch)) {
+ if (ch === 0x09) {
+ lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
+ } else {
+ lineIndent++;
+ }
+ } else if (first - lineStart < this.tShift[line]) {
+ // patched tShift masked characters to look like spaces (blockquotes, list markers)
+ lineIndent++;
+ } else {
+ break;
+ }
+
+ first++;
+ }
+
+ if (lineIndent > indent) {
+ // partially expanding tabs in code blocks, e.g '\t\tfoobar'
+ // with indent=2 becomes ' \tfoobar'
+ queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);
+ } else {
+ queue[i] = this.src.slice(first, last);
+ }
+ }
+
+ return queue.join('');
+};
+
+// re-export Token class to use in block rules
+StateBlock.prototype.Token = Token;
+
+
+module.exports = StateBlock;
+
+
+/***/ }),
+/* 86 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/** internal
+ * class ParserInline
+ *
+ * Tokenizes paragraph content.
+ **/
+
+
+
+var Ruler = __webpack_require__(62);
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Parser rules
+
+var _rules = [
+ [ 'text', __webpack_require__(87) ],
+ [ 'newline', __webpack_require__(88) ],
+ [ 'escape', __webpack_require__(89) ],
+ [ 'backticks', __webpack_require__(90) ],
+ [ 'strikethrough', __webpack_require__(91).tokenize ],
+ [ 'emphasis', __webpack_require__(92).tokenize ],
+ [ 'link', __webpack_require__(93) ],
+ [ 'image', __webpack_require__(94) ],
+ [ 'autolink', __webpack_require__(95) ],
+ [ 'html_inline', __webpack_require__(96) ],
+ [ 'entity', __webpack_require__(97) ]
+];
+
+var _rules2 = [
+ [ 'balance_pairs', __webpack_require__(98) ],
+ [ 'strikethrough', __webpack_require__(91).postProcess ],
+ [ 'emphasis', __webpack_require__(92).postProcess ],
+ [ 'text_collapse', __webpack_require__(99) ]
+];
+
+
+/**
+ * new ParserInline()
+ **/
+function ParserInline() {
+ var i;
+
+ /**
+ * ParserInline#ruler -> Ruler
+ *
+ * [[Ruler]] instance. Keep configuration of inline rules.
+ **/
+ this.ruler = new Ruler();
+
+ for (i = 0; i < _rules.length; i++) {
+ this.ruler.push(_rules[i][0], _rules[i][1]);
+ }
+
+ /**
+ * ParserInline#ruler2 -> Ruler
+ *
+ * [[Ruler]] instance. Second ruler used for post-processing
+ * (e.g. in emphasis-like rules).
+ **/
+ this.ruler2 = new Ruler();
+
+ for (i = 0; i < _rules2.length; i++) {
+ this.ruler2.push(_rules2[i][0], _rules2[i][1]);
+ }
+}
+
+
+// Skip single token by running all rules in validation mode;
+// returns `true` if any rule reported success
+//
+ParserInline.prototype.skipToken = function (state) {
+ var ok, i, pos = state.pos,
+ rules = this.ruler.getRules(''),
+ len = rules.length,
+ maxNesting = state.md.options.maxNesting,
+ cache = state.cache;
+
+
+ if (typeof cache[pos] !== 'undefined') {
+ state.pos = cache[pos];
+ return;
+ }
+
+ if (state.level < maxNesting) {
+ for (i = 0; i < len; i++) {
+ // Increment state.level and decrement it later to limit recursion.
+ // It's harmless to do here, because no tokens are created. But ideally,
+ // we'd need a separate private state variable for this purpose.
+ //
+ state.level++;
+ ok = rules[i](state, true);
+ state.level--;
+
+ if (ok) { break; }
+ }
+ } else {
+ // Too much nesting, just skip until the end of the paragraph.
+ //
+ // NOTE: this will cause links to behave incorrectly in the following case,
+ // when an amount of `[` is exactly equal to `maxNesting + 1`:
+ //
+ // [[[[[[[[[[[[[[[[[[[[[foo]()
+ //
+ // TODO: remove this workaround when CM standard will allow nested links
+ // (we can replace it by preventing links from being parsed in
+ // validation mode)
+ //
+ state.pos = state.posMax;
+ }
+
+ if (!ok) { state.pos++; }
+ cache[pos] = state.pos;
+};
+
+
+// Generate tokens for input range
+//
+ParserInline.prototype.tokenize = function (state) {
+ var ok, i,
+ rules = this.ruler.getRules(''),
+ len = rules.length,
+ end = state.posMax,
+ maxNesting = state.md.options.maxNesting;
+
+ while (state.pos < end) {
+ // Try all possible rules.
+ // On success, rule should:
+ //
+ // - update `state.pos`
+ // - update `state.tokens`
+ // - return true
+
+ if (state.level < maxNesting) {
+ for (i = 0; i < len; i++) {
+ ok = rules[i](state, false);
+ if (ok) { break; }
+ }
+ }
+
+ if (ok) {
+ if (state.pos >= end) { break; }
+ continue;
+ }
+
+ state.pending += state.src[state.pos++];
+ }
+
+ if (state.pending) {
+ state.pushPending();
+ }
+};
+
+
+/**
+ * ParserInline.parse(str, md, env, outTokens)
+ *
+ * Process input string and push inline tokens into `outTokens`
+ **/
+ParserInline.prototype.parse = function (str, md, env, outTokens) {
+ var i, rules, len;
+ var state = new this.State(str, md, env, outTokens);
+
+ this.tokenize(state);
+
+ rules = this.ruler2.getRules('');
+ len = rules.length;
+
+ for (i = 0; i < len; i++) {
+ rules[i](state);
+ }
+};
+
+
+ParserInline.prototype.State = __webpack_require__(100);
+
+
+module.exports = ParserInline;
+
+
+/***/ }),
+/* 87 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Skip text characters for text token, place those to pending buffer
+// and increment current pos
+
+
+
+
+// Rule to skip pure text
+// '{}$%@~+=:' reserved for extentions
+
+// !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
+
+// !!!! Don't confuse with "Markdown ASCII Punctuation" chars
+// http://spec.commonmark.org/0.15/#ascii-punctuation-character
+function isTerminatorChar(ch) {
+ switch (ch) {
+ case 0x0A/* \n */:
+ case 0x21/* ! */:
+ case 0x23/* # */:
+ case 0x24/* $ */:
+ case 0x25/* % */:
+ case 0x26/* & */:
+ case 0x2A/* * */:
+ case 0x2B/* + */:
+ case 0x2D/* - */:
+ case 0x3A/* : */:
+ case 0x3C/* < */:
+ case 0x3D/* = */:
+ case 0x3E/* > */:
+ case 0x40/* @ */:
+ case 0x5B/* [ */:
+ case 0x5C/* \ */:
+ case 0x5D/* ] */:
+ case 0x5E/* ^ */:
+ case 0x5F/* _ */:
+ case 0x60/* ` */:
+ case 0x7B/* { */:
+ case 0x7D/* } */:
+ case 0x7E/* ~ */:
+ return true;
+ default:
+ return false;
+ }
+}
+
+module.exports = function text(state, silent) {
+ var pos = state.pos;
+
+ while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
+ pos++;
+ }
+
+ if (pos === state.pos) { return false; }
+
+ if (!silent) { state.pending += state.src.slice(state.pos, pos); }
+
+ state.pos = pos;
+
+ return true;
+};
+
+// Alternative implementation, for memory.
+//
+// It costs 10% of performance, but allows extend terminators list, if place it
+// to `ParcerInline` property. Probably, will switch to it sometime, such
+// flexibility required.
+
+/*
+var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
+
+module.exports = function text(state, silent) {
+ var pos = state.pos,
+ idx = state.src.slice(pos).search(TERMINATOR_RE);
+
+ // first char is terminator -> empty text
+ if (idx === 0) { return false; }
+
+ // no terminator -> text till end of string
+ if (idx < 0) {
+ if (!silent) { state.pending += state.src.slice(pos); }
+ state.pos = state.src.length;
+ return true;
+ }
+
+ if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
+
+ state.pos += idx;
+
+ return true;
+};*/
+
+
+/***/ }),
+/* 88 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Proceess '\n'
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function newline(state, silent) {
+ var pmax, max, pos = state.pos;
+
+ if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
+
+ pmax = state.pending.length - 1;
+ max = state.posMax;
+
+ // ' \n' -> hardbreak
+ // Lookup in pending chars is bad practice! Don't copy to other rules!
+ // Pending string is stored in concat mode, indexed lookups will cause
+ // convertion to flat mode.
+ if (!silent) {
+ if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
+ if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
+ state.pending = state.pending.replace(/ +$/, '');
+ state.push('hardbreak', 'br', 0);
+ } else {
+ state.pending = state.pending.slice(0, -1);
+ state.push('softbreak', 'br', 0);
+ }
+
+ } else {
+ state.push('softbreak', 'br', 0);
+ }
+ }
+
+ pos++;
+
+ // skip heading spaces for next line
+ while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
+
+ state.pos = pos;
+ return true;
+};
+
+
+/***/ }),
+/* 89 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process escaped chars and hardbreaks
+
+
+
+var isSpace = __webpack_require__(42).isSpace;
+
+var ESCAPED = [];
+
+for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
+
+'\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
+ .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
+
+
+module.exports = function escape(state, silent) {
+ var ch, pos = state.pos, max = state.posMax;
+
+ if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
+
+ pos++;
+
+ if (pos < max) {
+ ch = state.src.charCodeAt(pos);
+
+ if (ch < 256 && ESCAPED[ch] !== 0) {
+ if (!silent) { state.pending += state.src[pos]; }
+ state.pos += 2;
+ return true;
+ }
+
+ if (ch === 0x0A) {
+ if (!silent) {
+ state.push('hardbreak', 'br', 0);
+ }
+
+ pos++;
+ // skip leading whitespaces from next line
+ while (pos < max) {
+ ch = state.src.charCodeAt(pos);
+ if (!isSpace(ch)) { break; }
+ pos++;
+ }
+
+ state.pos = pos;
+ return true;
+ }
+ }
+
+ if (!silent) { state.pending += '\\'; }
+ state.pos++;
+ return true;
+};
+
+
+/***/ }),
+/* 90 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Parse backticks
+
+
+
+module.exports = function backtick(state, silent) {
+ var start, max, marker, matchStart, matchEnd, token,
+ pos = state.pos,
+ ch = state.src.charCodeAt(pos);
+
+ if (ch !== 0x60/* ` */) { return false; }
+
+ start = pos;
+ pos++;
+ max = state.posMax;
+
+ while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
+
+ marker = state.src.slice(start, pos);
+
+ matchStart = matchEnd = pos;
+
+ while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
+ matchEnd = matchStart + 1;
+
+ while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }
+
+ if (matchEnd - matchStart === marker.length) {
+ if (!silent) {
+ token = state.push('code_inline', 'code', 0);
+ token.markup = marker;
+ token.content = state.src.slice(pos, matchStart)
+ .replace(/\n/g, ' ')
+ .replace(/^ (.+) $/, '$1');
+ }
+ state.pos = matchEnd;
+ return true;
+ }
+ }
+
+ if (!silent) { state.pending += marker; }
+ state.pos += marker.length;
+ return true;
+};
+
+
+/***/ }),
+/* 91 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// ~~strike through~~
+//
+
+
+
+// Insert each marker as a separate text token, and add it to delimiter list
+//
+module.exports.tokenize = function strikethrough(state, silent) {
+ var i, scanned, token, len, ch,
+ start = state.pos,
+ marker = state.src.charCodeAt(start);
+
+ if (silent) { return false; }
+
+ if (marker !== 0x7E/* ~ */) { return false; }
+
+ scanned = state.scanDelims(state.pos, true);
+ len = scanned.length;
+ ch = String.fromCharCode(marker);
+
+ if (len < 2) { return false; }
+
+ if (len % 2) {
+ token = state.push('text', '', 0);
+ token.content = ch;
+ len--;
+ }
+
+ for (i = 0; i < len; i += 2) {
+ token = state.push('text', '', 0);
+ token.content = ch + ch;
+
+ state.delimiters.push({
+ marker: marker,
+ length: 0, // disable "rule of 3" length checks meant for emphasis
+ jump: i,
+ token: state.tokens.length - 1,
+ end: -1,
+ open: scanned.can_open,
+ close: scanned.can_close
+ });
+ }
+
+ state.pos += scanned.length;
+
+ return true;
+};
+
+
+function postProcess(state, delimiters) {
+ var i, j,
+ startDelim,
+ endDelim,
+ token,
+ loneMarkers = [],
+ max = delimiters.length;
+
+ for (i = 0; i < max; i++) {
+ startDelim = delimiters[i];
+
+ if (startDelim.marker !== 0x7E/* ~ */) {
+ continue;
+ }
+
+ if (startDelim.end === -1) {
+ continue;
+ }
+
+ endDelim = delimiters[startDelim.end];
+
+ token = state.tokens[startDelim.token];
+ token.type = 's_open';
+ token.tag = 's';
+ token.nesting = 1;
+ token.markup = '~~';
+ token.content = '';
+
+ token = state.tokens[endDelim.token];
+ token.type = 's_close';
+ token.tag = 's';
+ token.nesting = -1;
+ token.markup = '~~';
+ token.content = '';
+
+ if (state.tokens[endDelim.token - 1].type === 'text' &&
+ state.tokens[endDelim.token - 1].content === '~') {
+
+ loneMarkers.push(endDelim.token - 1);
+ }
+ }
+
+ // If a marker sequence has an odd number of characters, it's splitted
+ // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
+ // start of the sequence.
+ //
+ // So, we have to move all those markers after subsequent s_close tags.
+ //
+ while (loneMarkers.length) {
+ i = loneMarkers.pop();
+ j = i + 1;
+
+ while (j < state.tokens.length && state.tokens[j].type === 's_close') {
+ j++;
+ }
+
+ j--;
+
+ if (i !== j) {
+ token = state.tokens[j];
+ state.tokens[j] = state.tokens[i];
+ state.tokens[i] = token;
+ }
+ }
+}
+
+
+// Walk through delimiter list and replace text tokens with tags
+//
+module.exports.postProcess = function strikethrough(state) {
+ var curr,
+ tokens_meta = state.tokens_meta,
+ max = state.tokens_meta.length;
+
+ postProcess(state, state.delimiters);
+
+ for (curr = 0; curr < max; curr++) {
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
+ postProcess(state, tokens_meta[curr].delimiters);
+ }
+ }
+};
+
+
+/***/ }),
+/* 92 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process *this* and _that_
+//
+
+
+
+// Insert each marker as a separate text token, and add it to delimiter list
+//
+module.exports.tokenize = function emphasis(state, silent) {
+ var i, scanned, token,
+ start = state.pos,
+ marker = state.src.charCodeAt(start);
+
+ if (silent) { return false; }
+
+ if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
+
+ scanned = state.scanDelims(state.pos, marker === 0x2A);
+
+ for (i = 0; i < scanned.length; i++) {
+ token = state.push('text', '', 0);
+ token.content = String.fromCharCode(marker);
+
+ state.delimiters.push({
+ // Char code of the starting marker (number).
+ //
+ marker: marker,
+
+ // Total length of these series of delimiters.
+ //
+ length: scanned.length,
+
+ // An amount of characters before this one that's equivalent to
+ // current one. In plain English: if this delimiter does not open
+ // an emphasis, neither do previous `jump` characters.
+ //
+ // Used to skip sequences like "*****" in one step, for 1st asterisk
+ // value will be 0, for 2nd it's 1 and so on.
+ //
+ jump: i,
+
+ // A position of the token this delimiter corresponds to.
+ //
+ token: state.tokens.length - 1,
+
+ // If this delimiter is matched as a valid opener, `end` will be
+ // equal to its position, otherwise it's `-1`.
+ //
+ end: -1,
+
+ // Boolean flags that determine if this delimiter could open or close
+ // an emphasis.
+ //
+ open: scanned.can_open,
+ close: scanned.can_close
+ });
+ }
+
+ state.pos += scanned.length;
+
+ return true;
+};
+
+
+function postProcess(state, delimiters) {
+ var i,
+ startDelim,
+ endDelim,
+ token,
+ ch,
+ isStrong,
+ max = delimiters.length;
+
+ for (i = max - 1; i >= 0; i--) {
+ startDelim = delimiters[i];
+
+ if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
+ continue;
+ }
+
+ // Process only opening markers
+ if (startDelim.end === -1) {
+ continue;
+ }
+
+ endDelim = delimiters[startDelim.end];
+
+ // If the previous delimiter has the same marker and is adjacent to this one,
+ // merge those into one strong delimiter.
+ //
+ // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
+ //
+ isStrong = i > 0 &&
+ delimiters[i - 1].end === startDelim.end + 1 &&
+ delimiters[i - 1].token === startDelim.token - 1 &&
+ delimiters[startDelim.end + 1].token === endDelim.token + 1 &&
+ delimiters[i - 1].marker === startDelim.marker;
+
+ ch = String.fromCharCode(startDelim.marker);
+
+ token = state.tokens[startDelim.token];
+ token.type = isStrong ? 'strong_open' : 'em_open';
+ token.tag = isStrong ? 'strong' : 'em';
+ token.nesting = 1;
+ token.markup = isStrong ? ch + ch : ch;
+ token.content = '';
+
+ token = state.tokens[endDelim.token];
+ token.type = isStrong ? 'strong_close' : 'em_close';
+ token.tag = isStrong ? 'strong' : 'em';
+ token.nesting = -1;
+ token.markup = isStrong ? ch + ch : ch;
+ token.content = '';
+
+ if (isStrong) {
+ state.tokens[delimiters[i - 1].token].content = '';
+ state.tokens[delimiters[startDelim.end + 1].token].content = '';
+ i--;
+ }
+ }
+}
+
+
+// Walk through delimiter list and replace text tokens with tags
+//
+module.exports.postProcess = function emphasis(state) {
+ var curr,
+ tokens_meta = state.tokens_meta,
+ max = state.tokens_meta.length;
+
+ postProcess(state, state.delimiters);
+
+ for (curr = 0; curr < max; curr++) {
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
+ postProcess(state, tokens_meta[curr].delimiters);
+ }
+ }
+};
+
+
+/***/ }),
+/* 93 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process [link](<to> "stuff")
+
+
+
+var normalizeReference = __webpack_require__(42).normalizeReference;
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function link(state, silent) {
+ var attrs,
+ code,
+ label,
+ labelEnd,
+ labelStart,
+ pos,
+ res,
+ ref,
+ title,
+ token,
+ href = '',
+ oldPos = state.pos,
+ max = state.posMax,
+ start = state.pos,
+ parseReference = true;
+
+ if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
+
+ labelStart = state.pos + 1;
+ labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
+
+ // parser failed to find ']', so it's not a valid link
+ if (labelEnd < 0) { return false; }
+
+ pos = labelEnd + 1;
+ if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
+ //
+ // Inline link
+ //
+
+ // might have found a valid shortcut link, disable reference parsing
+ parseReference = false;
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ pos++;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+ if (pos >= max) { return false; }
+
+ // [link]( <href> "title" )
+ // ^^^^^^ parsing link destination
+ start = pos;
+ res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
+ if (res.ok) {
+ href = state.md.normalizeLink(res.str);
+ if (state.md.validateLink(href)) {
+ pos = res.pos;
+ } else {
+ href = '';
+ }
+ }
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ start = pos;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+
+ // [link]( <href> "title" )
+ // ^^^^^^^ parsing link title
+ res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
+ if (pos < max && start !== pos && res.ok) {
+ title = res.str;
+ pos = res.pos;
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+ } else {
+ title = '';
+ }
+
+ if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
+ // parsing a valid shortcut link failed, fallback to reference
+ parseReference = true;
+ }
+ pos++;
+ }
+
+ if (parseReference) {
+ //
+ // Link reference
+ //
+ if (typeof state.env.references === 'undefined') { return false; }
+
+ if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
+ start = pos + 1;
+ pos = state.md.helpers.parseLinkLabel(state, pos);
+ if (pos >= 0) {
+ label = state.src.slice(start, pos++);
+ } else {
+ pos = labelEnd + 1;
+ }
+ } else {
+ pos = labelEnd + 1;
+ }
+
+ // covers label === '' and label === undefined
+ // (collapsed reference link and shortcut reference link respectively)
+ if (!label) { label = state.src.slice(labelStart, labelEnd); }
+
+ ref = state.env.references[normalizeReference(label)];
+ if (!ref) {
+ state.pos = oldPos;
+ return false;
+ }
+ href = ref.href;
+ title = ref.title;
+ }
+
+ //
+ // We found the end of the link, and know for a fact it's a valid link;
+ // so all that's left to do is to call tokenizer.
+ //
+ if (!silent) {
+ state.pos = labelStart;
+ state.posMax = labelEnd;
+
+ token = state.push('link_open', 'a', 1);
+ token.attrs = attrs = [ [ 'href', href ] ];
+ if (title) {
+ attrs.push([ 'title', title ]);
+ }
+
+ state.md.inline.tokenize(state);
+
+ token = state.push('link_close', 'a', -1);
+ }
+
+ state.pos = pos;
+ state.posMax = max;
+ return true;
+};
+
+
+/***/ }),
+/* 94 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process ![image](<src> "title")
+
+
+
+var normalizeReference = __webpack_require__(42).normalizeReference;
+var isSpace = __webpack_require__(42).isSpace;
+
+
+module.exports = function image(state, silent) {
+ var attrs,
+ code,
+ content,
+ label,
+ labelEnd,
+ labelStart,
+ pos,
+ ref,
+ res,
+ title,
+ token,
+ tokens,
+ start,
+ href = '',
+ oldPos = state.pos,
+ max = state.posMax;
+
+ if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
+ if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
+
+ labelStart = state.pos + 2;
+ labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
+
+ // parser failed to find ']', so it's not a valid link
+ if (labelEnd < 0) { return false; }
+
+ pos = labelEnd + 1;
+ if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
+ //
+ // Inline link
+ //
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ pos++;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+ if (pos >= max) { return false; }
+
+ // [link]( <href> "title" )
+ // ^^^^^^ parsing link destination
+ start = pos;
+ res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
+ if (res.ok) {
+ href = state.md.normalizeLink(res.str);
+ if (state.md.validateLink(href)) {
+ pos = res.pos;
+ } else {
+ href = '';
+ }
+ }
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ start = pos;
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+
+ // [link]( <href> "title" )
+ // ^^^^^^^ parsing link title
+ res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
+ if (pos < max && start !== pos && res.ok) {
+ title = res.str;
+ pos = res.pos;
+
+ // [link]( <href> "title" )
+ // ^^ skipping these spaces
+ for (; pos < max; pos++) {
+ code = state.src.charCodeAt(pos);
+ if (!isSpace(code) && code !== 0x0A) { break; }
+ }
+ } else {
+ title = '';
+ }
+
+ if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
+ state.pos = oldPos;
+ return false;
+ }
+ pos++;
+ } else {
+ //
+ // Link reference
+ //
+ if (typeof state.env.references === 'undefined') { return false; }
+
+ if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
+ start = pos + 1;
+ pos = state.md.helpers.parseLinkLabel(state, pos);
+ if (pos >= 0) {
+ label = state.src.slice(start, pos++);
+ } else {
+ pos = labelEnd + 1;
+ }
+ } else {
+ pos = labelEnd + 1;
+ }
+
+ // covers label === '' and label === undefined
+ // (collapsed reference link and shortcut reference link respectively)
+ if (!label) { label = state.src.slice(labelStart, labelEnd); }
+
+ ref = state.env.references[normalizeReference(label)];
+ if (!ref) {
+ state.pos = oldPos;
+ return false;
+ }
+ href = ref.href;
+ title = ref.title;
+ }
+
+ //
+ // We found the end of the link, and know for a fact it's a valid link;
+ // so all that's left to do is to call tokenizer.
+ //
+ if (!silent) {
+ content = state.src.slice(labelStart, labelEnd);
+
+ state.md.inline.parse(
+ content,
+ state.md,
+ state.env,
+ tokens = []
+ );
+
+ token = state.push('image', 'img', 0);
+ token.attrs = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
+ token.children = tokens;
+ token.content = content;
+
+ if (title) {
+ attrs.push([ 'title', title ]);
+ }
+ }
+
+ state.pos = pos;
+ state.posMax = max;
+ return true;
+};
+
+
+/***/ }),
+/* 95 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process autolinks '<protocol:...>'
+
+
+
+
+/*eslint max-len:0*/
+var EMAIL_RE = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
+var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
+
+
+module.exports = function autolink(state, silent) {
+ var tail, linkMatch, emailMatch, url, fullUrl, token,
+ pos = state.pos;
+
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
+
+ tail = state.src.slice(pos);
+
+ if (tail.indexOf('>') < 0) { return false; }
+
+ if (AUTOLINK_RE.test(tail)) {
+ linkMatch = tail.match(AUTOLINK_RE);
+
+ url = linkMatch[0].slice(1, -1);
+ fullUrl = state.md.normalizeLink(url);
+ if (!state.md.validateLink(fullUrl)) { return false; }
+
+ if (!silent) {
+ token = state.push('link_open', 'a', 1);
+ token.attrs = [ [ 'href', fullUrl ] ];
+ token.markup = 'autolink';
+ token.info = 'auto';
+
+ token = state.push('text', '', 0);
+ token.content = state.md.normalizeLinkText(url);
+
+ token = state.push('link_close', 'a', -1);
+ token.markup = 'autolink';
+ token.info = 'auto';
+ }
+
+ state.pos += linkMatch[0].length;
+ return true;
+ }
+
+ if (EMAIL_RE.test(tail)) {
+ emailMatch = tail.match(EMAIL_RE);
+
+ url = emailMatch[0].slice(1, -1);
+ fullUrl = state.md.normalizeLink('mailto:' + url);
+ if (!state.md.validateLink(fullUrl)) { return false; }
+
+ if (!silent) {
+ token = state.push('link_open', 'a', 1);
+ token.attrs = [ [ 'href', fullUrl ] ];
+ token.markup = 'autolink';
+ token.info = 'auto';
+
+ token = state.push('text', '', 0);
+ token.content = state.md.normalizeLinkText(url);
+
+ token = state.push('link_close', 'a', -1);
+ token.markup = 'autolink';
+ token.info = 'auto';
+ }
+
+ state.pos += emailMatch[0].length;
+ return true;
+ }
+
+ return false;
+};
+
+
+/***/ }),
+/* 96 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process html tags
+
+
+
+
+var HTML_TAG_RE = __webpack_require__(83).HTML_TAG_RE;
+
+
+function isLetter(ch) {
+ /*eslint no-bitwise:0*/
+ var lc = ch | 0x20; // to lower case
+ return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
+}
+
+
+module.exports = function html_inline(state, silent) {
+ var ch, match, max, token,
+ pos = state.pos;
+
+ if (!state.md.options.html) { return false; }
+
+ // Check start
+ max = state.posMax;
+ if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
+ pos + 2 >= max) {
+ return false;
+ }
+
+ // Quick fail on second char
+ ch = state.src.charCodeAt(pos + 1);
+ if (ch !== 0x21/* ! */ &&
+ ch !== 0x3F/* ? */ &&
+ ch !== 0x2F/* / */ &&
+ !isLetter(ch)) {
+ return false;
+ }
+
+ match = state.src.slice(pos).match(HTML_TAG_RE);
+ if (!match) { return false; }
+
+ if (!silent) {
+ token = state.push('html_inline', '', 0);
+ token.content = state.src.slice(pos, pos + match[0].length);
+ }
+ state.pos += match[0].length;
+ return true;
+};
+
+
+/***/ }),
+/* 97 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Process html entity - {, ¯, ", ...
+
+
+
+var entities = __webpack_require__(43);
+var has = __webpack_require__(42).has;
+var isValidEntityCode = __webpack_require__(42).isValidEntityCode;
+var fromCodePoint = __webpack_require__(42).fromCodePoint;
+
+
+var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
+var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
+
+
+module.exports = function entity(state, silent) {
+ var ch, code, match, pos = state.pos, max = state.posMax;
+
+ if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
+
+ if (pos + 1 < max) {
+ ch = state.src.charCodeAt(pos + 1);
+
+ if (ch === 0x23 /* # */) {
+ match = state.src.slice(pos).match(DIGITAL_RE);
+ if (match) {
+ if (!silent) {
+ code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
+ state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
+ }
+ state.pos += match[0].length;
+ return true;
+ }
+ } else {
+ match = state.src.slice(pos).match(NAMED_RE);
+ if (match) {
+ if (has(entities, match[1])) {
+ if (!silent) { state.pending += entities[match[1]]; }
+ state.pos += match[0].length;
+ return true;
+ }
+ }
+ }
+ }
+
+ if (!silent) { state.pending += '&'; }
+ state.pos++;
+ return true;
+};
+
+
+/***/ }),
+/* 98 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// For each opening emphasis-like marker find a matching closing one
+//
+
+
+
+function processDelimiters(state, delimiters) {
+ var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx,
+ isOddMatch, lastJump,
+ openersBottom = {},
+ max = delimiters.length;
+
+ for (closerIdx = 0; closerIdx < max; closerIdx++) {
+ closer = delimiters[closerIdx];
+
+ // Length is only used for emphasis-specific "rule of 3",
+ // if it's not defined (in strikethrough or 3rd party plugins),
+ // we can default it to 0 to disable those checks.
+ //
+ closer.length = closer.length || 0;
+
+ if (!closer.close) continue;
+
+ // Previously calculated lower bounds (previous fails)
+ // for each marker and each delimiter length modulo 3.
+ if (!openersBottom.hasOwnProperty(closer.marker)) {
+ openersBottom[closer.marker] = [ -1, -1, -1 ];
+ }
+
+ minOpenerIdx = openersBottom[closer.marker][closer.length % 3];
+ newMinOpenerIdx = -1;
+
+ openerIdx = closerIdx - closer.jump - 1;
+
+ for (; openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
+ opener = delimiters[openerIdx];
+
+ if (opener.marker !== closer.marker) continue;
+
+ if (newMinOpenerIdx === -1) newMinOpenerIdx = openerIdx;
+
+ if (opener.open &&
+ opener.end < 0 &&
+ opener.level === closer.level) {
+
+ isOddMatch = false;
+
+ // from spec:
+ //
+ // If one of the delimiters can both open and close emphasis, then the
+ // sum of the lengths of the delimiter runs containing the opening and
+ // closing delimiters must not be a multiple of 3 unless both lengths
+ // are multiples of 3.
+ //
+ if (opener.close || closer.open) {
+ if ((opener.length + closer.length) % 3 === 0) {
+ if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
+ isOddMatch = true;
+ }
+ }
+ }
+
+ if (!isOddMatch) {
+ // If previous delimiter cannot be an opener, we can safely skip
+ // the entire sequence in future checks. This is required to make
+ // sure algorithm has linear complexity (see *_*_*_*_*_... case).
+ //
+ lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?
+ delimiters[openerIdx - 1].jump + 1 :
+ 0;
+
+ closer.jump = closerIdx - openerIdx + lastJump;
+ closer.open = false;
+ opener.end = closerIdx;
+ opener.jump = lastJump;
+ opener.close = false;
+ newMinOpenerIdx = -1;
+ break;
+ }
+ }
+ }
+
+ if (newMinOpenerIdx !== -1) {
+ // If match for this delimiter run failed, we want to set lower bound for
+ // future lookups. This is required to make sure algorithm has linear
+ // complexity.
+ //
+ // See details here:
+ // https://github.com/commonmark/cmark/issues/178#issuecomment-270417442
+ //
+ openersBottom[closer.marker][(closer.length || 0) % 3] = newMinOpenerIdx;
+ }
+ }
+}
+
+
+module.exports = function link_pairs(state) {
+ var curr,
+ tokens_meta = state.tokens_meta,
+ max = state.tokens_meta.length;
+
+ processDelimiters(state, state.delimiters);
+
+ for (curr = 0; curr < max; curr++) {
+ if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
+ processDelimiters(state, tokens_meta[curr].delimiters);
+ }
+ }
+};
+
+
+/***/ }),
+/* 99 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Clean up tokens after emphasis and strikethrough postprocessing:
+// merge adjacent text nodes into one and re-calculate all token levels
+//
+// This is necessary because initially emphasis delimiter markers (*, _, ~)
+// are treated as their own separate text tokens. Then emphasis rule either
+// leaves them as text (needed to merge with adjacent text) or turns them
+// into opening/closing tags (which messes up levels inside).
+//
+
+
+
+module.exports = function text_collapse(state) {
+ var curr, last,
+ level = 0,
+ tokens = state.tokens,
+ max = state.tokens.length;
+
+ for (curr = last = 0; curr < max; curr++) {
+ // re-calculate levels after emphasis/strikethrough turns some text nodes
+ // into opening/closing tags
+ if (tokens[curr].nesting < 0) level--; // closing tag
+ tokens[curr].level = level;
+ if (tokens[curr].nesting > 0) level++; // opening tag
+
+ if (tokens[curr].type === 'text' &&
+ curr + 1 < max &&
+ tokens[curr + 1].type === 'text') {
+
+ // collapse two adjacent text nodes
+ tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
+ } else {
+ if (curr !== last) { tokens[last] = tokens[curr]; }
+
+ last++;
+ }
+ }
+
+ if (curr !== last) {
+ tokens.length = last;
+ }
+};
+
+
+/***/ }),
+/* 100 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Inline parser state
+
+
+
+
+var Token = __webpack_require__(70);
+var isWhiteSpace = __webpack_require__(42).isWhiteSpace;
+var isPunctChar = __webpack_require__(42).isPunctChar;
+var isMdAsciiPunct = __webpack_require__(42).isMdAsciiPunct;
+
+
+function StateInline(src, md, env, outTokens) {
+ this.src = src;
+ this.env = env;
+ this.md = md;
+ this.tokens = outTokens;
+ this.tokens_meta = Array(outTokens.length);
+
+ this.pos = 0;
+ this.posMax = this.src.length;
+ this.level = 0;
+ this.pending = '';
+ this.pendingLevel = 0;
+
+ // Stores { start: end } pairs. Useful for backtrack
+ // optimization of pairs parse (emphasis, strikes).
+ this.cache = {};
+
+ // List of emphasis-like delimiters for current tag
+ this.delimiters = [];
+
+ // Stack of delimiter lists for upper level tags
+ this._prev_delimiters = [];
+}
+
+
+// Flush pending text
+//
+StateInline.prototype.pushPending = function () {
+ var token = new Token('text', '', 0);
+ token.content = this.pending;
+ token.level = this.pendingLevel;
+ this.tokens.push(token);
+ this.pending = '';
+ return token;
+};
+
+
+// Push new token to "stream".
+// If pending text exists - flush it as text token
+//
+StateInline.prototype.push = function (type, tag, nesting) {
+ if (this.pending) {
+ this.pushPending();
+ }
+
+ var token = new Token(type, tag, nesting);
+ var token_meta = null;
+
+ if (nesting < 0) {
+ // closing tag
+ this.level--;
+ this.delimiters = this._prev_delimiters.pop();
+ }
+
+ token.level = this.level;
+
+ if (nesting > 0) {
+ // opening tag
+ this.level++;
+ this._prev_delimiters.push(this.delimiters);
+ this.delimiters = [];
+ token_meta = { delimiters: this.delimiters };
+ }
+
+ this.pendingLevel = this.level;
+ this.tokens.push(token);
+ this.tokens_meta.push(token_meta);
+ return token;
+};
+
+
+// Scan a sequence of emphasis-like markers, and determine whether
+// it can start an emphasis sequence or end an emphasis sequence.
+//
+// - start - position to scan from (it should point at a valid marker);
+// - canSplitWord - determine if these markers can be found inside a word
+//
+StateInline.prototype.scanDelims = function (start, canSplitWord) {
+ var pos = start, lastChar, nextChar, count, can_open, can_close,
+ isLastWhiteSpace, isLastPunctChar,
+ isNextWhiteSpace, isNextPunctChar,
+ left_flanking = true,
+ right_flanking = true,
+ max = this.posMax,
+ marker = this.src.charCodeAt(start);
+
+ // treat beginning of the line as a whitespace
+ lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
+
+ while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
+
+ count = pos - start;
+
+ // treat end of the line as a whitespace
+ nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
+
+ isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
+ isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
+
+ isLastWhiteSpace = isWhiteSpace(lastChar);
+ isNextWhiteSpace = isWhiteSpace(nextChar);
+
+ if (isNextWhiteSpace) {
+ left_flanking = false;
+ } else if (isNextPunctChar) {
+ if (!(isLastWhiteSpace || isLastPunctChar)) {
+ left_flanking = false;
+ }
+ }
+
+ if (isLastWhiteSpace) {
+ right_flanking = false;
+ } else if (isLastPunctChar) {
+ if (!(isNextWhiteSpace || isNextPunctChar)) {
+ right_flanking = false;
+ }
+ }
+
+ if (!canSplitWord) {
+ can_open = left_flanking && (!right_flanking || isLastPunctChar);
+ can_close = right_flanking && (!left_flanking || isNextPunctChar);
+ } else {
+ can_open = left_flanking;
+ can_close = right_flanking;
+ }
+
+ return {
+ can_open: can_open,
+ can_close: can_close,
+ length: count
+ };
+};
+
+
+// re-export Token class to use in block rules
+StateInline.prototype.Token = Token;
+
+
+module.exports = StateInline;
+
+
+/***/ }),
+/* 101 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Helpers
+
+// Merge objects
+//
+function assign(obj /*from1, from2, from3, ...*/) {
+ var sources = Array.prototype.slice.call(arguments, 1);
+
+ sources.forEach(function (source) {
+ if (!source) { return; }
+
+ Object.keys(source).forEach(function (key) {
+ obj[key] = source[key];
+ });
+ });
+
+ return obj;
+}
+
+function _class(obj) { return Object.prototype.toString.call(obj); }
+function isString(obj) { return _class(obj) === '[object String]'; }
+function isObject(obj) { return _class(obj) === '[object Object]'; }
+function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }
+function isFunction(obj) { return _class(obj) === '[object Function]'; }
+
+
+function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+var defaultOptions = {
+ fuzzyLink: true,
+ fuzzyEmail: true,
+ fuzzyIP: false
+};
+
+
+function isOptionsObj(obj) {
+ return Object.keys(obj || {}).reduce(function (acc, k) {
+ return acc || defaultOptions.hasOwnProperty(k);
+ }, false);
+}
+
+
+var defaultSchemas = {
+ 'http:': {
+ validate: function (text, pos, self) {
+ var tail = text.slice(pos);
+
+ if (!self.re.http) {
+ // compile lazily, because "host"-containing variables can change on tlds update.
+ self.re.http = new RegExp(
+ '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'
+ );
+ }
+ if (self.re.http.test(tail)) {
+ return tail.match(self.re.http)[0].length;
+ }
+ return 0;
+ }
+ },
+ 'https:': 'http:',
+ 'ftp:': 'http:',
+ '//': {
+ validate: function (text, pos, self) {
+ var tail = text.slice(pos);
+
+ if (!self.re.no_http) {
+ // compile lazily, because "host"-containing variables can change on tlds update.
+ self.re.no_http = new RegExp(
+ '^' +
+ self.re.src_auth +
+ // Don't allow single-level domains, because of false positives like '//test'
+ // with code comments
+ '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +
+ self.re.src_port +
+ self.re.src_host_terminator +
+ self.re.src_path,
+
+ 'i'
+ );
+ }
+
+ if (self.re.no_http.test(tail)) {
+ // should not be `://` & `///`, that protects from errors in protocol name
+ if (pos >= 3 && text[pos - 3] === ':') { return 0; }
+ if (pos >= 3 && text[pos - 3] === '/') { return 0; }
+ return tail.match(self.re.no_http)[0].length;
+ }
+ return 0;
+ }
+ },
+ 'mailto:': {
+ validate: function (text, pos, self) {
+ var tail = text.slice(pos);
+
+ if (!self.re.mailto) {
+ self.re.mailto = new RegExp(
+ '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'
+ );
+ }
+ if (self.re.mailto.test(tail)) {
+ return tail.match(self.re.mailto)[0].length;
+ }
+ return 0;
+ }
+ }
+};
+
+/*eslint-disable max-len*/
+
+// RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
+var tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
+
+// DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
+var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
+
+/*eslint-enable max-len*/
+
+////////////////////////////////////////////////////////////////////////////////
+
+function resetScanCache(self) {
+ self.__index__ = -1;
+ self.__text_cache__ = '';
+}
+
+function createValidator(re) {
+ return function (text, pos) {
+ var tail = text.slice(pos);
+
+ if (re.test(tail)) {
+ return tail.match(re)[0].length;
+ }
+ return 0;
+ };
+}
+
+function createNormalizer() {
+ return function (match, self) {
+ self.normalize(match);
+ };
+}
+
+// Schemas compiler. Build regexps.
+//
+function compile(self) {
+
+ // Load & clone RE patterns.
+ var re = self.re = __webpack_require__(102)(self.__opts__);
+
+ // Define dynamic patterns
+ var tlds = self.__tlds__.slice();
+
+ self.onCompile();
+
+ if (!self.__tlds_replaced__) {
+ tlds.push(tlds_2ch_src_re);
+ }
+ tlds.push(re.src_xn);
+
+ re.src_tlds = tlds.join('|');
+
+ function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }
+
+ re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), 'i');
+ re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), 'i');
+ re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
+ re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
+
+ //
+ // Compile each schema
+ //
+
+ var aliases = [];
+
+ self.__compiled__ = {}; // Reset compiled data
+
+ function schemaError(name, val) {
+ throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
+ }
+
+ Object.keys(self.__schemas__).forEach(function (name) {
+ var val = self.__schemas__[name];
+
+ // skip disabled methods
+ if (val === null) { return; }
+
+ var compiled = { validate: null, link: null };
+
+ self.__compiled__[name] = compiled;
+
+ if (isObject(val)) {
+ if (isRegExp(val.validate)) {
+ compiled.validate = createValidator(val.validate);
+ } else if (isFunction(val.validate)) {
+ compiled.validate = val.validate;
+ } else {
+ schemaError(name, val);
+ }
+
+ if (isFunction(val.normalize)) {
+ compiled.normalize = val.normalize;
+ } else if (!val.normalize) {
+ compiled.normalize = createNormalizer();
+ } else {
+ schemaError(name, val);
+ }
+
+ return;
+ }
+
+ if (isString(val)) {
+ aliases.push(name);
+ return;
+ }
+
+ schemaError(name, val);
+ });
+
+ //
+ // Compile postponed aliases
+ //
+
+ aliases.forEach(function (alias) {
+ if (!self.__compiled__[self.__schemas__[alias]]) {
+ // Silently fail on missed schemas to avoid errons on disable.
+ // schemaError(alias, self.__schemas__[alias]);
+ return;
+ }
+
+ self.__compiled__[alias].validate =
+ self.__compiled__[self.__schemas__[alias]].validate;
+ self.__compiled__[alias].normalize =
+ self.__compiled__[self.__schemas__[alias]].normalize;
+ });
+
+ //
+ // Fake record for guessed links
+ //
+ self.__compiled__[''] = { validate: null, normalize: createNormalizer() };
+
+ //
+ // Build schema condition
+ //
+ var slist = Object.keys(self.__compiled__)
+ .filter(function (name) {
+ // Filter disabled & fake schemas
+ return name.length > 0 && self.__compiled__[name];
+ })
+ .map(escapeRE)
+ .join('|');
+ // (?!_) cause 1.5x slowdown
+ self.re.schema_test = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
+ self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
+
+ self.re.pretest = RegExp(
+ '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',
+ 'i'
+ );
+
+ //
+ // Cleanup
+ //
+
+ resetScanCache(self);
+}
+
+/**
+ * class Match
+ *
+ * Match result. Single element of array, returned by [[LinkifyIt#match]]
+ **/
+function Match(self, shift) {
+ var start = self.__index__,
+ end = self.__last_index__,
+ text = self.__text_cache__.slice(start, end);
+
+ /**
+ * Match#schema -> String
+ *
+ * Prefix (protocol) for matched string.
+ **/
+ this.schema = self.__schema__.toLowerCase();
+ /**
+ * Match#index -> Number
+ *
+ * First position of matched string.
+ **/
+ this.index = start + shift;
+ /**
+ * Match#lastIndex -> Number
+ *
+ * Next position after matched string.
+ **/
+ this.lastIndex = end + shift;
+ /**
+ * Match#raw -> String
+ *
+ * Matched string.
+ **/
+ this.raw = text;
+ /**
+ * Match#text -> String
+ *
+ * Notmalized text of matched string.
+ **/
+ this.text = text;
+ /**
+ * Match#url -> String
+ *
+ * Normalized url of matched string.
+ **/
+ this.url = text;
+}
+
+function createMatch(self, shift) {
+ var match = new Match(self, shift);
+
+ self.__compiled__[match.schema].normalize(match, self);
+
+ return match;
+}
+
+
+/**
+ * class LinkifyIt
+ **/
+
+/**
+ * new LinkifyIt(schemas, options)
+ * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
+ * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
+ *
+ * Creates new linkifier instance with optional additional schemas.
+ * Can be called without `new` keyword for convenience.
+ *
+ * By default understands:
+ *
+ * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
+ * - "fuzzy" links and emails (example.com, foo@bar.com).
+ *
+ * `schemas` is an object, where each key/value describes protocol/rule:
+ *
+ * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
+ * for example). `linkify-it` makes shure that prefix is not preceeded with
+ * alphanumeric char and symbols. Only whitespaces and punctuation allowed.
+ * - __value__ - rule to check tail after link prefix
+ * - _String_ - just alias to existing rule
+ * - _Object_
+ * - _validate_ - validator function (should return matched length on success),
+ * or `RegExp`.
+ * - _normalize_ - optional function to normalize text & url of matched result
+ * (for example, for @twitter mentions).
+ *
+ * `options`:
+ *
+ * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.
+ * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts
+ * like version numbers. Default `false`.
+ * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.
+ *
+ **/
+function LinkifyIt(schemas, options) {
+ if (!(this instanceof LinkifyIt)) {
+ return new LinkifyIt(schemas, options);
+ }
+
+ if (!options) {
+ if (isOptionsObj(schemas)) {
+ options = schemas;
+ schemas = {};
+ }
+ }
+
+ this.__opts__ = assign({}, defaultOptions, options);
+
+ // Cache last tested result. Used to skip repeating steps on next `match` call.
+ this.__index__ = -1;
+ this.__last_index__ = -1; // Next scan position
+ this.__schema__ = '';
+ this.__text_cache__ = '';
+
+ this.__schemas__ = assign({}, defaultSchemas, schemas);
+ this.__compiled__ = {};
+
+ this.__tlds__ = tlds_default;
+ this.__tlds_replaced__ = false;
+
+ this.re = {};
+
+ compile(this);
+}
+
+
+/** chainable
+ * LinkifyIt#add(schema, definition)
+ * - schema (String): rule name (fixed pattern prefix)
+ * - definition (String|RegExp|Object): schema definition
+ *
+ * Add new rule definition. See constructor description for details.
+ **/
+LinkifyIt.prototype.add = function add(schema, definition) {
+ this.__schemas__[schema] = definition;
+ compile(this);
+ return this;
+};
+
+
+/** chainable
+ * LinkifyIt#set(options)
+ * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
+ *
+ * Set recognition options for links without schema.
+ **/
+LinkifyIt.prototype.set = function set(options) {
+ this.__opts__ = assign(this.__opts__, options);
+ return this;
+};
+
+
+/**
+ * LinkifyIt#test(text) -> Boolean
+ *
+ * Searches linkifiable pattern and returns `true` on success or `false` on fail.
+ **/
+LinkifyIt.prototype.test = function test(text) {
+ // Reset scan cache
+ this.__text_cache__ = text;
+ this.__index__ = -1;
+
+ if (!text.length) { return false; }
+
+ var m, ml, me, len, shift, next, re, tld_pos, at_pos;
+
+ // try to scan for link with schema - that's the most simple rule
+ if (this.re.schema_test.test(text)) {
+ re = this.re.schema_search;
+ re.lastIndex = 0;
+ while ((m = re.exec(text)) !== null) {
+ len = this.testSchemaAt(text, m[2], re.lastIndex);
+ if (len) {
+ this.__schema__ = m[2];
+ this.__index__ = m.index + m[1].length;
+ this.__last_index__ = m.index + m[0].length + len;
+ break;
+ }
+ }
+ }
+
+ if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
+ // guess schemaless links
+ tld_pos = text.search(this.re.host_fuzzy_test);
+ if (tld_pos >= 0) {
+ // if tld is located after found link - no need to check fuzzy pattern
+ if (this.__index__ < 0 || tld_pos < this.__index__) {
+ if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
+
+ shift = ml.index + ml[1].length;
+
+ if (this.__index__ < 0 || shift < this.__index__) {
+ this.__schema__ = '';
+ this.__index__ = shift;
+ this.__last_index__ = ml.index + ml[0].length;
+ }
+ }
+ }
+ }
+ }
+
+ if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
+ // guess schemaless emails
+ at_pos = text.indexOf('@');
+ if (at_pos >= 0) {
+ // We can't skip this check, because this cases are possible:
+ // 192.168.1.1@gmail.com, my.in@example.com
+ if ((me = text.match(this.re.email_fuzzy)) !== null) {
+
+ shift = me.index + me[1].length;
+ next = me.index + me[0].length;
+
+ if (this.__index__ < 0 || shift < this.__index__ ||
+ (shift === this.__index__ && next > this.__last_index__)) {
+ this.__schema__ = 'mailto:';
+ this.__index__ = shift;
+ this.__last_index__ = next;
+ }
+ }
+ }
+ }
+
+ return this.__index__ >= 0;
+};
+
+
+/**
+ * LinkifyIt#pretest(text) -> Boolean
+ *
+ * Very quick check, that can give false positives. Returns true if link MAY BE
+ * can exists. Can be used for speed optimization, when you need to check that
+ * link NOT exists.
+ **/
+LinkifyIt.prototype.pretest = function pretest(text) {
+ return this.re.pretest.test(text);
+};
+
+
+/**
+ * LinkifyIt#testSchemaAt(text, name, position) -> Number
+ * - text (String): text to scan
+ * - name (String): rule (schema) name
+ * - position (Number): text offset to check from
+ *
+ * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly
+ * at given position. Returns length of found pattern (0 on fail).
+ **/
+LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
+ // If not supported schema check requested - terminate
+ if (!this.__compiled__[schema.toLowerCase()]) {
+ return 0;
+ }
+ return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
+};
+
+
+/**
+ * LinkifyIt#match(text) -> Array|null
+ *
+ * Returns array of found link descriptions or `null` on fail. We strongly
+ * recommend to use [[LinkifyIt#test]] first, for best speed.
+ *
+ * ##### Result match description
+ *
+ * - __schema__ - link schema, can be empty for fuzzy links, or `//` for
+ * protocol-neutral links.
+ * - __index__ - offset of matched text
+ * - __lastIndex__ - index of next char after mathch end
+ * - __raw__ - matched text
+ * - __text__ - normalized text
+ * - __url__ - link, generated from matched text
+ **/
+LinkifyIt.prototype.match = function match(text) {
+ var shift = 0, result = [];
+
+ // Try to take previous element from cache, if .test() called before
+ if (this.__index__ >= 0 && this.__text_cache__ === text) {
+ result.push(createMatch(this, shift));
+ shift = this.__last_index__;
+ }
+
+ // Cut head if cache was used
+ var tail = shift ? text.slice(shift) : text;
+
+ // Scan string until end reached
+ while (this.test(tail)) {
+ result.push(createMatch(this, shift));
+
+ tail = tail.slice(this.__last_index__);
+ shift += this.__last_index__;
+ }
+
+ if (result.length) {
+ return result;
+ }
+
+ return null;
+};
+
+
+/** chainable
+ * LinkifyIt#tlds(list [, keepOld]) -> this
+ * - list (Array): list of tlds
+ * - keepOld (Boolean): merge with current list if `true` (`false` by default)
+ *
+ * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
+ * to avoid false positives. By default this algorythm used:
+ *
+ * - hostname with any 2-letter root zones are ok.
+ * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
+ * are ok.
+ * - encoded (`xn--...`) root zones are ok.
+ *
+ * If list is replaced, then exact match for 2-chars root zones will be checked.
+ **/
+LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
+ list = Array.isArray(list) ? list : [ list ];
+
+ if (!keepOld) {
+ this.__tlds__ = list.slice();
+ this.__tlds_replaced__ = true;
+ compile(this);
+ return this;
+ }
+
+ this.__tlds__ = this.__tlds__.concat(list)
+ .sort()
+ .filter(function (el, idx, arr) {
+ return el !== arr[idx - 1];
+ })
+ .reverse();
+
+ compile(this);
+ return this;
+};
+
+/**
+ * LinkifyIt#normalize(match)
+ *
+ * Default normalizer (if schema does not define it's own).
+ **/
+LinkifyIt.prototype.normalize = function normalize(match) {
+
+ // Do minimal possible changes by default. Need to collect feedback prior
+ // to move forward https://github.com/markdown-it/linkify-it/issues/1
+
+ if (!match.schema) { match.url = 'http://' + match.url; }
+
+ if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
+ match.url = 'mailto:' + match.url;
+ }
+};
+
+
+/**
+ * LinkifyIt#onCompile()
+ *
+ * Override to modify basic RegExp-s.
+ **/
+LinkifyIt.prototype.onCompile = function onCompile() {
+};
+
+
+module.exports = LinkifyIt;
+
+
+/***/ }),
+/* 102 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+
+module.exports = function (opts) {
+ var re = {};
+
+ // Use direct extract instead of `regenerate` to reduse browserified size
+ re.src_Any = __webpack_require__(52).source;
+ re.src_Cc = __webpack_require__(53).source;
+ re.src_Z = __webpack_require__(55).source;
+ re.src_P = __webpack_require__(45).source;
+
+ // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)
+ re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');
+
+ // \p{\Z\Cc} (white spaces + control)
+ re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');
+
+ // Experimental. List of chars, completely prohibited in links
+ // because can separate it from other part of text
+ var text_separators = '[><\uff5c]';
+
+ // All possible word characters (everything without punctuation, spaces & controls)
+ // Defined via punctuation & spaces to save space
+ // Should be something like \p{\L\N\S\M} (\w but without `_`)
+ re.src_pseudo_letter = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
+ // The same as abothe but without [0-9]
+ // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+ re.src_ip4 =
+
+ '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
+
+ // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
+ re.src_auth = '(?:(?:(?!' + re.src_ZCc + '|[@/\\[\\]()]).)+@)?';
+
+ re.src_port =
+
+ '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';
+
+ re.src_host_terminator =
+
+ '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
+
+ re.src_path =
+
+ '(?:' +
+ '[/?#]' +
+ '(?:' +
+ '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
+ '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
+ '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
+ '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
+ '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
+ "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
+ "\\'(?=" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found
+ '\\.{2,4}[a-zA-Z0-9%/]|' + // github has ... in commit range links,
+ // google has .... in links (issue #66)
+ // Restrict to
+ // - english
+ // - percent-encoded
+ // - parts of file path
+ // until more examples found.
+ '\\.(?!' + re.src_ZCc + '|[.]).|' +
+ (opts && opts['---'] ?
+ '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
+ :
+ '\\-+|'
+ ) +
+ '\\,(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
+ '\\!(?!' + re.src_ZCc + '|[!]).|' +
+ '\\?(?!' + re.src_ZCc + '|[?]).' +
+ ')+' +
+ '|\\/' +
+ ')?';
+
+ // Allow anything in markdown spec, forbid quote (") at the first position
+ // because emails enclosed in quotes are far more common
+ re.src_email_name =
+
+ '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';
+
+ re.src_xn =
+
+ 'xn--[a-z0-9\\-]{1,59}';
+
+ // More to read about domain names
+ // http://serverfault.com/questions/638260/
+
+ re.src_domain_root =
+
+ // Allow letters & digits (http://test1)
+ '(?:' +
+ re.src_xn +
+ '|' +
+ re.src_pseudo_letter + '{1,63}' +
+ ')';
+
+ re.src_domain =
+
+ '(?:' +
+ re.src_xn +
+ '|' +
+ '(?:' + re.src_pseudo_letter + ')' +
+ '|' +
+ '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +
+ ')';
+
+ re.src_host =
+
+ '(?:' +
+ // Don't need IP check, because digits are already allowed in normal domain names
+ // src_ip4 +
+ // '|' +
+ '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain/*_root*/ + ')' +
+ ')';
+
+ re.tpl_host_fuzzy =
+
+ '(?:' +
+ re.src_ip4 +
+ '|' +
+ '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +
+ ')';
+
+ re.tpl_host_no_ip_fuzzy =
+
+ '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';
+
+ re.src_host_strict =
+
+ re.src_host + re.src_host_terminator;
+
+ re.tpl_host_fuzzy_strict =
+
+ re.tpl_host_fuzzy + re.src_host_terminator;
+
+ re.src_host_port_strict =
+
+ re.src_host + re.src_port + re.src_host_terminator;
+
+ re.tpl_host_port_fuzzy_strict =
+
+ re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
+
+ re.tpl_host_port_no_ip_fuzzy_strict =
+
+ re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
+
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Main rules
+
+ // Rude test fuzzy links by host, for quick deny
+ re.tpl_host_fuzzy_test =
+
+ 'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';
+
+ re.tpl_email_fuzzy =
+
+ '(^|' + text_separators + '|"|\\(|' + re.src_ZCc + ')' +
+ '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
+
+ re.tpl_link_fuzzy =
+ // Fuzzy link can't be prepended with .:/\- and non punctuation.
+ // but can start with > (markdown blockquote)
+ '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
+ '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
+
+ re.tpl_link_no_ip_fuzzy =
+ // Fuzzy link can't be prepended with .:/\- and non punctuation.
+ // but can start with > (markdown blockquote)
+ '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
+ '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
+
+ return re;
+};
+
+
+/***/ }),
+/* 103 */
+/***/ (function(module, exports) {
+
+module.exports = require("punycode");
+
+/***/ }),
+/* 104 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// markdown-it default options
+
+
+
+
+module.exports = {
+ options: {
+ html: false, // Enable HTML tags in source
+ xhtmlOut: false, // Use '/' to close single tags (<br />)
+ breaks: false, // Convert '\n' in paragraphs into <br>
+ langPrefix: 'language-', // CSS language prefix for fenced blocks
+ linkify: false, // autoconvert URL-like texts to links
+
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with <pre... internal wrapper is skipped.
+ //
+ // function (/*str, lang*/) { return ''; }
+ //
+ highlight: null,
+
+ maxNesting: 100 // Internal protection, recursion limit
+ },
+
+ components: {
+
+ core: {},
+ block: {},
+ inline: {}
+ }
+};
+
+
+/***/ }),
+/* 105 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// "Zero" preset, with nothing enabled. Useful for manual configuring of simple
+// modes. For example, to parse bold/italic only.
+
+
+
+
+module.exports = {
+ options: {
+ html: false, // Enable HTML tags in source
+ xhtmlOut: false, // Use '/' to close single tags (<br />)
+ breaks: false, // Convert '\n' in paragraphs into <br>
+ langPrefix: 'language-', // CSS language prefix for fenced blocks
+ linkify: false, // autoconvert URL-like texts to links
+
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with <pre... internal wrapper is skipped.
+ //
+ // function (/*str, lang*/) { return ''; }
+ //
+ highlight: null,
+
+ maxNesting: 20 // Internal protection, recursion limit
+ },
+
+ components: {
+
+ core: {
+ rules: [
+ 'normalize',
+ 'block',
+ 'inline'
+ ]
+ },
+
+ block: {
+ rules: [
+ 'paragraph'
+ ]
+ },
+
+ inline: {
+ rules: [
+ 'text'
+ ],
+ rules2: [
+ 'balance_pairs',
+ 'text_collapse'
+ ]
+ }
+ }
+};
+
+
+/***/ }),
+/* 106 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// Commonmark default options
+
+
+
+
+module.exports = {
+ options: {
+ html: true, // Enable HTML tags in source
+ xhtmlOut: true, // Use '/' to close single tags (<br />)
+ breaks: false, // Convert '\n' in paragraphs into <br>
+ langPrefix: 'language-', // CSS language prefix for fenced blocks
+ linkify: false, // autoconvert URL-like texts to links
+
+ // Enable some language-neutral replacements + quotes beautification
+ typographer: false,
+
+ // Double + single quotes replacement pairs, when typographer enabled,
+ // and smartquotes on. Could be either a String or an Array.
+ //
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
+ quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
+
+ // Highlighter function. Should return escaped HTML,
+ // or '' if the source string is not changed and should be escaped externaly.
+ // If result starts with <pre... internal wrapper is skipped.
+ //
+ // function (/*str, lang*/) { return ''; }
+ //
+ highlight: null,
+
+ maxNesting: 20 // Internal protection, recursion limit
+ },
+
+ components: {
+
+ core: {
+ rules: [
+ 'normalize',
+ 'block',
+ 'inline'
+ ]
+ },
+
+ block: {
+ rules: [
+ 'blockquote',
+ 'code',
+ 'fence',
+ 'heading',
+ 'hr',
+ 'html_block',
+ 'lheading',
+ 'list',
+ 'reference',
+ 'paragraph'
+ ]
+ },
+
+ inline: {
+ rules: [
+ 'autolink',
+ 'backticks',
+ 'emphasis',
+ 'entity',
+ 'escape',
+ 'html_inline',
+ 'image',
+ 'link',
+ 'newline',
+ 'text'
+ ],
+ rules2: [
+ 'balance_pairs',
+ 'emphasis',
+ 'text_collapse'
+ ]
+ }
+ }
+};
+
+
+/***/ }),
+/* 107 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { URL } = __webpack_require__(39);
+const packageJson = __webpack_require__(108);
+const homepage = packageJson.homepage;
+const version = packageJson.version;
+
+const rules = [
+ __webpack_require__(109),
+ __webpack_require__(112),
+ __webpack_require__(113),
+ __webpack_require__(114),
+ __webpack_require__(116),
+ __webpack_require__(117),
+ __webpack_require__(118),
+ __webpack_require__(119),
+ __webpack_require__(120),
+ __webpack_require__(121),
+ __webpack_require__(122),
+ __webpack_require__(123),
+ __webpack_require__(124),
+ __webpack_require__(125),
+ __webpack_require__(126),
+ __webpack_require__(127),
+ __webpack_require__(128),
+ __webpack_require__(129),
+ __webpack_require__(130),
+ __webpack_require__(131),
+ __webpack_require__(132),
+ __webpack_require__(133),
+ __webpack_require__(134),
+ __webpack_require__(135),
+ __webpack_require__(136),
+ __webpack_require__(137),
+ __webpack_require__(138),
+ __webpack_require__(139),
+ __webpack_require__(140),
+ __webpack_require__(141),
+ __webpack_require__(142),
+ __webpack_require__(143),
+ __webpack_require__(144),
+ __webpack_require__(145),
+ __webpack_require__(146),
+ __webpack_require__(147),
+ __webpack_require__(148),
+ __webpack_require__(149),
+ __webpack_require__(150),
+ __webpack_require__(151),
+ __webpack_require__(152),
+ __webpack_require__(153),
+ __webpack_require__(154),
+ __webpack_require__(155)
+];
+rules.forEach((rule) => {
+ const name = rule.names[0].toLowerCase();
+ rule.information =
+ new URL(`${homepage}/blob/v${version}/doc/Rules.md#${name}`);
+});
+module.exports = rules;
+
+
+/***/ }),
+/* 108 */
+/***/ (function(module) {
+
+module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.20.4\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"test\":\"node test/markdownlint-test.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 node test/markdownlint-test.js\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"node test/markdownlint-test-extra.js\",\"debug\":\"node debug node_modules/nodeunit/bin/nodeunit\",\"lint\":\"eslint --max-warnings 0 lib helpers test schema && eslint --env browser --global markdownit --global markdownlint --rule \\\"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0\\\" demo && eslint --rule \\\"no-console: 0, no-invalid-this: 0, no-shadow: 0, object-property-newline: 0\\\" example\",\"ci\":\"npm run test-cover && npm run lint && npm run test-declaration\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --outDir declaration --resolveJsonModule lib/markdownlint.js && cpy declaration/lib/markdownlint.d.ts lib && rimraf declaration\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && cpy file-header.js . --rename=markdownlint-browser.js && tsc --allowJs --resolveJsonModule --outDir ../lib-es3 ../lib/markdownlint.js && cpy ../helpers/package.json ../lib-es3/helpers && browserify ../lib-es3/lib/markdownlint.js --standalone markdownlint >> markdownlint-browser.js && uglifyjs markdownlint-browser.js --compress --mangle --comments --output markdownlint-browser.min.js\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"clone-test-repos\":\"make-dir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"lint-test-repos\":\"node test/markdownlint-test-repos.js\",\"clean-test-repos\":\"rimraf test-repos\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"10.0.0\"},\"devDependencies\":{\"@types/node\":\"~13.11.1\",\"browserify\":\"~16.5.1\",\"c8\":\"~7.1.2\",\"cpy-cli\":\"~3.1.0\",\"eslint\":\"~6.8.0\",\"eslint-plugin-jsdoc\":\"~22.1.0\",\"globby\":\"~11.0.0\",\"js-yaml\":\"~3.13.1\",\"make-dir-cli\":\"~2.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-katex\":\"~2.0.3\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdownlint-rule-helpers\":\"~0.7.0\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.0\",\"tape\":\"~4.13.2\",\"tape-player\":\"~0.1.0\",\"toml\":\"~3.0.0\",\"tv4\":\"~1.3.0\",\"typescript\":\"~3.8.3\",\"uglify-js\":\"~3.8.1\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"],\"browser\":{\"markdown-it\":\"../demo/markdown-it-stub.js\"}}");
+
+/***/ }),
+/* 109 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, filterTokens } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD001", "heading-increment", "header-increment" ],
+ "description": "Heading levels should only increment by one level at a time",
+ "tags": [ "headings", "headers" ],
+ "function": function MD001(params, onError) {
+ let prevLevel = 0;
+ filterTokens(params, "heading_open", function forToken(token) {
+ const level = parseInt(token.tag.slice(1), 10);
+ if (prevLevel && (level > prevLevel)) {
+ addErrorDetailIf(onError, token.lineNumber,
+ "h" + (prevLevel + 1), "h" + level);
+ }
+ prevLevel = level;
+ });
+ }
+};
+
+
+/***/ }),
+/* 110 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const os = __webpack_require__(111);
+
+// Regular expression for matching common newline characters
+// See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js
+const newLineRe = /\r\n?|\n/g;
+module.exports.newLineRe = newLineRe;
+
+// Regular expression for matching common front matter (YAML and TOML)
+module.exports.frontMatterRe =
+ // eslint-disable-next-line max-len
+ /((^---\s*$[^]*?^---\s*$)|(^\+\+\+\s*$[^]*?^(\+\+\+|\.\.\.)\s*$))(\r\n|\r|\n|$)/m;
+
+// Regular expression for matching inline disable/enable comments
+const inlineCommentRe =
+ // eslint-disable-next-line max-len
+ /<!--\s*markdownlint-(?:(?:(disable|enable|capture|restore|disable-file|enable-file)((?:\s+[a-z0-9_-]+)*))|(?:(configure-file)\s+([\s\S]*?)))\s*-->/ig;
+module.exports.inlineCommentRe = inlineCommentRe;
+
+// Regular expressions for range matching
+module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
+module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
+module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
+
+// Regular expression for all instances of emphasis markers
+const emphasisMarkersRe = /[_*]/g;
+
+// Regular expression for inline links and shortcut reference links
+const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g;
+
+// readFile options for reading with the UTF-8 encoding
+module.exports.utf8Encoding = { "encoding": "utf8" };
+
+// All punctuation characters (normal and full-width)
+module.exports.allPunctuation = ".,;:!?。,;:!?";
+
+// Returns true iff the input is a number
+module.exports.isNumber = function isNumber(obj) {
+ return typeof obj === "number";
+};
+
+// Returns true iff the input is a string
+module.exports.isString = function isString(obj) {
+ return typeof obj === "string";
+};
+
+// Returns true iff the input string is empty
+module.exports.isEmptyString = function isEmptyString(str) {
+ return str.length === 0;
+};
+
+// Returns true iff the input is an object
+module.exports.isObject = function isObject(obj) {
+ return (obj !== null) && (typeof obj === "object") && !Array.isArray(obj);
+};
+
+// Returns true iff the input line is blank (no content)
+// Example: Contains nothing, whitespace, or comments
+const blankLineRe = />|(?:<!--.*?-->)/g;
+module.exports.isBlankLine = function isBlankLine(line) {
+ return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
+};
+
+/**
+ * Compare function for Array.prototype.sort for ascending order of numbers.
+ *
+ * @param {number} a First number.
+ * @param {number} b Second number.
+ * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
+ */
+module.exports.numericSortAscending = function numericSortAscending(a, b) {
+ return a - b;
+};
+
+// Returns true iff the sorted array contains the specified element
+module.exports.includesSorted = function includesSorted(array, element) {
+ let left = 0;
+ let right = array.length - 1;
+ while (left <= right) {
+ /* eslint-disable no-bitwise */
+ const mid = (left + right) >> 1;
+ if (array[mid] < element) {
+ left = mid + 1;
+ } else if (array[mid] > element) {
+ right = mid - 1;
+ } else {
+ return true;
+ }
+ }
+ return false;
+};
+
+// Replaces the text of all properly-formatted HTML comments with whitespace
+// This preserves the line/column information for the rest of the document
+// Trailing whitespace is avoided with a '\' character in the last column
+// See https://www.w3.org/TR/html5/syntax.html#comments for details
+const htmlCommentBegin = "<!--";
+const htmlCommentEnd = "-->";
+module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
+ let i = 0;
+ while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
+ const j = text.indexOf(htmlCommentEnd, i);
+ if (j === -1) {
+ // Un-terminated comments are treated as text
+ break;
+ }
+ const comment = text.slice(i + htmlCommentBegin.length, j);
+ if ((comment.length > 0) &&
+ (comment[0] !== ">") &&
+ (comment[comment.length - 1] !== "-") &&
+ !comment.includes("--") &&
+ (text.slice(i, j + htmlCommentEnd.length)
+ .search(inlineCommentRe) === -1)) {
+ const blanks = comment
+ .replace(/[^\r\n]/g, " ")
+ .replace(/ ([\r\n])/g, "\\$1");
+ text = text.slice(0, i + htmlCommentBegin.length) +
+ blanks + text.slice(j);
+ }
+ i = j + htmlCommentEnd.length;
+ }
+ return text;
+};
+
+// Escapes a string for use in a RegExp
+module.exports.escapeForRegExp = function escapeForRegExp(str) {
+ return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
+};
+
+// Un-escapes Markdown content (simple algorithm; not a parser)
+const escapedMarkdownRe = /\\./g;
+module.exports.unescapeMarkdown =
+ function unescapeMarkdown(markdown, replacement) {
+ return markdown.replace(escapedMarkdownRe, (match) => {
+ const char = match[1];
+ if ("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".includes(char)) {
+ return replacement || char;
+ }
+ return match;
+ });
+ };
+
+/**
+ * Return the string representation of a fence markup character.
+ *
+ * @param {string} markup Fence string.
+ * @returns {string} String representation.
+ */
+module.exports.fencedCodeBlockStyleFor =
+ function fencedCodeBlockStyleFor(markup) {
+ switch (markup[0]) {
+ case "~":
+ return "tilde";
+ default:
+ return "backtick";
+ }
+ };
+
+/**
+ * Return the number of characters of indent for a token.
+ *
+ * @param {Object} token MarkdownItToken instance.
+ * @returns {number} Characters of indent.
+ */
+function indentFor(token) {
+ const line = token.line.replace(/^[\s>]*(> |>)/, "");
+ return line.length - line.trimLeft().length;
+}
+module.exports.indentFor = indentFor;
+
+// Returns the heading style for a heading token
+module.exports.headingStyleFor = function headingStyleFor(token) {
+ if ((token.map[1] - token.map[0]) === 1) {
+ if (/[^\\]#\s*$/.test(token.line)) {
+ return "atx_closed";
+ }
+ return "atx";
+ }
+ return "setext";
+};
+
+/**
+ * Return the string representation of an unordered list marker.
+ *
+ * @param {Object} token MarkdownItToken instance.
+ * @returns {string} String representation.
+ */
+module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
+ switch (token.markup) {
+ case "-":
+ return "dash";
+ case "+":
+ return "plus";
+ // case "*":
+ default:
+ return "asterisk";
+ }
+};
+
+/**
+ * Calls the provided function for each matching token.
+ *
+ * @param {Object} params RuleParams instance.
+ * @param {string} type Token type identifier.
+ * @param {Function} handler Callback function.
+ * @returns {void}
+ */
+function filterTokens(params, type, handler) {
+ params.tokens.forEach(function forToken(token) {
+ if (token.type === type) {
+ handler(token);
+ }
+ });
+}
+module.exports.filterTokens = filterTokens;
+
+// Get line metadata array
+module.exports.getLineMetadata = function getLineMetadata(params) {
+ const lineMetadata = params.lines.map(function mapLine(line, index) {
+ return [ line, index, false, 0, false, false ];
+ });
+ filterTokens(params, "fence", function forToken(token) {
+ lineMetadata[token.map[0]][3] = 1;
+ lineMetadata[token.map[1] - 1][3] = -1;
+ for (let i = token.map[0] + 1; i < token.map[1] - 1; i++) {
+ lineMetadata[i][2] = true;
+ }
+ });
+ filterTokens(params, "code_block", function forToken(token) {
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][2] = true;
+ }
+ });
+ filterTokens(params, "table_open", function forToken(token) {
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][4] = true;
+ }
+ });
+ filterTokens(params, "list_item_open", function forToken(token) {
+ let count = 1;
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][5] = count;
+ count++;
+ }
+ });
+ filterTokens(params, "hr", function forToken(token) {
+ lineMetadata[token.map[0]][6] = true;
+ });
+ return lineMetadata;
+};
+
+// Calls the provided function for each line (with context)
+module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
+ lineMetadata.forEach(function forMetadata(metadata) {
+ // Parameters: line, lineIndex, inCode, onFence, inTable, inItem, inBreak
+ handler(...metadata);
+ });
+};
+
+// Returns (nested) lists as a flat array (in order)
+module.exports.flattenLists = function flattenLists(params) {
+ const flattenedLists = [];
+ const stack = [];
+ let current = null;
+ let nesting = 0;
+ const nestingStack = [];
+ let lastWithMap = { "map": [ 0, 1 ] };
+ params.tokens.forEach(function forToken(token) {
+ if ((token.type === "bullet_list_open") ||
+ (token.type === "ordered_list_open")) {
+ // Save current context and start a new one
+ stack.push(current);
+ current = {
+ "unordered": (token.type === "bullet_list_open"),
+ "parentsUnordered": !current ||
+ (current.unordered && current.parentsUnordered),
+ "open": token,
+ "indent": indentFor(token),
+ "parentIndent": (current && current.indent) || 0,
+ "items": [],
+ "nesting": nesting,
+ "lastLineIndex": -1,
+ "insert": flattenedLists.length
+ };
+ nesting++;
+ } else if ((token.type === "bullet_list_close") ||
+ (token.type === "ordered_list_close")) {
+ // Finalize current context and restore previous
+ current.lastLineIndex = lastWithMap.map[1];
+ flattenedLists.splice(current.insert, 0, current);
+ delete current.insert;
+ current = stack.pop();
+ nesting--;
+ } else if (token.type === "list_item_open") {
+ // Add list item
+ current.items.push(token);
+ } else if (token.type === "blockquote_open") {
+ nestingStack.push(nesting);
+ nesting = 0;
+ } else if (token.type === "blockquote_close") {
+ nesting = nestingStack.pop();
+ } else if (token.map) {
+ // Track last token with map
+ lastWithMap = token;
+ }
+ });
+ return flattenedLists;
+};
+
+// Calls the provided function for each specified inline child token
+module.exports.forEachInlineChild =
+function forEachInlineChild(params, type, handler) {
+ filterTokens(params, "inline", function forToken(token) {
+ token.children.forEach(function forChild(child) {
+ if (child.type === type) {
+ handler(child, token);
+ }
+ });
+ });
+};
+
+// Calls the provided function for each heading's content
+module.exports.forEachHeading = function forEachHeading(params, handler) {
+ let heading = null;
+ params.tokens.forEach(function forToken(token) {
+ if (token.type === "heading_open") {
+ heading = token;
+ } else if (token.type === "heading_close") {
+ heading = null;
+ } else if ((token.type === "inline") && heading) {
+ handler(heading, token.content);
+ }
+ });
+};
+
+/**
+ * Calls the provided function for each inline code span's content.
+ *
+ * @param {string} input Markdown content.
+ * @param {Function} handler Callback function.
+ * @returns {void}
+ */
+function forEachInlineCodeSpan(input, handler) {
+ let currentLine = 0;
+ let currentColumn = 0;
+ let index = 0;
+ while (index < input.length) {
+ let startIndex = -1;
+ let startLine = -1;
+ let startColumn = -1;
+ let tickCount = 0;
+ let currentTicks = 0;
+ let state = "normal";
+ // Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
+ for (; index <= input.length; index++) {
+ const char = input[index];
+ // Ignore backticks in link destination
+ if ((char === "[") && (state === "normal")) {
+ state = "linkTextOpen";
+ } else if ((char === "]") && (state === "linkTextOpen")) {
+ state = "linkTextClosed";
+ } else if ((char === "(") && (state === "linkTextClosed")) {
+ state = "linkDestinationOpen";
+ } else if (
+ ((char === "(") && (state === "linkDestinationOpen")) ||
+ ((char === ")") && (state === "linkDestinationOpen")) ||
+ (state === "linkTextClosed")) {
+ state = "normal";
+ }
+ // Parse backtick open/close
+ if ((char === "`") && (state !== "linkDestinationOpen")) {
+ // Count backticks at start or end of code span
+ currentTicks++;
+ if ((startIndex === -1) || (startColumn === -1)) {
+ startIndex = index + 1;
+ }
+ } else {
+ if ((startIndex >= 0) &&
+ (startColumn >= 0) &&
+ (tickCount === currentTicks)) {
+ // Found end backticks; invoke callback for code span
+ handler(
+ input.substring(startIndex, index - currentTicks),
+ startLine, startColumn, tickCount);
+ startIndex = -1;
+ startColumn = -1;
+ } else if ((startIndex >= 0) && (startColumn === -1)) {
+ // Found start backticks
+ tickCount = currentTicks;
+ startLine = currentLine;
+ startColumn = currentColumn;
+ }
+ // Not in backticks
+ currentTicks = 0;
+ }
+ if (char === "\n") {
+ // On next line
+ currentLine++;
+ currentColumn = 0;
+ } else if ((char === "\\") &&
+ ((startIndex === -1) || (startColumn === -1)) &&
+ (input[index + 1] !== "\n")) {
+ // Escape character outside code, skip next
+ index++;
+ currentColumn += 2;
+ } else {
+ // On next column
+ currentColumn++;
+ }
+ }
+ if (startIndex >= 0) {
+ // Restart loop after unmatched start backticks (ex: "`text``code``")
+ index = startIndex;
+ currentLine = startLine;
+ currentColumn = startColumn;
+ }
+ }
+}
+module.exports.forEachInlineCodeSpan = forEachInlineCodeSpan;
+
+/**
+ * Adds a generic error object via the onError callback.
+ *
+ * @param {Object} onError RuleOnError instance.
+ * @param {number} lineNumber Line number.
+ * @param {string} [detail] Error details.
+ * @param {string} [context] Error context.
+ * @param {number[]} [range] Column and length of error.
+ * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
+ * @returns {void}
+ */
+function addError(onError, lineNumber, detail, context, range, fixInfo) {
+ onError({
+ lineNumber,
+ detail,
+ context,
+ range,
+ fixInfo
+ });
+}
+module.exports.addError = addError;
+
+// Adds an error object with details conditionally via the onError callback
+module.exports.addErrorDetailIf = function addErrorDetailIf(
+ onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
+ if (expected !== actual) {
+ addError(
+ onError,
+ lineNumber,
+ "Expected: " + expected + "; Actual: " + actual +
+ (detail ? "; " + detail : ""),
+ context,
+ range,
+ fixInfo);
+ }
+};
+
+// Adds an error object with context via the onError callback
+module.exports.addErrorContext = function addErrorContext(
+ onError, lineNumber, context, left, right, range, fixInfo) {
+ if (context.length <= 30) {
+ // Nothing to do
+ } else if (left && right) {
+ context = context.substr(0, 15) + "..." + context.substr(-15);
+ } else if (right) {
+ context = "..." + context.substr(-30);
+ } else {
+ context = context.substr(0, 30) + "...";
+ }
+ addError(onError, lineNumber, null, context, range, fixInfo);
+};
+
+// Returns a range object for a line by applying a RegExp
+module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
+ let range = null;
+ const match = line.match(regexp);
+ if (match) {
+ const column = match.index + 1;
+ const length = match[0].length;
+ range = [ column, length ];
+ }
+ return range;
+};
+
+// Determines if the front matter includes a title
+module.exports.frontMatterHasTitle =
+ function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
+ const ignoreFrontMatter =
+ (frontMatterTitlePattern !== undefined) && !frontMatterTitlePattern;
+ const frontMatterTitleRe =
+ new RegExp(String(frontMatterTitlePattern || "^\\s*title\\s*[:=]"), "i");
+ return !ignoreFrontMatter &&
+ frontMatterLines.some((line) => frontMatterTitleRe.test(line));
+ };
+
+/**
+ * Returns a list of emphasis markers in code spans and links.
+ *
+ * @param {Object} params RuleParams instance.
+ * @returns {number[][]} List of markers.
+ */
+function emphasisMarkersInContent(params) {
+ const { lines } = params;
+ const byLine = new Array(lines.length);
+ // Search code spans
+ filterTokens(params, "inline", (token) => {
+ const { children, lineNumber, map } = token;
+ if (children.some((child) => child.type === "code_inline")) {
+ const tokenLines = lines.slice(map[0], map[1]);
+ forEachInlineCodeSpan(
+ tokenLines.join("\n"),
+ (code, lineIndex, column, tickCount) => {
+ const codeLines = code.split(newLineRe);
+ codeLines.forEach((codeLine, codeLineIndex) => {
+ let match = null;
+ while ((match = emphasisMarkersRe.exec(codeLine))) {
+ const byLineIndex = lineNumber - 1 + lineIndex + codeLineIndex;
+ const inLine = byLine[byLineIndex] || [];
+ const codeLineOffset = codeLineIndex ? 0 : column - 1 + tickCount;
+ inLine.push(codeLineOffset + match.index);
+ byLine[byLineIndex] = inLine;
+ }
+ });
+ }
+ );
+ }
+ });
+ // Search links
+ lines.forEach((tokenLine, tokenLineIndex) => {
+ let linkMatch = null;
+ while ((linkMatch = linkRe.exec(tokenLine))) {
+ let markerMatch = null;
+ while ((markerMatch = emphasisMarkersRe.exec(linkMatch[0]))) {
+ const inLine = byLine[tokenLineIndex] || [];
+ inLine.push(linkMatch.index + markerMatch.index);
+ byLine[tokenLineIndex] = inLine;
+ }
+ }
+ });
+ return byLine;
+}
+module.exports.emphasisMarkersInContent = emphasisMarkersInContent;
+
+/**
+ * Gets the most common line ending, falling back to the platform default.
+ *
+ * @param {string} input Markdown content to analyze.
+ * @returns {string} Preferred line ending.
+ */
+function getPreferredLineEnding(input) {
+ let cr = 0;
+ let lf = 0;
+ let crlf = 0;
+ const endings = input.match(newLineRe) || [];
+ endings.forEach((ending) => {
+ // eslint-disable-next-line default-case
+ switch (ending) {
+ case "\r":
+ cr++;
+ break;
+ case "\n":
+ lf++;
+ break;
+ case "\r\n":
+ crlf++;
+ break;
+ }
+ });
+ let preferredLineEnding = null;
+ if (!cr && !lf && !crlf) {
+ preferredLineEnding = os.EOL;
+ } else if ((lf >= crlf) && (lf >= cr)) {
+ preferredLineEnding = "\n";
+ } else if (crlf >= cr) {
+ preferredLineEnding = "\r\n";
+ } else {
+ preferredLineEnding = "\r";
+ }
+ return preferredLineEnding;
+}
+module.exports.getPreferredLineEnding = getPreferredLineEnding;
+
+/**
+ * Normalizes the fields of a RuleOnErrorFixInfo instance.
+ *
+ * @param {Object} fixInfo RuleOnErrorFixInfo instance.
+ * @param {number} [lineNumber] Line number.
+ * @returns {Object} Normalized RuleOnErrorFixInfo instance.
+ */
+function normalizeFixInfo(fixInfo, lineNumber) {
+ return {
+ "lineNumber": fixInfo.lineNumber || lineNumber,
+ "editColumn": fixInfo.editColumn || 1,
+ "deleteCount": fixInfo.deleteCount || 0,
+ "insertText": fixInfo.insertText || ""
+ };
+}
+
+/**
+ * Fixes the specified error on a line of Markdown content.
+ *
+ * @param {string} line Line of Markdown content.
+ * @param {Object} fixInfo RuleOnErrorFixInfo instance.
+ * @param {string} lineEnding Line ending to use.
+ * @returns {string} Fixed content.
+ */
+function applyFix(line, fixInfo, lineEnding) {
+ const { editColumn, deleteCount, insertText } = normalizeFixInfo(fixInfo);
+ const editIndex = editColumn - 1;
+ return (deleteCount === -1) ?
+ null :
+ line.slice(0, editIndex) +
+ insertText.replace(/\n/g, lineEnding || "\n") +
+ line.slice(editIndex + deleteCount);
+}
+module.exports.applyFix = applyFix;
+
+// Applies as many fixes as possible to the input lines
+module.exports.applyFixes = function applyFixes(input, errors) {
+ const lineEnding = getPreferredLineEnding(input);
+ const lines = input.split(newLineRe);
+ // Normalize fixInfo objects
+ let fixInfos = errors
+ .filter((error) => error.fixInfo)
+ .map((error) => normalizeFixInfo(error.fixInfo, error.lineNumber));
+ // Sort bottom-to-top, line-deletes last, right-to-left, long-to-short
+ fixInfos.sort((a, b) => {
+ const aDeletingLine = (a.deleteCount === -1);
+ const bDeletingLine = (b.deleteCount === -1);
+ return (
+ (b.lineNumber - a.lineNumber) ||
+ (aDeletingLine ? 1 : (bDeletingLine ? -1 : 0)) ||
+ (b.editColumn - a.editColumn) ||
+ (b.insertText.length - a.insertText.length)
+ );
+ });
+ // Remove duplicate entries (needed for following collapse step)
+ let lastFixInfo = {};
+ fixInfos = fixInfos.filter((fixInfo) => {
+ const unique = (
+ (fixInfo.lineNumber !== lastFixInfo.lineNumber) ||
+ (fixInfo.editColumn !== lastFixInfo.editColumn) ||
+ (fixInfo.deleteCount !== lastFixInfo.deleteCount) ||
+ (fixInfo.insertText !== lastFixInfo.insertText)
+ );
+ lastFixInfo = fixInfo;
+ return unique;
+ });
+ // Collapse insert/no-delete and no-insert/delete for same line/column
+ lastFixInfo = {};
+ fixInfos.forEach((fixInfo) => {
+ if (
+ (fixInfo.lineNumber === lastFixInfo.lineNumber) &&
+ (fixInfo.editColumn === lastFixInfo.editColumn) &&
+ !fixInfo.insertText &&
+ (fixInfo.deleteCount > 0) &&
+ lastFixInfo.insertText &&
+ !lastFixInfo.deleteCount) {
+ fixInfo.insertText = lastFixInfo.insertText;
+ lastFixInfo.lineNumber = 0;
+ }
+ lastFixInfo = fixInfo;
+ });
+ fixInfos = fixInfos.filter((fixInfo) => fixInfo.lineNumber);
+ // Apply all (remaining/updated) fixes
+ let lastLineIndex = -1;
+ let lastEditIndex = -1;
+ fixInfos.forEach((fixInfo) => {
+ const { lineNumber, editColumn, deleteCount } = fixInfo;
+ const lineIndex = lineNumber - 1;
+ const editIndex = editColumn - 1;
+ if (
+ (lineIndex !== lastLineIndex) ||
+ ((editIndex + deleteCount) < lastEditIndex) ||
+ (deleteCount === -1)
+ ) {
+ lines[lineIndex] = applyFix(lines[lineIndex], fixInfo, lineEnding);
+ }
+ lastLineIndex = lineIndex;
+ lastEditIndex = editIndex;
+ });
+ // Return corrected input
+ return lines.filter((line) => line !== null).join(lineEnding);
+};
+
+
+/***/ }),
+/* 111 */
+/***/ (function(module, exports) {
+
+module.exports = require("os");
+
+/***/ }),
+/* 112 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD002", "first-heading-h1", "first-header-h1" ],
+ "description": "First heading should be a top level heading",
+ "tags": [ "headings", "headers" ],
+ "function": function MD002(params, onError) {
+ const level = Number(params.config.level || 1);
+ const tag = "h" + level;
+ params.tokens.every(function forToken(token) {
+ if (token.type === "heading_open") {
+ addErrorDetailIf(onError, token.lineNumber, tag, token.tag);
+ return false;
+ }
+ return true;
+ });
+ }
+};
+
+
+/***/ }),
+/* 113 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, filterTokens, headingStyleFor } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD003", "heading-style", "header-style" ],
+ "description": "Heading style",
+ "tags": [ "headings", "headers" ],
+ "function": function MD003(params, onError) {
+ let style = String(params.config.style || "consistent");
+ filterTokens(params, "heading_open", function forToken(token) {
+ const styleForToken = headingStyleFor(token);
+ if (style === "consistent") {
+ style = styleForToken;
+ }
+ if (styleForToken !== style) {
+ const h12 = /h[12]/.test(token.tag);
+ const setextWithAtx =
+ (style === "setext_with_atx") &&
+ ((h12 && (styleForToken === "setext")) ||
+ (!h12 && (styleForToken === "atx")));
+ const setextWithAtxClosed =
+ (style === "setext_with_atx_closed") &&
+ ((h12 && (styleForToken === "setext")) ||
+ (!h12 && (styleForToken === "atx_closed")));
+ if (!setextWithAtx && !setextWithAtxClosed) {
+ let expected = style;
+ if (style === "setext_with_atx") {
+ expected = h12 ? "setext" : "atx";
+ } else if (style === "setext_with_atx_closed") {
+ expected = h12 ? "setext" : "atx_closed";
+ }
+ addErrorDetailIf(onError, token.lineNumber,
+ expected, styleForToken);
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 114 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, listItemMarkerRe,
+ rangeFromRegExp, unorderedListStyleFor } = __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD004", "ul-style" ],
+ "description": "Unordered list style",
+ "tags": [ "bullet", "ul" ],
+ "function": function MD004(params, onError) {
+ const style = String(params.config.style || "consistent");
+ let expectedStyle = style;
+ const nestingStyles = [];
+ flattenedLists().forEach((list) => {
+ if (list.unordered) {
+ if (expectedStyle === "consistent") {
+ expectedStyle = unorderedListStyleFor(list.items[0]);
+ }
+ list.items.forEach((item) => {
+ const itemStyle = unorderedListStyleFor(item);
+ if (style === "sublist") {
+ const nesting = list.nesting;
+ if (!nestingStyles[nesting] &&
+ (itemStyle !== nestingStyles[nesting - 1])) {
+ nestingStyles[nesting] = itemStyle;
+ } else {
+ addErrorDetailIf(onError, item.lineNumber,
+ nestingStyles[nesting], itemStyle, null, null,
+ rangeFromRegExp(item.line, listItemMarkerRe));
+ }
+ } else {
+ addErrorDetailIf(onError, item.lineNumber,
+ expectedStyle, itemStyle, null, null,
+ rangeFromRegExp(item.line, listItemMarkerRe));
+ }
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 115 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+let lineMetadata = null;
+module.exports.lineMetadata = (value) => {
+ if (value) {
+ lineMetadata = value;
+ }
+ return lineMetadata;
+};
+
+let flattenedLists = null;
+module.exports.flattenedLists = (value) => {
+ if (value) {
+ flattenedLists = value;
+ }
+ return flattenedLists;
+};
+
+module.exports.clear = () => {
+ lineMetadata = null;
+ flattenedLists = null;
+};
+
+
+/***/ }),
+/* 116 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, addErrorDetailIf, indentFor, listItemMarkerRe,
+ orderedListItemMarkerRe, rangeFromRegExp } = __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD005", "list-indent" ],
+ "description": "Inconsistent indentation for list items at the same level",
+ "tags": [ "bullet", "ul", "indentation" ],
+ "function": function MD005(params, onError) {
+ flattenedLists().forEach((list) => {
+ const expectedIndent = list.indent;
+ let expectedEnd = 0;
+ let actualEnd = -1;
+ let endMatching = false;
+ list.items.forEach((item) => {
+ const { line, lineNumber } = item;
+ const actualIndent = indentFor(item);
+ let match = null;
+ if (list.unordered) {
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ expectedIndent,
+ actualIndent,
+ null,
+ null,
+ rangeFromRegExp(line, listItemMarkerRe)
+ // No fixInfo; MD007 handles this scenario better
+ );
+ } else if ((match = orderedListItemMarkerRe.exec(line))) {
+ actualEnd = match[0].length;
+ expectedEnd = expectedEnd || actualEnd;
+ const markerLength = match[1].length + 1;
+ if ((expectedIndent !== actualIndent) || endMatching) {
+ if (expectedEnd === actualEnd) {
+ endMatching = true;
+ } else {
+ const detail = endMatching ?
+ `Expected: (${expectedEnd}); Actual: (${actualEnd})` :
+ `Expected: ${expectedIndent}; Actual: ${actualIndent}`;
+ const expected = endMatching ?
+ expectedEnd - markerLength :
+ expectedIndent;
+ const actual = endMatching ?
+ actualEnd - markerLength :
+ actualIndent;
+ addError(
+ onError,
+ lineNumber,
+ detail,
+ null,
+ rangeFromRegExp(line, listItemMarkerRe),
+ {
+ "editColumn": Math.min(actual, expected) + 1,
+ "deleteCount": Math.max(actual - expected, 0),
+ "insertText": "".padEnd(Math.max(expected - actual, 0))
+ }
+ );
+ }
+ }
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 117 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
+ __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD006", "ul-start-left" ],
+ "description":
+ "Consider starting bulleted lists at the beginning of the line",
+ "tags": [ "bullet", "ul", "indentation" ],
+ "function": function MD006(params, onError) {
+ flattenedLists().forEach((list) => {
+ if (list.unordered && !list.nesting && (list.indent !== 0)) {
+ list.items.forEach((item) => {
+ const { lineNumber, line } = item;
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ 0,
+ list.indent,
+ null,
+ null,
+ rangeFromRegExp(line, listItemMarkerRe),
+ {
+ "deleteCount": line.length - line.trimLeft().length
+ });
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 118 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, indentFor, listItemMarkerRe } =
+ __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD007", "ul-indent" ],
+ "description": "Unordered list indentation",
+ "tags": [ "bullet", "ul", "indentation" ],
+ "function": function MD007(params, onError) {
+ const indent = Number(params.config.indent || 2);
+ const startIndented = !!params.config.start_indented;
+ flattenedLists().forEach((list) => {
+ if (list.unordered && list.parentsUnordered) {
+ list.items.forEach((item) => {
+ const { lineNumber, line } = item;
+ const expectedNesting = list.nesting + (startIndented ? 1 : 0);
+ const expectedIndent = expectedNesting * indent;
+ const actualIndent = indentFor(item);
+ let range = null;
+ let editColumn = 1;
+ const match = line.match(listItemMarkerRe);
+ if (match) {
+ range = [ 1, match[0].length ];
+ editColumn += match[1].length - actualIndent;
+ }
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ expectedIndent,
+ actualIndent,
+ null,
+ null,
+ range,
+ {
+ editColumn,
+ "deleteCount": actualIndent,
+ "insertText": "".padEnd(expectedIndent)
+ });
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 119 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, filterTokens, forEachInlineCodeSpan, forEachLine,
+ includesSorted, newLineRe, numericSortAscending } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD009", "no-trailing-spaces" ],
+ "description": "Trailing spaces",
+ "tags": [ "whitespace" ],
+ "function": function MD009(params, onError) {
+ let brSpaces = params.config.br_spaces;
+ brSpaces = Number((brSpaces === undefined) ? 2 : brSpaces);
+ const listItemEmptyLines = !!params.config.list_item_empty_lines;
+ const strict = !!params.config.strict;
+ const listItemLineNumbers = [];
+ if (listItemEmptyLines) {
+ filterTokens(params, "list_item_open", (token) => {
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ listItemLineNumbers.push(i + 1);
+ }
+ });
+ listItemLineNumbers.sort(numericSortAscending);
+ }
+ const paragraphLineNumbers = [];
+ const codeInlineLineNumbers = [];
+ if (strict) {
+ filterTokens(params, "paragraph_open", (token) => {
+ for (let i = token.map[0]; i < token.map[1] - 1; i++) {
+ paragraphLineNumbers.push(i + 1);
+ }
+ });
+ paragraphLineNumbers.sort(numericSortAscending);
+ filterTokens(params, "inline", (token) => {
+ if (token.children.some((child) => child.type === "code_inline")) {
+ const tokenLines = params.lines.slice(token.map[0], token.map[1]);
+ forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
+ const codeLineCount = code.split(newLineRe).length;
+ for (let i = 0; i < codeLineCount; i++) {
+ codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
+ }
+ });
+ }
+ });
+ codeInlineLineNumbers.sort(numericSortAscending);
+ }
+ const expected = (brSpaces < 2) ? 0 : brSpaces;
+ let inFencedCode = 0;
+ forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
+ inFencedCode += onFence;
+ const lineNumber = lineIndex + 1;
+ const trailingSpaces = line.length - line.trimRight().length;
+ if ((!inCode || inFencedCode) && trailingSpaces &&
+ !includesSorted(listItemLineNumbers, lineNumber)) {
+ if ((expected !== trailingSpaces) ||
+ (strict &&
+ (!includesSorted(paragraphLineNumbers, lineNumber) ||
+ includesSorted(codeInlineLineNumbers, lineNumber)))) {
+ const column = line.length - trailingSpaces + 1;
+ addError(
+ onError,
+ lineNumber,
+ "Expected: " + (expected === 0 ? "" : "0 or ") +
+ expected + "; Actual: " + trailingSpaces,
+ null,
+ [ column, trailingSpaces ],
+ {
+ "editColumn": column,
+ "deleteCount": trailingSpaces
+ });
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 120 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, forEachLine } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+const tabRe = /\t+/g;
+
+module.exports = {
+ "names": [ "MD010", "no-hard-tabs" ],
+ "description": "Hard tabs",
+ "tags": [ "whitespace", "hard_tab" ],
+ "function": function MD010(params, onError) {
+ const codeBlocks = params.config.code_blocks;
+ const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
+ if (!inCode || includeCodeBlocks) {
+ let match = null;
+ while ((match = tabRe.exec(line)) !== null) {
+ const column = match.index + 1;
+ const length = match[0].length;
+ addError(
+ onError,
+ lineIndex + 1,
+ "Column: " + column,
+ null,
+ [ column, length ],
+ {
+ "editColumn": column,
+ "deleteCount": length,
+ "insertText": "".padEnd(length)
+ });
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 121 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, forEachInlineChild, unescapeMarkdown } =
+ __webpack_require__(110);
+
+const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g;
+
+module.exports = {
+ "names": [ "MD011", "no-reversed-links" ],
+ "description": "Reversed link syntax",
+ "tags": [ "links" ],
+ "function": function MD011(params, onError) {
+ forEachInlineChild(params, "text", (token) => {
+ const { lineNumber, content } = token;
+ let match = null;
+ while ((match = reversedLinkRe.exec(content)) !== null) {
+ const [ reversedLink, linkText, linkDestination ] = match;
+ const line = params.lines[lineNumber - 1];
+ const column = unescapeMarkdown(line).indexOf(reversedLink) + 1;
+ const length = reversedLink.length;
+ addError(
+ onError,
+ lineNumber,
+ reversedLink,
+ null,
+ [ column, length ],
+ {
+ "editColumn": column,
+ "deleteCount": length,
+ "insertText": `[${linkText}](${linkDestination})`
+ }
+ );
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 122 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, forEachLine } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD012", "no-multiple-blanks" ],
+ "description": "Multiple consecutive blank lines",
+ "tags": [ "whitespace", "blank_lines" ],
+ "function": function MD012(params, onError) {
+ const maximum = Number(params.config.maximum || 1);
+ let count = 0;
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
+ count = (inCode || line.trim().length) ? 0 : count + 1;
+ if (maximum < count) {
+ addErrorDetailIf(
+ onError,
+ lineIndex + 1,
+ maximum,
+ count,
+ null,
+ null,
+ null,
+ {
+ "deleteCount": -1
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 123 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, filterTokens, forEachHeading, forEachLine,
+ includesSorted } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+const longLineRePrefix = "^.{";
+const longLineRePostfixRelaxed = "}.*\\s.*$";
+const longLineRePostfixStrict = "}.+$";
+const labelRe = /^\s*\[.*[^\\]]:/;
+const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
+const sternModeRe = /^([#>\s]*\s)?\S*$/;
+const tokenTypeMap = {
+ "em_open": "e",
+ "em_close": "E",
+ "image": "I",
+ "link_open": "l",
+ "link_close": "L",
+ "strong_open": "s",
+ "strong_close": "S",
+ "text": "T"
+};
+
+module.exports = {
+ "names": [ "MD013", "line-length" ],
+ "description": "Line length",
+ "tags": [ "line_length" ],
+ "function": function MD013(params, onError) {
+ const lineLength = Number(params.config.line_length || 80);
+ const headingLineLength =
+ Number(params.config.heading_line_length || lineLength);
+ const codeLineLength =
+ Number(params.config.code_block_line_length || lineLength);
+ const strict = !!params.config.strict;
+ const stern = !!params.config.stern;
+ const longLineRePostfix =
+ (strict || stern) ? longLineRePostfixStrict : longLineRePostfixRelaxed;
+ const longLineRe =
+ new RegExp(longLineRePrefix + lineLength + longLineRePostfix);
+ const longHeadingLineRe =
+ new RegExp(longLineRePrefix + headingLineLength + longLineRePostfix);
+ const longCodeLineRe =
+ new RegExp(longLineRePrefix + codeLineLength + longLineRePostfix);
+ const codeBlocks = params.config.code_blocks;
+ const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
+ const tables = params.config.tables;
+ const includeTables = (tables === undefined) ? true : !!tables;
+ let headings = params.config.headings;
+ if (headings === undefined) {
+ headings = params.config.headers;
+ }
+ const includeHeadings = (headings === undefined) ? true : !!headings;
+ const headingLineNumbers = [];
+ forEachHeading(params, (heading) => {
+ headingLineNumbers.push(heading.lineNumber);
+ });
+ const linkOnlyLineNumbers = [];
+ filterTokens(params, "inline", (token) => {
+ let childTokenTypes = "";
+ token.children.forEach((child) => {
+ if (child.type !== "text" || child.content !== "") {
+ childTokenTypes += tokenTypeMap[child.type] || "x";
+ }
+ });
+ if (linkOrImageOnlyLineRe.test(childTokenTypes)) {
+ linkOnlyLineNumbers.push(token.lineNumber);
+ }
+ });
+ forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence, inTable) => {
+ const lineNumber = lineIndex + 1;
+ const isHeading = includesSorted(headingLineNumbers, lineNumber);
+ const length = inCode ?
+ codeLineLength :
+ (isHeading ? headingLineLength : lineLength);
+ const lengthRe = inCode ?
+ longCodeLineRe :
+ (isHeading ? longHeadingLineRe : longLineRe);
+ if ((includeCodeBlocks || !inCode) &&
+ (includeTables || !inTable) &&
+ (includeHeadings || !isHeading) &&
+ (strict ||
+ (!(stern && sternModeRe.test(line)) &&
+ !includesSorted(linkOnlyLineNumbers, lineNumber) &&
+ !labelRe.test(line))) &&
+ lengthRe.test(line)) {
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ length,
+ line.length,
+ null,
+ null,
+ [ length + 1, line.length - length ]);
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 124 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens } = __webpack_require__(110);
+
+const dollarCommandRe = /^(\s*)(\$\s+)/;
+
+module.exports = {
+ "names": [ "MD014", "commands-show-output" ],
+ "description": "Dollar signs used before commands without showing output",
+ "tags": [ "code" ],
+ "function": function MD014(params, onError) {
+ [ "code_block", "fence" ].forEach((type) => {
+ filterTokens(params, type, (token) => {
+ const margin = (token.type === "fence") ? 1 : 0;
+ const dollarInstances = [];
+ let allDollars = true;
+ for (let i = token.map[0] + margin; i < token.map[1] - margin; i++) {
+ const line = params.lines[i];
+ const lineTrim = line.trim();
+ if (lineTrim) {
+ const match = dollarCommandRe.exec(line);
+ if (match) {
+ const column = match[1].length + 1;
+ const length = match[2].length;
+ dollarInstances.push([ i, lineTrim, column, length ]);
+ } else {
+ allDollars = false;
+ }
+ }
+ }
+ if (allDollars) {
+ dollarInstances.forEach((instance) => {
+ const [ i, lineTrim, column, length ] = instance;
+ addErrorContext(
+ onError,
+ i + 1,
+ lineTrim,
+ null,
+ null,
+ [ column, length ],
+ {
+ "editColumn": column,
+ "deleteCount": length
+ }
+ );
+ });
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 125 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, forEachLine } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD018", "no-missing-space-atx" ],
+ "description": "No space after hash on atx style heading",
+ "tags": [ "headings", "headers", "atx", "spaces" ],
+ "function": function MD018(params, onError) {
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
+ if (!inCode &&
+ /^#+[^#\s]/.test(line) &&
+ !/#\s*$/.test(line) &&
+ !line.startsWith("#️⃣")) {
+ const hashCount = /^#+/.exec(line)[0].length;
+ addErrorContext(
+ onError,
+ lineIndex + 1,
+ line.trim(),
+ null,
+ null,
+ [ 1, hashCount + 1 ],
+ {
+ "editColumn": hashCount + 1,
+ "insertText": " "
+ }
+ );
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 126 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens, headingStyleFor } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD019", "no-multiple-space-atx" ],
+ "description": "Multiple spaces after hash on atx style heading",
+ "tags": [ "headings", "headers", "atx", "spaces" ],
+ "function": function MD019(params, onError) {
+ filterTokens(params, "heading_open", (token) => {
+ if (headingStyleFor(token) === "atx") {
+ const { line, lineNumber } = token;
+ const match = /^(#+)(\s{2,})(?:\S)/.exec(line);
+ if (match) {
+ const [
+ ,
+ { "length": hashLength },
+ { "length": spacesLength }
+ ] = match;
+ addErrorContext(
+ onError,
+ lineNumber,
+ line.trim(),
+ null,
+ null,
+ [ 1, hashLength + spacesLength + 1 ],
+ {
+ "editColumn": hashLength + 1,
+ "deleteCount": spacesLength - 1
+ }
+ );
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 127 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, forEachLine } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD020", "no-missing-space-closed-atx" ],
+ "description": "No space inside hashes on closed atx style heading",
+ "tags": [ "headings", "headers", "atx_closed", "spaces" ],
+ "function": function MD020(params, onError) {
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
+ if (!inCode) {
+ const match =
+ /^(#+)(\s*)([^#]*?[^#\\])(\s*)((?:\\#)?)(#+)(\s*)$/.exec(line);
+ if (match) {
+ const [
+ ,
+ leftHash,
+ { "length": leftSpaceLength },
+ content,
+ { "length": rightSpaceLength },
+ rightEscape,
+ rightHash,
+ { "length": trailSpaceLength }
+ ] = match;
+ const leftHashLength = leftHash.length;
+ const rightHashLength = rightHash.length;
+ const left = !leftSpaceLength;
+ const right = !rightSpaceLength || rightEscape;
+ const rightEscapeReplacement = rightEscape ? `${rightEscape} ` : "";
+ if (left || right) {
+ const range = left ?
+ [
+ 1,
+ leftHashLength + 1
+ ] :
+ [
+ line.length - trailSpaceLength - rightHashLength,
+ rightHashLength + 1
+ ];
+ addErrorContext(
+ onError,
+ lineIndex + 1,
+ line.trim(),
+ left,
+ right,
+ range,
+ {
+ "editColumn": 1,
+ "deleteCount": line.length,
+ "insertText":
+ `${leftHash} ${content} ${rightEscapeReplacement}${rightHash}`
+ }
+ );
+ }
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 128 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens, headingStyleFor } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD021", "no-multiple-space-closed-atx" ],
+ "description": "Multiple spaces inside hashes on closed atx style heading",
+ "tags": [ "headings", "headers", "atx_closed", "spaces" ],
+ "function": function MD021(params, onError) {
+ filterTokens(params, "heading_open", (token) => {
+ if (headingStyleFor(token) === "atx_closed") {
+ const { line, lineNumber } = token;
+ const match = /^(#+)(\s+)([^#]+?)(\s+)(#+)(\s*)$/.exec(line);
+ if (match) {
+ const [
+ ,
+ leftHash,
+ { "length": leftSpaceLength },
+ content,
+ { "length": rightSpaceLength },
+ rightHash,
+ { "length": trailSpaceLength }
+ ] = match;
+ const left = leftSpaceLength > 1;
+ const right = rightSpaceLength > 1;
+ if (left || right) {
+ const length = line.length;
+ const leftHashLength = leftHash.length;
+ const rightHashLength = rightHash.length;
+ const range = left ?
+ [
+ 1,
+ leftHashLength + leftSpaceLength + 1
+ ] :
+ [
+ length - trailSpaceLength - rightHashLength - rightSpaceLength,
+ rightSpaceLength + rightHashLength + 1
+ ];
+ addErrorContext(
+ onError,
+ lineNumber,
+ line.trim(),
+ left,
+ right,
+ range,
+ {
+ "editColumn": 1,
+ "deleteCount": length,
+ "insertText": `${leftHash} ${content} ${rightHash}`
+ }
+ );
+ }
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 129 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, filterTokens, isBlankLine } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
+ "description": "Headings should be surrounded by blank lines",
+ "tags": [ "headings", "headers", "blank_lines" ],
+ "function": function MD022(params, onError) {
+ let linesAbove = params.config.lines_above;
+ linesAbove = Number((linesAbove === undefined) ? 1 : linesAbove);
+ let linesBelow = params.config.lines_below;
+ linesBelow = Number((linesBelow === undefined) ? 1 : linesBelow);
+ const { lines } = params;
+ filterTokens(params, "heading_open", (token) => {
+ const [ topIndex, nextIndex ] = token.map;
+ let actualAbove = 0;
+ for (let i = 0; i < linesAbove; i++) {
+ if (isBlankLine(lines[topIndex - i - 1])) {
+ actualAbove++;
+ }
+ }
+ addErrorDetailIf(
+ onError,
+ topIndex + 1,
+ linesAbove,
+ actualAbove,
+ "Above",
+ lines[topIndex].trim(),
+ null,
+ {
+ "insertText": "".padEnd(linesAbove - actualAbove, "\n")
+ });
+ let actualBelow = 0;
+ for (let i = 0; i < linesBelow; i++) {
+ if (isBlankLine(lines[nextIndex + i])) {
+ actualBelow++;
+ }
+ }
+ addErrorDetailIf(
+ onError,
+ topIndex + 1,
+ linesBelow,
+ actualBelow,
+ "Below",
+ lines[topIndex].trim(),
+ null,
+ {
+ "lineNumber": nextIndex + 1,
+ "insertText": "".padEnd(linesBelow - actualBelow, "\n")
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 130 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens } = __webpack_require__(110);
+
+const spaceBeforeHeadingRe = /^((?:\s+)|(?:[>\s]+\s\s))[^>\s]/;
+
+module.exports = {
+ "names": [ "MD023", "heading-start-left", "header-start-left" ],
+ "description": "Headings must start at the beginning of the line",
+ "tags": [ "headings", "headers", "spaces" ],
+ "function": function MD023(params, onError) {
+ filterTokens(params, "heading_open", function forToken(token) {
+ const { lineNumber, line } = token;
+ const match = line.match(spaceBeforeHeadingRe);
+ if (match) {
+ const [ prefixAndFirstChar, prefix ] = match;
+ let deleteCount = prefix.length;
+ const prefixLengthNoSpace = prefix.trimRight().length;
+ if (prefixLengthNoSpace) {
+ deleteCount -= prefixLengthNoSpace - 1;
+ }
+ addErrorContext(
+ onError,
+ lineNumber,
+ line,
+ null,
+ null,
+ [ 1, prefixAndFirstChar.length ],
+ {
+ "editColumn": prefixLengthNoSpace + 1,
+ "deleteCount": deleteCount
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 131 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, forEachHeading } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ],
+ "description": "Multiple headings with the same content",
+ "tags": [ "headings", "headers" ],
+ "function": function MD024(params, onError) {
+ const siblingsOnly = !!params.config.siblings_only ||
+ !!params.config.allow_different_nesting || false;
+ const knownContents = [ null, [] ];
+ let lastLevel = 1;
+ let knownContent = knownContents[lastLevel];
+ forEachHeading(params, (heading, content) => {
+ if (siblingsOnly) {
+ const newLevel = heading.tag.slice(1);
+ while (lastLevel < newLevel) {
+ lastLevel++;
+ knownContents[lastLevel] = [];
+ }
+ while (lastLevel > newLevel) {
+ knownContents[lastLevel] = [];
+ lastLevel--;
+ }
+ knownContent = knownContents[newLevel];
+ }
+ if (knownContent.includes(content)) {
+ addErrorContext(onError, heading.lineNumber,
+ heading.line.trim());
+ } else {
+ knownContent.push(content);
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 132 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens, frontMatterHasTitle } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD025", "single-title", "single-h1" ],
+ "description": "Multiple top level headings in the same document",
+ "tags": [ "headings", "headers" ],
+ "function": function MD025(params, onError) {
+ const level = Number(params.config.level || 1);
+ const tag = "h" + level;
+ const foundFrontMatterTitle =
+ frontMatterHasTitle(
+ params.frontMatterLines,
+ params.config.front_matter_title
+ );
+ let hasTopLevelHeading = false;
+ filterTokens(params, "heading_open", function forToken(token) {
+ if (token.tag === tag) {
+ if (hasTopLevelHeading || foundFrontMatterTitle) {
+ addErrorContext(onError, token.lineNumber,
+ token.line.trim());
+ } else if (token.lineNumber === 1) {
+ hasTopLevelHeading = true;
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 133 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, allPunctuation, escapeForRegExp, forEachHeading } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD026", "no-trailing-punctuation" ],
+ "description": "Trailing punctuation in heading",
+ "tags": [ "headings", "headers" ],
+ "function": function MD026(params, onError) {
+ let punctuation = params.config.punctuation;
+ punctuation =
+ String((punctuation === undefined) ? allPunctuation : punctuation);
+ const trailingPunctuationRe =
+ new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
+ forEachHeading(params, (heading) => {
+ const { line, lineNumber } = heading;
+ const trimmedLine = line.replace(/[\s#]*$/, "");
+ const match = trailingPunctuationRe.exec(trimmedLine);
+ if (match) {
+ const fullMatch = match[0];
+ const column = match.index + 1;
+ const length = fullMatch.length;
+ addError(
+ onError,
+ lineNumber,
+ `Punctuation: '${fullMatch}'`,
+ null,
+ [ column, length ],
+ {
+ "editColumn": column,
+ "deleteCount": length
+ }
+ );
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 134 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, newLineRe } = __webpack_require__(110);
+
+const spaceAfterBlockQuoteRe = /^((?:\s*>)+)(\s{2,})\S/;
+
+module.exports = {
+ "names": [ "MD027", "no-multiple-space-blockquote" ],
+ "description": "Multiple spaces after blockquote symbol",
+ "tags": [ "blockquote", "whitespace", "indentation" ],
+ "function": function MD027(params, onError) {
+ let blockquoteNesting = 0;
+ let listItemNesting = 0;
+ params.tokens.forEach((token) => {
+ const { content, lineNumber, type } = token;
+ if (type === "blockquote_open") {
+ blockquoteNesting++;
+ } else if (type === "blockquote_close") {
+ blockquoteNesting--;
+ } else if (type === "list_item_open") {
+ listItemNesting++;
+ } else if (type === "list_item_close") {
+ listItemNesting--;
+ } else if ((type === "inline") && blockquoteNesting) {
+ const lineCount = content.split(newLineRe).length;
+ for (let i = 0; i < lineCount; i++) {
+ const line = params.lines[lineNumber + i - 1];
+ const match = line.match(spaceAfterBlockQuoteRe);
+ if (match) {
+ const [
+ fullMatch,
+ { "length": blockquoteLength },
+ { "length": spaceLength }
+ ] = match;
+ if (!listItemNesting || (fullMatch[fullMatch.length - 1] === ">")) {
+ addErrorContext(
+ onError,
+ lineNumber + i,
+ line,
+ null,
+ null,
+ [ 1, fullMatch.length ],
+ {
+ "editColumn": blockquoteLength + 1,
+ "deleteCount": spaceLength - 1
+ }
+ );
+ }
+ }
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 135 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD028", "no-blanks-blockquote" ],
+ "description": "Blank line inside blockquote",
+ "tags": [ "blockquote", "whitespace" ],
+ "function": function MD028(params, onError) {
+ let prevToken = {};
+ let prevLineNumber = null;
+ params.tokens.forEach(function forToken(token) {
+ if ((token.type === "blockquote_open") &&
+ (prevToken.type === "blockquote_close")) {
+ for (
+ let lineNumber = prevLineNumber;
+ lineNumber < token.lineNumber;
+ lineNumber++) {
+ addError(
+ onError,
+ lineNumber,
+ null,
+ null,
+ null,
+ {
+ "deleteCount": -1
+ });
+ }
+ }
+ prevToken = token;
+ if (token.type === "blockquote_open") {
+ prevLineNumber = token.map[1] + 1;
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 136 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, listItemMarkerRe, orderedListItemMarkerRe,
+ rangeFromRegExp } = __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+const listStyleExamples = {
+ "one": "1/1/1",
+ "ordered": "1/2/3",
+ "zero": "0/0/0"
+};
+
+module.exports = {
+ "names": [ "MD029", "ol-prefix" ],
+ "description": "Ordered list item prefix",
+ "tags": [ "ol" ],
+ "function": function MD029(params, onError) {
+ const style = String(params.config.style || "one_or_ordered");
+ flattenedLists().filter((list) => !list.unordered).forEach((list) => {
+ const { items } = list;
+ let current = 1;
+ let incrementing = false;
+ // Check for incrementing number pattern 1/2/3 or 0/1/2
+ if (items.length >= 2) {
+ const first = orderedListItemMarkerRe.exec(items[0].line);
+ const second = orderedListItemMarkerRe.exec(items[1].line);
+ if (first && second) {
+ const [ , firstNumber ] = first;
+ const [ , secondNumber ] = second;
+ if ((secondNumber !== "1") || (firstNumber === "0")) {
+ incrementing = true;
+ if (firstNumber === "0") {
+ current = 0;
+ }
+ }
+ }
+ }
+ // Determine effective style
+ let listStyle = style;
+ if (listStyle === "one_or_ordered") {
+ listStyle = incrementing ? "ordered" : "one";
+ }
+ // Force expected value for 0/0/0 and 1/1/1 patterns
+ if (listStyle === "zero") {
+ current = 0;
+ } else if (listStyle === "one") {
+ current = 1;
+ }
+ // Validate each list item marker
+ items.forEach((item) => {
+ const match = orderedListItemMarkerRe.exec(item.line);
+ if (match) {
+ addErrorDetailIf(onError, item.lineNumber,
+ String(current), match[1],
+ "Style: " + listStyleExamples[listStyle], null,
+ rangeFromRegExp(item.line, listItemMarkerRe));
+ if (listStyle === "ordered") {
+ current++;
+ }
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 137 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf } = __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+module.exports = {
+ "names": [ "MD030", "list-marker-space" ],
+ "description": "Spaces after list markers",
+ "tags": [ "ol", "ul", "whitespace" ],
+ "function": function MD030(params, onError) {
+ const ulSingle = Number(params.config.ul_single || 1);
+ const olSingle = Number(params.config.ol_single || 1);
+ const ulMulti = Number(params.config.ul_multi || 1);
+ const olMulti = Number(params.config.ol_multi || 1);
+ flattenedLists().forEach((list) => {
+ const lineCount = list.lastLineIndex - list.open.map[0];
+ const allSingle = lineCount === list.items.length;
+ const expectedSpaces = list.unordered ?
+ (allSingle ? ulSingle : ulMulti) :
+ (allSingle ? olSingle : olMulti);
+ list.items.forEach((item) => {
+ const { line, lineNumber } = item;
+ const match = /^[\s>]*\S+(\s*)/.exec(line);
+ const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
+ if (matchLength < line.length) {
+ let fixInfo = null;
+ if (expectedSpaces !== actualSpaces) {
+ fixInfo = {
+ "editColumn": matchLength - actualSpaces + 1,
+ "deleteCount": actualSpaces,
+ "insertText": "".padEnd(expectedSpaces)
+ };
+ }
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ expectedSpaces,
+ actualSpaces,
+ null,
+ null,
+ [ 1, matchLength ],
+ fixInfo
+ );
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 138 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, forEachLine, isBlankLine } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+const codeFencePrefixRe = /^(.*?)\s*[`~]/;
+
+module.exports = {
+ "names": [ "MD031", "blanks-around-fences" ],
+ "description": "Fenced code blocks should be surrounded by blank lines",
+ "tags": [ "code", "blank_lines" ],
+ "function": function MD031(params, onError) {
+ const listItems = params.config.list_items;
+ const includeListItems = (listItems === undefined) ? true : !!listItems;
+ const { lines } = params;
+ forEachLine(lineMetadata(), (line, i, inCode, onFence, inTable, inItem) => {
+ const onTopFence = (onFence > 0);
+ const onBottomFence = (onFence < 0);
+ if ((includeListItems || !inItem) &&
+ ((onTopFence && !isBlankLine(lines[i - 1])) ||
+ (onBottomFence && !isBlankLine(lines[i + 1])))) {
+ const [ , prefix ] = line.match(codeFencePrefixRe);
+ addErrorContext(
+ onError,
+ i + 1,
+ lines[i].trim(),
+ null,
+ null,
+ null,
+ {
+ "lineNumber": i + (onTopFence ? 1 : 2),
+ "insertText": `${prefix}\n`
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 139 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, isBlankLine } = __webpack_require__(110);
+const { flattenedLists } = __webpack_require__(115);
+
+const quotePrefixRe = /^[>\s]*/;
+
+module.exports = {
+ "names": [ "MD032", "blanks-around-lists" ],
+ "description": "Lists should be surrounded by blank lines",
+ "tags": [ "bullet", "ul", "ol", "blank_lines" ],
+ "function": function MD032(params, onError) {
+ const { lines } = params;
+ flattenedLists().filter((list) => !list.nesting).forEach((list) => {
+ const firstIndex = list.open.map[0];
+ if (!isBlankLine(lines[firstIndex - 1])) {
+ const line = lines[firstIndex];
+ const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
+ addErrorContext(
+ onError,
+ firstIndex + 1,
+ line.trim(),
+ null,
+ null,
+ null,
+ {
+ "insertText": `${quotePrefix}\n`
+ });
+ }
+ const lastIndex = list.lastLineIndex - 1;
+ if (!isBlankLine(lines[lastIndex + 1])) {
+ const line = lines[lastIndex];
+ const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
+ addErrorContext(
+ onError,
+ lastIndex + 1,
+ line.trim(),
+ null,
+ null,
+ null,
+ {
+ "lineNumber": lastIndex + 2,
+ "insertText": `${quotePrefix}\n`
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 140 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, forEachLine, unescapeMarkdown } = __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+const htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:\s[^>]*)?)\/?>/g;
+const linkDestinationRe = /]\(\s*$/;
+const inlineCodeRe = /^[^`]*(`+[^`]+`+[^`]+)*`+[^`]*$/;
+// See https://spec.commonmark.org/0.29/#autolinks
+const emailAddressRe =
+ // eslint-disable-next-line max-len
+ /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
+
+module.exports = {
+ "names": [ "MD033", "no-inline-html" ],
+ "description": "Inline HTML",
+ "tags": [ "html" ],
+ "function": function MD033(params, onError) {
+ let allowedElements = params.config.allowed_elements;
+ allowedElements = Array.isArray(allowedElements) ? allowedElements : [];
+ allowedElements = allowedElements.map((element) => element.toLowerCase());
+ forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
+ let match = null;
+ // eslint-disable-next-line no-unmodified-loop-condition
+ while (!inCode && ((match = htmlElementRe.exec(line)) !== null)) {
+ const [ tag, content, element ] = match;
+ if (!allowedElements.includes(element.toLowerCase()) &&
+ !tag.endsWith("\\>") &&
+ !emailAddressRe.test(content)) {
+ const prefix = line.substring(0, match.index);
+ if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix)) {
+ const unescaped = unescapeMarkdown(prefix + "<", "_");
+ if (!unescaped.endsWith("_") &&
+ ((unescaped + "`").match(/`/g).length % 2)) {
+ addError(onError, lineIndex + 1, "Element: " + element,
+ null, [ match.index + 1, tag.length ]);
+ }
+ }
+ }
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 141 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, bareUrlRe, filterTokens } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD034", "no-bare-urls" ],
+ "description": "Bare URL used",
+ "tags": [ "links", "url" ],
+ "function": function MD034(params, onError) {
+ filterTokens(params, "inline", (token) => {
+ let inLink = false;
+ token.children.forEach((child) => {
+ const { content, line, lineNumber, type } = child;
+ let match = null;
+ if (type === "link_open") {
+ inLink = true;
+ } else if (type === "link_close") {
+ inLink = false;
+ } else if ((type === "text") && !inLink) {
+ while ((match = bareUrlRe.exec(content)) !== null) {
+ const [ bareUrl ] = match;
+ const matchIndex = match.index;
+ const bareUrlLength = bareUrl.length;
+ // Allow "[https://example.com]" to avoid conflicts with
+ // MD011/no-reversed-links; allow quoting as another way
+ // of deliberately including a bare URL
+ const leftChar = content[matchIndex - 1];
+ const rightChar = content[matchIndex + bareUrlLength];
+ if (
+ !((leftChar === "[") && (rightChar === "]")) &&
+ !((leftChar === "\"") && (rightChar === "\"")) &&
+ !((leftChar === "'") && (rightChar === "'"))
+ ) {
+ const index = line.indexOf(content);
+ const range = (index === -1) ? null : [
+ index + matchIndex + 1,
+ bareUrlLength
+ ];
+ const fixInfo = range ? {
+ "editColumn": range[0],
+ "deleteCount": range[1],
+ "insertText": `<${bareUrl}>`
+ } : null;
+ addErrorContext(
+ onError,
+ lineNumber,
+ bareUrl,
+ null,
+ null,
+ range,
+ fixInfo
+ );
+ }
+ }
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 142 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, filterTokens } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD035", "hr-style" ],
+ "description": "Horizontal rule style",
+ "tags": [ "hr" ],
+ "function": function MD035(params, onError) {
+ let style = String(params.config.style || "consistent");
+ filterTokens(params, "hr", function forToken(token) {
+ const lineTrim = token.line.trim();
+ if (style === "consistent") {
+ style = lineTrim;
+ }
+ addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
+ });
+ }
+};
+
+
+/***/ }),
+/* 143 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, allPunctuation } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD036", "no-emphasis-as-heading", "no-emphasis-as-header" ],
+ "description": "Emphasis used instead of a heading",
+ "tags": [ "headings", "headers", "emphasis" ],
+ "function": function MD036(params, onError) {
+ let punctuation = params.config.punctuation;
+ punctuation =
+ String((punctuation === undefined) ? allPunctuation : punctuation);
+ const re = new RegExp("[" + punctuation + "]$");
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function base(token) {
+ if (token.type === "paragraph_open") {
+ return function inParagraph(t) {
+ // Always paragraph_open/inline/paragraph_close,
+ const children = t.children.filter(function notEmptyText(child) {
+ return (child.type !== "text") || (child.content !== "");
+ });
+ if ((children.length === 3) &&
+ ((children[0].type === "strong_open") ||
+ (children[0].type === "em_open")) &&
+ (children[1].type === "text") &&
+ !re.test(children[1].content)) {
+ addErrorContext(onError, t.lineNumber,
+ children[1].content);
+ }
+ return base;
+ };
+ } else if (token.type === "blockquote_open") {
+ return function inBlockquote(t) {
+ if (t.type !== "blockquote_close") {
+ return inBlockquote;
+ }
+ return base;
+ };
+ } else if (token.type === "list_item_open") {
+ return function inListItem(t) {
+ if (t.type !== "list_item_close") {
+ return inListItem;
+ }
+ return base;
+ };
+ }
+ return base;
+ }
+ let state = base;
+ params.tokens.forEach(function forToken(token) {
+ state = state(token);
+ });
+ }
+};
+
+
+/***/ }),
+/* 144 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, emphasisMarkersInContent, forEachLine, isBlankLine } =
+ __webpack_require__(110);
+const { lineMetadata } = __webpack_require__(115);
+
+const emphasisRe = /(^|[^\\]|\\\\)(?:(\*\*?\*?)|(__?_?))/g;
+const asteriskListItemMarkerRe = /^([\s>]*)\*(\s+)/;
+const leftSpaceRe = /^\s+/;
+const rightSpaceRe = /\s+$/;
+
+module.exports = {
+ "names": [ "MD037", "no-space-in-emphasis" ],
+ "description": "Spaces inside emphasis markers",
+ "tags": [ "whitespace", "emphasis" ],
+ "function": function MD037(params, onError) {
+ // eslint-disable-next-line init-declarations
+ let effectiveEmphasisLength, emphasisIndex, emphasisKind, emphasisLength,
+ pendingError = null;
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function resetRunTracking() {
+ emphasisIndex = -1;
+ emphasisLength = 0;
+ emphasisKind = "";
+ effectiveEmphasisLength = 0;
+ pendingError = null;
+ }
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function handleRunEnd(line, lineIndex, contextLength, match, matchIndex) {
+ // Close current run
+ let content = line.substring(emphasisIndex, matchIndex);
+ if (!emphasisLength) {
+ content = content.trimStart();
+ }
+ if (!match) {
+ content = content.trimEnd();
+ }
+ const leftSpace = leftSpaceRe.test(content);
+ const rightSpace = rightSpaceRe.test(content);
+ if (leftSpace || rightSpace) {
+ // Report the violation
+ const contextStart = emphasisIndex - emphasisLength;
+ const contextEnd = matchIndex + contextLength;
+ const context = line.substring(contextStart, contextEnd);
+ const column = contextStart + 1;
+ const length = contextEnd - contextStart;
+ const leftMarker = line.substring(contextStart, emphasisIndex);
+ const rightMarker = match ? (match[2] || match[3]) : "";
+ const fixedText = `${leftMarker}${content.trim()}${rightMarker}`;
+ return [
+ onError,
+ lineIndex + 1,
+ context,
+ leftSpace,
+ rightSpace,
+ [ column, length ],
+ {
+ "editColumn": column,
+ "deleteCount": length,
+ "insertText": fixedText
+ }
+ ];
+ }
+ return null;
+ }
+ // Initialize
+ const ignoreMarkersByLine = emphasisMarkersInContent(params);
+ resetRunTracking();
+ forEachLine(
+ lineMetadata(),
+ (line, lineIndex, inCode, onFence, inTable, inItem, onBreak) => {
+ const onItemStart = (inItem === 1);
+ if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) {
+ // Emphasis resets when leaving a block
+ resetRunTracking();
+ }
+ if (inCode || onBreak) {
+ // Emphasis has no meaning here
+ return;
+ }
+ if (onItemStart) {
+ // Trim overlapping '*' list item marker
+ line = line.replace(asteriskListItemMarkerRe, "$1 $2");
+ }
+ let match = null;
+ // Match all emphasis-looking runs in the line...
+ while ((match = emphasisRe.exec(line))) {
+ const ignoreMarkersForLine = ignoreMarkersByLine[lineIndex] || [];
+ const matchIndex = match.index + match[1].length;
+ if (ignoreMarkersForLine.includes(matchIndex)) {
+ // Ignore emphasis markers inside code spans and links
+ continue;
+ }
+ const matchLength = match[0].length - match[1].length;
+ const matchKind = (match[2] || match[3])[0];
+ if (emphasisIndex === -1) {
+ // New run
+ emphasisIndex = matchIndex + matchLength;
+ emphasisLength = matchLength;
+ emphasisKind = matchKind;
+ effectiveEmphasisLength = matchLength;
+ } else if (matchKind === emphasisKind) {
+ // Matching emphasis markers
+ if (matchLength === effectiveEmphasisLength) {
+ // Ending an existing run, report any pending error
+ if (pendingError) {
+ addErrorContext(...pendingError);
+ pendingError = null;
+ }
+ const error = handleRunEnd(
+ line, lineIndex, effectiveEmphasisLength, match, matchIndex);
+ if (error) {
+ addErrorContext(...error);
+ }
+ // Reset
+ resetRunTracking();
+ } else if (matchLength === 3) {
+ // Swap internal run length (1->2 or 2->1)
+ effectiveEmphasisLength = matchLength - effectiveEmphasisLength;
+ } else if (effectiveEmphasisLength === 3) {
+ // Downgrade internal run (3->1 or 3->2)
+ effectiveEmphasisLength -= matchLength;
+ } else {
+ // Upgrade to internal run (1->3 or 2->3)
+ effectiveEmphasisLength += matchLength;
+ }
+ // Back up one character so RegExp has a chance to match the
+ // next marker (ex: "**star**_underscore_")
+ if (emphasisRe.lastIndex > 1) {
+ emphasisRe.lastIndex--;
+ }
+ } else if (emphasisRe.lastIndex > 1) {
+ // Back up one character so RegExp has a chance to match the
+ // mis-matched marker (ex: "*text_*")
+ emphasisRe.lastIndex--;
+ }
+ }
+ if (emphasisIndex !== -1) {
+ pendingError = pendingError ||
+ handleRunEnd(line, lineIndex, 0, null, line.length);
+ // Adjust for pending run on new line
+ emphasisIndex = 0;
+ emphasisLength = 0;
+ }
+ }
+ );
+ }
+};
+
+
+/***/ }),
+/* 145 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens, forEachInlineCodeSpan, newLineRe } =
+ __webpack_require__(110);
+
+const leftSpaceRe = /^\s([^`]|$)/;
+const rightSpaceRe = /[^`]\s$/;
+const singleLeftRightSpaceRe = /^\s(?:\S.*\S|\S)\s$/;
+
+module.exports = {
+ "names": [ "MD038", "no-space-in-code" ],
+ "description": "Spaces inside code span elements",
+ "tags": [ "whitespace", "code" ],
+ "function": function MD038(params, onError) {
+ filterTokens(params, "inline", (token) => {
+ if (token.children.some((child) => child.type === "code_inline")) {
+ const tokenLines = params.lines.slice(token.map[0], token.map[1]);
+ forEachInlineCodeSpan(
+ tokenLines.join("\n"),
+ (code, lineIndex, columnIndex, tickCount) => {
+ let rangeIndex = columnIndex - tickCount;
+ let rangeLength = code.length + (2 * tickCount);
+ let rangeLineOffset = 0;
+ let fixIndex = columnIndex;
+ let fixLength = code.length;
+ const codeLines = code.split(newLineRe);
+ const left = leftSpaceRe.test(code);
+ const right = !left && rightSpaceRe.test(code);
+ if (right && (codeLines.length > 1)) {
+ rangeIndex = 0;
+ rangeLineOffset = codeLines.length - 1;
+ fixIndex = 0;
+ }
+ const allowed = singleLeftRightSpaceRe.test(code);
+ if ((left || right) && !allowed) {
+ const codeLinesRange = codeLines[rangeLineOffset];
+ if (codeLines.length > 1) {
+ rangeLength = codeLinesRange.length + tickCount;
+ fixLength = codeLinesRange.length;
+ }
+ const context = tokenLines[lineIndex + rangeLineOffset]
+ .substring(rangeIndex, rangeIndex + rangeLength);
+ const codeLinesRangeTrim = codeLinesRange.trim();
+ const fixText =
+ (codeLinesRangeTrim.startsWith("`") ? " " : "") +
+ codeLinesRangeTrim +
+ (codeLinesRangeTrim.endsWith("`") ? " " : "");
+ addErrorContext(
+ onError,
+ token.lineNumber + lineIndex + rangeLineOffset,
+ context,
+ left,
+ right,
+ [ rangeIndex + 1, rangeLength ],
+ {
+ "editColumn": fixIndex + 1,
+ "deleteCount": fixLength,
+ "insertText": fixText
+ }
+ );
+ }
+ });
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 146 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens } = __webpack_require__(110);
+
+const spaceInLinkRe = /\[(?:\s+(?:[^\]]*?)\s*|(?:[^\]]*?)\s+)](?=\(\S*\))/;
+
+module.exports = {
+ "names": [ "MD039", "no-space-in-links" ],
+ "description": "Spaces inside link text",
+ "tags": [ "whitespace", "links" ],
+ "function": function MD039(params, onError) {
+ filterTokens(params, "inline", (token) => {
+ const { children } = token;
+ let { lineNumber } = token;
+ let inLink = false;
+ let linkText = "";
+ let lineIndex = 0;
+ children.forEach((child) => {
+ const { content, type } = child;
+ if (type === "link_open") {
+ inLink = true;
+ linkText = "";
+ } else if (type === "link_close") {
+ inLink = false;
+ const left = linkText.trimLeft().length !== linkText.length;
+ const right = linkText.trimRight().length !== linkText.length;
+ if (left || right) {
+ const line = params.lines[lineNumber - 1];
+ let range = null;
+ let fixInfo = null;
+ const match = line.slice(lineIndex).match(spaceInLinkRe);
+ if (match) {
+ const column = match.index + lineIndex + 1;
+ const length = match[0].length;
+ range = [ column, length ];
+ fixInfo = {
+ "editColumn": column + 1,
+ "deleteCount": length - 2,
+ "insertText": linkText.trim()
+ };
+ lineIndex = column + length - 1;
+ }
+ addErrorContext(
+ onError,
+ lineNumber,
+ `[${linkText}]`,
+ left,
+ right,
+ range,
+ fixInfo
+ );
+ }
+ } else if ((type === "softbreak") || (type === "hardbreak")) {
+ lineNumber++;
+ lineIndex = 0;
+ } else if (inLink) {
+ linkText += content;
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 147 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD040", "fenced-code-language" ],
+ "description": "Fenced code blocks should have a language specified",
+ "tags": [ "code", "language" ],
+ "function": function MD040(params, onError) {
+ filterTokens(params, "fence", function forToken(token) {
+ if (!token.info.trim()) {
+ addErrorContext(onError, token.lineNumber, token.line);
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 148 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, frontMatterHasTitle } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD041", "first-line-heading", "first-line-h1" ],
+ "description": "First line in file should be a top level heading",
+ "tags": [ "headings", "headers" ],
+ "function": function MD041(params, onError) {
+ const level = Number(params.config.level || 1);
+ const tag = "h" + level;
+ const foundFrontMatterTitle =
+ frontMatterHasTitle(
+ params.frontMatterLines,
+ params.config.front_matter_title
+ );
+ if (!foundFrontMatterTitle) {
+ params.tokens.every((token) => {
+ if (token.type === "html_block") {
+ return true;
+ }
+ if ((token.type !== "heading_open") || (token.tag !== tag)) {
+ addErrorContext(onError, token.lineNumber, token.line);
+ }
+ return false;
+ });
+ }
+ }
+};
+
+
+/***/ }),
+/* 149 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, filterTokens, rangeFromRegExp } =
+ __webpack_require__(110);
+
+const emptyLinkRe = /\[[^\]]*](?:\((?:#?|(?:<>))\))/;
+
+module.exports = {
+ "names": [ "MD042", "no-empty-links" ],
+ "description": "No empty links",
+ "tags": [ "links" ],
+ "function": function MD042(params, onError) {
+ filterTokens(params, "inline", function forToken(token) {
+ let inLink = false;
+ let linkText = "";
+ let emptyLink = false;
+ token.children.forEach(function forChild(child) {
+ if (child.type === "link_open") {
+ inLink = true;
+ linkText = "";
+ child.attrs.forEach(function forAttr(attr) {
+ if (attr[0] === "href" && (!attr[1] || (attr[1] === "#"))) {
+ emptyLink = true;
+ }
+ });
+ } else if (child.type === "link_close") {
+ inLink = false;
+ if (emptyLink) {
+ addErrorContext(onError, child.lineNumber,
+ "[" + linkText + "]()", null, null,
+ rangeFromRegExp(child.line, emptyLinkRe));
+ }
+ } else if (inLink) {
+ linkText += child.content;
+ }
+ });
+ });
+ }
+};
+
+
+/***/ }),
+/* 150 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorContext, addErrorDetailIf, forEachHeading } =
+ __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD043", "required-headings", "required-headers" ],
+ "description": "Required heading structure",
+ "tags": [ "headings", "headers" ],
+ "function": function MD043(params, onError) {
+ const requiredHeadings = params.config.headings || params.config.headers;
+ if (Array.isArray(requiredHeadings)) {
+ const levels = {};
+ [ 1, 2, 3, 4, 5, 6 ].forEach(function forLevel(level) {
+ levels["h" + level] = "######".substr(-level);
+ });
+ let i = 0;
+ let optional = false;
+ let errorCount = 0;
+ forEachHeading(params, function forHeading(heading, content) {
+ if (!errorCount) {
+ const actual = levels[heading.tag] + " " + content;
+ const expected = requiredHeadings[i++] || "[None]";
+ if (expected === "*") {
+ optional = true;
+ } else if (expected.toLowerCase() === actual.toLowerCase()) {
+ optional = false;
+ } else if (optional) {
+ i--;
+ } else {
+ addErrorDetailIf(onError, heading.lineNumber,
+ expected, actual);
+ errorCount++;
+ }
+ }
+ });
+ if ((i < requiredHeadings.length) && !errorCount) {
+ addErrorContext(onError, params.lines.length,
+ requiredHeadings[i]);
+ }
+ }
+ }
+};
+
+
+/***/ }),
+/* 151 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, bareUrlRe, escapeForRegExp, filterTokens,
+ forEachInlineChild, newLineRe } = __webpack_require__(110);
+
+const startNonWordRe = /^\W/;
+const endNonWordRe = /\W$/;
+
+module.exports = {
+ "names": [ "MD044", "proper-names" ],
+ "description": "Proper names should have the correct capitalization",
+ "tags": [ "spelling" ],
+ "function": function MD044(params, onError) {
+ let names = params.config.names;
+ names = Array.isArray(names) ? names : [];
+ const codeBlocks = params.config.code_blocks;
+ const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
+ names.forEach((name) => {
+ const escapedName = escapeForRegExp(name);
+ const startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b";
+ const endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*";
+ const namePattern =
+ `(${startNamePattern})(${escapedName})(${endNamePattern})`;
+ const anyNameRe = new RegExp(namePattern, "gi");
+ // eslint-disable-next-line jsdoc/require-jsdoc
+ function forToken(token) {
+ const fenceOffset = (token.type === "fence") ? 1 : 0;
+ token.content.split(newLineRe)
+ .forEach((line, index) => {
+ let match = null;
+ while ((match = anyNameRe.exec(line)) !== null) {
+ const [ fullMatch, leftMatch, nameMatch, rightMatch ] = match;
+ if (fullMatch.search(bareUrlRe) === -1) {
+ const wordMatch = fullMatch
+ .replace(new RegExp(`^\\W{0,${leftMatch.length}}`), "")
+ .replace(new RegExp(`\\W{0,${rightMatch.length}}$`), "");
+ if (!names.includes(wordMatch)) {
+ const lineNumber = token.lineNumber + index + fenceOffset;
+ const fullLine = params.lines[lineNumber - 1];
+ const matchLength = wordMatch.length;
+ const matchIndex = fullLine.indexOf(wordMatch);
+ const range = (matchIndex === -1) ?
+ null :
+ [ matchIndex + 1, matchLength ];
+ const fixInfo = (matchIndex === -1) ?
+ null :
+ {
+ "editColumn": matchIndex + 1,
+ "deleteCount": matchLength,
+ "insertText": name
+ };
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ name,
+ nameMatch,
+ null,
+ null,
+ range,
+ fixInfo
+ );
+ }
+ }
+ }
+ });
+ }
+ forEachInlineChild(params, "text", forToken);
+ if (includeCodeBlocks) {
+ forEachInlineChild(params, "code_inline", forToken);
+ filterTokens(params, "code_block", forToken);
+ filterTokens(params, "fence", forToken);
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 152 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, forEachInlineChild } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD045", "no-alt-text" ],
+ "description": "Images should have alternate text (alt text)",
+ "tags": [ "accessibility", "images" ],
+ "function": function MD045(params, onError) {
+ forEachInlineChild(params, "image", function forToken(token) {
+ if (token.content === "") {
+ addError(onError, token.lineNumber);
+ }
+ });
+ }
+};
+
+
+/***/ }),
+/* 153 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf } = __webpack_require__(110);
+
+const tokenTypeToStyle = {
+ "fence": "fenced",
+ "code_block": "indented"
+};
+
+module.exports = {
+ "names": [ "MD046", "code-block-style" ],
+ "description": "Code block style",
+ "tags": [ "code" ],
+ "function": function MD046(params, onError) {
+ let expectedStyle = String(params.config.style || "consistent");
+ params.tokens
+ .filter((token) => token.type === "code_block" || token.type === "fence")
+ .forEach((token) => {
+ const { lineNumber, type } = token;
+ if (expectedStyle === "consistent") {
+ expectedStyle = tokenTypeToStyle[type];
+ }
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ expectedStyle,
+ tokenTypeToStyle[type]);
+ });
+ }
+};
+
+
+/***/ }),
+/* 154 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addError, isBlankLine } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD047", "single-trailing-newline" ],
+ "description": "Files should end with a single newline character",
+ "tags": [ "blank_lines" ],
+ "function": function MD047(params, onError) {
+ const lastLineNumber = params.lines.length;
+ const lastLine = params.lines[lastLineNumber - 1];
+ if (!isBlankLine(lastLine)) {
+ addError(
+ onError,
+ lastLineNumber,
+ null,
+ null,
+ [ lastLine.length, 1 ],
+ {
+ "insertText": "\n",
+ "editColumn": lastLine.length + 1
+ }
+ );
+ }
+ }
+};
+
+
+/***/ }),
+/* 155 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const { addErrorDetailIf, fencedCodeBlockStyleFor } = __webpack_require__(110);
+
+module.exports = {
+ "names": [ "MD048", "code-fence-style" ],
+ "description": "Code fence style",
+ "tags": [ "code" ],
+ "function": function MD048(params, onError) {
+ const style = String(params.config.style || "consistent");
+ let expectedStyle = style;
+ params.tokens
+ .filter((token) => token.type === "fence")
+ .forEach((fenceToken) => {
+ const { lineNumber, markup } = fenceToken;
+ if (expectedStyle === "consistent") {
+ expectedStyle = fencedCodeBlockStyleFor(markup);
+ }
+ addErrorDetailIf(
+ onError,
+ lineNumber,
+ expectedStyle,
+ fencedCodeBlockStyleFor(markup)
+ );
+ });
+ }
+};
+
+
+/***/ }),
+/* 156 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+// @ts-check
+
+
+
+const os = __webpack_require__(111);
+
+// Regular expression for matching common newline characters
+// See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js
+const newLineRe = /\r\n?|\n/g;
+module.exports.newLineRe = newLineRe;
+
+// Regular expression for matching common front matter (YAML and TOML)
+module.exports.frontMatterRe =
+ // eslint-disable-next-line max-len
+ /((^---\s*$[^]*?^---\s*$)|(^\+\+\+\s*$[^]*?^(\+\+\+|\.\.\.)\s*$))(\r\n|\r|\n|$)/m;
+
+// Regular expression for matching inline disable/enable comments
+const inlineCommentRe =
+ // eslint-disable-next-line max-len
+ /<!--\s*markdownlint-(?:(?:(disable|enable|capture|restore|disable-file|enable-file)((?:\s+[a-z0-9_-]+)*))|(?:(configure-file)\s+([\s\S]*?)))\s*-->/ig;
+module.exports.inlineCommentRe = inlineCommentRe;
+
+// Regular expressions for range matching
+module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
+module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
+module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
+
+// Regular expression for all instances of emphasis markers
+const emphasisMarkersRe = /[_*]/g;
+
+// Regular expression for inline links and shortcut reference links
+const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g;
+
+// readFile options for reading with the UTF-8 encoding
+module.exports.utf8Encoding = { "encoding": "utf8" };
+
+// All punctuation characters (normal and full-width)
+module.exports.allPunctuation = ".,;:!?。,;:!?";
+
+// Returns true iff the input is a number
+module.exports.isNumber = function isNumber(obj) {
+ return typeof obj === "number";
+};
+
+// Returns true iff the input is a string
+module.exports.isString = function isString(obj) {
+ return typeof obj === "string";
+};
+
+// Returns true iff the input string is empty
+module.exports.isEmptyString = function isEmptyString(str) {
+ return str.length === 0;
+};
+
+// Returns true iff the input is an object
+module.exports.isObject = function isObject(obj) {
+ return (obj !== null) && (typeof obj === "object") && !Array.isArray(obj);
+};
+
+// Returns true iff the input line is blank (no content)
+// Example: Contains nothing, whitespace, or comments
+const blankLineRe = />|(?:<!--.*?-->)/g;
+module.exports.isBlankLine = function isBlankLine(line) {
+ return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
+};
+
+/**
+ * Compare function for Array.prototype.sort for ascending order of numbers.
+ *
+ * @param {number} a First number.
+ * @param {number} b Second number.
+ * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
+ */
+module.exports.numericSortAscending = function numericSortAscending(a, b) {
+ return a - b;
+};
+
+// Returns true iff the sorted array contains the specified element
+module.exports.includesSorted = function includesSorted(array, element) {
+ let left = 0;
+ let right = array.length - 1;
+ while (left <= right) {
+ /* eslint-disable no-bitwise */
+ const mid = (left + right) >> 1;
+ if (array[mid] < element) {
+ left = mid + 1;
+ } else if (array[mid] > element) {
+ right = mid - 1;
+ } else {
+ return true;
+ }
+ }
+ return false;
+};
+
+// Replaces the text of all properly-formatted HTML comments with whitespace
+// This preserves the line/column information for the rest of the document
+// Trailing whitespace is avoided with a '\' character in the last column
+// See https://www.w3.org/TR/html5/syntax.html#comments for details
+const htmlCommentBegin = "<!--";
+const htmlCommentEnd = "-->";
+module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
+ let i = 0;
+ while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
+ const j = text.indexOf(htmlCommentEnd, i);
+ if (j === -1) {
+ // Un-terminated comments are treated as text
+ break;
+ }
+ const comment = text.slice(i + htmlCommentBegin.length, j);
+ if ((comment.length > 0) &&
+ (comment[0] !== ">") &&
+ (comment[comment.length - 1] !== "-") &&
+ !comment.includes("--") &&
+ (text.slice(i, j + htmlCommentEnd.length)
+ .search(inlineCommentRe) === -1)) {
+ const blanks = comment
+ .replace(/[^\r\n]/g, " ")
+ .replace(/ ([\r\n])/g, "\\$1");
+ text = text.slice(0, i + htmlCommentBegin.length) +
+ blanks + text.slice(j);
+ }
+ i = j + htmlCommentEnd.length;
+ }
+ return text;
+};
+
+// Escapes a string for use in a RegExp
+module.exports.escapeForRegExp = function escapeForRegExp(str) {
+ return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
+};
+
+// Un-escapes Markdown content (simple algorithm; not a parser)
+const escapedMarkdownRe = /\\./g;
+module.exports.unescapeMarkdown =
+ function unescapeMarkdown(markdown, replacement) {
+ return markdown.replace(escapedMarkdownRe, (match) => {
+ const char = match[1];
+ if ("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".includes(char)) {
+ return replacement || char;
+ }
+ return match;
+ });
+ };
+
+/**
+ * Return the string representation of a fence markup character.
+ *
+ * @param {string} markup Fence string.
+ * @returns {string} String representation.
+ */
+module.exports.fencedCodeBlockStyleFor =
+ function fencedCodeBlockStyleFor(markup) {
+ switch (markup[0]) {
+ case "~":
+ return "tilde";
+ default:
+ return "backtick";
+ }
+ };
+
+/**
+ * Return the number of characters of indent for a token.
+ *
+ * @param {Object} token MarkdownItToken instance.
+ * @returns {number} Characters of indent.
+ */
+function indentFor(token) {
+ const line = token.line.replace(/^[\s>]*(> |>)/, "");
+ return line.length - line.trimLeft().length;
+}
+module.exports.indentFor = indentFor;
+
+// Returns the heading style for a heading token
+module.exports.headingStyleFor = function headingStyleFor(token) {
+ if ((token.map[1] - token.map[0]) === 1) {
+ if (/[^\\]#\s*$/.test(token.line)) {
+ return "atx_closed";
+ }
+ return "atx";
+ }
+ return "setext";
+};
+
+/**
+ * Return the string representation of an unordered list marker.
+ *
+ * @param {Object} token MarkdownItToken instance.
+ * @returns {string} String representation.
+ */
+module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
+ switch (token.markup) {
+ case "-":
+ return "dash";
+ case "+":
+ return "plus";
+ // case "*":
+ default:
+ return "asterisk";
+ }
+};
+
+/**
+ * Calls the provided function for each matching token.
+ *
+ * @param {Object} params RuleParams instance.
+ * @param {string} type Token type identifier.
+ * @param {Function} handler Callback function.
+ * @returns {void}
+ */
+function filterTokens(params, type, handler) {
+ params.tokens.forEach(function forToken(token) {
+ if (token.type === type) {
+ handler(token);
+ }
+ });
+}
+module.exports.filterTokens = filterTokens;
+
+// Get line metadata array
+module.exports.getLineMetadata = function getLineMetadata(params) {
+ const lineMetadata = params.lines.map(function mapLine(line, index) {
+ return [ line, index, false, 0, false, false ];
+ });
+ filterTokens(params, "fence", function forToken(token) {
+ lineMetadata[token.map[0]][3] = 1;
+ lineMetadata[token.map[1] - 1][3] = -1;
+ for (let i = token.map[0] + 1; i < token.map[1] - 1; i++) {
+ lineMetadata[i][2] = true;
+ }
+ });
+ filterTokens(params, "code_block", function forToken(token) {
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][2] = true;
+ }
+ });
+ filterTokens(params, "table_open", function forToken(token) {
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][4] = true;
+ }
+ });
+ filterTokens(params, "list_item_open", function forToken(token) {
+ let count = 1;
+ for (let i = token.map[0]; i < token.map[1]; i++) {
+ lineMetadata[i][5] = count;
+ count++;
+ }
+ });
+ filterTokens(params, "hr", function forToken(token) {
+ lineMetadata[token.map[0]][6] = true;
+ });
+ return lineMetadata;
+};
+
+// Calls the provided function for each line (with context)
+module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
+ lineMetadata.forEach(function forMetadata(metadata) {
+ // Parameters: line, lineIndex, inCode, onFence, inTable, inItem, inBreak
+ handler(...metadata);
+ });
+};
+
+// Returns (nested) lists as a flat array (in order)
+module.exports.flattenLists = function flattenLists(params) {
+ const flattenedLists = [];
+ const stack = [];
+ let current = null;
+ let nesting = 0;
+ const nestingStack = [];
+ let lastWithMap = { "map": [ 0, 1 ] };
+ params.tokens.forEach(function forToken(token) {
+ if ((token.type === "bullet_list_open") ||
+ (token.type === "ordered_list_open")) {
+ // Save current context and start a new one
+ stack.push(current);
+ current = {
+ "unordered": (token.type === "bullet_list_open"),
+ "parentsUnordered": !current ||
+ (current.unordered && current.parentsUnordered),
+ "open": token,
+ "indent": indentFor(token),
+ "parentIndent": (current && current.indent) || 0,
+ "items": [],
+ "nesting": nesting,
+ "lastLineIndex": -1,
+ "insert": flattenedLists.length
+ };
+ nesting++;
+ } else if ((token.type === "bullet_list_close") ||
+ (token.type === "ordered_list_close")) {
+ // Finalize current context and restore previous
+ current.lastLineIndex = lastWithMap.map[1];
+ flattenedLists.splice(current.insert, 0, current);
+ delete current.insert;
+ current = stack.pop();
+ nesting--;
+ } else if (token.type === "list_item_open") {
+ // Add list item
+ current.items.push(token);
+ } else if (token.type === "blockquote_open") {
+ nestingStack.push(nesting);
+ nesting = 0;
+ } else if (token.type === "blockquote_close") {
+ nesting = nestingStack.pop();
+ } else if (token.map) {
+ // Track last token with map
+ lastWithMap = token;
+ }
+ });
+ return flattenedLists;
+};
+
+// Calls the provided function for each specified inline child token
+module.exports.forEachInlineChild =
+function forEachInlineChild(params, type, handler) {
+ filterTokens(params, "inline", function forToken(token) {
+ token.children.forEach(function forChild(child) {
+ if (child.type === type) {
+ handler(child, token);
+ }
+ });
+ });
+};
+
+// Calls the provided function for each heading's content
+module.exports.forEachHeading = function forEachHeading(params, handler) {
+ let heading = null;
+ params.tokens.forEach(function forToken(token) {
+ if (token.type === "heading_open") {
+ heading = token;
+ } else if (token.type === "heading_close") {
+ heading = null;
+ } else if ((token.type === "inline") && heading) {
+ handler(heading, token.content);
+ }
+ });
+};
+
+/**
+ * Calls the provided function for each inline code span's content.
+ *
+ * @param {string} input Markdown content.
+ * @param {Function} handler Callback function.
+ * @returns {void}
+ */
+function forEachInlineCodeSpan(input, handler) {
+ let currentLine = 0;
+ let currentColumn = 0;
+ let index = 0;
+ while (index < input.length) {
+ let startIndex = -1;
+ let startLine = -1;
+ let startColumn = -1;
+ let tickCount = 0;
+ let currentTicks = 0;
+ let state = "normal";
+ // Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
+ for (; index <= input.length; index++) {
+ const char = input[index];
+ // Ignore backticks in link destination
+ if ((char === "[") && (state === "normal")) {
+ state = "linkTextOpen";
+ } else if ((char === "]") && (state === "linkTextOpen")) {
+ state = "linkTextClosed";
+ } else if ((char === "(") && (state === "linkTextClosed")) {
+ state = "linkDestinationOpen";
+ } else if (
+ ((char === "(") && (state === "linkDestinationOpen")) ||
+ ((char === ")") && (state === "linkDestinationOpen")) ||
+ (state === "linkTextClosed")) {
+ state = "normal";
+ }
+ // Parse backtick open/close
+ if ((char === "`") && (state !== "linkDestinationOpen")) {
+ // Count backticks at start or end of code span
+ currentTicks++;
+ if ((startIndex === -1) || (startColumn === -1)) {
+ startIndex = index + 1;
+ }
+ } else {
+ if ((startIndex >= 0) &&
+ (startColumn >= 0) &&
+ (tickCount === currentTicks)) {
+ // Found end backticks; invoke callback for code span
+ handler(
+ input.substring(startIndex, index - currentTicks),
+ startLine, startColumn, tickCount);
+ startIndex = -1;
+ startColumn = -1;
+ } else if ((startIndex >= 0) && (startColumn === -1)) {
+ // Found start backticks
+ tickCount = currentTicks;
+ startLine = currentLine;
+ startColumn = currentColumn;
+ }
+ // Not in backticks
+ currentTicks = 0;
+ }
+ if (char === "\n") {
+ // On next line
+ currentLine++;
+ currentColumn = 0;
+ } else if ((char === "\\") &&
+ ((startIndex === -1) || (startColumn === -1)) &&
+ (input[index + 1] !== "\n")) {
+ // Escape character outside code, skip next
+ index++;
+ currentColumn += 2;
+ } else {
+ // On next column
+ currentColumn++;
+ }
+ }
+ if (startIndex >= 0) {
+ // Restart loop after unmatched start backticks (ex: "`text``code``")
+ index = startIndex;
+ currentLine = startLine;
+ currentColumn = startColumn;
+ }
+ }
+}
+module.exports.forEachInlineCodeSpan = forEachInlineCodeSpan;
+
+/**
+ * Adds a generic error object via the onError callback.
+ *
+ * @param {Object} onError RuleOnError instance.
+ * @param {number} lineNumber Line number.
+ * @param {string} [detail] Error details.
+ * @param {string} [context] Error context.
+ * @param {number[]} [range] Column and length of error.
+ * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
+ * @returns {void}
+ */
+function addError(onError, lineNumber, detail, context, range, fixInfo) {
+ onError({
+ lineNumber,
+ detail,
+ context,
+ range,
+ fixInfo
+ });
+}
+module.exports.addError = addError;
+
+// Adds an error object with details conditionally via the onError callback
+module.exports.addErrorDetailIf = function addErrorDetailIf(
+ onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
+ if (expected !== actual) {
+ addError(
+ onError,
+ lineNumber,
+ "Expected: " + expected + "; Actual: " + actual +
+ (detail ? "; " + detail : ""),
+ context,
+ range,
+ fixInfo);
+ }
+};
+
+// Adds an error object with context via the onError callback
+module.exports.addErrorContext = function addErrorContext(
+ onError, lineNumber, context, left, right, range, fixInfo) {
+ if (context.length <= 30) {
+ // Nothing to do
+ } else if (left && right) {
+ context = context.substr(0, 15) + "..." + context.substr(-15);
+ } else if (right) {
+ context = "..." + context.substr(-30);
+ } else {
+ context = context.substr(0, 30) + "...";
+ }
+ addError(onError, lineNumber, null, context, range, fixInfo);
+};
+
+// Returns a range object for a line by applying a RegExp
+module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
+ let range = null;
+ const match = line.match(regexp);
+ if (match) {
+ const column = match.index + 1;
+ const length = match[0].length;
+ range = [ column, length ];
+ }
+ return range;
+};
+
+// Determines if the front matter includes a title
+module.exports.frontMatterHasTitle =
+ function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
+ const ignoreFrontMatter =
+ (frontMatterTitlePattern !== undefined) && !frontMatterTitlePattern;
+ const frontMatterTitleRe =
+ new RegExp(String(frontMatterTitlePattern || "^\\s*title\\s*[:=]"), "i");
+ return !ignoreFrontMatter &&
+ frontMatterLines.some((line) => frontMatterTitleRe.test(line));
+ };
+
+/**
+ * Returns a list of emphasis markers in code spans and links.
+ *
+ * @param {Object} params RuleParams instance.
+ * @returns {number[][]} List of markers.
+ */
+function emphasisMarkersInContent(params) {
+ const { lines } = params;
+ const byLine = new Array(lines.length);
+ // Search code spans
+ filterTokens(params, "inline", (token) => {
+ const { children, lineNumber, map } = token;
+ if (children.some((child) => child.type === "code_inline")) {
+ const tokenLines = lines.slice(map[0], map[1]);
+ forEachInlineCodeSpan(
+ tokenLines.join("\n"),
+ (code, lineIndex, column, tickCount) => {
+ const codeLines = code.split(newLineRe);
+ codeLines.forEach((codeLine, codeLineIndex) => {
+ let match = null;
+ while ((match = emphasisMarkersRe.exec(codeLine))) {
+ const byLineIndex = lineNumber - 1 + lineIndex + codeLineIndex;
+ const inLine = byLine[byLineIndex] || [];
+ const codeLineOffset = codeLineIndex ? 0 : column - 1 + tickCount;
+ inLine.push(codeLineOffset + match.index);
+ byLine[byLineIndex] = inLine;
+ }
+ });
+ }
+ );
+ }
+ });
+ // Search links
+ lines.forEach((tokenLine, tokenLineIndex) => {
+ let linkMatch = null;
+ while ((linkMatch = linkRe.exec(tokenLine))) {
+ let markerMatch = null;
+ while ((markerMatch = emphasisMarkersRe.exec(linkMatch[0]))) {
+ const inLine = byLine[tokenLineIndex] || [];
+ inLine.push(linkMatch.index + markerMatch.index);
+ byLine[tokenLineIndex] = inLine;
+ }
+ }
+ });
+ return byLine;
+}
+module.exports.emphasisMarkersInContent = emphasisMarkersInContent;
+
+/**
+ * Gets the most common line ending, falling back to the platform default.
+ *
+ * @param {string} input Markdown content to analyze.
+ * @returns {string} Preferred line ending.
+ */
+function getPreferredLineEnding(input) {
+ let cr = 0;
+ let lf = 0;
+ let crlf = 0;
+ const endings = input.match(newLineRe) || [];
+ endings.forEach((ending) => {
+ // eslint-disable-next-line default-case
+ switch (ending) {
+ case "\r":
+ cr++;
+ break;
+ case "\n":
+ lf++;
+ break;
+ case "\r\n":
+ crlf++;
+ break;
+ }
+ });
+ let preferredLineEnding = null;
+ if (!cr && !lf && !crlf) {
+ preferredLineEnding = os.EOL;
+ } else if ((lf >= crlf) && (lf >= cr)) {
+ preferredLineEnding = "\n";
+ } else if (crlf >= cr) {
+ preferredLineEnding = "\r\n";
+ } else {
+ preferredLineEnding = "\r";
+ }
+ return preferredLineEnding;
+}
+module.exports.getPreferredLineEnding = getPreferredLineEnding;
+
+/**
+ * Normalizes the fields of a RuleOnErrorFixInfo instance.
+ *
+ * @param {Object} fixInfo RuleOnErrorFixInfo instance.
+ * @param {number} [lineNumber] Line number.
+ * @returns {Object} Normalized RuleOnErrorFixInfo instance.
+ */
+function normalizeFixInfo(fixInfo, lineNumber) {
+ return {
+ "lineNumber": fixInfo.lineNumber || lineNumber,
+ "editColumn": fixInfo.editColumn || 1,
+ "deleteCount": fixInfo.deleteCount || 0,
+ "insertText": fixInfo.insertText || ""
+ };
+}
+
+/**
+ * Fixes the specified error on a line of Markdown content.
+ *
+ * @param {string} line Line of Markdown content.
+ * @param {Object} fixInfo RuleOnErrorFixInfo instance.
+ * @param {string} lineEnding Line ending to use.
+ * @returns {string} Fixed content.
+ */
+function applyFix(line, fixInfo, lineEnding) {
+ const { editColumn, deleteCount, insertText } = normalizeFixInfo(fixInfo);
+ const editIndex = editColumn - 1;
+ return (deleteCount === -1) ?
+ null :
+ line.slice(0, editIndex) +
+ insertText.replace(/\n/g, lineEnding || "\n") +
+ line.slice(editIndex + deleteCount);
+}
+module.exports.applyFix = applyFix;
+
+// Applies as many fixes as possible to the input lines
+module.exports.applyFixes = function applyFixes(input, errors) {
+ const lineEnding = getPreferredLineEnding(input);
+ const lines = input.split(newLineRe);
+ // Normalize fixInfo objects
+ let fixInfos = errors
+ .filter((error) => error.fixInfo)
+ .map((error) => normalizeFixInfo(error.fixInfo, error.lineNumber));
+ // Sort bottom-to-top, line-deletes last, right-to-left, long-to-short
+ fixInfos.sort((a, b) => {
+ const aDeletingLine = (a.deleteCount === -1);
+ const bDeletingLine = (b.deleteCount === -1);
+ return (
+ (b.lineNumber - a.lineNumber) ||
+ (aDeletingLine ? 1 : (bDeletingLine ? -1 : 0)) ||
+ (b.editColumn - a.editColumn) ||
+ (b.insertText.length - a.insertText.length)
+ );
+ });
+ // Remove duplicate entries (needed for following collapse step)
+ let lastFixInfo = {};
+ fixInfos = fixInfos.filter((fixInfo) => {
+ const unique = (
+ (fixInfo.lineNumber !== lastFixInfo.lineNumber) ||
+ (fixInfo.editColumn !== lastFixInfo.editColumn) ||
+ (fixInfo.deleteCount !== lastFixInfo.deleteCount) ||
+ (fixInfo.insertText !== lastFixInfo.insertText)
+ );
+ lastFixInfo = fixInfo;
+ return unique;
+ });
+ // Collapse insert/no-delete and no-insert/delete for same line/column
+ lastFixInfo = {};
+ fixInfos.forEach((fixInfo) => {
+ if (
+ (fixInfo.lineNumber === lastFixInfo.lineNumber) &&
+ (fixInfo.editColumn === lastFixInfo.editColumn) &&
+ !fixInfo.insertText &&
+ (fixInfo.deleteCount > 0) &&
+ lastFixInfo.insertText &&
+ !lastFixInfo.deleteCount) {
+ fixInfo.insertText = lastFixInfo.insertText;
+ lastFixInfo.lineNumber = 0;
+ }
+ lastFixInfo = fixInfo;
+ });
+ fixInfos = fixInfos.filter((fixInfo) => fixInfo.lineNumber);
+ // Apply all (remaining/updated) fixes
+ let lastLineIndex = -1;
+ let lastEditIndex = -1;
+ fixInfos.forEach((fixInfo) => {
+ const { lineNumber, editColumn, deleteCount } = fixInfo;
+ const lineIndex = lineNumber - 1;
+ const editIndex = editColumn - 1;
+ if (
+ (lineIndex !== lastLineIndex) ||
+ ((editIndex + deleteCount) < lastEditIndex) ||
+ (deleteCount === -1)
+ ) {
+ lines[lineIndex] = applyFix(lines[lineIndex], fixInfo, lineEnding);
+ }
+ lastLineIndex = lineIndex;
+ lastEditIndex = editIndex;
+ });
+ // Return corrected input
+ return lines.filter((line) => line !== null).join(lineEnding);
+};
+
+
+/***/ }),
+/* 157 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var cc = __webpack_require__(158)
+var join = __webpack_require__(38).join
+var deepExtend = __webpack_require__(3)
+var etc = '/etc'
+var win = process.platform === "win32"
+var home = win
+ ? process.env.USERPROFILE
+ : process.env.HOME
+
+module.exports = function (name, defaults, argv, parse) {
+ if('string' !== typeof name)
+ throw new Error('rc(name): name *must* be string')
+ if(!argv)
+ argv = __webpack_require__(161)(process.argv.slice(2))
+ defaults = (
+ 'string' === typeof defaults
+ ? cc.json(defaults) : defaults
+ ) || {}
+
+ parse = parse || cc.parse
+
+ var env = cc.env(name + '_')
+
+ var configs = [defaults]
+ var configFiles = []
+ function addConfigFile (file) {
+ if (configFiles.indexOf(file) >= 0) return
+ var fileConfig = cc.file(file)
+ if (fileConfig) {
+ configs.push(parse(fileConfig))
+ configFiles.push(file)
+ }
+ }
+
+ // which files do we look at?
+ if (!win)
+ [join(etc, name, 'config'),
+ join(etc, name + 'rc')].forEach(addConfigFile)
+ if (home)
+ [join(home, '.config', name, 'config'),
+ join(home, '.config', name),
+ join(home, '.' + name, 'config'),
+ join(home, '.' + name + 'rc')].forEach(addConfigFile)
+ addConfigFile(cc.find('.'+name+'rc'))
+ if (env.config) addConfigFile(env.config)
+ if (argv.config) addConfigFile(argv.config)
+
+ return deepExtend.apply(null, configs.concat([
+ env,
+ argv,
+ configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
+ ]))
+}
+
+
+/***/ }),
+/* 158 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var fs = __webpack_require__(4)
+var ini = __webpack_require__(159)
+var path = __webpack_require__(38)
+var stripJsonComments = __webpack_require__(160)
+
+var parse = exports.parse = function (content) {
+
+ //if it ends in .json or starts with { then it must be json.
+ //must be done this way, because ini accepts everything.
+ //can't just try and parse it and let it throw if it's not ini.
+ //everything is ini. even json with a syntax error.
+
+ if(/^\s*{/.test(content))
+ return JSON.parse(stripJsonComments(content))
+ return ini.parse(content)
+
+}
+
+var file = exports.file = function () {
+ var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
+
+ //path.join breaks if it's a not a string, so just skip this.
+ for(var i in args)
+ if('string' !== typeof args[i])
+ return
+
+ var file = path.join.apply(null, args)
+ var content
+ try {
+ return fs.readFileSync(file,'utf-8')
+ } catch (err) {
+ return
+ }
+}
+
+var json = exports.json = function () {
+ var content = file.apply(null, arguments)
+ return content ? parse(content) : null
+}
+
+var env = exports.env = function (prefix, env) {
+ env = env || process.env
+ var obj = {}
+ var l = prefix.length
+ for(var k in env) {
+ if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
+
+ var keypath = k.substring(l).split('__')
+
+ // Trim empty strings from keypath array
+ var _emptyStringIndex
+ while ((_emptyStringIndex=keypath.indexOf('')) > -1) {
+ keypath.splice(_emptyStringIndex, 1)
+ }
+
+ var cursor = obj
+ keypath.forEach(function _buildSubObj(_subkey,i){
+
+ // (check for _subkey first so we ignore empty strings)
+ // (check for cursor to avoid assignment to primitive objects)
+ if (!_subkey || typeof cursor !== 'object')
+ return
+
+ // If this is the last key, just stuff the value in there
+ // Assigns actual value from env variable to final key
+ // (unless it's just an empty string- in that case use the last valid key)
+ if (i === keypath.length-1)
+ cursor[_subkey] = env[k]
+
+
+ // Build sub-object if nothing already exists at the keypath
+ if (cursor[_subkey] === undefined)
+ cursor[_subkey] = {}
+
+ // Increment cursor used to track the object at the current depth
+ cursor = cursor[_subkey]
+
+ })
+
+ }
+
+ }
+
+ return obj
+}
+
+var find = exports.find = function () {
+ var rel = path.join.apply(null, [].slice.call(arguments))
+
+ function find(start, rel) {
+ var file = path.join(start, rel)
+ try {
+ fs.statSync(file)
+ return file
+ } catch (err) {
+ if(path.dirname(start) !== start) // root
+ return find(path.dirname(start), rel)
+ }
+ }
+ return find(process.cwd(), rel)
+}
+
+
+
+
+/***/ }),
+/* 159 */
+/***/ (function(module, exports) {
+
+exports.parse = exports.decode = decode
+
+exports.stringify = exports.encode = encode
+
+exports.safe = safe
+exports.unsafe = unsafe
+
+var eol = typeof process !== 'undefined' &&
+ process.platform === 'win32' ? '\r\n' : '\n'
+
+function encode (obj, opt) {
+ var children = []
+ var out = ''
+
+ if (typeof opt === 'string') {
+ opt = {
+ section: opt,
+ whitespace: false
+ }
+ } else {
+ opt = opt || {}
+ opt.whitespace = opt.whitespace === true
+ }
+
+ var separator = opt.whitespace ? ' = ' : '='
+
+ Object.keys(obj).forEach(function (k, _, __) {
+ var val = obj[k]
+ if (val && Array.isArray(val)) {
+ val.forEach(function (item) {
+ out += safe(k + '[]') + separator + safe(item) + '\n'
+ })
+ } else if (val && typeof val === 'object') {
+ children.push(k)
+ } else {
+ out += safe(k) + separator + safe(val) + eol
+ }
+ })
+
+ if (opt.section && out.length) {
+ out = '[' + safe(opt.section) + ']' + eol + out
+ }
+
+ children.forEach(function (k, _, __) {
+ var nk = dotSplit(k).join('\\.')
+ var section = (opt.section ? opt.section + '.' : '') + nk
+ var child = encode(obj[k], {
+ section: section,
+ whitespace: opt.whitespace
+ })
+ if (out.length && child.length) {
+ out += eol
+ }
+ out += child
+ })
+
+ return out
+}
+
+function dotSplit (str) {
+ return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
+ .replace(/\\\./g, '\u0001')
+ .split(/\./).map(function (part) {
+ return part.replace(/\1/g, '\\.')
+ .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
+ })
+}
+
+function decode (str) {
+ var out = {}
+ var p = out
+ var section = null
+ // section |key = value
+ var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
+ var lines = str.split(/[\r\n]+/g)
+
+ lines.forEach(function (line, _, __) {
+ if (!line || line.match(/^\s*[;#]/)) return
+ var match = line.match(re)
+ if (!match) return
+ if (match[1] !== undefined) {
+ section = unsafe(match[1])
+ p = out[section] = out[section] || {}
+ return
+ }
+ var key = unsafe(match[2])
+ var value = match[3] ? unsafe(match[4]) : true
+ switch (value) {
+ case 'true':
+ case 'false':
+ case 'null': value = JSON.parse(value)
+ }
+
+ // Convert keys with '[]' suffix to an array
+ if (key.length > 2 && key.slice(-2) === '[]') {
+ key = key.substring(0, key.length - 2)
+ if (!p[key]) {
+ p[key] = []
+ } else if (!Array.isArray(p[key])) {
+ p[key] = [p[key]]
+ }
+ }
+
+ // safeguard against resetting a previously defined
+ // array by accidentally forgetting the brackets
+ if (Array.isArray(p[key])) {
+ p[key].push(value)
+ } else {
+ p[key] = value
+ }
+ })
+
+ // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
+ // use a filter to return the keys that have to be deleted.
+ Object.keys(out).filter(function (k, _, __) {
+ if (!out[k] ||
+ typeof out[k] !== 'object' ||
+ Array.isArray(out[k])) {
+ return false
+ }
+ // see if the parent section is also an object.
+ // if so, add it to that, and mark this one for deletion
+ var parts = dotSplit(k)
+ var p = out
+ var l = parts.pop()
+ var nl = l.replace(/\\\./g, '.')
+ parts.forEach(function (part, _, __) {
+ if (!p[part] || typeof p[part] !== 'object') p[part] = {}
+ p = p[part]
+ })
+ if (p === out && nl === l) {
+ return false
+ }
+ p[nl] = out[k]
+ return true
+ }).forEach(function (del, _, __) {
+ delete out[del]
+ })
+
+ return out
+}
+
+function isQuoted (val) {
+ return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
+ (val.charAt(0) === "'" && val.slice(-1) === "'")
+}
+
+function safe (val) {
+ return (typeof val !== 'string' ||
+ val.match(/[=\r\n]/) ||
+ val.match(/^\[/) ||
+ (val.length > 1 &&
+ isQuoted(val)) ||
+ val !== val.trim())
+ ? JSON.stringify(val)
+ : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
+}
+
+function unsafe (val, doUnesc) {
+ val = (val || '').trim()
+ if (isQuoted(val)) {
+ // remove the single quotes before calling JSON.parse
+ if (val.charAt(0) === "'") {
+ val = val.substr(1, val.length - 2)
+ }
+ try { val = JSON.parse(val) } catch (_) {}
+ } else {
+ // walk the val to find the first not-escaped ; character
+ var esc = false
+ var unesc = ''
+ for (var i = 0, l = val.length; i < l; i++) {
+ var c = val.charAt(i)
+ if (esc) {
+ if ('\\;#'.indexOf(c) !== -1) {
+ unesc += c
+ } else {
+ unesc += '\\' + c
+ }
+ esc = false
+ } else if (';#'.indexOf(c) !== -1) {
+ break
+ } else if (c === '\\') {
+ esc = true
+ } else {
+ unesc += c
+ }
+ }
+ if (esc) {
+ unesc += '\\'
+ }
+ return unesc.trim()
+ }
+ return val
+}
+
+
+/***/ }),
+/* 160 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+var singleComment = 1;
+var multiComment = 2;
+
+function stripWithoutWhitespace() {
+ return '';
+}
+
+function stripWithWhitespace(str, start, end) {
+ return str.slice(start, end).replace(/\S/g, ' ');
+}
+
+module.exports = function (str, opts) {
+ opts = opts || {};
+
+ var currentChar;
+ var nextChar;
+ var insideString = false;
+ var insideComment = false;
+ var offset = 0;
+ var ret = '';
+ var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
+
+ for (var i = 0; i < str.length; i++) {
+ currentChar = str[i];
+ nextChar = str[i + 1];
+
+ if (!insideComment && currentChar === '"') {
+ var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
+ if (!escaped) {
+ insideString = !insideString;
+ }
+ }
+
+ if (insideString) {
+ continue;
+ }
+
+ if (!insideComment && currentChar + nextChar === '//') {
+ ret += str.slice(offset, i);
+ offset = i;
+ insideComment = singleComment;
+ i++;
+ } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
+ i++;
+ insideComment = false;
+ ret += strip(str, offset, i);
+ offset = i;
+ continue;
+ } else if (insideComment === singleComment && currentChar === '\n') {
+ insideComment = false;
+ ret += strip(str, offset, i);
+ offset = i;
+ } else if (!insideComment && currentChar + nextChar === '/*') {
+ ret += str.slice(offset, i);
+ offset = i;
+ insideComment = multiComment;
+ i++;
+ continue;
+ } else if (insideComment === multiComment && currentChar + nextChar === '*/') {
+ i++;
+ insideComment = false;
+ ret += strip(str, offset, i + 1);
+ offset = i + 1;
+ continue;
+ }
+ }
+
+ return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
+};
+
+
+/***/ }),
+/* 161 */
+/***/ (function(module, exports) {
+
+module.exports = function (args, opts) {
+ if (!opts) opts = {};
+
+ var flags = { bools : {}, strings : {}, unknownFn: null };
+
+ if (typeof opts['unknown'] === 'function') {
+ flags.unknownFn = opts['unknown'];
+ }
+
+ if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
+ flags.allBools = true;
+ } else {
+ [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+ flags.bools[key] = true;
+ });
+ }
+
+ var aliases = {};
+ Object.keys(opts.alias || {}).forEach(function (key) {
+ aliases[key] = [].concat(opts.alias[key]);
+ aliases[key].forEach(function (x) {
+ aliases[x] = [key].concat(aliases[key].filter(function (y) {
+ return x !== y;
+ }));
+ });
+ });
+
+ [].concat(opts.string).filter(Boolean).forEach(function (key) {
+ flags.strings[key] = true;
+ if (aliases[key]) {
+ flags.strings[aliases[key]] = true;
+ }
+ });
+
+ var defaults = opts['default'] || {};
+
+ var argv = { _ : [] };
+ Object.keys(flags.bools).forEach(function (key) {
+ setArg(key, defaults[key] === undefined ? false : defaults[key]);
+ });
+
+ var notFlags = [];
+
+ if (args.indexOf('--') !== -1) {
+ notFlags = args.slice(args.indexOf('--')+1);
+ args = args.slice(0, args.indexOf('--'));
+ }
+
+ function argDefined(key, arg) {
+ return (flags.allBools && /^--[^=]+$/.test(arg)) ||
+ flags.strings[key] || flags.bools[key] || aliases[key];
+ }
+
+ function setArg (key, val, arg) {
+ if (arg && flags.unknownFn && !argDefined(key, arg)) {
+ if (flags.unknownFn(arg) === false) return;
+ }
+
+ var value = !flags.strings[key] && isNumber(val)
+ ? Number(val) : val
+ ;
+ setKey(argv, key.split('.'), value);
+
+ (aliases[key] || []).forEach(function (x) {
+ setKey(argv, x.split('.'), value);
+ });
+ }
+
+ function setKey (obj, keys, value) {
+ var o = obj;
+ for (var i = 0; i < keys.length-1; i++) {
+ var key = keys[i];
+ if (key === '__proto__') return;
+ if (o[key] === undefined) o[key] = {};
+ if (o[key] === Object.prototype || o[key] === Number.prototype
+ || o[key] === String.prototype) o[key] = {};
+ if (o[key] === Array.prototype) o[key] = [];
+ o = o[key];
+ }
+
+ var key = keys[keys.length - 1];
+ if (key === '__proto__') return;
+ if (o === Object.prototype || o === Number.prototype
+ || o === String.prototype) o = {};
+ if (o === Array.prototype) o = [];
+ if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
+ o[key] = value;
+ }
+ else if (Array.isArray(o[key])) {
+ o[key].push(value);
+ }
+ else {
+ o[key] = [ o[key], value ];
+ }
+ }
+
+ function aliasIsBoolean(key) {
+ return aliases[key].some(function (x) {
+ return flags.bools[x];
+ });
+ }
+
+ for (var i = 0; i < args.length; i++) {
+ var arg = args[i];
+
+ if (/^--.+=/.test(arg)) {
+ // Using [\s\S] instead of . because js doesn't support the
+ // 'dotall' regex modifier. See:
+ // http://stackoverflow.com/a/1068308/13216
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
+ var key = m[1];
+ var value = m[2];
+ if (flags.bools[key]) {
+ value = value !== 'false';
+ }
+ setArg(key, value, arg);
+ }
+ else if (/^--no-.+/.test(arg)) {
+ var key = arg.match(/^--no-(.+)/)[1];
+ setArg(key, false, arg);
+ }
+ else if (/^--.+/.test(arg)) {
+ var key = arg.match(/^--(.+)/)[1];
+ var next = args[i + 1];
+ if (next !== undefined && !/^-/.test(next)
+ && !flags.bools[key]
+ && !flags.allBools
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
+ setArg(key, next, arg);
+ i++;
+ }
+ else if (/^(true|false)$/.test(next)) {
+ setArg(key, next === 'true', arg);
+ i++;
+ }
+ else {
+ setArg(key, flags.strings[key] ? '' : true, arg);
+ }
+ }
+ else if (/^-[^-]+/.test(arg)) {
+ var letters = arg.slice(1,-1).split('');
+
+ var broken = false;
+ for (var j = 0; j < letters.length; j++) {
+ var next = arg.slice(j+2);
+
+ if (next === '-') {
+ setArg(letters[j], next, arg)
+ continue;
+ }
+
+ if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
+ setArg(letters[j], next.split('=')[1], arg);
+ broken = true;
+ break;
+ }
+
+ if (/[A-Za-z]/.test(letters[j])
+ && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
+ setArg(letters[j], next, arg);
+ broken = true;
+ break;
+ }
+
+ if (letters[j+1] && letters[j+1].match(/\W/)) {
+ setArg(letters[j], arg.slice(j+2), arg);
+ broken = true;
+ break;
+ }
+ else {
+ setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
+ }
+ }
+
+ var key = arg.slice(-1)[0];
+ if (!broken && key !== '-') {
+ if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
+ && !flags.bools[key]
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
+ setArg(key, args[i+1], arg);
+ i++;
+ }
+ else if (args[i+1] && /^(true|false)$/.test(args[i+1])) {
+ setArg(key, args[i+1] === 'true', arg);
+ i++;
+ }
+ else {
+ setArg(key, flags.strings[key] ? '' : true, arg);
+ }
+ }
+ }
+ else {
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
+ argv._.push(
+ flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+ );
+ }
+ if (opts.stopEarly) {
+ argv._.push.apply(argv._, args.slice(i + 1));
+ break;
+ }
+ }
+ }
+
+ Object.keys(defaults).forEach(function (key) {
+ if (!hasKey(argv, key.split('.'))) {
+ setKey(argv, key.split('.'), defaults[key]);
+
+ (aliases[key] || []).forEach(function (x) {
+ setKey(argv, x.split('.'), defaults[key]);
+ });
+ }
+ });
+
+ if (opts['--']) {
+ argv['--'] = new Array();
+ notFlags.forEach(function(key) {
+ argv['--'].push(key);
+ });
+ }
+ else {
+ notFlags.forEach(function(key) {
+ argv._.push(key);
+ });
+ }
+
+ return argv;
+};
+
+function hasKey (obj, keys) {
+ var o = obj;
+ keys.slice(0,-1).forEach(function (key) {
+ o = (o[key] || {});
+ });
+
+ var key = keys[keys.length - 1];
+ return key in o;
+}
+
+function isNumber (x) {
+ if (typeof x === 'number') return true;
+ if (/^0x[0-9a-f]+$/i.test(x)) return true;
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
+}
+
+
+
+/***/ }),
+/* 162 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+function __export(m) {\r
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
+}\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
+exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
+exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
+exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
+exports.Disposable = vscode_jsonrpc_1.Disposable;\r
+exports.Event = vscode_jsonrpc_1.Event;\r
+exports.Emitter = vscode_jsonrpc_1.Emitter;\r
+exports.Trace = vscode_jsonrpc_1.Trace;\r
+exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
+exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
+exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
+exports.RequestType = vscode_jsonrpc_1.RequestType;\r
+exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
+exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
+exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
+exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
+exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
+exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
+exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
+exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
+exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
+exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
+exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
+exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
+exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
+exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
+exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
+exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
+__export(__webpack_require__(175));\r
+__export(__webpack_require__(176));\r
+const callHierarchy = __webpack_require__(188);\r
+const st = __webpack_require__(189);\r
+var Proposed;\r
+(function (Proposed) {\r
+ let CallHierarchyPrepareRequest;\r
+ (function (CallHierarchyPrepareRequest) {\r
+ CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
+ CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
+ })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
+ let CallHierarchyIncomingCallsRequest;\r
+ (function (CallHierarchyIncomingCallsRequest) {\r
+ CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
+ CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
+ })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
+ let CallHierarchyOutgoingCallsRequest;\r
+ (function (CallHierarchyOutgoingCallsRequest) {\r
+ CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
+ CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
+ })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
+ Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
+ Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
+ Proposed.SemanticTokens = st.SemanticTokens;\r
+ let SemanticTokensRequest;\r
+ (function (SemanticTokensRequest) {\r
+ SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
+ SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
+ })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
+ let SemanticTokensEditsRequest;\r
+ (function (SemanticTokensEditsRequest) {\r
+ SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
+ SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
+ })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
+ let SemanticTokensRangeRequest;\r
+ (function (SemanticTokensRangeRequest) {\r
+ SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
+ SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
+ })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
+})(Proposed = exports.Proposed || (exports.Proposed = {}));\r
+function createProtocolConnection(reader, writer, logger, strategy) {\r
+ return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
+}\r
+exports.createProtocolConnection = createProtocolConnection;\r
+
+
+/***/ }),
+/* 163 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+/// <reference path="../typings/thenable.d.ts" />\r
+\r
+function __export(m) {\r
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
+}\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const Is = __webpack_require__(164);\r
+const messages_1 = __webpack_require__(165);\r
+exports.RequestType = messages_1.RequestType;\r
+exports.RequestType0 = messages_1.RequestType0;\r
+exports.RequestType1 = messages_1.RequestType1;\r
+exports.RequestType2 = messages_1.RequestType2;\r
+exports.RequestType3 = messages_1.RequestType3;\r
+exports.RequestType4 = messages_1.RequestType4;\r
+exports.RequestType5 = messages_1.RequestType5;\r
+exports.RequestType6 = messages_1.RequestType6;\r
+exports.RequestType7 = messages_1.RequestType7;\r
+exports.RequestType8 = messages_1.RequestType8;\r
+exports.RequestType9 = messages_1.RequestType9;\r
+exports.ResponseError = messages_1.ResponseError;\r
+exports.ErrorCodes = messages_1.ErrorCodes;\r
+exports.NotificationType = messages_1.NotificationType;\r
+exports.NotificationType0 = messages_1.NotificationType0;\r
+exports.NotificationType1 = messages_1.NotificationType1;\r
+exports.NotificationType2 = messages_1.NotificationType2;\r
+exports.NotificationType3 = messages_1.NotificationType3;\r
+exports.NotificationType4 = messages_1.NotificationType4;\r
+exports.NotificationType5 = messages_1.NotificationType5;\r
+exports.NotificationType6 = messages_1.NotificationType6;\r
+exports.NotificationType7 = messages_1.NotificationType7;\r
+exports.NotificationType8 = messages_1.NotificationType8;\r
+exports.NotificationType9 = messages_1.NotificationType9;\r
+const messageReader_1 = __webpack_require__(166);\r
+exports.MessageReader = messageReader_1.MessageReader;\r
+exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
+exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
+exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
+const messageWriter_1 = __webpack_require__(168);\r
+exports.MessageWriter = messageWriter_1.MessageWriter;\r
+exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
+exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
+exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
+const events_1 = __webpack_require__(167);\r
+exports.Disposable = events_1.Disposable;\r
+exports.Event = events_1.Event;\r
+exports.Emitter = events_1.Emitter;\r
+const cancellation_1 = __webpack_require__(169);\r
+exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
+exports.CancellationToken = cancellation_1.CancellationToken;\r
+const linkedMap_1 = __webpack_require__(170);\r
+__export(__webpack_require__(171));\r
+__export(__webpack_require__(174));\r
+var CancelNotification;\r
+(function (CancelNotification) {\r
+ CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
+})(CancelNotification || (CancelNotification = {}));\r
+var ProgressNotification;\r
+(function (ProgressNotification) {\r
+ ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
+})(ProgressNotification || (ProgressNotification = {}));\r
+class ProgressType {\r
+ constructor() {\r
+ }\r
+}\r
+exports.ProgressType = ProgressType;\r
+exports.NullLogger = Object.freeze({\r
+ error: () => { },\r
+ warn: () => { },\r
+ info: () => { },\r
+ log: () => { }\r
+});\r
+var Trace;\r
+(function (Trace) {\r
+ Trace[Trace["Off"] = 0] = "Off";\r
+ Trace[Trace["Messages"] = 1] = "Messages";\r
+ Trace[Trace["Verbose"] = 2] = "Verbose";\r
+})(Trace = exports.Trace || (exports.Trace = {}));\r
+(function (Trace) {\r
+ function fromString(value) {\r
+ if (!Is.string(value)) {\r
+ return Trace.Off;\r
+ }\r
+ value = value.toLowerCase();\r
+ switch (value) {\r
+ case 'off':\r
+ return Trace.Off;\r
+ case 'messages':\r
+ return Trace.Messages;\r
+ case 'verbose':\r
+ return Trace.Verbose;\r
+ default:\r
+ return Trace.Off;\r
+ }\r
+ }\r
+ Trace.fromString = fromString;\r
+ function toString(value) {\r
+ switch (value) {\r
+ case Trace.Off:\r
+ return 'off';\r
+ case Trace.Messages:\r
+ return 'messages';\r
+ case Trace.Verbose:\r
+ return 'verbose';\r
+ default:\r
+ return 'off';\r
+ }\r
+ }\r
+ Trace.toString = toString;\r
+})(Trace = exports.Trace || (exports.Trace = {}));\r
+var TraceFormat;\r
+(function (TraceFormat) {\r
+ TraceFormat["Text"] = "text";\r
+ TraceFormat["JSON"] = "json";\r
+})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
+(function (TraceFormat) {\r
+ function fromString(value) {\r
+ value = value.toLowerCase();\r
+ if (value === 'json') {\r
+ return TraceFormat.JSON;\r
+ }\r
+ else {\r
+ return TraceFormat.Text;\r
+ }\r
+ }\r
+ TraceFormat.fromString = fromString;\r
+})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
+var SetTraceNotification;\r
+(function (SetTraceNotification) {\r
+ SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
+})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
+var LogTraceNotification;\r
+(function (LogTraceNotification) {\r
+ LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
+})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
+var ConnectionErrors;\r
+(function (ConnectionErrors) {\r
+ /**\r
+ * The connection is closed.\r
+ */\r
+ ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
+ /**\r
+ * The connection got disposed.\r
+ */\r
+ ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
+ /**\r
+ * The connection is already in listening mode.\r
+ */\r
+ ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
+})(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
+class ConnectionError extends Error {\r
+ constructor(code, message) {\r
+ super(message);\r
+ this.code = code;\r
+ Object.setPrototypeOf(this, ConnectionError.prototype);\r
+ }\r
+}\r
+exports.ConnectionError = ConnectionError;\r
+var ConnectionStrategy;\r
+(function (ConnectionStrategy) {\r
+ function is(value) {\r
+ let candidate = value;\r
+ return candidate && Is.func(candidate.cancelUndispatched);\r
+ }\r
+ ConnectionStrategy.is = is;\r
+})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
+var ConnectionState;\r
+(function (ConnectionState) {\r
+ ConnectionState[ConnectionState["New"] = 1] = "New";\r
+ ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
+ ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
+ ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
+})(ConnectionState || (ConnectionState = {}));\r
+function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
+ let sequenceNumber = 0;\r
+ let notificationSquenceNumber = 0;\r
+ let unknownResponseSquenceNumber = 0;\r
+ const version = '2.0';\r
+ let starRequestHandler = undefined;\r
+ let requestHandlers = Object.create(null);\r
+ let starNotificationHandler = undefined;\r
+ let notificationHandlers = Object.create(null);\r
+ let progressHandlers = new Map();\r
+ let timer;\r
+ let messageQueue = new linkedMap_1.LinkedMap();\r
+ let responsePromises = Object.create(null);\r
+ let requestTokens = Object.create(null);\r
+ let trace = Trace.Off;\r
+ let traceFormat = TraceFormat.Text;\r
+ let tracer;\r
+ let state = ConnectionState.New;\r
+ let errorEmitter = new events_1.Emitter();\r
+ let closeEmitter = new events_1.Emitter();\r
+ let unhandledNotificationEmitter = new events_1.Emitter();\r
+ let unhandledProgressEmitter = new events_1.Emitter();\r
+ let disposeEmitter = new events_1.Emitter();\r
+ function createRequestQueueKey(id) {\r
+ return 'req-' + id.toString();\r
+ }\r
+ function createResponseQueueKey(id) {\r
+ if (id === null) {\r
+ return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
+ }\r
+ else {\r
+ return 'res-' + id.toString();\r
+ }\r
+ }\r
+ function createNotificationQueueKey() {\r
+ return 'not-' + (++notificationSquenceNumber).toString();\r
+ }\r
+ function addMessageToQueue(queue, message) {\r
+ if (messages_1.isRequestMessage(message)) {\r
+ queue.set(createRequestQueueKey(message.id), message);\r
+ }\r
+ else if (messages_1.isResponseMessage(message)) {\r
+ queue.set(createResponseQueueKey(message.id), message);\r
+ }\r
+ else {\r
+ queue.set(createNotificationQueueKey(), message);\r
+ }\r
+ }\r
+ function cancelUndispatched(_message) {\r
+ return undefined;\r
+ }\r
+ function isListening() {\r
+ return state === ConnectionState.Listening;\r
+ }\r
+ function isClosed() {\r
+ return state === ConnectionState.Closed;\r
+ }\r
+ function isDisposed() {\r
+ return state === ConnectionState.Disposed;\r
+ }\r
+ function closeHandler() {\r
+ if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
+ state = ConnectionState.Closed;\r
+ closeEmitter.fire(undefined);\r
+ }\r
+ // If the connection is disposed don't sent close events.\r
+ }\r
+ function readErrorHandler(error) {\r
+ errorEmitter.fire([error, undefined, undefined]);\r
+ }\r
+ function writeErrorHandler(data) {\r
+ errorEmitter.fire(data);\r
+ }\r
+ messageReader.onClose(closeHandler);\r
+ messageReader.onError(readErrorHandler);\r
+ messageWriter.onClose(closeHandler);\r
+ messageWriter.onError(writeErrorHandler);\r
+ function triggerMessageQueue() {\r
+ if (timer || messageQueue.size === 0) {\r
+ return;\r
+ }\r
+ timer = setImmediate(() => {\r
+ timer = undefined;\r
+ processMessageQueue();\r
+ });\r
+ }\r
+ function processMessageQueue() {\r
+ if (messageQueue.size === 0) {\r
+ return;\r
+ }\r
+ let message = messageQueue.shift();\r
+ try {\r
+ if (messages_1.isRequestMessage(message)) {\r
+ handleRequest(message);\r
+ }\r
+ else if (messages_1.isNotificationMessage(message)) {\r
+ handleNotification(message);\r
+ }\r
+ else if (messages_1.isResponseMessage(message)) {\r
+ handleResponse(message);\r
+ }\r
+ else {\r
+ handleInvalidMessage(message);\r
+ }\r
+ }\r
+ finally {\r
+ triggerMessageQueue();\r
+ }\r
+ }\r
+ let callback = (message) => {\r
+ try {\r
+ // We have received a cancellation message. Check if the message is still in the queue\r
+ // and cancel it if allowed to do so.\r
+ if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
+ let key = createRequestQueueKey(message.params.id);\r
+ let toCancel = messageQueue.get(key);\r
+ if (messages_1.isRequestMessage(toCancel)) {\r
+ let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
+ if (response && (response.error !== void 0 || response.result !== void 0)) {\r
+ messageQueue.delete(key);\r
+ response.id = toCancel.id;\r
+ traceSendingResponse(response, message.method, Date.now());\r
+ messageWriter.write(response);\r
+ return;\r
+ }\r
+ }\r
+ }\r
+ addMessageToQueue(messageQueue, message);\r
+ }\r
+ finally {\r
+ triggerMessageQueue();\r
+ }\r
+ };\r
+ function handleRequest(requestMessage) {\r
+ if (isDisposed()) {\r
+ // we return here silently since we fired an event when the\r
+ // connection got disposed.\r
+ return;\r
+ }\r
+ function reply(resultOrError, method, startTime) {\r
+ let message = {\r
+ jsonrpc: version,\r
+ id: requestMessage.id\r
+ };\r
+ if (resultOrError instanceof messages_1.ResponseError) {\r
+ message.error = resultOrError.toJson();\r
+ }\r
+ else {\r
+ message.result = resultOrError === void 0 ? null : resultOrError;\r
+ }\r
+ traceSendingResponse(message, method, startTime);\r
+ messageWriter.write(message);\r
+ }\r
+ function replyError(error, method, startTime) {\r
+ let message = {\r
+ jsonrpc: version,\r
+ id: requestMessage.id,\r
+ error: error.toJson()\r
+ };\r
+ traceSendingResponse(message, method, startTime);\r
+ messageWriter.write(message);\r
+ }\r
+ function replySuccess(result, method, startTime) {\r
+ // The JSON RPC defines that a response must either have a result or an error\r
+ // So we can't treat undefined as a valid response result.\r
+ if (result === void 0) {\r
+ result = null;\r
+ }\r
+ let message = {\r
+ jsonrpc: version,\r
+ id: requestMessage.id,\r
+ result: result\r
+ };\r
+ traceSendingResponse(message, method, startTime);\r
+ messageWriter.write(message);\r
+ }\r
+ traceReceivedRequest(requestMessage);\r
+ let element = requestHandlers[requestMessage.method];\r
+ let type;\r
+ let requestHandler;\r
+ if (element) {\r
+ type = element.type;\r
+ requestHandler = element.handler;\r
+ }\r
+ let startTime = Date.now();\r
+ if (requestHandler || starRequestHandler) {\r
+ let cancellationSource = new cancellation_1.CancellationTokenSource();\r
+ let tokenKey = String(requestMessage.id);\r
+ requestTokens[tokenKey] = cancellationSource;\r
+ try {\r
+ let handlerResult;\r
+ if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
+ handlerResult = requestHandler\r
+ ? requestHandler(cancellationSource.token)\r
+ : starRequestHandler(requestMessage.method, cancellationSource.token);\r
+ }\r
+ else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
+ handlerResult = requestHandler\r
+ ? requestHandler(...requestMessage.params, cancellationSource.token)\r
+ : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
+ }\r
+ else {\r
+ handlerResult = requestHandler\r
+ ? requestHandler(requestMessage.params, cancellationSource.token)\r
+ : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
+ }\r
+ let promise = handlerResult;\r
+ if (!handlerResult) {\r
+ delete requestTokens[tokenKey];\r
+ replySuccess(handlerResult, requestMessage.method, startTime);\r
+ }\r
+ else if (promise.then) {\r
+ promise.then((resultOrError) => {\r
+ delete requestTokens[tokenKey];\r
+ reply(resultOrError, requestMessage.method, startTime);\r
+ }, error => {\r
+ delete requestTokens[tokenKey];\r
+ if (error instanceof messages_1.ResponseError) {\r
+ replyError(error, requestMessage.method, startTime);\r
+ }\r
+ else if (error && Is.string(error.message)) {\r
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
+ }\r
+ else {\r
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
+ }\r
+ });\r
+ }\r
+ else {\r
+ delete requestTokens[tokenKey];\r
+ reply(handlerResult, requestMessage.method, startTime);\r
+ }\r
+ }\r
+ catch (error) {\r
+ delete requestTokens[tokenKey];\r
+ if (error instanceof messages_1.ResponseError) {\r
+ reply(error, requestMessage.method, startTime);\r
+ }\r
+ else if (error && Is.string(error.message)) {\r
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
+ }\r
+ else {\r
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
+ }\r
+ }\r
+ function handleResponse(responseMessage) {\r
+ if (isDisposed()) {\r
+ // See handle request.\r
+ return;\r
+ }\r
+ if (responseMessage.id === null) {\r
+ if (responseMessage.error) {\r
+ logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
+ }\r
+ else {\r
+ logger.error(`Received response message without id. No further error information provided.`);\r
+ }\r
+ }\r
+ else {\r
+ let key = String(responseMessage.id);\r
+ let responsePromise = responsePromises[key];\r
+ traceReceivedResponse(responseMessage, responsePromise);\r
+ if (responsePromise) {\r
+ delete responsePromises[key];\r
+ try {\r
+ if (responseMessage.error) {\r
+ let error = responseMessage.error;\r
+ responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
+ }\r
+ else if (responseMessage.result !== void 0) {\r
+ responsePromise.resolve(responseMessage.result);\r
+ }\r
+ else {\r
+ throw new Error('Should never happen.');\r
+ }\r
+ }\r
+ catch (error) {\r
+ if (error.message) {\r
+ logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
+ }\r
+ else {\r
+ logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ function handleNotification(message) {\r
+ if (isDisposed()) {\r
+ // See handle request.\r
+ return;\r
+ }\r
+ let type = undefined;\r
+ let notificationHandler;\r
+ if (message.method === CancelNotification.type.method) {\r
+ notificationHandler = (params) => {\r
+ let id = params.id;\r
+ let source = requestTokens[String(id)];\r
+ if (source) {\r
+ source.cancel();\r
+ }\r
+ };\r
+ }\r
+ else {\r
+ let element = notificationHandlers[message.method];\r
+ if (element) {\r
+ notificationHandler = element.handler;\r
+ type = element.type;\r
+ }\r
+ }\r
+ if (notificationHandler || starNotificationHandler) {\r
+ try {\r
+ traceReceivedNotification(message);\r
+ if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
+ notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
+ }\r
+ else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
+ notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
+ }\r
+ else {\r
+ notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
+ }\r
+ }\r
+ catch (error) {\r
+ if (error.message) {\r
+ logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
+ }\r
+ else {\r
+ logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ unhandledNotificationEmitter.fire(message);\r
+ }\r
+ }\r
+ function handleInvalidMessage(message) {\r
+ if (!message) {\r
+ logger.error('Received empty message.');\r
+ return;\r
+ }\r
+ logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
+ // Test whether we find an id to reject the promise\r
+ let responseMessage = message;\r
+ if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
+ let key = String(responseMessage.id);\r
+ let responseHandler = responsePromises[key];\r
+ if (responseHandler) {\r
+ responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
+ }\r
+ }\r
+ }\r
+ function traceSendingRequest(message) {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose && message.params) {\r
+ data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
+ }\r
+ tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
+ }\r
+ else {\r
+ logLSPMessage('send-request', message);\r
+ }\r
+ }\r
+ function traceSendingNotification(message) {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose) {\r
+ if (message.params) {\r
+ data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
+ }\r
+ else {\r
+ data = 'No parameters provided.\n\n';\r
+ }\r
+ }\r
+ tracer.log(`Sending notification '${message.method}'.`, data);\r
+ }\r
+ else {\r
+ logLSPMessage('send-notification', message);\r
+ }\r
+ }\r
+ function traceSendingResponse(message, method, startTime) {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose) {\r
+ if (message.error && message.error.data) {\r
+ data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
+ }\r
+ else {\r
+ if (message.result) {\r
+ data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
+ }\r
+ else if (message.error === void 0) {\r
+ data = 'No result returned.\n\n';\r
+ }\r
+ }\r
+ }\r
+ tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
+ }\r
+ else {\r
+ logLSPMessage('send-response', message);\r
+ }\r
+ }\r
+ function traceReceivedRequest(message) {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose && message.params) {\r
+ data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
+ }\r
+ tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
+ }\r
+ else {\r
+ logLSPMessage('receive-request', message);\r
+ }\r
+ }\r
+ function traceReceivedNotification(message) {\r
+ if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose) {\r
+ if (message.params) {\r
+ data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
+ }\r
+ else {\r
+ data = 'No parameters provided.\n\n';\r
+ }\r
+ }\r
+ tracer.log(`Received notification '${message.method}'.`, data);\r
+ }\r
+ else {\r
+ logLSPMessage('receive-notification', message);\r
+ }\r
+ }\r
+ function traceReceivedResponse(message, responsePromise) {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ if (traceFormat === TraceFormat.Text) {\r
+ let data = undefined;\r
+ if (trace === Trace.Verbose) {\r
+ if (message.error && message.error.data) {\r
+ data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
+ }\r
+ else {\r
+ if (message.result) {\r
+ data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
+ }\r
+ else if (message.error === void 0) {\r
+ data = 'No result returned.\n\n';\r
+ }\r
+ }\r
+ }\r
+ if (responsePromise) {\r
+ let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
+ tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
+ }\r
+ else {\r
+ tracer.log(`Received response ${message.id} without active response promise.`, data);\r
+ }\r
+ }\r
+ else {\r
+ logLSPMessage('receive-response', message);\r
+ }\r
+ }\r
+ function logLSPMessage(type, message) {\r
+ if (!tracer || trace === Trace.Off) {\r
+ return;\r
+ }\r
+ const lspMessage = {\r
+ isLSPMessage: true,\r
+ type,\r
+ message,\r
+ timestamp: Date.now()\r
+ };\r
+ tracer.log(lspMessage);\r
+ }\r
+ function throwIfClosedOrDisposed() {\r
+ if (isClosed()) {\r
+ throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
+ }\r
+ if (isDisposed()) {\r
+ throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
+ }\r
+ }\r
+ function throwIfListening() {\r
+ if (isListening()) {\r
+ throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
+ }\r
+ }\r
+ function throwIfNotListening() {\r
+ if (!isListening()) {\r
+ throw new Error('Call listen() first.');\r
+ }\r
+ }\r
+ function undefinedToNull(param) {\r
+ if (param === void 0) {\r
+ return null;\r
+ }\r
+ else {\r
+ return param;\r
+ }\r
+ }\r
+ function computeMessageParams(type, params) {\r
+ let result;\r
+ let numberOfParams = type.numberOfParams;\r
+ switch (numberOfParams) {\r
+ case 0:\r
+ result = null;\r
+ break;\r
+ case 1:\r
+ result = undefinedToNull(params[0]);\r
+ break;\r
+ default:\r
+ result = [];\r
+ for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
+ result.push(undefinedToNull(params[i]));\r
+ }\r
+ if (params.length < numberOfParams) {\r
+ for (let i = params.length; i < numberOfParams; i++) {\r
+ result.push(null);\r
+ }\r
+ }\r
+ break;\r
+ }\r
+ return result;\r
+ }\r
+ let connection = {\r
+ sendNotification: (type, ...params) => {\r
+ throwIfClosedOrDisposed();\r
+ let method;\r
+ let messageParams;\r
+ if (Is.string(type)) {\r
+ method = type;\r
+ switch (params.length) {\r
+ case 0:\r
+ messageParams = null;\r
+ break;\r
+ case 1:\r
+ messageParams = params[0];\r
+ break;\r
+ default:\r
+ messageParams = params;\r
+ break;\r
+ }\r
+ }\r
+ else {\r
+ method = type.method;\r
+ messageParams = computeMessageParams(type, params);\r
+ }\r
+ let notificationMessage = {\r
+ jsonrpc: version,\r
+ method: method,\r
+ params: messageParams\r
+ };\r
+ traceSendingNotification(notificationMessage);\r
+ messageWriter.write(notificationMessage);\r
+ },\r
+ onNotification: (type, handler) => {\r
+ throwIfClosedOrDisposed();\r
+ if (Is.func(type)) {\r
+ starNotificationHandler = type;\r
+ }\r
+ else if (handler) {\r
+ if (Is.string(type)) {\r
+ notificationHandlers[type] = { type: undefined, handler };\r
+ }\r
+ else {\r
+ notificationHandlers[type.method] = { type, handler };\r
+ }\r
+ }\r
+ },\r
+ onProgress: (_type, token, handler) => {\r
+ if (progressHandlers.has(token)) {\r
+ throw new Error(`Progress handler for token ${token} already registered`);\r
+ }\r
+ progressHandlers.set(token, handler);\r
+ return {\r
+ dispose: () => {\r
+ progressHandlers.delete(token);\r
+ }\r
+ };\r
+ },\r
+ sendProgress: (_type, token, value) => {\r
+ connection.sendNotification(ProgressNotification.type, { token, value });\r
+ },\r
+ onUnhandledProgress: unhandledProgressEmitter.event,\r
+ sendRequest: (type, ...params) => {\r
+ throwIfClosedOrDisposed();\r
+ throwIfNotListening();\r
+ let method;\r
+ let messageParams;\r
+ let token = undefined;\r
+ if (Is.string(type)) {\r
+ method = type;\r
+ switch (params.length) {\r
+ case 0:\r
+ messageParams = null;\r
+ break;\r
+ case 1:\r
+ // The cancellation token is optional so it can also be undefined.\r
+ if (cancellation_1.CancellationToken.is(params[0])) {\r
+ messageParams = null;\r
+ token = params[0];\r
+ }\r
+ else {\r
+ messageParams = undefinedToNull(params[0]);\r
+ }\r
+ break;\r
+ default:\r
+ const last = params.length - 1;\r
+ if (cancellation_1.CancellationToken.is(params[last])) {\r
+ token = params[last];\r
+ if (params.length === 2) {\r
+ messageParams = undefinedToNull(params[0]);\r
+ }\r
+ else {\r
+ messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
+ }\r
+ }\r
+ else {\r
+ messageParams = params.map(value => undefinedToNull(value));\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ else {\r
+ method = type.method;\r
+ messageParams = computeMessageParams(type, params);\r
+ let numberOfParams = type.numberOfParams;\r
+ token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
+ }\r
+ let id = sequenceNumber++;\r
+ let result = new Promise((resolve, reject) => {\r
+ let requestMessage = {\r
+ jsonrpc: version,\r
+ id: id,\r
+ method: method,\r
+ params: messageParams\r
+ };\r
+ let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
+ traceSendingRequest(requestMessage);\r
+ try {\r
+ messageWriter.write(requestMessage);\r
+ }\r
+ catch (e) {\r
+ // Writing the message failed. So we need to reject the promise.\r
+ responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
+ responsePromise = null;\r
+ }\r
+ if (responsePromise) {\r
+ responsePromises[String(id)] = responsePromise;\r
+ }\r
+ });\r
+ if (token) {\r
+ token.onCancellationRequested(() => {\r
+ connection.sendNotification(CancelNotification.type, { id });\r
+ });\r
+ }\r
+ return result;\r
+ },\r
+ onRequest: (type, handler) => {\r
+ throwIfClosedOrDisposed();\r
+ if (Is.func(type)) {\r
+ starRequestHandler = type;\r
+ }\r
+ else if (handler) {\r
+ if (Is.string(type)) {\r
+ requestHandlers[type] = { type: undefined, handler };\r
+ }\r
+ else {\r
+ requestHandlers[type.method] = { type, handler };\r
+ }\r
+ }\r
+ },\r
+ trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
+ let _sendNotification = false;\r
+ let _traceFormat = TraceFormat.Text;\r
+ if (sendNotificationOrTraceOptions !== void 0) {\r
+ if (Is.boolean(sendNotificationOrTraceOptions)) {\r
+ _sendNotification = sendNotificationOrTraceOptions;\r
+ }\r
+ else {\r
+ _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
+ _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
+ }\r
+ }\r
+ trace = _value;\r
+ traceFormat = _traceFormat;\r
+ if (trace === Trace.Off) {\r
+ tracer = undefined;\r
+ }\r
+ else {\r
+ tracer = _tracer;\r
+ }\r
+ if (_sendNotification && !isClosed() && !isDisposed()) {\r
+ connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
+ }\r
+ },\r
+ onError: errorEmitter.event,\r
+ onClose: closeEmitter.event,\r
+ onUnhandledNotification: unhandledNotificationEmitter.event,\r
+ onDispose: disposeEmitter.event,\r
+ dispose: () => {\r
+ if (isDisposed()) {\r
+ return;\r
+ }\r
+ state = ConnectionState.Disposed;\r
+ disposeEmitter.fire(undefined);\r
+ let error = new Error('Connection got disposed.');\r
+ Object.keys(responsePromises).forEach((key) => {\r
+ responsePromises[key].reject(error);\r
+ });\r
+ responsePromises = Object.create(null);\r
+ requestTokens = Object.create(null);\r
+ messageQueue = new linkedMap_1.LinkedMap();\r
+ // Test for backwards compatibility\r
+ if (Is.func(messageWriter.dispose)) {\r
+ messageWriter.dispose();\r
+ }\r
+ if (Is.func(messageReader.dispose)) {\r
+ messageReader.dispose();\r
+ }\r
+ },\r
+ listen: () => {\r
+ throwIfClosedOrDisposed();\r
+ throwIfListening();\r
+ state = ConnectionState.Listening;\r
+ messageReader.listen(callback);\r
+ },\r
+ inspect: () => {\r
+ // eslint-disable-next-line no-console\r
+ console.log('inspect');\r
+ }\r
+ };\r
+ connection.onNotification(LogTraceNotification.type, (params) => {\r
+ if (trace === Trace.Off || !tracer) {\r
+ return;\r
+ }\r
+ tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
+ });\r
+ connection.onNotification(ProgressNotification.type, (params) => {\r
+ const handler = progressHandlers.get(params.token);\r
+ if (handler) {\r
+ handler(params.value);\r
+ }\r
+ else {\r
+ unhandledProgressEmitter.fire(params);\r
+ }\r
+ });\r
+ return connection;\r
+}\r
+function isMessageReader(value) {\r
+ return value.listen !== void 0 && value.read === void 0;\r
+}\r
+function isMessageWriter(value) {\r
+ return value.write !== void 0 && value.end === void 0;\r
+}\r
+function createMessageConnection(input, output, logger, strategy) {\r
+ if (!logger) {\r
+ logger = exports.NullLogger;\r
+ }\r
+ let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
+ let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
+ return _createMessageConnection(reader, writer, logger, strategy);\r
+}\r
+exports.createMessageConnection = createMessageConnection;\r
+
+
+/***/ }),
+/* 164 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+function boolean(value) {\r
+ return value === true || value === false;\r
+}\r
+exports.boolean = boolean;\r
+function string(value) {\r
+ return typeof value === 'string' || value instanceof String;\r
+}\r
+exports.string = string;\r
+function number(value) {\r
+ return typeof value === 'number' || value instanceof Number;\r
+}\r
+exports.number = number;\r
+function error(value) {\r
+ return value instanceof Error;\r
+}\r
+exports.error = error;\r
+function func(value) {\r
+ return typeof value === 'function';\r
+}\r
+exports.func = func;\r
+function array(value) {\r
+ return Array.isArray(value);\r
+}\r
+exports.array = array;\r
+function stringArray(value) {\r
+ return array(value) && value.every(elem => string(elem));\r
+}\r
+exports.stringArray = stringArray;\r
+
+
+/***/ }),
+/* 165 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const is = __webpack_require__(164);\r
+/**\r
+ * Predefined error codes.\r
+ */\r
+var ErrorCodes;\r
+(function (ErrorCodes) {\r
+ // Defined by JSON RPC\r
+ ErrorCodes.ParseError = -32700;\r
+ ErrorCodes.InvalidRequest = -32600;\r
+ ErrorCodes.MethodNotFound = -32601;\r
+ ErrorCodes.InvalidParams = -32602;\r
+ ErrorCodes.InternalError = -32603;\r
+ ErrorCodes.serverErrorStart = -32099;\r
+ ErrorCodes.serverErrorEnd = -32000;\r
+ ErrorCodes.ServerNotInitialized = -32002;\r
+ ErrorCodes.UnknownErrorCode = -32001;\r
+ // Defined by the protocol.\r
+ ErrorCodes.RequestCancelled = -32800;\r
+ ErrorCodes.ContentModified = -32801;\r
+ // Defined by VSCode library.\r
+ ErrorCodes.MessageWriteError = 1;\r
+ ErrorCodes.MessageReadError = 2;\r
+})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
+/**\r
+ * An error object return in a response in case a request\r
+ * has failed.\r
+ */\r
+class ResponseError extends Error {\r
+ constructor(code, message, data) {\r
+ super(message);\r
+ this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
+ this.data = data;\r
+ Object.setPrototypeOf(this, ResponseError.prototype);\r
+ }\r
+ toJson() {\r
+ return {\r
+ code: this.code,\r
+ message: this.message,\r
+ data: this.data,\r
+ };\r
+ }\r
+}\r
+exports.ResponseError = ResponseError;\r
+/**\r
+ * An abstract implementation of a MessageType.\r
+ */\r
+class AbstractMessageType {\r
+ constructor(_method, _numberOfParams) {\r
+ this._method = _method;\r
+ this._numberOfParams = _numberOfParams;\r
+ }\r
+ get method() {\r
+ return this._method;\r
+ }\r
+ get numberOfParams() {\r
+ return this._numberOfParams;\r
+ }\r
+}\r
+exports.AbstractMessageType = AbstractMessageType;\r
+/**\r
+ * Classes to type request response pairs\r
+ *\r
+ * The type parameter RO will be removed in the next major version\r
+ * of the JSON RPC library since it is a LSP concept and doesn't\r
+ * belong here. For now it is tagged as default never.\r
+ */\r
+class RequestType0 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 0);\r
+ }\r
+}\r
+exports.RequestType0 = RequestType0;\r
+class RequestType extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 1);\r
+ }\r
+}\r
+exports.RequestType = RequestType;\r
+class RequestType1 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 1);\r
+ }\r
+}\r
+exports.RequestType1 = RequestType1;\r
+class RequestType2 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 2);\r
+ }\r
+}\r
+exports.RequestType2 = RequestType2;\r
+class RequestType3 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 3);\r
+ }\r
+}\r
+exports.RequestType3 = RequestType3;\r
+class RequestType4 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 4);\r
+ }\r
+}\r
+exports.RequestType4 = RequestType4;\r
+class RequestType5 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 5);\r
+ }\r
+}\r
+exports.RequestType5 = RequestType5;\r
+class RequestType6 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 6);\r
+ }\r
+}\r
+exports.RequestType6 = RequestType6;\r
+class RequestType7 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 7);\r
+ }\r
+}\r
+exports.RequestType7 = RequestType7;\r
+class RequestType8 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 8);\r
+ }\r
+}\r
+exports.RequestType8 = RequestType8;\r
+class RequestType9 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 9);\r
+ }\r
+}\r
+exports.RequestType9 = RequestType9;\r
+/**\r
+ * The type parameter RO will be removed in the next major version\r
+ * of the JSON RPC library since it is a LSP concept and doesn't\r
+ * belong here. For now it is tagged as default never.\r
+ */\r
+class NotificationType extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 1);\r
+ this._ = undefined;\r
+ }\r
+}\r
+exports.NotificationType = NotificationType;\r
+class NotificationType0 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 0);\r
+ }\r
+}\r
+exports.NotificationType0 = NotificationType0;\r
+class NotificationType1 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 1);\r
+ }\r
+}\r
+exports.NotificationType1 = NotificationType1;\r
+class NotificationType2 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 2);\r
+ }\r
+}\r
+exports.NotificationType2 = NotificationType2;\r
+class NotificationType3 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 3);\r
+ }\r
+}\r
+exports.NotificationType3 = NotificationType3;\r
+class NotificationType4 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 4);\r
+ }\r
+}\r
+exports.NotificationType4 = NotificationType4;\r
+class NotificationType5 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 5);\r
+ }\r
+}\r
+exports.NotificationType5 = NotificationType5;\r
+class NotificationType6 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 6);\r
+ }\r
+}\r
+exports.NotificationType6 = NotificationType6;\r
+class NotificationType7 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 7);\r
+ }\r
+}\r
+exports.NotificationType7 = NotificationType7;\r
+class NotificationType8 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 8);\r
+ }\r
+}\r
+exports.NotificationType8 = NotificationType8;\r
+class NotificationType9 extends AbstractMessageType {\r
+ constructor(method) {\r
+ super(method, 9);\r
+ }\r
+}\r
+exports.NotificationType9 = NotificationType9;\r
+/**\r
+ * Tests if the given message is a request message\r
+ */\r
+function isRequestMessage(message) {\r
+ let candidate = message;\r
+ return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
+}\r
+exports.isRequestMessage = isRequestMessage;\r
+/**\r
+ * Tests if the given message is a notification message\r
+ */\r
+function isNotificationMessage(message) {\r
+ let candidate = message;\r
+ return candidate && is.string(candidate.method) && message.id === void 0;\r
+}\r
+exports.isNotificationMessage = isNotificationMessage;\r
+/**\r
+ * Tests if the given message is a response message\r
+ */\r
+function isResponseMessage(message) {\r
+ let candidate = message;\r
+ return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
+}\r
+exports.isResponseMessage = isResponseMessage;\r
+
+
+/***/ }),
+/* 166 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const events_1 = __webpack_require__(167);\r
+const Is = __webpack_require__(164);\r
+let DefaultSize = 8192;\r
+let CR = Buffer.from('\r', 'ascii')[0];\r
+let LF = Buffer.from('\n', 'ascii')[0];\r
+let CRLF = '\r\n';\r
+class MessageBuffer {\r
+ constructor(encoding = 'utf8') {\r
+ this.encoding = encoding;\r
+ this.index = 0;\r
+ this.buffer = Buffer.allocUnsafe(DefaultSize);\r
+ }\r
+ append(chunk) {\r
+ var toAppend = chunk;\r
+ if (typeof (chunk) === 'string') {\r
+ var str = chunk;\r
+ var bufferLen = Buffer.byteLength(str, this.encoding);\r
+ toAppend = Buffer.allocUnsafe(bufferLen);\r
+ toAppend.write(str, 0, bufferLen, this.encoding);\r
+ }\r
+ if (this.buffer.length - this.index >= toAppend.length) {\r
+ toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
+ }\r
+ else {\r
+ var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
+ if (this.index === 0) {\r
+ this.buffer = Buffer.allocUnsafe(newSize);\r
+ toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
+ }\r
+ else {\r
+ this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
+ }\r
+ }\r
+ this.index += toAppend.length;\r
+ }\r
+ tryReadHeaders() {\r
+ let result = undefined;\r
+ let current = 0;\r
+ while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {\r
+ current++;\r
+ }\r
+ // No header / body separator found (e.g CRLFCRLF)\r
+ if (current + 3 >= this.index) {\r
+ return result;\r
+ }\r
+ result = Object.create(null);\r
+ let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
+ headers.forEach((header) => {\r
+ let index = header.indexOf(':');\r
+ if (index === -1) {\r
+ throw new Error('Message header must separate key and value using :');\r
+ }\r
+ let key = header.substr(0, index);\r
+ let value = header.substr(index + 1).trim();\r
+ result[key] = value;\r
+ });\r
+ let nextStart = current + 4;\r
+ this.buffer = this.buffer.slice(nextStart);\r
+ this.index = this.index - nextStart;\r
+ return result;\r
+ }\r
+ tryReadContent(length) {\r
+ if (this.index < length) {\r
+ return null;\r
+ }\r
+ let result = this.buffer.toString(this.encoding, 0, length);\r
+ let nextStart = length;\r
+ this.buffer.copy(this.buffer, 0, nextStart);\r
+ this.index = this.index - nextStart;\r
+ return result;\r
+ }\r
+ get numberOfBytes() {\r
+ return this.index;\r
+ }\r
+}\r
+var MessageReader;\r
+(function (MessageReader) {\r
+ function is(value) {\r
+ let candidate = value;\r
+ return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
+ Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
+ }\r
+ MessageReader.is = is;\r
+})(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
+class AbstractMessageReader {\r
+ constructor() {\r
+ this.errorEmitter = new events_1.Emitter();\r
+ this.closeEmitter = new events_1.Emitter();\r
+ this.partialMessageEmitter = new events_1.Emitter();\r
+ }\r
+ dispose() {\r
+ this.errorEmitter.dispose();\r
+ this.closeEmitter.dispose();\r
+ }\r
+ get onError() {\r
+ return this.errorEmitter.event;\r
+ }\r
+ fireError(error) {\r
+ this.errorEmitter.fire(this.asError(error));\r
+ }\r
+ get onClose() {\r
+ return this.closeEmitter.event;\r
+ }\r
+ fireClose() {\r
+ this.closeEmitter.fire(undefined);\r
+ }\r
+ get onPartialMessage() {\r
+ return this.partialMessageEmitter.event;\r
+ }\r
+ firePartialMessage(info) {\r
+ this.partialMessageEmitter.fire(info);\r
+ }\r
+ asError(error) {\r
+ if (error instanceof Error) {\r
+ return error;\r
+ }\r
+ else {\r
+ return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
+ }\r
+ }\r
+}\r
+exports.AbstractMessageReader = AbstractMessageReader;\r
+class StreamMessageReader extends AbstractMessageReader {\r
+ constructor(readable, encoding = 'utf8') {\r
+ super();\r
+ this.readable = readable;\r
+ this.buffer = new MessageBuffer(encoding);\r
+ this._partialMessageTimeout = 10000;\r
+ }\r
+ set partialMessageTimeout(timeout) {\r
+ this._partialMessageTimeout = timeout;\r
+ }\r
+ get partialMessageTimeout() {\r
+ return this._partialMessageTimeout;\r
+ }\r
+ listen(callback) {\r
+ this.nextMessageLength = -1;\r
+ this.messageToken = 0;\r
+ this.partialMessageTimer = undefined;\r
+ this.callback = callback;\r
+ this.readable.on('data', (data) => {\r
+ this.onData(data);\r
+ });\r
+ this.readable.on('error', (error) => this.fireError(error));\r
+ this.readable.on('close', () => this.fireClose());\r
+ }\r
+ onData(data) {\r
+ this.buffer.append(data);\r
+ while (true) {\r
+ if (this.nextMessageLength === -1) {\r
+ let headers = this.buffer.tryReadHeaders();\r
+ if (!headers) {\r
+ return;\r
+ }\r
+ let contentLength = headers['Content-Length'];\r
+ if (!contentLength) {\r
+ throw new Error('Header must provide a Content-Length property.');\r
+ }\r
+ let length = parseInt(contentLength);\r
+ if (isNaN(length)) {\r
+ throw new Error('Content-Length value must be a number.');\r
+ }\r
+ this.nextMessageLength = length;\r
+ // Take the encoding form the header. For compatibility\r
+ // treat both utf-8 and utf8 as node utf8\r
+ }\r
+ var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
+ if (msg === null) {\r
+ /** We haven't received the full message yet. */\r
+ this.setPartialMessageTimer();\r
+ return;\r
+ }\r
+ this.clearPartialMessageTimer();\r
+ this.nextMessageLength = -1;\r
+ this.messageToken++;\r
+ var json = JSON.parse(msg);\r
+ this.callback(json);\r
+ }\r
+ }\r
+ clearPartialMessageTimer() {\r
+ if (this.partialMessageTimer) {\r
+ clearTimeout(this.partialMessageTimer);\r
+ this.partialMessageTimer = undefined;\r
+ }\r
+ }\r
+ setPartialMessageTimer() {\r
+ this.clearPartialMessageTimer();\r
+ if (this._partialMessageTimeout <= 0) {\r
+ return;\r
+ }\r
+ this.partialMessageTimer = setTimeout((token, timeout) => {\r
+ this.partialMessageTimer = undefined;\r
+ if (token === this.messageToken) {\r
+ this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
+ this.setPartialMessageTimer();\r
+ }\r
+ }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
+ }\r
+}\r
+exports.StreamMessageReader = StreamMessageReader;\r
+class IPCMessageReader extends AbstractMessageReader {\r
+ constructor(process) {\r
+ super();\r
+ this.process = process;\r
+ let eventEmitter = this.process;\r
+ eventEmitter.on('error', (error) => this.fireError(error));\r
+ eventEmitter.on('close', () => this.fireClose());\r
+ }\r
+ listen(callback) {\r
+ this.process.on('message', callback);\r
+ }\r
+}\r
+exports.IPCMessageReader = IPCMessageReader;\r
+class SocketMessageReader extends StreamMessageReader {\r
+ constructor(socket, encoding = 'utf-8') {\r
+ super(socket, encoding);\r
+ }\r
+}\r
+exports.SocketMessageReader = SocketMessageReader;\r
+
+
+/***/ }),
+/* 167 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+var Disposable;\r
+(function (Disposable) {\r
+ function create(func) {\r
+ return {\r
+ dispose: func\r
+ };\r
+ }\r
+ Disposable.create = create;\r
+})(Disposable = exports.Disposable || (exports.Disposable = {}));\r
+var Event;\r
+(function (Event) {\r
+ const _disposable = { dispose() { } };\r
+ Event.None = function () { return _disposable; };\r
+})(Event = exports.Event || (exports.Event = {}));\r
+class CallbackList {\r
+ add(callback, context = null, bucket) {\r
+ if (!this._callbacks) {\r
+ this._callbacks = [];\r
+ this._contexts = [];\r
+ }\r
+ this._callbacks.push(callback);\r
+ this._contexts.push(context);\r
+ if (Array.isArray(bucket)) {\r
+ bucket.push({ dispose: () => this.remove(callback, context) });\r
+ }\r
+ }\r
+ remove(callback, context = null) {\r
+ if (!this._callbacks) {\r
+ return;\r
+ }\r
+ var foundCallbackWithDifferentContext = false;\r
+ for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
+ if (this._callbacks[i] === callback) {\r
+ if (this._contexts[i] === context) {\r
+ // callback & context match => remove it\r
+ this._callbacks.splice(i, 1);\r
+ this._contexts.splice(i, 1);\r
+ return;\r
+ }\r
+ else {\r
+ foundCallbackWithDifferentContext = true;\r
+ }\r
+ }\r
+ }\r
+ if (foundCallbackWithDifferentContext) {\r
+ throw new Error('When adding a listener with a context, you should remove it with the same context');\r
+ }\r
+ }\r
+ invoke(...args) {\r
+ if (!this._callbacks) {\r
+ return [];\r
+ }\r
+ var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
+ for (var i = 0, len = callbacks.length; i < len; i++) {\r
+ try {\r
+ ret.push(callbacks[i].apply(contexts[i], args));\r
+ }\r
+ catch (e) {\r
+ // eslint-disable-next-line no-console\r
+ console.error(e);\r
+ }\r
+ }\r
+ return ret;\r
+ }\r
+ isEmpty() {\r
+ return !this._callbacks || this._callbacks.length === 0;\r
+ }\r
+ dispose() {\r
+ this._callbacks = undefined;\r
+ this._contexts = undefined;\r
+ }\r
+}\r
+class Emitter {\r
+ constructor(_options) {\r
+ this._options = _options;\r
+ }\r
+ /**\r
+ * For the public to allow to subscribe\r
+ * to events from this Emitter\r
+ */\r
+ get event() {\r
+ if (!this._event) {\r
+ this._event = (listener, thisArgs, disposables) => {\r
+ if (!this._callbacks) {\r
+ this._callbacks = new CallbackList();\r
+ }\r
+ if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
+ this._options.onFirstListenerAdd(this);\r
+ }\r
+ this._callbacks.add(listener, thisArgs);\r
+ let result;\r
+ result = {\r
+ dispose: () => {\r
+ this._callbacks.remove(listener, thisArgs);\r
+ result.dispose = Emitter._noop;\r
+ if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
+ this._options.onLastListenerRemove(this);\r
+ }\r
+ }\r
+ };\r
+ if (Array.isArray(disposables)) {\r
+ disposables.push(result);\r
+ }\r
+ return result;\r
+ };\r
+ }\r
+ return this._event;\r
+ }\r
+ /**\r
+ * To be kept private to fire an event to\r
+ * subscribers\r
+ */\r
+ fire(event) {\r
+ if (this._callbacks) {\r
+ this._callbacks.invoke.call(this._callbacks, event);\r
+ }\r
+ }\r
+ dispose() {\r
+ if (this._callbacks) {\r
+ this._callbacks.dispose();\r
+ this._callbacks = undefined;\r
+ }\r
+ }\r
+}\r
+exports.Emitter = Emitter;\r
+Emitter._noop = function () { };\r
+
+
+/***/ }),
+/* 168 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const events_1 = __webpack_require__(167);\r
+const Is = __webpack_require__(164);\r
+let ContentLength = 'Content-Length: ';\r
+let CRLF = '\r\n';\r
+var MessageWriter;\r
+(function (MessageWriter) {\r
+ function is(value) {\r
+ let candidate = value;\r
+ return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
+ Is.func(candidate.onError) && Is.func(candidate.write);\r
+ }\r
+ MessageWriter.is = is;\r
+})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
+class AbstractMessageWriter {\r
+ constructor() {\r
+ this.errorEmitter = new events_1.Emitter();\r
+ this.closeEmitter = new events_1.Emitter();\r
+ }\r
+ dispose() {\r
+ this.errorEmitter.dispose();\r
+ this.closeEmitter.dispose();\r
+ }\r
+ get onError() {\r
+ return this.errorEmitter.event;\r
+ }\r
+ fireError(error, message, count) {\r
+ this.errorEmitter.fire([this.asError(error), message, count]);\r
+ }\r
+ get onClose() {\r
+ return this.closeEmitter.event;\r
+ }\r
+ fireClose() {\r
+ this.closeEmitter.fire(undefined);\r
+ }\r
+ asError(error) {\r
+ if (error instanceof Error) {\r
+ return error;\r
+ }\r
+ else {\r
+ return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
+ }\r
+ }\r
+}\r
+exports.AbstractMessageWriter = AbstractMessageWriter;\r
+class StreamMessageWriter extends AbstractMessageWriter {\r
+ constructor(writable, encoding = 'utf8') {\r
+ super();\r
+ this.writable = writable;\r
+ this.encoding = encoding;\r
+ this.errorCount = 0;\r
+ this.writable.on('error', (error) => this.fireError(error));\r
+ this.writable.on('close', () => this.fireClose());\r
+ }\r
+ write(msg) {\r
+ let json = JSON.stringify(msg);\r
+ let contentLength = Buffer.byteLength(json, this.encoding);\r
+ let headers = [\r
+ ContentLength, contentLength.toString(), CRLF,\r
+ CRLF\r
+ ];\r
+ try {\r
+ // Header must be written in ASCII encoding\r
+ this.writable.write(headers.join(''), 'ascii');\r
+ // Now write the content. This can be written in any encoding\r
+ this.writable.write(json, this.encoding);\r
+ this.errorCount = 0;\r
+ }\r
+ catch (error) {\r
+ this.errorCount++;\r
+ this.fireError(error, msg, this.errorCount);\r
+ }\r
+ }\r
+}\r
+exports.StreamMessageWriter = StreamMessageWriter;\r
+class IPCMessageWriter extends AbstractMessageWriter {\r
+ constructor(process) {\r
+ super();\r
+ this.process = process;\r
+ this.errorCount = 0;\r
+ this.queue = [];\r
+ this.sending = false;\r
+ let eventEmitter = this.process;\r
+ eventEmitter.on('error', (error) => this.fireError(error));\r
+ eventEmitter.on('close', () => this.fireClose);\r
+ }\r
+ write(msg) {\r
+ if (!this.sending && this.queue.length === 0) {\r
+ // See https://github.com/nodejs/node/issues/7657\r
+ this.doWriteMessage(msg);\r
+ }\r
+ else {\r
+ this.queue.push(msg);\r
+ }\r
+ }\r
+ doWriteMessage(msg) {\r
+ try {\r
+ if (this.process.send) {\r
+ this.sending = true;\r
+ this.process.send(msg, undefined, undefined, (error) => {\r
+ this.sending = false;\r
+ if (error) {\r
+ this.errorCount++;\r
+ this.fireError(error, msg, this.errorCount);\r
+ }\r
+ else {\r
+ this.errorCount = 0;\r
+ }\r
+ if (this.queue.length > 0) {\r
+ this.doWriteMessage(this.queue.shift());\r
+ }\r
+ });\r
+ }\r
+ }\r
+ catch (error) {\r
+ this.errorCount++;\r
+ this.fireError(error, msg, this.errorCount);\r
+ }\r
+ }\r
+}\r
+exports.IPCMessageWriter = IPCMessageWriter;\r
+class SocketMessageWriter extends AbstractMessageWriter {\r
+ constructor(socket, encoding = 'utf8') {\r
+ super();\r
+ this.socket = socket;\r
+ this.queue = [];\r
+ this.sending = false;\r
+ this.encoding = encoding;\r
+ this.errorCount = 0;\r
+ this.socket.on('error', (error) => this.fireError(error));\r
+ this.socket.on('close', () => this.fireClose());\r
+ }\r
+ dispose() {\r
+ super.dispose();\r
+ this.socket.destroy();\r
+ }\r
+ write(msg) {\r
+ if (!this.sending && this.queue.length === 0) {\r
+ // See https://github.com/nodejs/node/issues/7657\r
+ this.doWriteMessage(msg);\r
+ }\r
+ else {\r
+ this.queue.push(msg);\r
+ }\r
+ }\r
+ doWriteMessage(msg) {\r
+ let json = JSON.stringify(msg);\r
+ let contentLength = Buffer.byteLength(json, this.encoding);\r
+ let headers = [\r
+ ContentLength, contentLength.toString(), CRLF,\r
+ CRLF\r
+ ];\r
+ try {\r
+ // Header must be written in ASCII encoding\r
+ this.sending = true;\r
+ this.socket.write(headers.join(''), 'ascii', (error) => {\r
+ if (error) {\r
+ this.handleError(error, msg);\r
+ }\r
+ try {\r
+ // Now write the content. This can be written in any encoding\r
+ this.socket.write(json, this.encoding, (error) => {\r
+ this.sending = false;\r
+ if (error) {\r
+ this.handleError(error, msg);\r
+ }\r
+ else {\r
+ this.errorCount = 0;\r
+ }\r
+ if (this.queue.length > 0) {\r
+ this.doWriteMessage(this.queue.shift());\r
+ }\r
+ });\r
+ }\r
+ catch (error) {\r
+ this.handleError(error, msg);\r
+ }\r
+ });\r
+ }\r
+ catch (error) {\r
+ this.handleError(error, msg);\r
+ }\r
+ }\r
+ handleError(error, msg) {\r
+ this.errorCount++;\r
+ this.fireError(error, msg, this.errorCount);\r
+ }\r
+}\r
+exports.SocketMessageWriter = SocketMessageWriter;\r
+
+
+/***/ }),
+/* 169 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/*---------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ *--------------------------------------------------------------------------------------------*/\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const events_1 = __webpack_require__(167);\r
+const Is = __webpack_require__(164);\r
+var CancellationToken;\r
+(function (CancellationToken) {\r
+ CancellationToken.None = Object.freeze({\r
+ isCancellationRequested: false,\r
+ onCancellationRequested: events_1.Event.None\r
+ });\r
+ CancellationToken.Cancelled = Object.freeze({\r
+ isCancellationRequested: true,\r
+ onCancellationRequested: events_1.Event.None\r
+ });\r
+ function is(value) {\r
+ let candidate = value;\r
+ return candidate && (candidate === CancellationToken.None\r
+ || candidate === CancellationToken.Cancelled\r
+ || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
+ }\r
+ CancellationToken.is = is;\r
+})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
+const shortcutEvent = Object.freeze(function (callback, context) {\r
+ let handle = setTimeout(callback.bind(context), 0);\r
+ return { dispose() { clearTimeout(handle); } };\r
+});\r
+class MutableToken {\r
+ constructor() {\r
+ this._isCancelled = false;\r
+ }\r
+ cancel() {\r
+ if (!this._isCancelled) {\r
+ this._isCancelled = true;\r
+ if (this._emitter) {\r
+ this._emitter.fire(undefined);\r
+ this.dispose();\r
+ }\r
+ }\r
+ }\r
+ get isCancellationRequested() {\r
+ return this._isCancelled;\r
+ }\r
+ get onCancellationRequested() {\r
+ if (this._isCancelled) {\r
+ return shortcutEvent;\r
+ }\r
+ if (!this._emitter) {\r
+ this._emitter = new events_1.Emitter();\r
+ }\r
+ return this._emitter.event;\r
+ }\r
+ dispose() {\r
+ if (this._emitter) {\r
+ this._emitter.dispose();\r
+ this._emitter = undefined;\r
+ }\r
+ }\r
+}\r
+class CancellationTokenSource {\r
+ get token() {\r
+ if (!this._token) {\r
+ // be lazy and create the token only when\r
+ // actually needed\r
+ this._token = new MutableToken();\r
+ }\r
+ return this._token;\r
+ }\r
+ cancel() {\r
+ if (!this._token) {\r
+ // save an object by returning the default\r
+ // cancelled token when cancellation happens\r
+ // before someone asks for the token\r
+ this._token = CancellationToken.Cancelled;\r
+ }\r
+ else {\r
+ this._token.cancel();\r
+ }\r
+ }\r
+ dispose() {\r
+ if (!this._token) {\r
+ // ensure to initialize with an empty token if we had none\r
+ this._token = CancellationToken.None;\r
+ }\r
+ else if (this._token instanceof MutableToken) {\r
+ // actually dispose\r
+ this._token.dispose();\r
+ }\r
+ }\r
+}\r
+exports.CancellationTokenSource = CancellationTokenSource;\r
+
+
+/***/ }),
+/* 170 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+\r
+/*---------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ *--------------------------------------------------------------------------------------------*/\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+var Touch;\r
+(function (Touch) {\r
+ Touch.None = 0;\r
+ Touch.First = 1;\r
+ Touch.Last = 2;\r
+})(Touch = exports.Touch || (exports.Touch = {}));\r
+class LinkedMap {\r
+ constructor() {\r
+ this._map = new Map();\r
+ this._head = undefined;\r
+ this._tail = undefined;\r
+ this._size = 0;\r
+ }\r
+ clear() {\r
+ this._map.clear();\r
+ this._head = undefined;\r
+ this._tail = undefined;\r
+ this._size = 0;\r
+ }\r
+ isEmpty() {\r
+ return !this._head && !this._tail;\r
+ }\r
+ get size() {\r
+ return this._size;\r
+ }\r
+ has(key) {\r
+ return this._map.has(key);\r
+ }\r
+ get(key) {\r
+ const item = this._map.get(key);\r
+ if (!item) {\r
+ return undefined;\r
+ }\r
+ return item.value;\r
+ }\r
+ set(key, value, touch = Touch.None) {\r
+ let item = this._map.get(key);\r
+ if (item) {\r
+ item.value = value;\r
+ if (touch !== Touch.None) {\r
+ this.touch(item, touch);\r
+ }\r
+ }\r
+ else {\r
+ item = { key, value, next: undefined, previous: undefined };\r
+ switch (touch) {\r
+ case Touch.None:\r
+ this.addItemLast(item);\r
+ break;\r
+ case Touch.First:\r
+ this.addItemFirst(item);\r
+ break;\r
+ case Touch.Last:\r
+ this.addItemLast(item);\r
+ break;\r
+ default:\r
+ this.addItemLast(item);\r
+ break;\r
+ }\r
+ this._map.set(key, item);\r
+ this._size++;\r
+ }\r
+ }\r
+ delete(key) {\r
+ const item = this._map.get(key);\r
+ if (!item) {\r
+ return false;\r
+ }\r
+ this._map.delete(key);\r
+ this.removeItem(item);\r
+ this._size--;\r
+ return true;\r
+ }\r
+ shift() {\r
+ if (!this._head && !this._tail) {\r
+ return undefined;\r
+ }\r
+ if (!this._head || !this._tail) {\r
+ throw new Error('Invalid list');\r
+ }\r
+ const item = this._head;\r
+ this._map.delete(item.key);\r
+ this.removeItem(item);\r
+ this._size--;\r
+ return item.value;\r
+ }\r
+ forEach(callbackfn, thisArg) {\r
+ let current = this._head;\r
+ while (current) {\r
+ if (thisArg) {\r
+ callbackfn.bind(thisArg)(current.value, current.key, this);\r
+ }\r
+ else {\r
+ callbackfn(current.value, current.key, this);\r
+ }\r
+ current = current.next;\r
+ }\r
+ }\r
+ forEachReverse(callbackfn, thisArg) {\r
+ let current = this._tail;\r
+ while (current) {\r
+ if (thisArg) {\r
+ callbackfn.bind(thisArg)(current.value, current.key, this);\r
+ }\r
+ else {\r
+ callbackfn(current.value, current.key, this);\r
+ }\r
+ current = current.previous;\r
+ }\r
+ }\r
+ values() {\r
+ let result = [];\r
+ let current = this._head;\r
+ while (current) {\r
+ result.push(current.value);\r
+ current = current.next;\r
+ }\r
+ return result;\r
+ }\r
+ keys() {\r
+ let result = [];\r
+ let current = this._head;\r
+ while (current) {\r
+ result.push(current.key);\r
+ current = current.next;\r
+ }\r
+ return result;\r
+ }\r
+ /* JSON RPC run on es5 which has no Symbol.iterator\r
+ public keys(): IterableIterator<K> {\r
+ let current = this._head;\r
+ let iterator: IterableIterator<K> = {\r
+ [Symbol.iterator]() {\r
+ return iterator;\r
+ },\r
+ next():IteratorResult<K> {\r
+ if (current) {\r
+ let result = { value: current.key, done: false };\r
+ current = current.next;\r
+ return result;\r
+ } else {\r
+ return { value: undefined, done: true };\r
+ }\r
+ }\r
+ };\r
+ return iterator;\r
+ }\r
+\r
+ public values(): IterableIterator<V> {\r
+ let current = this._head;\r
+ let iterator: IterableIterator<V> = {\r
+ [Symbol.iterator]() {\r
+ return iterator;\r
+ },\r
+ next():IteratorResult<V> {\r
+ if (current) {\r
+ let result = { value: current.value, done: false };\r
+ current = current.next;\r
+ return result;\r
+ } else {\r
+ return { value: undefined, done: true };\r
+ }\r
+ }\r
+ };\r
+ return iterator;\r
+ }\r
+ */\r
+ addItemFirst(item) {\r
+ // First time Insert\r
+ if (!this._head && !this._tail) {\r
+ this._tail = item;\r
+ }\r
+ else if (!this._head) {\r
+ throw new Error('Invalid list');\r
+ }\r
+ else {\r
+ item.next = this._head;\r
+ this._head.previous = item;\r
+ }\r
+ this._head = item;\r
+ }\r
+ addItemLast(item) {\r
+ // First time Insert\r
+ if (!this._head && !this._tail) {\r
+ this._head = item;\r
+ }\r
+ else if (!this._tail) {\r
+ throw new Error('Invalid list');\r
+ }\r
+ else {\r
+ item.previous = this._tail;\r
+ this._tail.next = item;\r
+ }\r
+ this._tail = item;\r
+ }\r
+ removeItem(item) {\r
+ if (item === this._head && item === this._tail) {\r
+ this._head = undefined;\r
+ this._tail = undefined;\r
+ }\r
+ else if (item === this._head) {\r
+ this._head = item.next;\r
+ }\r
+ else if (item === this._tail) {\r
+ this._tail = item.previous;\r
+ }\r
+ else {\r
+ const next = item.next;\r
+ const previous = item.previous;\r
+ if (!next || !previous) {\r
+ throw new Error('Invalid list');\r
+ }\r
+ next.previous = previous;\r
+ previous.next = next;\r
+ }\r
+ }\r
+ touch(item, touch) {\r
+ if (!this._head || !this._tail) {\r
+ throw new Error('Invalid list');\r
+ }\r
+ if ((touch !== Touch.First && touch !== Touch.Last)) {\r
+ return;\r
+ }\r
+ if (touch === Touch.First) {\r
+ if (item === this._head) {\r
+ return;\r
+ }\r
+ const next = item.next;\r
+ const previous = item.previous;\r
+ // Unlink the item\r
+ if (item === this._tail) {\r
+ // previous must be defined since item was not head but is tail\r
+ // So there are more than on item in the map\r
+ previous.next = undefined;\r
+ this._tail = previous;\r
+ }\r
+ else {\r
+ // Both next and previous are not undefined since item was neither head nor tail.\r
+ next.previous = previous;\r
+ previous.next = next;\r
+ }\r
+ // Insert the node at head\r
+ item.previous = undefined;\r
+ item.next = this._head;\r
+ this._head.previous = item;\r
+ this._head = item;\r
+ }\r
+ else if (touch === Touch.Last) {\r
+ if (item === this._tail) {\r
+ return;\r
+ }\r
+ const next = item.next;\r
+ const previous = item.previous;\r
+ // Unlink the item.\r
+ if (item === this._head) {\r
+ // next must be defined since item was not tail but is head\r
+ // So there are more than on item in the map\r
+ next.previous = undefined;\r
+ this._head = next;\r
+ }\r
+ else {\r
+ // Both next and previous are not undefined since item was neither head nor tail.\r
+ next.previous = previous;\r
+ previous.next = next;\r
+ }\r
+ item.next = undefined;\r
+ item.previous = this._tail;\r
+ this._tail.next = item;\r
+ this._tail = item;\r
+ }\r
+ }\r
+}\r
+exports.LinkedMap = LinkedMap;\r
+
+
+/***/ }),
+/* 171 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const path_1 = __webpack_require__(38);\r
+const os_1 = __webpack_require__(111);\r
+const crypto_1 = __webpack_require__(172);\r
+const net_1 = __webpack_require__(173);\r
+const messageReader_1 = __webpack_require__(166);\r
+const messageWriter_1 = __webpack_require__(168);\r
+function generateRandomPipeName() {\r
+ const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
+ if (process.platform === 'win32') {\r
+ return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
+ }\r
+ else {\r
+ // Mac/Unix: use socket file\r
+ return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
+ }\r
+}\r
+exports.generateRandomPipeName = generateRandomPipeName;\r
+function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
+ let connectResolve;\r
+ let connected = new Promise((resolve, _reject) => {\r
+ connectResolve = resolve;\r
+ });\r
+ return new Promise((resolve, reject) => {\r
+ let server = net_1.createServer((socket) => {\r
+ server.close();\r
+ connectResolve([\r
+ new messageReader_1.SocketMessageReader(socket, encoding),\r
+ new messageWriter_1.SocketMessageWriter(socket, encoding)\r
+ ]);\r
+ });\r
+ server.on('error', reject);\r
+ server.listen(pipeName, () => {\r
+ server.removeListener('error', reject);\r
+ resolve({\r
+ onConnected: () => { return connected; }\r
+ });\r
+ });\r
+ });\r
+}\r
+exports.createClientPipeTransport = createClientPipeTransport;\r
+function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
+ const socket = net_1.createConnection(pipeName);\r
+ return [\r
+ new messageReader_1.SocketMessageReader(socket, encoding),\r
+ new messageWriter_1.SocketMessageWriter(socket, encoding)\r
+ ];\r
+}\r
+exports.createServerPipeTransport = createServerPipeTransport;\r
+
+
+/***/ }),
+/* 172 */
+/***/ (function(module, exports) {
+
+module.exports = require("crypto");
+
+/***/ }),
+/* 173 */
+/***/ (function(module, exports) {
+
+module.exports = require("net");
+
+/***/ }),
+/* 174 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const net_1 = __webpack_require__(173);\r
+const messageReader_1 = __webpack_require__(166);\r
+const messageWriter_1 = __webpack_require__(168);\r
+function createClientSocketTransport(port, encoding = 'utf-8') {\r
+ let connectResolve;\r
+ let connected = new Promise((resolve, _reject) => {\r
+ connectResolve = resolve;\r
+ });\r
+ return new Promise((resolve, reject) => {\r
+ let server = net_1.createServer((socket) => {\r
+ server.close();\r
+ connectResolve([\r
+ new messageReader_1.SocketMessageReader(socket, encoding),\r
+ new messageWriter_1.SocketMessageWriter(socket, encoding)\r
+ ]);\r
+ });\r
+ server.on('error', reject);\r
+ server.listen(port, '127.0.0.1', () => {\r
+ server.removeListener('error', reject);\r
+ resolve({\r
+ onConnected: () => { return connected; }\r
+ });\r
+ });\r
+ });\r
+}\r
+exports.createClientSocketTransport = createClientSocketTransport;\r
+function createServerSocketTransport(port, encoding = 'utf-8') {\r
+ const socket = net_1.createConnection(port, '127.0.0.1');\r
+ return [\r
+ new messageReader_1.SocketMessageReader(socket, encoding),\r
+ new messageWriter_1.SocketMessageWriter(socket, encoding)\r
+ ];\r
+}\r
+exports.createServerSocketTransport = createServerSocketTransport;\r
+
+
+/***/ }),
+/* 175 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+/**\r
+ * The Position namespace provides helper functions to work with\r
+ * [Position](#Position) literals.\r
+ */\r
+var Position;\r
+(function (Position) {\r
+ /**\r
+ * Creates a new Position literal from the given line and character.\r
+ * @param line The position's line.\r
+ * @param character The position's character.\r
+ */\r
+ function create(line, character) {\r
+ return { line: line, character: character };\r
+ }\r
+ Position.create = create;\r
+ /**\r
+ * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
+ }\r
+ Position.is = is;\r
+})(Position || (Position = {}));\r
+/**\r
+ * The Range namespace provides helper functions to work with\r
+ * [Range](#Range) literals.\r
+ */\r
+var Range;\r
+(function (Range) {\r
+ function create(one, two, three, four) {\r
+ if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
+ return { start: Position.create(one, two), end: Position.create(three, four) };\r
+ }\r
+ else if (Position.is(one) && Position.is(two)) {\r
+ return { start: one, end: two };\r
+ }\r
+ else {\r
+ throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
+ }\r
+ }\r
+ Range.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [Range](#Range) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
+ }\r
+ Range.is = is;\r
+})(Range || (Range = {}));\r
+/**\r
+ * The Location namespace provides helper functions to work with\r
+ * [Location](#Location) literals.\r
+ */\r
+var Location;\r
+(function (Location) {\r
+ /**\r
+ * Creates a Location literal.\r
+ * @param uri The location's uri.\r
+ * @param range The location's range.\r
+ */\r
+ function create(uri, range) {\r
+ return { uri: uri, range: range };\r
+ }\r
+ Location.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [Location](#Location) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
+ }\r
+ Location.is = is;\r
+})(Location || (Location = {}));\r
+/**\r
+ * The LocationLink namespace provides helper functions to work with\r
+ * [LocationLink](#LocationLink) literals.\r
+ */\r
+var LocationLink;\r
+(function (LocationLink) {\r
+ /**\r
+ * Creates a LocationLink literal.\r
+ * @param targetUri The definition's uri.\r
+ * @param targetRange The full range of the definition.\r
+ * @param targetSelectionRange The span of the symbol definition at the target.\r
+ * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
+ */\r
+ function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
+ return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
+ }\r
+ LocationLink.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
+ && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
+ && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
+ }\r
+ LocationLink.is = is;\r
+})(LocationLink || (LocationLink = {}));\r
+/**\r
+ * The Color namespace provides helper functions to work with\r
+ * [Color](#Color) literals.\r
+ */\r
+var Color;\r
+(function (Color) {\r
+ /**\r
+ * Creates a new Color literal.\r
+ */\r
+ function create(red, green, blue, alpha) {\r
+ return {\r
+ red: red,\r
+ green: green,\r
+ blue: blue,\r
+ alpha: alpha,\r
+ };\r
+ }\r
+ Color.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [Color](#Color) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.number(candidate.red)\r
+ && Is.number(candidate.green)\r
+ && Is.number(candidate.blue)\r
+ && Is.number(candidate.alpha);\r
+ }\r
+ Color.is = is;\r
+})(Color || (Color = {}));\r
+/**\r
+ * The ColorInformation namespace provides helper functions to work with\r
+ * [ColorInformation](#ColorInformation) literals.\r
+ */\r
+var ColorInformation;\r
+(function (ColorInformation) {\r
+ /**\r
+ * Creates a new ColorInformation literal.\r
+ */\r
+ function create(range, color) {\r
+ return {\r
+ range: range,\r
+ color: color,\r
+ };\r
+ }\r
+ ColorInformation.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Range.is(candidate.range) && Color.is(candidate.color);\r
+ }\r
+ ColorInformation.is = is;\r
+})(ColorInformation || (ColorInformation = {}));\r
+/**\r
+ * The Color namespace provides helper functions to work with\r
+ * [ColorPresentation](#ColorPresentation) literals.\r
+ */\r
+var ColorPresentation;\r
+(function (ColorPresentation) {\r
+ /**\r
+ * Creates a new ColorInformation literal.\r
+ */\r
+ function create(label, textEdit, additionalTextEdits) {\r
+ return {\r
+ label: label,\r
+ textEdit: textEdit,\r
+ additionalTextEdits: additionalTextEdits,\r
+ };\r
+ }\r
+ ColorPresentation.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.string(candidate.label)\r
+ && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
+ && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
+ }\r
+ ColorPresentation.is = is;\r
+})(ColorPresentation || (ColorPresentation = {}));\r
+/**\r
+ * Enum of known range kinds\r
+ */\r
+var FoldingRangeKind;\r
+(function (FoldingRangeKind) {\r
+ /**\r
+ * Folding range for a comment\r
+ */\r
+ FoldingRangeKind["Comment"] = "comment";\r
+ /**\r
+ * Folding range for a imports or includes\r
+ */\r
+ FoldingRangeKind["Imports"] = "imports";\r
+ /**\r
+ * Folding range for a region (e.g. `#region`)\r
+ */\r
+ FoldingRangeKind["Region"] = "region";\r
+})(FoldingRangeKind || (FoldingRangeKind = {}));\r
+/**\r
+ * The folding range namespace provides helper functions to work with\r
+ * [FoldingRange](#FoldingRange) literals.\r
+ */\r
+var FoldingRange;\r
+(function (FoldingRange) {\r
+ /**\r
+ * Creates a new FoldingRange literal.\r
+ */\r
+ function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
+ var result = {\r
+ startLine: startLine,\r
+ endLine: endLine\r
+ };\r
+ if (Is.defined(startCharacter)) {\r
+ result.startCharacter = startCharacter;\r
+ }\r
+ if (Is.defined(endCharacter)) {\r
+ result.endCharacter = endCharacter;\r
+ }\r
+ if (Is.defined(kind)) {\r
+ result.kind = kind;\r
+ }\r
+ return result;\r
+ }\r
+ FoldingRange.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
+ && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
+ && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
+ && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
+ }\r
+ FoldingRange.is = is;\r
+})(FoldingRange || (FoldingRange = {}));\r
+/**\r
+ * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
+ * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
+ */\r
+var DiagnosticRelatedInformation;\r
+(function (DiagnosticRelatedInformation) {\r
+ /**\r
+ * Creates a new DiagnosticRelatedInformation literal.\r
+ */\r
+ function create(location, message) {\r
+ return {\r
+ location: location,\r
+ message: message\r
+ };\r
+ }\r
+ DiagnosticRelatedInformation.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
+ }\r
+ DiagnosticRelatedInformation.is = is;\r
+})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
+/**\r
+ * The diagnostic's severity.\r
+ */\r
+var DiagnosticSeverity;\r
+(function (DiagnosticSeverity) {\r
+ /**\r
+ * Reports an error.\r
+ */\r
+ DiagnosticSeverity.Error = 1;\r
+ /**\r
+ * Reports a warning.\r
+ */\r
+ DiagnosticSeverity.Warning = 2;\r
+ /**\r
+ * Reports an information.\r
+ */\r
+ DiagnosticSeverity.Information = 3;\r
+ /**\r
+ * Reports a hint.\r
+ */\r
+ DiagnosticSeverity.Hint = 4;\r
+})(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
+/**\r
+ * The diagnostic tags.\r
+ *\r
+ * @since 3.15.0\r
+ */\r
+var DiagnosticTag;\r
+(function (DiagnosticTag) {\r
+ /**\r
+ * Unused or unnecessary code.\r
+ *\r
+ * Clients are allowed to render diagnostics with this tag faded out instead of having\r
+ * an error squiggle.\r
+ */\r
+ DiagnosticTag.Unnecessary = 1;\r
+ /**\r
+ * Deprecated or obsolete code.\r
+ *\r
+ * Clients are allowed to rendered diagnostics with this tag strike through.\r
+ */\r
+ DiagnosticTag.Deprecated = 2;\r
+})(DiagnosticTag || (DiagnosticTag = {}));\r
+/**\r
+ * The Diagnostic namespace provides helper functions to work with\r
+ * [Diagnostic](#Diagnostic) literals.\r
+ */\r
+var Diagnostic;\r
+(function (Diagnostic) {\r
+ /**\r
+ * Creates a new Diagnostic literal.\r
+ */\r
+ function create(range, message, severity, code, source, relatedInformation) {\r
+ var result = { range: range, message: message };\r
+ if (Is.defined(severity)) {\r
+ result.severity = severity;\r
+ }\r
+ if (Is.defined(code)) {\r
+ result.code = code;\r
+ }\r
+ if (Is.defined(source)) {\r
+ result.source = source;\r
+ }\r
+ if (Is.defined(relatedInformation)) {\r
+ result.relatedInformation = relatedInformation;\r
+ }\r
+ return result;\r
+ }\r
+ Diagnostic.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate)\r
+ && Range.is(candidate.range)\r
+ && Is.string(candidate.message)\r
+ && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
+ && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
+ && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
+ && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
+ }\r
+ Diagnostic.is = is;\r
+})(Diagnostic || (Diagnostic = {}));\r
+/**\r
+ * The Command namespace provides helper functions to work with\r
+ * [Command](#Command) literals.\r
+ */\r
+var Command;\r
+(function (Command) {\r
+ /**\r
+ * Creates a new Command literal.\r
+ */\r
+ function create(title, command) {\r
+ var args = [];\r
+ for (var _i = 2; _i < arguments.length; _i++) {\r
+ args[_i - 2] = arguments[_i];\r
+ }\r
+ var result = { title: title, command: command };\r
+ if (Is.defined(args) && args.length > 0) {\r
+ result.arguments = args;\r
+ }\r
+ return result;\r
+ }\r
+ Command.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [Command](#Command) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
+ }\r
+ Command.is = is;\r
+})(Command || (Command = {}));\r
+/**\r
+ * The TextEdit namespace provides helper function to create replace,\r
+ * insert and delete edits more easily.\r
+ */\r
+var TextEdit;\r
+(function (TextEdit) {\r
+ /**\r
+ * Creates a replace text edit.\r
+ * @param range The range of text to be replaced.\r
+ * @param newText The new text.\r
+ */\r
+ function replace(range, newText) {\r
+ return { range: range, newText: newText };\r
+ }\r
+ TextEdit.replace = replace;\r
+ /**\r
+ * Creates a insert text edit.\r
+ * @param position The position to insert the text at.\r
+ * @param newText The text to be inserted.\r
+ */\r
+ function insert(position, newText) {\r
+ return { range: { start: position, end: position }, newText: newText };\r
+ }\r
+ TextEdit.insert = insert;\r
+ /**\r
+ * Creates a delete text edit.\r
+ * @param range The range of text to be deleted.\r
+ */\r
+ function del(range) {\r
+ return { range: range, newText: '' };\r
+ }\r
+ TextEdit.del = del;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.objectLiteral(candidate)\r
+ && Is.string(candidate.newText)\r
+ && Range.is(candidate.range);\r
+ }\r
+ TextEdit.is = is;\r
+})(TextEdit || (TextEdit = {}));\r
+/**\r
+ * The TextDocumentEdit namespace provides helper function to create\r
+ * an edit that manipulates a text document.\r
+ */\r
+var TextDocumentEdit;\r
+(function (TextDocumentEdit) {\r
+ /**\r
+ * Creates a new `TextDocumentEdit`\r
+ */\r
+ function create(textDocument, edits) {\r
+ return { textDocument: textDocument, edits: edits };\r
+ }\r
+ TextDocumentEdit.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate)\r
+ && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
+ && Array.isArray(candidate.edits);\r
+ }\r
+ TextDocumentEdit.is = is;\r
+})(TextDocumentEdit || (TextDocumentEdit = {}));\r
+var CreateFile;\r
+(function (CreateFile) {\r
+ function create(uri, options) {\r
+ var result = {\r
+ kind: 'create',\r
+ uri: uri\r
+ };\r
+ if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
+ result.options = options;\r
+ }\r
+ return result;\r
+ }\r
+ CreateFile.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
+ (candidate.options === void 0 ||\r
+ ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
+ }\r
+ CreateFile.is = is;\r
+})(CreateFile || (CreateFile = {}));\r
+var RenameFile;\r
+(function (RenameFile) {\r
+ function create(oldUri, newUri, options) {\r
+ var result = {\r
+ kind: 'rename',\r
+ oldUri: oldUri,\r
+ newUri: newUri\r
+ };\r
+ if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
+ result.options = options;\r
+ }\r
+ return result;\r
+ }\r
+ RenameFile.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
+ (candidate.options === void 0 ||\r
+ ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
+ }\r
+ RenameFile.is = is;\r
+})(RenameFile || (RenameFile = {}));\r
+var DeleteFile;\r
+(function (DeleteFile) {\r
+ function create(uri, options) {\r
+ var result = {\r
+ kind: 'delete',\r
+ uri: uri\r
+ };\r
+ if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
+ result.options = options;\r
+ }\r
+ return result;\r
+ }\r
+ DeleteFile.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
+ (candidate.options === void 0 ||\r
+ ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
+ }\r
+ DeleteFile.is = is;\r
+})(DeleteFile || (DeleteFile = {}));\r
+var WorkspaceEdit;\r
+(function (WorkspaceEdit) {\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate &&\r
+ (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
+ (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
+ if (Is.string(change.kind)) {\r
+ return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
+ }\r
+ else {\r
+ return TextDocumentEdit.is(change);\r
+ }\r
+ }));\r
+ }\r
+ WorkspaceEdit.is = is;\r
+})(WorkspaceEdit || (WorkspaceEdit = {}));\r
+var TextEditChangeImpl = /** @class */ (function () {\r
+ function TextEditChangeImpl(edits) {\r
+ this.edits = edits;\r
+ }\r
+ TextEditChangeImpl.prototype.insert = function (position, newText) {\r
+ this.edits.push(TextEdit.insert(position, newText));\r
+ };\r
+ TextEditChangeImpl.prototype.replace = function (range, newText) {\r
+ this.edits.push(TextEdit.replace(range, newText));\r
+ };\r
+ TextEditChangeImpl.prototype.delete = function (range) {\r
+ this.edits.push(TextEdit.del(range));\r
+ };\r
+ TextEditChangeImpl.prototype.add = function (edit) {\r
+ this.edits.push(edit);\r
+ };\r
+ TextEditChangeImpl.prototype.all = function () {\r
+ return this.edits;\r
+ };\r
+ TextEditChangeImpl.prototype.clear = function () {\r
+ this.edits.splice(0, this.edits.length);\r
+ };\r
+ return TextEditChangeImpl;\r
+}());\r
+/**\r
+ * A workspace change helps constructing changes to a workspace.\r
+ */\r
+var WorkspaceChange = /** @class */ (function () {\r
+ function WorkspaceChange(workspaceEdit) {\r
+ var _this = this;\r
+ this._textEditChanges = Object.create(null);\r
+ if (workspaceEdit) {\r
+ this._workspaceEdit = workspaceEdit;\r
+ if (workspaceEdit.documentChanges) {\r
+ workspaceEdit.documentChanges.forEach(function (change) {\r
+ if (TextDocumentEdit.is(change)) {\r
+ var textEditChange = new TextEditChangeImpl(change.edits);\r
+ _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
+ }\r
+ });\r
+ }\r
+ else if (workspaceEdit.changes) {\r
+ Object.keys(workspaceEdit.changes).forEach(function (key) {\r
+ var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
+ _this._textEditChanges[key] = textEditChange;\r
+ });\r
+ }\r
+ }\r
+ }\r
+ Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
+ /**\r
+ * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
+ * use to be returned from a workspace edit operation like rename.\r
+ */\r
+ get: function () {\r
+ return this._workspaceEdit;\r
+ },\r
+ enumerable: true,\r
+ configurable: true\r
+ });\r
+ WorkspaceChange.prototype.getTextEditChange = function (key) {\r
+ if (VersionedTextDocumentIdentifier.is(key)) {\r
+ if (!this._workspaceEdit) {\r
+ this._workspaceEdit = {\r
+ documentChanges: []\r
+ };\r
+ }\r
+ if (!this._workspaceEdit.documentChanges) {\r
+ throw new Error('Workspace edit is not configured for document changes.');\r
+ }\r
+ var textDocument = key;\r
+ var result = this._textEditChanges[textDocument.uri];\r
+ if (!result) {\r
+ var edits = [];\r
+ var textDocumentEdit = {\r
+ textDocument: textDocument,\r
+ edits: edits\r
+ };\r
+ this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
+ result = new TextEditChangeImpl(edits);\r
+ this._textEditChanges[textDocument.uri] = result;\r
+ }\r
+ return result;\r
+ }\r
+ else {\r
+ if (!this._workspaceEdit) {\r
+ this._workspaceEdit = {\r
+ changes: Object.create(null)\r
+ };\r
+ }\r
+ if (!this._workspaceEdit.changes) {\r
+ throw new Error('Workspace edit is not configured for normal text edit changes.');\r
+ }\r
+ var result = this._textEditChanges[key];\r
+ if (!result) {\r
+ var edits = [];\r
+ this._workspaceEdit.changes[key] = edits;\r
+ result = new TextEditChangeImpl(edits);\r
+ this._textEditChanges[key] = result;\r
+ }\r
+ return result;\r
+ }\r
+ };\r
+ WorkspaceChange.prototype.createFile = function (uri, options) {\r
+ this.checkDocumentChanges();\r
+ this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
+ };\r
+ WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
+ this.checkDocumentChanges();\r
+ this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
+ };\r
+ WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
+ this.checkDocumentChanges();\r
+ this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
+ };\r
+ WorkspaceChange.prototype.checkDocumentChanges = function () {\r
+ if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
+ throw new Error('Workspace edit is not configured for document changes.');\r
+ }\r
+ };\r
+ return WorkspaceChange;\r
+}());\r
+\r
+/**\r
+ * The TextDocumentIdentifier namespace provides helper functions to work with\r
+ * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
+ */\r
+var TextDocumentIdentifier;\r
+(function (TextDocumentIdentifier) {\r
+ /**\r
+ * Creates a new TextDocumentIdentifier literal.\r
+ * @param uri The document's uri.\r
+ */\r
+ function create(uri) {\r
+ return { uri: uri };\r
+ }\r
+ TextDocumentIdentifier.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.string(candidate.uri);\r
+ }\r
+ TextDocumentIdentifier.is = is;\r
+})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
+/**\r
+ * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
+ * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
+ */\r
+var VersionedTextDocumentIdentifier;\r
+(function (VersionedTextDocumentIdentifier) {\r
+ /**\r
+ * Creates a new VersionedTextDocumentIdentifier literal.\r
+ * @param uri The document's uri.\r
+ * @param uri The document's text.\r
+ */\r
+ function create(uri, version) {\r
+ return { uri: uri, version: version };\r
+ }\r
+ VersionedTextDocumentIdentifier.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
+ }\r
+ VersionedTextDocumentIdentifier.is = is;\r
+})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
+/**\r
+ * The TextDocumentItem namespace provides helper functions to work with\r
+ * [TextDocumentItem](#TextDocumentItem) literals.\r
+ */\r
+var TextDocumentItem;\r
+(function (TextDocumentItem) {\r
+ /**\r
+ * Creates a new TextDocumentItem literal.\r
+ * @param uri The document's uri.\r
+ * @param languageId The document's language identifier.\r
+ * @param version The document's version number.\r
+ * @param text The document's text.\r
+ */\r
+ function create(uri, languageId, version, text) {\r
+ return { uri: uri, languageId: languageId, version: version, text: text };\r
+ }\r
+ TextDocumentItem.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
+ }\r
+ TextDocumentItem.is = is;\r
+})(TextDocumentItem || (TextDocumentItem = {}));\r
+/**\r
+ * Describes the content type that a client supports in various\r
+ * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
+ *\r
+ * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
+ * are reserved for internal usage.\r
+ */\r
+var MarkupKind;\r
+(function (MarkupKind) {\r
+ /**\r
+ * Plain text is supported as a content format\r
+ */\r
+ MarkupKind.PlainText = 'plaintext';\r
+ /**\r
+ * Markdown is supported as a content format\r
+ */\r
+ MarkupKind.Markdown = 'markdown';\r
+})(MarkupKind || (MarkupKind = {}));\r
+(function (MarkupKind) {\r
+ /**\r
+ * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
+ }\r
+ MarkupKind.is = is;\r
+})(MarkupKind || (MarkupKind = {}));\r
+var MarkupContent;\r
+(function (MarkupContent) {\r
+ /**\r
+ * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
+ }\r
+ MarkupContent.is = is;\r
+})(MarkupContent || (MarkupContent = {}));\r
+/**\r
+ * The kind of a completion entry.\r
+ */\r
+var CompletionItemKind;\r
+(function (CompletionItemKind) {\r
+ CompletionItemKind.Text = 1;\r
+ CompletionItemKind.Method = 2;\r
+ CompletionItemKind.Function = 3;\r
+ CompletionItemKind.Constructor = 4;\r
+ CompletionItemKind.Field = 5;\r
+ CompletionItemKind.Variable = 6;\r
+ CompletionItemKind.Class = 7;\r
+ CompletionItemKind.Interface = 8;\r
+ CompletionItemKind.Module = 9;\r
+ CompletionItemKind.Property = 10;\r
+ CompletionItemKind.Unit = 11;\r
+ CompletionItemKind.Value = 12;\r
+ CompletionItemKind.Enum = 13;\r
+ CompletionItemKind.Keyword = 14;\r
+ CompletionItemKind.Snippet = 15;\r
+ CompletionItemKind.Color = 16;\r
+ CompletionItemKind.File = 17;\r
+ CompletionItemKind.Reference = 18;\r
+ CompletionItemKind.Folder = 19;\r
+ CompletionItemKind.EnumMember = 20;\r
+ CompletionItemKind.Constant = 21;\r
+ CompletionItemKind.Struct = 22;\r
+ CompletionItemKind.Event = 23;\r
+ CompletionItemKind.Operator = 24;\r
+ CompletionItemKind.TypeParameter = 25;\r
+})(CompletionItemKind || (CompletionItemKind = {}));\r
+/**\r
+ * Defines whether the insert text in a completion item should be interpreted as\r
+ * plain text or a snippet.\r
+ */\r
+var InsertTextFormat;\r
+(function (InsertTextFormat) {\r
+ /**\r
+ * The primary text to be inserted is treated as a plain string.\r
+ */\r
+ InsertTextFormat.PlainText = 1;\r
+ /**\r
+ * The primary text to be inserted is treated as a snippet.\r
+ *\r
+ * A snippet can define tab stops and placeholders with `$1`, `$2`\r
+ * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
+ * the end of the snippet. Placeholders with equal identifiers are linked,\r
+ * that is typing in one will update others too.\r
+ *\r
+ * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
+ */\r
+ InsertTextFormat.Snippet = 2;\r
+})(InsertTextFormat || (InsertTextFormat = {}));\r
+/**\r
+ * Completion item tags are extra annotations that tweak the rendering of a completion\r
+ * item.\r
+ *\r
+ * @since 3.15.0\r
+ */\r
+var CompletionItemTag;\r
+(function (CompletionItemTag) {\r
+ /**\r
+ * Render a completion as obsolete, usually using a strike-out.\r
+ */\r
+ CompletionItemTag.Deprecated = 1;\r
+})(CompletionItemTag || (CompletionItemTag = {}));\r
+/**\r
+ * The CompletionItem namespace provides functions to deal with\r
+ * completion items.\r
+ */\r
+var CompletionItem;\r
+(function (CompletionItem) {\r
+ /**\r
+ * Create a completion item and seed it with a label.\r
+ * @param label The completion item's label\r
+ */\r
+ function create(label) {\r
+ return { label: label };\r
+ }\r
+ CompletionItem.create = create;\r
+})(CompletionItem || (CompletionItem = {}));\r
+/**\r
+ * The CompletionList namespace provides functions to deal with\r
+ * completion lists.\r
+ */\r
+var CompletionList;\r
+(function (CompletionList) {\r
+ /**\r
+ * Creates a new completion list.\r
+ *\r
+ * @param items The completion items.\r
+ * @param isIncomplete The list is not complete.\r
+ */\r
+ function create(items, isIncomplete) {\r
+ return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
+ }\r
+ CompletionList.create = create;\r
+})(CompletionList || (CompletionList = {}));\r
+var MarkedString;\r
+(function (MarkedString) {\r
+ /**\r
+ * Creates a marked string from plain text.\r
+ *\r
+ * @param plainText The plain text.\r
+ */\r
+ function fromPlainText(plainText) {\r
+ return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
+ }\r
+ MarkedString.fromPlainText = fromPlainText;\r
+ /**\r
+ * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
+ }\r
+ MarkedString.is = is;\r
+})(MarkedString || (MarkedString = {}));\r
+var Hover;\r
+(function (Hover) {\r
+ /**\r
+ * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
+ MarkedString.is(candidate.contents) ||\r
+ Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
+ }\r
+ Hover.is = is;\r
+})(Hover || (Hover = {}));\r
+/**\r
+ * The ParameterInformation namespace provides helper functions to work with\r
+ * [ParameterInformation](#ParameterInformation) literals.\r
+ */\r
+var ParameterInformation;\r
+(function (ParameterInformation) {\r
+ /**\r
+ * Creates a new parameter information literal.\r
+ *\r
+ * @param label A label string.\r
+ * @param documentation A doc string.\r
+ */\r
+ function create(label, documentation) {\r
+ return documentation ? { label: label, documentation: documentation } : { label: label };\r
+ }\r
+ ParameterInformation.create = create;\r
+})(ParameterInformation || (ParameterInformation = {}));\r
+/**\r
+ * The SignatureInformation namespace provides helper functions to work with\r
+ * [SignatureInformation](#SignatureInformation) literals.\r
+ */\r
+var SignatureInformation;\r
+(function (SignatureInformation) {\r
+ function create(label, documentation) {\r
+ var parameters = [];\r
+ for (var _i = 2; _i < arguments.length; _i++) {\r
+ parameters[_i - 2] = arguments[_i];\r
+ }\r
+ var result = { label: label };\r
+ if (Is.defined(documentation)) {\r
+ result.documentation = documentation;\r
+ }\r
+ if (Is.defined(parameters)) {\r
+ result.parameters = parameters;\r
+ }\r
+ else {\r
+ result.parameters = [];\r
+ }\r
+ return result;\r
+ }\r
+ SignatureInformation.create = create;\r
+})(SignatureInformation || (SignatureInformation = {}));\r
+/**\r
+ * A document highlight kind.\r
+ */\r
+var DocumentHighlightKind;\r
+(function (DocumentHighlightKind) {\r
+ /**\r
+ * A textual occurrence.\r
+ */\r
+ DocumentHighlightKind.Text = 1;\r
+ /**\r
+ * Read-access of a symbol, like reading a variable.\r
+ */\r
+ DocumentHighlightKind.Read = 2;\r
+ /**\r
+ * Write-access of a symbol, like writing to a variable.\r
+ */\r
+ DocumentHighlightKind.Write = 3;\r
+})(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
+/**\r
+ * DocumentHighlight namespace to provide helper functions to work with\r
+ * [DocumentHighlight](#DocumentHighlight) literals.\r
+ */\r
+var DocumentHighlight;\r
+(function (DocumentHighlight) {\r
+ /**\r
+ * Create a DocumentHighlight object.\r
+ * @param range The range the highlight applies to.\r
+ */\r
+ function create(range, kind) {\r
+ var result = { range: range };\r
+ if (Is.number(kind)) {\r
+ result.kind = kind;\r
+ }\r
+ return result;\r
+ }\r
+ DocumentHighlight.create = create;\r
+})(DocumentHighlight || (DocumentHighlight = {}));\r
+/**\r
+ * A symbol kind.\r
+ */\r
+var SymbolKind;\r
+(function (SymbolKind) {\r
+ SymbolKind.File = 1;\r
+ SymbolKind.Module = 2;\r
+ SymbolKind.Namespace = 3;\r
+ SymbolKind.Package = 4;\r
+ SymbolKind.Class = 5;\r
+ SymbolKind.Method = 6;\r
+ SymbolKind.Property = 7;\r
+ SymbolKind.Field = 8;\r
+ SymbolKind.Constructor = 9;\r
+ SymbolKind.Enum = 10;\r
+ SymbolKind.Interface = 11;\r
+ SymbolKind.Function = 12;\r
+ SymbolKind.Variable = 13;\r
+ SymbolKind.Constant = 14;\r
+ SymbolKind.String = 15;\r
+ SymbolKind.Number = 16;\r
+ SymbolKind.Boolean = 17;\r
+ SymbolKind.Array = 18;\r
+ SymbolKind.Object = 19;\r
+ SymbolKind.Key = 20;\r
+ SymbolKind.Null = 21;\r
+ SymbolKind.EnumMember = 22;\r
+ SymbolKind.Struct = 23;\r
+ SymbolKind.Event = 24;\r
+ SymbolKind.Operator = 25;\r
+ SymbolKind.TypeParameter = 26;\r
+})(SymbolKind || (SymbolKind = {}));\r
+/**\r
+ * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
+ * @since 3.15\r
+ */\r
+var SymbolTag;\r
+(function (SymbolTag) {\r
+ /**\r
+ * Render a symbol as obsolete, usually using a strike-out.\r
+ */\r
+ SymbolTag.Deprecated = 1;\r
+})(SymbolTag || (SymbolTag = {}));\r
+var SymbolInformation;\r
+(function (SymbolInformation) {\r
+ /**\r
+ * Creates a new symbol information literal.\r
+ *\r
+ * @param name The name of the symbol.\r
+ * @param kind The kind of the symbol.\r
+ * @param range The range of the location of the symbol.\r
+ * @param uri The resource of the location of symbol, defaults to the current document.\r
+ * @param containerName The name of the symbol containing the symbol.\r
+ */\r
+ function create(name, kind, range, uri, containerName) {\r
+ var result = {\r
+ name: name,\r
+ kind: kind,\r
+ location: { uri: uri, range: range }\r
+ };\r
+ if (containerName) {\r
+ result.containerName = containerName;\r
+ }\r
+ return result;\r
+ }\r
+ SymbolInformation.create = create;\r
+})(SymbolInformation || (SymbolInformation = {}));\r
+var DocumentSymbol;\r
+(function (DocumentSymbol) {\r
+ /**\r
+ * Creates a new symbol information literal.\r
+ *\r
+ * @param name The name of the symbol.\r
+ * @param detail The detail of the symbol.\r
+ * @param kind The kind of the symbol.\r
+ * @param range The range of the symbol.\r
+ * @param selectionRange The selectionRange of the symbol.\r
+ * @param children Children of the symbol.\r
+ */\r
+ function create(name, detail, kind, range, selectionRange, children) {\r
+ var result = {\r
+ name: name,\r
+ detail: detail,\r
+ kind: kind,\r
+ range: range,\r
+ selectionRange: selectionRange\r
+ };\r
+ if (children !== void 0) {\r
+ result.children = children;\r
+ }\r
+ return result;\r
+ }\r
+ DocumentSymbol.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate &&\r
+ Is.string(candidate.name) && Is.number(candidate.kind) &&\r
+ Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
+ (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
+ (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
+ (candidate.children === void 0 || Array.isArray(candidate.children));\r
+ }\r
+ DocumentSymbol.is = is;\r
+})(DocumentSymbol || (DocumentSymbol = {}));\r
+/**\r
+ * A set of predefined code action kinds\r
+ */\r
+var CodeActionKind;\r
+(function (CodeActionKind) {\r
+ /**\r
+ * Empty kind.\r
+ */\r
+ CodeActionKind.Empty = '';\r
+ /**\r
+ * Base kind for quickfix actions: 'quickfix'\r
+ */\r
+ CodeActionKind.QuickFix = 'quickfix';\r
+ /**\r
+ * Base kind for refactoring actions: 'refactor'\r
+ */\r
+ CodeActionKind.Refactor = 'refactor';\r
+ /**\r
+ * Base kind for refactoring extraction actions: 'refactor.extract'\r
+ *\r
+ * Example extract actions:\r
+ *\r
+ * - Extract method\r
+ * - Extract function\r
+ * - Extract variable\r
+ * - Extract interface from class\r
+ * - ...\r
+ */\r
+ CodeActionKind.RefactorExtract = 'refactor.extract';\r
+ /**\r
+ * Base kind for refactoring inline actions: 'refactor.inline'\r
+ *\r
+ * Example inline actions:\r
+ *\r
+ * - Inline function\r
+ * - Inline variable\r
+ * - Inline constant\r
+ * - ...\r
+ */\r
+ CodeActionKind.RefactorInline = 'refactor.inline';\r
+ /**\r
+ * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
+ *\r
+ * Example rewrite actions:\r
+ *\r
+ * - Convert JavaScript function to class\r
+ * - Add or remove parameter\r
+ * - Encapsulate field\r
+ * - Make method static\r
+ * - Move method to base class\r
+ * - ...\r
+ */\r
+ CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
+ /**\r
+ * Base kind for source actions: `source`\r
+ *\r
+ * Source code actions apply to the entire file.\r
+ */\r
+ CodeActionKind.Source = 'source';\r
+ /**\r
+ * Base kind for an organize imports source action: `source.organizeImports`\r
+ */\r
+ CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
+ /**\r
+ * Base kind for auto-fix source actions: `source.fixAll`.\r
+ *\r
+ * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
+ * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
+ *\r
+ * @since 3.15.0\r
+ */\r
+ CodeActionKind.SourceFixAll = 'source.fixAll';\r
+})(CodeActionKind || (CodeActionKind = {}));\r
+/**\r
+ * The CodeActionContext namespace provides helper functions to work with\r
+ * [CodeActionContext](#CodeActionContext) literals.\r
+ */\r
+var CodeActionContext;\r
+(function (CodeActionContext) {\r
+ /**\r
+ * Creates a new CodeActionContext literal.\r
+ */\r
+ function create(diagnostics, only) {\r
+ var result = { diagnostics: diagnostics };\r
+ if (only !== void 0 && only !== null) {\r
+ result.only = only;\r
+ }\r
+ return result;\r
+ }\r
+ CodeActionContext.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
+ }\r
+ CodeActionContext.is = is;\r
+})(CodeActionContext || (CodeActionContext = {}));\r
+var CodeAction;\r
+(function (CodeAction) {\r
+ function create(title, commandOrEdit, kind) {\r
+ var result = { title: title };\r
+ if (Command.is(commandOrEdit)) {\r
+ result.command = commandOrEdit;\r
+ }\r
+ else {\r
+ result.edit = commandOrEdit;\r
+ }\r
+ if (kind !== void 0) {\r
+ result.kind = kind;\r
+ }\r
+ return result;\r
+ }\r
+ CodeAction.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate && Is.string(candidate.title) &&\r
+ (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
+ (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
+ (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
+ (candidate.command === void 0 || Command.is(candidate.command)) &&\r
+ (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
+ (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
+ }\r
+ CodeAction.is = is;\r
+})(CodeAction || (CodeAction = {}));\r
+/**\r
+ * The CodeLens namespace provides helper functions to work with\r
+ * [CodeLens](#CodeLens) literals.\r
+ */\r
+var CodeLens;\r
+(function (CodeLens) {\r
+ /**\r
+ * Creates a new CodeLens literal.\r
+ */\r
+ function create(range, data) {\r
+ var result = { range: range };\r
+ if (Is.defined(data)) {\r
+ result.data = data;\r
+ }\r
+ return result;\r
+ }\r
+ CodeLens.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
+ }\r
+ CodeLens.is = is;\r
+})(CodeLens || (CodeLens = {}));\r
+/**\r
+ * The FormattingOptions namespace provides helper functions to work with\r
+ * [FormattingOptions](#FormattingOptions) literals.\r
+ */\r
+var FormattingOptions;\r
+(function (FormattingOptions) {\r
+ /**\r
+ * Creates a new FormattingOptions literal.\r
+ */\r
+ function create(tabSize, insertSpaces) {\r
+ return { tabSize: tabSize, insertSpaces: insertSpaces };\r
+ }\r
+ FormattingOptions.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
+ }\r
+ FormattingOptions.is = is;\r
+})(FormattingOptions || (FormattingOptions = {}));\r
+/**\r
+ * The DocumentLink namespace provides helper functions to work with\r
+ * [DocumentLink](#DocumentLink) literals.\r
+ */\r
+var DocumentLink;\r
+(function (DocumentLink) {\r
+ /**\r
+ * Creates a new DocumentLink literal.\r
+ */\r
+ function create(range, target, data) {\r
+ return { range: range, target: target, data: data };\r
+ }\r
+ DocumentLink.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
+ }\r
+ DocumentLink.is = is;\r
+})(DocumentLink || (DocumentLink = {}));\r
+/**\r
+ * The SelectionRange namespace provides helper function to work with\r
+ * SelectionRange literals.\r
+ */\r
+var SelectionRange;\r
+(function (SelectionRange) {\r
+ /**\r
+ * Creates a new SelectionRange\r
+ * @param range the range.\r
+ * @param parent an optional parent.\r
+ */\r
+ function create(range, parent) {\r
+ return { range: range, parent: parent };\r
+ }\r
+ SelectionRange.create = create;\r
+ function is(value) {\r
+ var candidate = value;\r
+ return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
+ }\r
+ SelectionRange.is = is;\r
+})(SelectionRange || (SelectionRange = {}));\r
+var EOL = ['\n', '\r\n', '\r'];\r
+/**\r
+ * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
+ */\r
+var TextDocument;\r
+(function (TextDocument) {\r
+ /**\r
+ * Creates a new ITextDocument literal from the given uri and content.\r
+ * @param uri The document's uri.\r
+ * @param languageId The document's language Id.\r
+ * @param content The document's content.\r
+ */\r
+ function create(uri, languageId, version, content) {\r
+ return new FullTextDocument(uri, languageId, version, content);\r
+ }\r
+ TextDocument.create = create;\r
+ /**\r
+ * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
+ */\r
+ function is(value) {\r
+ var candidate = value;\r
+ return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
+ && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
+ }\r
+ TextDocument.is = is;\r
+ function applyEdits(document, edits) {\r
+ var text = document.getText();\r
+ var sortedEdits = mergeSort(edits, function (a, b) {\r
+ var diff = a.range.start.line - b.range.start.line;\r
+ if (diff === 0) {\r
+ return a.range.start.character - b.range.start.character;\r
+ }\r
+ return diff;\r
+ });\r
+ var lastModifiedOffset = text.length;\r
+ for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
+ var e = sortedEdits[i];\r
+ var startOffset = document.offsetAt(e.range.start);\r
+ var endOffset = document.offsetAt(e.range.end);\r
+ if (endOffset <= lastModifiedOffset) {\r
+ text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
+ }\r
+ else {\r
+ throw new Error('Overlapping edit');\r
+ }\r
+ lastModifiedOffset = startOffset;\r
+ }\r
+ return text;\r
+ }\r
+ TextDocument.applyEdits = applyEdits;\r
+ function mergeSort(data, compare) {\r
+ if (data.length <= 1) {\r
+ // sorted\r
+ return data;\r
+ }\r
+ var p = (data.length / 2) | 0;\r
+ var left = data.slice(0, p);\r
+ var right = data.slice(p);\r
+ mergeSort(left, compare);\r
+ mergeSort(right, compare);\r
+ var leftIdx = 0;\r
+ var rightIdx = 0;\r
+ var i = 0;\r
+ while (leftIdx < left.length && rightIdx < right.length) {\r
+ var ret = compare(left[leftIdx], right[rightIdx]);\r
+ if (ret <= 0) {\r
+ // smaller_equal -> take left to preserve order\r
+ data[i++] = left[leftIdx++];\r
+ }\r
+ else {\r
+ // greater -> take right\r
+ data[i++] = right[rightIdx++];\r
+ }\r
+ }\r
+ while (leftIdx < left.length) {\r
+ data[i++] = left[leftIdx++];\r
+ }\r
+ while (rightIdx < right.length) {\r
+ data[i++] = right[rightIdx++];\r
+ }\r
+ return data;\r
+ }\r
+})(TextDocument || (TextDocument = {}));\r
+var FullTextDocument = /** @class */ (function () {\r
+ function FullTextDocument(uri, languageId, version, content) {\r
+ this._uri = uri;\r
+ this._languageId = languageId;\r
+ this._version = version;\r
+ this._content = content;\r
+ this._lineOffsets = undefined;\r
+ }\r
+ Object.defineProperty(FullTextDocument.prototype, "uri", {\r
+ get: function () {\r
+ return this._uri;\r
+ },\r
+ enumerable: true,\r
+ configurable: true\r
+ });\r
+ Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
+ get: function () {\r
+ return this._languageId;\r
+ },\r
+ enumerable: true,\r
+ configurable: true\r
+ });\r
+ Object.defineProperty(FullTextDocument.prototype, "version", {\r
+ get: function () {\r
+ return this._version;\r
+ },\r
+ enumerable: true,\r
+ configurable: true\r
+ });\r
+ FullTextDocument.prototype.getText = function (range) {\r
+ if (range) {\r
+ var start = this.offsetAt(range.start);\r
+ var end = this.offsetAt(range.end);\r
+ return this._content.substring(start, end);\r
+ }\r
+ return this._content;\r
+ };\r
+ FullTextDocument.prototype.update = function (event, version) {\r
+ this._content = event.text;\r
+ this._version = version;\r
+ this._lineOffsets = undefined;\r
+ };\r
+ FullTextDocument.prototype.getLineOffsets = function () {\r
+ if (this._lineOffsets === undefined) {\r
+ var lineOffsets = [];\r
+ var text = this._content;\r
+ var isLineStart = true;\r
+ for (var i = 0; i < text.length; i++) {\r
+ if (isLineStart) {\r
+ lineOffsets.push(i);\r
+ isLineStart = false;\r
+ }\r
+ var ch = text.charAt(i);\r
+ isLineStart = (ch === '\r' || ch === '\n');\r
+ if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
+ i++;\r
+ }\r
+ }\r
+ if (isLineStart && text.length > 0) {\r
+ lineOffsets.push(text.length);\r
+ }\r
+ this._lineOffsets = lineOffsets;\r
+ }\r
+ return this._lineOffsets;\r
+ };\r
+ FullTextDocument.prototype.positionAt = function (offset) {\r
+ offset = Math.max(Math.min(offset, this._content.length), 0);\r
+ var lineOffsets = this.getLineOffsets();\r
+ var low = 0, high = lineOffsets.length;\r
+ if (high === 0) {\r
+ return Position.create(0, offset);\r
+ }\r
+ while (low < high) {\r
+ var mid = Math.floor((low + high) / 2);\r
+ if (lineOffsets[mid] > offset) {\r
+ high = mid;\r
+ }\r
+ else {\r
+ low = mid + 1;\r
+ }\r
+ }\r
+ // low is the least x for which the line offset is larger than the current offset\r
+ // or array.length if no line offset is larger than the current offset\r
+ var line = low - 1;\r
+ return Position.create(line, offset - lineOffsets[line]);\r
+ };\r
+ FullTextDocument.prototype.offsetAt = function (position) {\r
+ var lineOffsets = this.getLineOffsets();\r
+ if (position.line >= lineOffsets.length) {\r
+ return this._content.length;\r
+ }\r
+ else if (position.line < 0) {\r
+ return 0;\r
+ }\r
+ var lineOffset = lineOffsets[position.line];\r
+ var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
+ return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
+ };\r
+ Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
+ get: function () {\r
+ return this.getLineOffsets().length;\r
+ },\r
+ enumerable: true,\r
+ configurable: true\r
+ });\r
+ return FullTextDocument;\r
+}());\r
+var Is;\r
+(function (Is) {\r
+ var toString = Object.prototype.toString;\r
+ function defined(value) {\r
+ return typeof value !== 'undefined';\r
+ }\r
+ Is.defined = defined;\r
+ function undefined(value) {\r
+ return typeof value === 'undefined';\r
+ }\r
+ Is.undefined = undefined;\r
+ function boolean(value) {\r
+ return value === true || value === false;\r
+ }\r
+ Is.boolean = boolean;\r
+ function string(value) {\r
+ return toString.call(value) === '[object String]';\r
+ }\r
+ Is.string = string;\r
+ function number(value) {\r
+ return toString.call(value) === '[object Number]';\r
+ }\r
+ Is.number = number;\r
+ function func(value) {\r
+ return toString.call(value) === '[object Function]';\r
+ }\r
+ Is.func = func;\r
+ function objectLiteral(value) {\r
+ // Strictly speaking class instances pass this check as well. Since the LSP\r
+ // doesn't use classes we ignore this for now. If we do we need to add something\r
+ // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
+ return value !== null && typeof value === 'object';\r
+ }\r
+ Is.objectLiteral = objectLiteral;\r
+ function typedArray(value, check) {\r
+ return Array.isArray(value) && value.every(check);\r
+ }\r
+ Is.typedArray = typedArray;\r
+})(Is || (Is = {}));\r
+
+
+/***/ }),
+/* 176 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const Is = __webpack_require__(177);\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+const protocol_implementation_1 = __webpack_require__(179);\r
+exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
+const protocol_typeDefinition_1 = __webpack_require__(180);\r
+exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
+const protocol_workspaceFolders_1 = __webpack_require__(181);\r
+exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
+exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
+const protocol_configuration_1 = __webpack_require__(182);\r
+exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
+const protocol_colorProvider_1 = __webpack_require__(183);\r
+exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
+exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
+const protocol_foldingRange_1 = __webpack_require__(184);\r
+exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
+const protocol_declaration_1 = __webpack_require__(185);\r
+exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
+const protocol_selectionRange_1 = __webpack_require__(186);\r
+exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
+const protocol_progress_1 = __webpack_require__(187);\r
+exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
+exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
+exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
+// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
+let __noDynamicImport;\r
+/**\r
+ * The DocumentFilter namespace provides helper functions to work with\r
+ * [DocumentFilter](#DocumentFilter) literals.\r
+ */\r
+var DocumentFilter;\r
+(function (DocumentFilter) {\r
+ function is(value) {\r
+ const candidate = value;\r
+ return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
+ }\r
+ DocumentFilter.is = is;\r
+})(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
+/**\r
+ * The DocumentSelector namespace provides helper functions to work with\r
+ * [DocumentSelector](#DocumentSelector)s.\r
+ */\r
+var DocumentSelector;\r
+(function (DocumentSelector) {\r
+ function is(value) {\r
+ if (!Array.isArray(value)) {\r
+ return false;\r
+ }\r
+ for (let elem of value) {\r
+ if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
+ return false;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ DocumentSelector.is = is;\r
+})(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
+/**\r
+ * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
+ * handler on the client side.\r
+ */\r
+var RegistrationRequest;\r
+(function (RegistrationRequest) {\r
+ RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
+})(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
+/**\r
+ * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
+ * handler on the client side.\r
+ */\r
+var UnregistrationRequest;\r
+(function (UnregistrationRequest) {\r
+ UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
+})(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
+var ResourceOperationKind;\r
+(function (ResourceOperationKind) {\r
+ /**\r
+ * Supports creating new files and folders.\r
+ */\r
+ ResourceOperationKind.Create = 'create';\r
+ /**\r
+ * Supports renaming existing files and folders.\r
+ */\r
+ ResourceOperationKind.Rename = 'rename';\r
+ /**\r
+ * Supports deleting existing files and folders.\r
+ */\r
+ ResourceOperationKind.Delete = 'delete';\r
+})(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
+var FailureHandlingKind;\r
+(function (FailureHandlingKind) {\r
+ /**\r
+ * Applying the workspace change is simply aborted if one of the changes provided\r
+ * fails. All operations executed before the failing operation stay executed.\r
+ */\r
+ FailureHandlingKind.Abort = 'abort';\r
+ /**\r
+ * All operations are executed transactional. That means they either all\r
+ * succeed or no changes at all are applied to the workspace.\r
+ */\r
+ FailureHandlingKind.Transactional = 'transactional';\r
+ /**\r
+ * If the workspace edit contains only textual file changes they are executed transactional.\r
+ * If resource changes (create, rename or delete file) are part of the change the failure\r
+ * handling startegy is abort.\r
+ */\r
+ FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
+ /**\r
+ * The client tries to undo the operations already executed. But there is no\r
+ * guarantee that this is succeeding.\r
+ */\r
+ FailureHandlingKind.Undo = 'undo';\r
+})(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
+/**\r
+ * The StaticRegistrationOptions namespace provides helper functions to work with\r
+ * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
+ */\r
+var StaticRegistrationOptions;\r
+(function (StaticRegistrationOptions) {\r
+ function hasId(value) {\r
+ const candidate = value;\r
+ return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
+ }\r
+ StaticRegistrationOptions.hasId = hasId;\r
+})(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
+/**\r
+ * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
+ * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
+ */\r
+var TextDocumentRegistrationOptions;\r
+(function (TextDocumentRegistrationOptions) {\r
+ function is(value) {\r
+ const candidate = value;\r
+ return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
+ }\r
+ TextDocumentRegistrationOptions.is = is;\r
+})(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
+/**\r
+ * The WorkDoneProgressOptions namespace provides helper functions to work with\r
+ * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
+ */\r
+var WorkDoneProgressOptions;\r
+(function (WorkDoneProgressOptions) {\r
+ function is(value) {\r
+ const candidate = value;\r
+ return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
+ }\r
+ WorkDoneProgressOptions.is = is;\r
+ function hasWorkDoneProgress(value) {\r
+ const candidate = value;\r
+ return candidate && Is.boolean(candidate.workDoneProgress);\r
+ }\r
+ WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
+})(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
+/**\r
+ * The initialize request is sent from the client to the server.\r
+ * It is sent once as the request after starting up the server.\r
+ * The requests parameter is of type [InitializeParams](#InitializeParams)\r
+ * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
+ * resolves to such.\r
+ */\r
+var InitializeRequest;\r
+(function (InitializeRequest) {\r
+ InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
+})(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
+/**\r
+ * Known error codes for an `InitializeError`;\r
+ */\r
+var InitializeError;\r
+(function (InitializeError) {\r
+ /**\r
+ * If the protocol version provided by the client can't be handled by the server.\r
+ * @deprecated This initialize error got replaced by client capabilities. There is\r
+ * no version handshake in version 3.0x\r
+ */\r
+ InitializeError.unknownProtocolVersion = 1;\r
+})(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
+/**\r
+ * The intialized notification is sent from the client to the\r
+ * server after the client is fully initialized and the server\r
+ * is allowed to send requests from the server to the client.\r
+ */\r
+var InitializedNotification;\r
+(function (InitializedNotification) {\r
+ InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
+})(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
+//---- Shutdown Method ----\r
+/**\r
+ * A shutdown request is sent from the client to the server.\r
+ * It is sent once when the client decides to shutdown the\r
+ * server. The only notification that is sent after a shutdown request\r
+ * is the exit event.\r
+ */\r
+var ShutdownRequest;\r
+(function (ShutdownRequest) {\r
+ ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
+})(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
+//---- Exit Notification ----\r
+/**\r
+ * The exit event is sent from the client to the server to\r
+ * ask the server to exit its process.\r
+ */\r
+var ExitNotification;\r
+(function (ExitNotification) {\r
+ ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
+})(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
+/**\r
+ * The configuration change notification is sent from the client to the server\r
+ * when the client's configuration has changed. The notification contains\r
+ * the changed configuration as defined by the language client.\r
+ */\r
+var DidChangeConfigurationNotification;\r
+(function (DidChangeConfigurationNotification) {\r
+ DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
+})(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
+//---- Message show and log notifications ----\r
+/**\r
+ * The message type\r
+ */\r
+var MessageType;\r
+(function (MessageType) {\r
+ /**\r
+ * An error message.\r
+ */\r
+ MessageType.Error = 1;\r
+ /**\r
+ * A warning message.\r
+ */\r
+ MessageType.Warning = 2;\r
+ /**\r
+ * An information message.\r
+ */\r
+ MessageType.Info = 3;\r
+ /**\r
+ * A log message.\r
+ */\r
+ MessageType.Log = 4;\r
+})(MessageType = exports.MessageType || (exports.MessageType = {}));\r
+/**\r
+ * The show message notification is sent from a server to a client to ask\r
+ * the client to display a particular message in the user interface.\r
+ */\r
+var ShowMessageNotification;\r
+(function (ShowMessageNotification) {\r
+ ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
+})(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
+/**\r
+ * The show message request is sent from the server to the client to show a message\r
+ * and a set of options actions to the user.\r
+ */\r
+var ShowMessageRequest;\r
+(function (ShowMessageRequest) {\r
+ ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
+})(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
+/**\r
+ * The log message notification is sent from the server to the client to ask\r
+ * the client to log a particular message.\r
+ */\r
+var LogMessageNotification;\r
+(function (LogMessageNotification) {\r
+ LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
+})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
+//---- Telemetry notification\r
+/**\r
+ * The telemetry event notification is sent from the server to the client to ask\r
+ * the client to log telemetry data.\r
+ */\r
+var TelemetryEventNotification;\r
+(function (TelemetryEventNotification) {\r
+ TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
+})(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
+/**\r
+ * Defines how the host (editor) should sync\r
+ * document changes to the language server.\r
+ */\r
+var TextDocumentSyncKind;\r
+(function (TextDocumentSyncKind) {\r
+ /**\r
+ * Documents should not be synced at all.\r
+ */\r
+ TextDocumentSyncKind.None = 0;\r
+ /**\r
+ * Documents are synced by always sending the full content\r
+ * of the document.\r
+ */\r
+ TextDocumentSyncKind.Full = 1;\r
+ /**\r
+ * Documents are synced by sending the full content on open.\r
+ * After that only incremental updates to the document are\r
+ * send.\r
+ */\r
+ TextDocumentSyncKind.Incremental = 2;\r
+})(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
+/**\r
+ * The document open notification is sent from the client to the server to signal\r
+ * newly opened text documents. The document's truth is now managed by the client\r
+ * and the server must not try to read the document's truth using the document's\r
+ * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
+ * mean that its content is presented in an editor. An open notification must not\r
+ * be sent more than once without a corresponding close notification send before.\r
+ * This means open and close notification must be balanced and the max open count\r
+ * is one.\r
+ */\r
+var DidOpenTextDocumentNotification;\r
+(function (DidOpenTextDocumentNotification) {\r
+ DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
+ DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
+})(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
+/**\r
+ * The document change notification is sent from the client to the server to signal\r
+ * changes to a text document.\r
+ */\r
+var DidChangeTextDocumentNotification;\r
+(function (DidChangeTextDocumentNotification) {\r
+ DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
+ DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
+})(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
+/**\r
+ * The document close notification is sent from the client to the server when\r
+ * the document got closed in the client. The document's truth now exists where\r
+ * the document's uri points to (e.g. if the document's uri is a file uri the\r
+ * truth now exists on disk). As with the open notification the close notification\r
+ * is about managing the document's content. Receiving a close notification\r
+ * doesn't mean that the document was open in an editor before. A close\r
+ * notification requires a previous open notification to be sent.\r
+ */\r
+var DidCloseTextDocumentNotification;\r
+(function (DidCloseTextDocumentNotification) {\r
+ DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
+ DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
+})(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
+/**\r
+ * The document save notification is sent from the client to the server when\r
+ * the document got saved in the client.\r
+ */\r
+var DidSaveTextDocumentNotification;\r
+(function (DidSaveTextDocumentNotification) {\r
+ DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
+ DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
+})(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
+/**\r
+ * Represents reasons why a text document is saved.\r
+ */\r
+var TextDocumentSaveReason;\r
+(function (TextDocumentSaveReason) {\r
+ /**\r
+ * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
+ * or by an API call.\r
+ */\r
+ TextDocumentSaveReason.Manual = 1;\r
+ /**\r
+ * Automatic after a delay.\r
+ */\r
+ TextDocumentSaveReason.AfterDelay = 2;\r
+ /**\r
+ * When the editor lost focus.\r
+ */\r
+ TextDocumentSaveReason.FocusOut = 3;\r
+})(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
+/**\r
+ * A document will save notification is sent from the client to the server before\r
+ * the document is actually saved.\r
+ */\r
+var WillSaveTextDocumentNotification;\r
+(function (WillSaveTextDocumentNotification) {\r
+ WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
+ WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
+})(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
+/**\r
+ * A document will save request is sent from the client to the server before\r
+ * the document is actually saved. The request can return an array of TextEdits\r
+ * which will be applied to the text document before it is saved. Please note that\r
+ * clients might drop results if computing the text edits took too long or if a\r
+ * server constantly fails on this request. This is done to keep the save fast and\r
+ * reliable.\r
+ */\r
+var WillSaveTextDocumentWaitUntilRequest;\r
+(function (WillSaveTextDocumentWaitUntilRequest) {\r
+ WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
+ WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
+})(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
+/**\r
+ * The watched files notification is sent from the client to the server when\r
+ * the client detects changes to file watched by the language client.\r
+ */\r
+var DidChangeWatchedFilesNotification;\r
+(function (DidChangeWatchedFilesNotification) {\r
+ DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
+})(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
+/**\r
+ * The file event type\r
+ */\r
+var FileChangeType;\r
+(function (FileChangeType) {\r
+ /**\r
+ * The file got created.\r
+ */\r
+ FileChangeType.Created = 1;\r
+ /**\r
+ * The file got changed.\r
+ */\r
+ FileChangeType.Changed = 2;\r
+ /**\r
+ * The file got deleted.\r
+ */\r
+ FileChangeType.Deleted = 3;\r
+})(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
+var WatchKind;\r
+(function (WatchKind) {\r
+ /**\r
+ * Interested in create events.\r
+ */\r
+ WatchKind.Create = 1;\r
+ /**\r
+ * Interested in change events\r
+ */\r
+ WatchKind.Change = 2;\r
+ /**\r
+ * Interested in delete events\r
+ */\r
+ WatchKind.Delete = 4;\r
+})(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
+/**\r
+ * Diagnostics notification are sent from the server to the client to signal\r
+ * results of validation runs.\r
+ */\r
+var PublishDiagnosticsNotification;\r
+(function (PublishDiagnosticsNotification) {\r
+ PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
+})(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
+/**\r
+ * How a completion was triggered\r
+ */\r
+var CompletionTriggerKind;\r
+(function (CompletionTriggerKind) {\r
+ /**\r
+ * Completion was triggered by typing an identifier (24x7 code\r
+ * complete), manual invocation (e.g Ctrl+Space) or via API.\r
+ */\r
+ CompletionTriggerKind.Invoked = 1;\r
+ /**\r
+ * Completion was triggered by a trigger character specified by\r
+ * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
+ */\r
+ CompletionTriggerKind.TriggerCharacter = 2;\r
+ /**\r
+ * Completion was re-triggered as current completion list is incomplete\r
+ */\r
+ CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
+})(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
+/**\r
+ * Request to request completion at a given text document position. The request's\r
+ * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
+ * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
+ * or a Thenable that resolves to such.\r
+ *\r
+ * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
+ * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
+ * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
+ * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
+ */\r
+var CompletionRequest;\r
+(function (CompletionRequest) {\r
+ CompletionRequest.method = 'textDocument/completion';\r
+ CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
+ /** @deprecated Use CompletionRequest.type */\r
+ CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
+/**\r
+ * Request to resolve additional information for a given completion item.The request's\r
+ * parameter is of type [CompletionItem](#CompletionItem) the response\r
+ * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
+ */\r
+var CompletionResolveRequest;\r
+(function (CompletionResolveRequest) {\r
+ CompletionResolveRequest.method = 'completionItem/resolve';\r
+ CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
+})(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
+/**\r
+ * Request to request hover information at a given text document position. The request's\r
+ * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
+ * type [Hover](#Hover) or a Thenable that resolves to such.\r
+ */\r
+var HoverRequest;\r
+(function (HoverRequest) {\r
+ HoverRequest.method = 'textDocument/hover';\r
+ HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
+})(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
+/**\r
+ * How a signature help was triggered.\r
+ *\r
+ * @since 3.15.0\r
+ */\r
+var SignatureHelpTriggerKind;\r
+(function (SignatureHelpTriggerKind) {\r
+ /**\r
+ * Signature help was invoked manually by the user or by a command.\r
+ */\r
+ SignatureHelpTriggerKind.Invoked = 1;\r
+ /**\r
+ * Signature help was triggered by a trigger character.\r
+ */\r
+ SignatureHelpTriggerKind.TriggerCharacter = 2;\r
+ /**\r
+ * Signature help was triggered by the cursor moving or by the document content changing.\r
+ */\r
+ SignatureHelpTriggerKind.ContentChange = 3;\r
+})(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
+var SignatureHelpRequest;\r
+(function (SignatureHelpRequest) {\r
+ SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
+ SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
+})(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
+/**\r
+ * A request to resolve the definition location of a symbol at a given text\r
+ * document position. The request's parameter is of type [TextDocumentPosition]\r
+ * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
+ * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
+ * to such.\r
+ */\r
+var DefinitionRequest;\r
+(function (DefinitionRequest) {\r
+ DefinitionRequest.method = 'textDocument/definition';\r
+ DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
+ /** @deprecated Use DefinitionRequest.type */\r
+ DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
+/**\r
+ * A request to resolve project-wide references for the symbol denoted\r
+ * by the given text document position. The request's parameter is of\r
+ * type [ReferenceParams](#ReferenceParams) the response is of type\r
+ * [Location[]](#Location) or a Thenable that resolves to such.\r
+ */\r
+var ReferencesRequest;\r
+(function (ReferencesRequest) {\r
+ ReferencesRequest.method = 'textDocument/references';\r
+ ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
+ /** @deprecated Use ReferencesRequest.type */\r
+ ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
+/**\r
+ * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
+ * text document position. The request's parameter is of type [TextDocumentPosition]\r
+ * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
+ * (#DocumentHighlight) or a Thenable that resolves to such.\r
+ */\r
+var DocumentHighlightRequest;\r
+(function (DocumentHighlightRequest) {\r
+ DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
+ DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
+ /** @deprecated Use DocumentHighlightRequest.type */\r
+ DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
+/**\r
+ * A request to list all symbols found in a given text document. The request's\r
+ * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
+ * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
+ * that resolves to such.\r
+ */\r
+var DocumentSymbolRequest;\r
+(function (DocumentSymbolRequest) {\r
+ DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
+ DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
+ /** @deprecated Use DocumentSymbolRequest.type */\r
+ DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
+/**\r
+ * A request to provide commands for the given text document and range.\r
+ */\r
+var CodeActionRequest;\r
+(function (CodeActionRequest) {\r
+ CodeActionRequest.method = 'textDocument/codeAction';\r
+ CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
+ /** @deprecated Use CodeActionRequest.type */\r
+ CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
+/**\r
+ * A request to list project-wide symbols matching the query string given\r
+ * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
+ * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
+ * resolves to such.\r
+ */\r
+var WorkspaceSymbolRequest;\r
+(function (WorkspaceSymbolRequest) {\r
+ WorkspaceSymbolRequest.method = 'workspace/symbol';\r
+ WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
+ /** @deprecated Use WorkspaceSymbolRequest.type */\r
+ WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
+/**\r
+ * A request to provide code lens for the given text document.\r
+ */\r
+var CodeLensRequest;\r
+(function (CodeLensRequest) {\r
+ CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
+ /** @deprecated Use CodeLensRequest.type */\r
+ CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
+/**\r
+ * A request to resolve a command for a given code lens.\r
+ */\r
+var CodeLensResolveRequest;\r
+(function (CodeLensResolveRequest) {\r
+ CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
+})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
+/**\r
+ * A request to provide document links\r
+ */\r
+var DocumentLinkRequest;\r
+(function (DocumentLinkRequest) {\r
+ DocumentLinkRequest.method = 'textDocument/documentLink';\r
+ DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
+ /** @deprecated Use DocumentLinkRequest.type */\r
+ DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
+/**\r
+ * Request to resolve additional information for a given document link. The request's\r
+ * parameter is of type [DocumentLink](#DocumentLink) the response\r
+ * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
+ */\r
+var DocumentLinkResolveRequest;\r
+(function (DocumentLinkResolveRequest) {\r
+ DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
+})(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
+/**\r
+ * A request to to format a whole document.\r
+ */\r
+var DocumentFormattingRequest;\r
+(function (DocumentFormattingRequest) {\r
+ DocumentFormattingRequest.method = 'textDocument/formatting';\r
+ DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
+})(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
+/**\r
+ * A request to to format a range in a document.\r
+ */\r
+var DocumentRangeFormattingRequest;\r
+(function (DocumentRangeFormattingRequest) {\r
+ DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
+ DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
+})(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
+/**\r
+ * A request to format a document on type.\r
+ */\r
+var DocumentOnTypeFormattingRequest;\r
+(function (DocumentOnTypeFormattingRequest) {\r
+ DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
+ DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
+})(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
+/**\r
+ * A request to rename a symbol.\r
+ */\r
+var RenameRequest;\r
+(function (RenameRequest) {\r
+ RenameRequest.method = 'textDocument/rename';\r
+ RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
+})(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
+/**\r
+ * A request to test and perform the setup necessary for a rename.\r
+ */\r
+var PrepareRenameRequest;\r
+(function (PrepareRenameRequest) {\r
+ PrepareRenameRequest.method = 'textDocument/prepareRename';\r
+ PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
+})(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
+/**\r
+ * A request send from the client to the server to execute a command. The request might return\r
+ * a workspace edit which the client will apply to the workspace.\r
+ */\r
+var ExecuteCommandRequest;\r
+(function (ExecuteCommandRequest) {\r
+ ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
+})(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
+/**\r
+ * A request sent from the server to the client to modified certain resources.\r
+ */\r
+var ApplyWorkspaceEditRequest;\r
+(function (ApplyWorkspaceEditRequest) {\r
+ ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
+})(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
+
+
+/***/ }),
+/* 177 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+function boolean(value) {\r
+ return value === true || value === false;\r
+}\r
+exports.boolean = boolean;\r
+function string(value) {\r
+ return typeof value === 'string' || value instanceof String;\r
+}\r
+exports.string = string;\r
+function number(value) {\r
+ return typeof value === 'number' || value instanceof Number;\r
+}\r
+exports.number = number;\r
+function error(value) {\r
+ return value instanceof Error;\r
+}\r
+exports.error = error;\r
+function func(value) {\r
+ return typeof value === 'function';\r
+}\r
+exports.func = func;\r
+function array(value) {\r
+ return Array.isArray(value);\r
+}\r
+exports.array = array;\r
+function stringArray(value) {\r
+ return array(value) && value.every(elem => string(elem));\r
+}\r
+exports.stringArray = stringArray;\r
+function typedArray(value, check) {\r
+ return Array.isArray(value) && value.every(check);\r
+}\r
+exports.typedArray = typedArray;\r
+function objectLiteral(value) {\r
+ // Strictly speaking class instances pass this check as well. Since the LSP\r
+ // doesn't use classes we ignore this for now. If we do we need to add something\r
+ // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
+ return value !== null && typeof value === 'object';\r
+}\r
+exports.objectLiteral = objectLiteral;\r
+
+
+/***/ }),
+/* 178 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
+ constructor(method) {\r
+ super(method);\r
+ }\r
+}\r
+exports.ProtocolRequestType0 = ProtocolRequestType0;\r
+class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
+ constructor(method) {\r
+ super(method);\r
+ }\r
+}\r
+exports.ProtocolRequestType = ProtocolRequestType;\r
+class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
+ constructor(method) {\r
+ super(method);\r
+ }\r
+}\r
+exports.ProtocolNotificationType = ProtocolNotificationType;\r
+class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
+ constructor(method) {\r
+ super(method);\r
+ }\r
+}\r
+exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
+
+
+/***/ }),
+/* 179 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
+let __noDynamicImport;\r
+/**\r
+ * A request to resolve the implementation locations of a symbol at a given text\r
+ * document position. The request's parameter is of type [TextDocumentPositioParams]\r
+ * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
+ * Thenable that resolves to such.\r
+ */\r
+var ImplementationRequest;\r
+(function (ImplementationRequest) {\r
+ ImplementationRequest.method = 'textDocument/implementation';\r
+ ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
+ /** @deprecated Use ImplementationRequest.type */\r
+ ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
+
+
+/***/ }),
+/* 180 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
+let __noDynamicImport;\r
+/**\r
+ * A request to resolve the type definition locations of a symbol at a given text\r
+ * document position. The request's parameter is of type [TextDocumentPositioParams]\r
+ * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
+ * Thenable that resolves to such.\r
+ */\r
+var TypeDefinitionRequest;\r
+(function (TypeDefinitionRequest) {\r
+ TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
+ TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
+ /** @deprecated Use TypeDefinitionRequest.type */\r
+ TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
+
+
+/***/ }),
+/* 181 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
+ */\r
+var WorkspaceFoldersRequest;\r
+(function (WorkspaceFoldersRequest) {\r
+ WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
+})(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
+/**\r
+ * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
+ * folder configuration changes.\r
+ */\r
+var DidChangeWorkspaceFoldersNotification;\r
+(function (DidChangeWorkspaceFoldersNotification) {\r
+ DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
+})(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
+
+
+/***/ }),
+/* 182 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
+ * configuration setting.\r
+ *\r
+ * This pull model replaces the old push model were the client signaled configuration change via an\r
+ * event. If the server still needs to react to configuration changes (since the server caches the\r
+ * result of `workspace/configuration` requests) the server should register for an empty configuration\r
+ * change event and empty the cache if such an event is received.\r
+ */\r
+var ConfigurationRequest;\r
+(function (ConfigurationRequest) {\r
+ ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
+})(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
+
+
+/***/ }),
+/* 183 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * A request to list all color symbols found in a given text document. The request's\r
+ * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
+ * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
+ * that resolves to such.\r
+ */\r
+var DocumentColorRequest;\r
+(function (DocumentColorRequest) {\r
+ DocumentColorRequest.method = 'textDocument/documentColor';\r
+ DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
+ /** @deprecated Use DocumentColorRequest.type */\r
+ DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
+/**\r
+ * A request to list all presentation for a color. The request's\r
+ * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
+ * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
+ * that resolves to such.\r
+ */\r
+var ColorPresentationRequest;\r
+(function (ColorPresentationRequest) {\r
+ ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
+})(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
+
+
+/***/ }),
+/* 184 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+\r
+/*---------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ *--------------------------------------------------------------------------------------------*/\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * Enum of known range kinds\r
+ */\r
+var FoldingRangeKind;\r
+(function (FoldingRangeKind) {\r
+ /**\r
+ * Folding range for a comment\r
+ */\r
+ FoldingRangeKind["Comment"] = "comment";\r
+ /**\r
+ * Folding range for a imports or includes\r
+ */\r
+ FoldingRangeKind["Imports"] = "imports";\r
+ /**\r
+ * Folding range for a region (e.g. `#region`)\r
+ */\r
+ FoldingRangeKind["Region"] = "region";\r
+})(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
+/**\r
+ * A request to provide folding ranges in a document. The request's\r
+ * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
+ * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
+ * that resolves to such.\r
+ */\r
+var FoldingRangeRequest;\r
+(function (FoldingRangeRequest) {\r
+ FoldingRangeRequest.method = 'textDocument/foldingRange';\r
+ FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
+ /** @deprecated Use FoldingRangeRequest.type */\r
+ FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
+
+
+/***/ }),
+/* 185 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+// @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
+let __noDynamicImport;\r
+/**\r
+ * A request to resolve the type definition locations of a symbol at a given text\r
+ * document position. The request's parameter is of type [TextDocumentPositioParams]\r
+ * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
+ * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
+ * to such.\r
+ */\r
+var DeclarationRequest;\r
+(function (DeclarationRequest) {\r
+ DeclarationRequest.method = 'textDocument/declaration';\r
+ DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
+ /** @deprecated Use DeclarationRequest.type */\r
+ DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
+
+
+/***/ }),
+/* 186 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+\r
+/*---------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ *--------------------------------------------------------------------------------------------*/\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * A request to provide selection ranges in a document. The request's\r
+ * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
+ * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
+ * that resolves to such.\r
+ */\r
+var SelectionRangeRequest;\r
+(function (SelectionRangeRequest) {\r
+ SelectionRangeRequest.method = 'textDocument/selectionRange';\r
+ SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
+ /** @deprecated Use SelectionRangeRequest.type */\r
+ SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
+})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
+
+
+/***/ }),
+/* 187 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const vscode_jsonrpc_1 = __webpack_require__(163);\r
+const messages_1 = __webpack_require__(178);\r
+var WorkDoneProgress;\r
+(function (WorkDoneProgress) {\r
+ WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
+})(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
+/**\r
+ * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
+ * reporting from the server.\r
+ */\r
+var WorkDoneProgressCreateRequest;\r
+(function (WorkDoneProgressCreateRequest) {\r
+ WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
+})(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
+/**\r
+ * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress\r
+ * initiated on the server side.\r
+ */\r
+var WorkDoneProgressCancelNotification;\r
+(function (WorkDoneProgressCancelNotification) {\r
+ WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
+})(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
+
+
+/***/ }),
+/* 188 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) TypeFox and others. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * A request to result a `CallHierarchyItem` in a document at a given position.\r
+ * Can be used as an input to a incoming or outgoing call hierarchy.\r
+ *\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var CallHierarchyPrepareRequest;\r
+(function (CallHierarchyPrepareRequest) {\r
+ CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
+ CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
+})(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
+/**\r
+ * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
+ *\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var CallHierarchyIncomingCallsRequest;\r
+(function (CallHierarchyIncomingCallsRequest) {\r
+ CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
+ CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
+})(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
+/**\r
+ * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
+ *\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var CallHierarchyOutgoingCallsRequest;\r
+(function (CallHierarchyOutgoingCallsRequest) {\r
+ CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
+ CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
+})(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
+
+
+/***/ }),
+/* 189 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/* --------------------------------------------------------------------------------------------\r
+ * Copyright (c) Microsoft Corporation. All rights reserved.\r
+ * Licensed under the MIT License. See License.txt in the project root for license information.\r
+ * ------------------------------------------------------------------------------------------ */\r
+\r
+Object.defineProperty(exports, "__esModule", { value: true });\r
+const messages_1 = __webpack_require__(178);\r
+/**\r
+ * A set of predefined token types. This set is not fixed\r
+ * an clients can specify additional token types via the\r
+ * corresponding client capabilities.\r
+ *\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokenTypes;\r
+(function (SemanticTokenTypes) {\r
+ SemanticTokenTypes["comment"] = "comment";\r
+ SemanticTokenTypes["keyword"] = "keyword";\r
+ SemanticTokenTypes["string"] = "string";\r
+ SemanticTokenTypes["number"] = "number";\r
+ SemanticTokenTypes["regexp"] = "regexp";\r
+ SemanticTokenTypes["operator"] = "operator";\r
+ SemanticTokenTypes["namespace"] = "namespace";\r
+ SemanticTokenTypes["type"] = "type";\r
+ SemanticTokenTypes["struct"] = "struct";\r
+ SemanticTokenTypes["class"] = "class";\r
+ SemanticTokenTypes["interface"] = "interface";\r
+ SemanticTokenTypes["enum"] = "enum";\r
+ SemanticTokenTypes["typeParameter"] = "typeParameter";\r
+ SemanticTokenTypes["function"] = "function";\r
+ SemanticTokenTypes["member"] = "member";\r
+ SemanticTokenTypes["property"] = "property";\r
+ SemanticTokenTypes["macro"] = "macro";\r
+ SemanticTokenTypes["variable"] = "variable";\r
+ SemanticTokenTypes["parameter"] = "parameter";\r
+ SemanticTokenTypes["label"] = "label";\r
+})(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
+/**\r
+ * A set of predefined token modifiers. This set is not fixed\r
+ * an clients can specify additional token types via the\r
+ * corresponding client capabilities.\r
+ *\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokenModifiers;\r
+(function (SemanticTokenModifiers) {\r
+ SemanticTokenModifiers["documentation"] = "documentation";\r
+ SemanticTokenModifiers["declaration"] = "declaration";\r
+ SemanticTokenModifiers["definition"] = "definition";\r
+ SemanticTokenModifiers["reference"] = "reference";\r
+ SemanticTokenModifiers["static"] = "static";\r
+ SemanticTokenModifiers["abstract"] = "abstract";\r
+ SemanticTokenModifiers["deprecated"] = "deprecated";\r
+ SemanticTokenModifiers["async"] = "async";\r
+ SemanticTokenModifiers["volatile"] = "volatile";\r
+ SemanticTokenModifiers["readonly"] = "readonly";\r
+})(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
+/**\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokens;\r
+(function (SemanticTokens) {\r
+ function is(value) {\r
+ const candidate = value;\r
+ return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
+ Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
+ }\r
+ SemanticTokens.is = is;\r
+})(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
+/**\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokensRequest;\r
+(function (SemanticTokensRequest) {\r
+ SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
+ SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
+})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
+/**\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokensEditsRequest;\r
+(function (SemanticTokensEditsRequest) {\r
+ SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
+ SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
+})(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
+/**\r
+ * @since 3.16.0 - Proposed state\r
+ */\r
+var SemanticTokensRangeRequest;\r
+(function (SemanticTokensRangeRequest) {\r
+ SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
+ SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
+})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
+
+
+/***/ })
+/******/ ])));
\ No newline at end of file