From 98fd5af27fc4a5932426a65b393ff1ab8b8d42a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= Date: Sat, 29 Oct 2022 16:12:38 +0200 Subject: [PATCH] update @actions/core to 1.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows us to automatically use the file based version [1] of `set-output` instead of the deprecated stdout version that will be removed on 31st May 2023. [2] [1] https://github.com/actions/toolkit/pull/1178 [2] https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ Signed-off-by: Matthias Aßhauer --- dist/index.js | 2078 ++++++++++++++++++++++++++++++++++++++++++++- dist/index.js.map | 2 +- package-lock.json | 26 +- package.json | 2 +- 4 files changed, 2071 insertions(+), 37 deletions(-) diff --git a/dist/index.js b/dist/index.js index 16d8e5b..7af37f5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -169,14 +169,27 @@ if (typeof jest !== 'undefined') { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(2087)); const utils_1 = __nccwpck_require__(5278); /** @@ -255,6 +268,25 @@ function escapeProperty(s) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -264,19 +296,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; const command_1 = __nccwpck_require__(7351); const file_command_1 = __nccwpck_require__(717); const utils_1 = __nccwpck_require__(5278); const os = __importStar(__nccwpck_require__(2087)); const path = __importStar(__nccwpck_require__(5622)); +const oidc_utils_1 = __nccwpck_require__(8041); /** * The code to exit an action */ @@ -305,13 +332,9 @@ function exportVariable(name, val) { process.env[name] = convertedVal; const filePath = process.env['GITHUB_ENV'] || ''; if (filePath) { - const delimiter = '_GitHubActionsFileCommandDelimeter_'; - const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; - file_command_1.issueCommand('ENV', commandValue); - } - else { - command_1.issueCommand('set-env', { name }, convertedVal); + return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); } + command_1.issueCommand('set-env', { name }, convertedVal); } exports.exportVariable = exportVariable; /** @@ -329,7 +352,7 @@ exports.setSecret = setSecret; function addPath(inputPath) { const filePath = process.env['GITHUB_PATH'] || ''; if (filePath) { - file_command_1.issueCommand('PATH', inputPath); + file_command_1.issueFileCommand('PATH', inputPath); } else { command_1.issueCommand('add-path', {}, inputPath); @@ -338,7 +361,9 @@ function addPath(inputPath) { } exports.addPath = addPath; /** - * Gets the value of an input. The value is also trimmed. + * Gets the value of an input. + * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. + * Returns an empty string if the value is not defined. * * @param name name of the input to get * @param options optional. See InputOptions. @@ -349,9 +374,52 @@ function getInput(name, options) { if (options && options.required && !val) { throw new Error(`Input required and not supplied: ${name}`); } + if (options && options.trimWhitespace === false) { + return val; + } return val.trim(); } exports.getInput = getInput; +/** + * Gets the values of an multiline input. Each value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string[] + * + */ +function getMultilineInput(name, options) { + const inputs = getInput(name, options) + .split('\n') + .filter(x => x !== ''); + if (options && options.trimWhitespace === false) { + return inputs; + } + return inputs.map(input => input.trim()); +} +exports.getMultilineInput = getMultilineInput; +/** + * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. + * Support boolean input list: `true | True | TRUE | false | False | FALSE` . + * The return value is also in boolean type. + * ref: https://yaml.org/spec/1.2/spec.html#id2804923 + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns boolean + */ +function getBooleanInput(name, options) { + const trueValue = ['true', 'True', 'TRUE']; + const falseValue = ['false', 'False', 'FALSE']; + const val = getInput(name, options); + if (trueValue.includes(val)) + return true; + if (falseValue.includes(val)) + return false; + throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + + `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); +} +exports.getBooleanInput = getBooleanInput; /** * Sets the value of an output. * @@ -360,7 +428,12 @@ exports.getInput = getInput; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { - command_1.issueCommand('set-output', { name }, value); + const filePath = process.env['GITHUB_OUTPUT'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); + } + process.stdout.write(os.EOL); + command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); } exports.setOutput = setOutput; /** @@ -406,19 +479,30 @@ exports.debug = debug; /** * Adds an error issue * @param message error issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. */ -function error(message) { - command_1.issue('error', message instanceof Error ? message.toString() : message); +function error(message, properties = {}) { + command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports.error = error; /** - * Adds an warning issue + * Adds a warning issue * @param message warning issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. */ -function warning(message) { - command_1.issue('warning', message instanceof Error ? message.toString() : message); +function warning(message, properties = {}) { + command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports.warning = warning; +/** + * Adds a notice issue + * @param message notice issue message. Errors will be converted to string via toString() + * @param properties optional properties to add to the annotation. + */ +function notice(message, properties = {}) { + command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); +} +exports.notice = notice; /** * Writes info to log with console.log. * @param message info message @@ -478,7 +562,11 @@ exports.group = group; */ // eslint-disable-next-line @typescript-eslint/no-explicit-any function saveState(name, value) { - command_1.issueCommand('save-state', { name }, value); + const filePath = process.env['GITHUB_STATE'] || ''; + if (filePath) { + return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); + } + command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value)); } exports.saveState = saveState; /** @@ -491,6 +579,29 @@ function getState(name) { return process.env[`STATE_${name}`] || ''; } exports.getState = getState; +function getIDToken(aud) { + return __awaiter(this, void 0, void 0, function* () { + return yield oidc_utils_1.OidcClient.getIDToken(aud); + }); +} +exports.getIDToken = getIDToken; +/** + * Summary exports + */ +var summary_1 = __nccwpck_require__(1327); +Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); +/** + * @deprecated use core.summary + */ +var summary_2 = __nccwpck_require__(1327); +Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); +/** + * Path exports + */ +var path_utils_1 = __nccwpck_require__(2981); +Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); +Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); +Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); //# sourceMappingURL=core.js.map /***/ }), @@ -501,20 +612,34 @@ exports.getState = getState; "use strict"; // For internal use, subject to change. +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(5747)); const os = __importStar(__nccwpck_require__(2087)); +const uuid_1 = __nccwpck_require__(5840); const utils_1 = __nccwpck_require__(5278); -function issueCommand(command, message) { +function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); @@ -526,11 +651,465 @@ function issueCommand(command, message) { encoding: 'utf8' }); } -exports.issueCommand = issueCommand; +exports.issueFileCommand = issueFileCommand; +function prepareKeyValueMessage(key, value) { + const delimiter = `ghadelimiter_${uuid_1.v4()}`; + const convertedValue = utils_1.toCommandValue(value); + // These should realistically never happen, but just in case someone finds a + // way to exploit uuid generation let's not allow keys or values that contain + // the delimiter. + if (key.includes(delimiter)) { + throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); + } + if (convertedValue.includes(delimiter)) { + throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); + } + return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; +} +exports.prepareKeyValueMessage = prepareKeyValueMessage; //# sourceMappingURL=file-command.js.map /***/ }), +/***/ 8041: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OidcClient = void 0; +const http_client_1 = __nccwpck_require__(1404); +const auth_1 = __nccwpck_require__(6758); +const core_1 = __nccwpck_require__(2186); +class OidcClient { + static createHttpClient(allowRetry = true, maxRetry = 10) { + const requestOptions = { + allowRetries: allowRetry, + maxRetries: maxRetry + }; + return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions); + } + static getRequestToken() { + const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN']; + if (!token) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable'); + } + return token; + } + static getIDTokenUrl() { + const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL']; + if (!runtimeUrl) { + throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable'); + } + return runtimeUrl; + } + static getCall(id_token_url) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + const httpclient = OidcClient.createHttpClient(); + const res = yield httpclient + .getJson(id_token_url) + .catch(error => { + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n + Error Message: ${error.result.message}`); + }); + const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; + if (!id_token) { + throw new Error('Response json body do not have ID Token field'); + } + return id_token; + }); + } + static getIDToken(audience) { + return __awaiter(this, void 0, void 0, function* () { + try { + // New ID Token is requested from action service + let id_token_url = OidcClient.getIDTokenUrl(); + if (audience) { + const encodedAudience = encodeURIComponent(audience); + id_token_url = `${id_token_url}&audience=${encodedAudience}`; + } + core_1.debug(`ID token url is ${id_token_url}`); + const id_token = yield OidcClient.getCall(id_token_url); + core_1.setSecret(id_token); + return id_token; + } + catch (error) { + throw new Error(`Error message: ${error.message}`); + } + }); + } +} +exports.OidcClient = OidcClient; +//# sourceMappingURL=oidc-utils.js.map + +/***/ }), + +/***/ 2981: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; +const path = __importStar(__nccwpck_require__(5622)); +/** + * toPosixPath converts the given path to the posix form. On Windows, \\ will be + * replaced with /. + * + * @param pth. Path to transform. + * @return string Posix path. + */ +function toPosixPath(pth) { + return pth.replace(/[\\]/g, '/'); +} +exports.toPosixPath = toPosixPath; +/** + * toWin32Path converts the given path to the win32 form. On Linux, / will be + * replaced with \\. + * + * @param pth. Path to transform. + * @return string Win32 path. + */ +function toWin32Path(pth) { + return pth.replace(/[/]/g, '\\'); +} +exports.toWin32Path = toWin32Path; +/** + * toPlatformPath converts the given path to a platform-specific path. It does + * this by replacing instances of / and \ with the platform-specific path + * separator. + * + * @param pth The path to platformize. + * @return string The platform-specific path. + */ +function toPlatformPath(pth) { + return pth.replace(/[/\\]/g, path.sep); +} +exports.toPlatformPath = toPlatformPath; +//# sourceMappingURL=path-utils.js.map + +/***/ }), + +/***/ 1327: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; +const os_1 = __nccwpck_require__(2087); +const fs_1 = __nccwpck_require__(5747); +const { access, appendFile, writeFile } = fs_1.promises; +exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; +exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; +class Summary { + constructor() { + this._buffer = ''; + } + /** + * Finds the summary file path from the environment, rejects if env var is not found or file does not exist + * Also checks r/w permissions. + * + * @returns step summary file path + */ + filePath() { + return __awaiter(this, void 0, void 0, function* () { + if (this._filePath) { + return this._filePath; + } + const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR]; + if (!pathFromEnv) { + throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`); + } + try { + yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK); + } + catch (_a) { + throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`); + } + this._filePath = pathFromEnv; + return this._filePath; + }); + } + /** + * Wraps content in an HTML tag, adding any HTML attributes + * + * @param {string} tag HTML tag to wrap + * @param {string | null} content content within the tag + * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add + * + * @returns {string} content wrapped in HTML element + */ + wrap(tag, content, attrs = {}) { + const htmlAttrs = Object.entries(attrs) + .map(([key, value]) => ` ${key}="${value}"`) + .join(''); + if (!content) { + return `<${tag}${htmlAttrs}>`; + } + return `<${tag}${htmlAttrs}>${content}`; + } + /** + * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default. + * + * @param {SummaryWriteOptions} [options] (optional) options for write operation + * + * @returns {Promise} summary instance + */ + write(options) { + return __awaiter(this, void 0, void 0, function* () { + const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite); + const filePath = yield this.filePath(); + const writeFunc = overwrite ? writeFile : appendFile; + yield writeFunc(filePath, this._buffer, { encoding: 'utf8' }); + return this.emptyBuffer(); + }); + } + /** + * Clears the summary buffer and wipes the summary file + * + * @returns {Summary} summary instance + */ + clear() { + return __awaiter(this, void 0, void 0, function* () { + return this.emptyBuffer().write({ overwrite: true }); + }); + } + /** + * Returns the current summary buffer as a string + * + * @returns {string} string of summary buffer + */ + stringify() { + return this._buffer; + } + /** + * If the summary buffer is empty + * + * @returns {boolen} true if the buffer is empty + */ + isEmptyBuffer() { + return this._buffer.length === 0; + } + /** + * Resets the summary buffer without writing to summary file + * + * @returns {Summary} summary instance + */ + emptyBuffer() { + this._buffer = ''; + return this; + } + /** + * Adds raw text to the summary buffer + * + * @param {string} text content to add + * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false) + * + * @returns {Summary} summary instance + */ + addRaw(text, addEOL = false) { + this._buffer += text; + return addEOL ? this.addEOL() : this; + } + /** + * Adds the operating system-specific end-of-line marker to the buffer + * + * @returns {Summary} summary instance + */ + addEOL() { + return this.addRaw(os_1.EOL); + } + /** + * Adds an HTML codeblock to the summary buffer + * + * @param {string} code content to render within fenced code block + * @param {string} lang (optional) language to syntax highlight code + * + * @returns {Summary} summary instance + */ + addCodeBlock(code, lang) { + const attrs = Object.assign({}, (lang && { lang })); + const element = this.wrap('pre', this.wrap('code', code), attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML list to the summary buffer + * + * @param {string[]} items list of items to render + * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false) + * + * @returns {Summary} summary instance + */ + addList(items, ordered = false) { + const tag = ordered ? 'ol' : 'ul'; + const listItems = items.map(item => this.wrap('li', item)).join(''); + const element = this.wrap(tag, listItems); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML table to the summary buffer + * + * @param {SummaryTableCell[]} rows table rows + * + * @returns {Summary} summary instance + */ + addTable(rows) { + const tableBody = rows + .map(row => { + const cells = row + .map(cell => { + if (typeof cell === 'string') { + return this.wrap('td', cell); + } + const { header, data, colspan, rowspan } = cell; + const tag = header ? 'th' : 'td'; + const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan })); + return this.wrap(tag, data, attrs); + }) + .join(''); + return this.wrap('tr', cells); + }) + .join(''); + const element = this.wrap('table', tableBody); + return this.addRaw(element).addEOL(); + } + /** + * Adds a collapsable HTML details element to the summary buffer + * + * @param {string} label text for the closed state + * @param {string} content collapsable content + * + * @returns {Summary} summary instance + */ + addDetails(label, content) { + const element = this.wrap('details', this.wrap('summary', label) + content); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML image tag to the summary buffer + * + * @param {string} src path to the image you to embed + * @param {string} alt text description of the image + * @param {SummaryImageOptions} options (optional) addition image attributes + * + * @returns {Summary} summary instance + */ + addImage(src, alt, options) { + const { width, height } = options || {}; + const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height })); + const element = this.wrap('img', null, Object.assign({ src, alt }, attrs)); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML section heading element + * + * @param {string} text heading text + * @param {number | string} [level=1] (optional) the heading level, default: 1 + * + * @returns {Summary} summary instance + */ + addHeading(text, level) { + const tag = `h${level}`; + const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag) + ? tag + : 'h1'; + const element = this.wrap(allowedTag, text); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML thematic break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addSeparator() { + const element = this.wrap('hr', null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML line break (
) to the summary buffer + * + * @returns {Summary} summary instance + */ + addBreak() { + const element = this.wrap('br', null); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML blockquote to the summary buffer + * + * @param {string} text quote text + * @param {string} cite (optional) citation url + * + * @returns {Summary} summary instance + */ + addQuote(text, cite) { + const attrs = Object.assign({}, (cite && { cite })); + const element = this.wrap('blockquote', text, attrs); + return this.addRaw(element).addEOL(); + } + /** + * Adds an HTML anchor tag to the summary buffer + * + * @param {string} text link text/content + * @param {string} href hyperlink + * + * @returns {Summary} summary instance + */ + addLink(text, href) { + const element = this.wrap('a', text, { href }); + return this.addRaw(element).addEOL(); + } +} +const _summary = new Summary(); +/** + * @deprecated use `core.summary` + */ +exports.markdownSummary = _summary; +exports.summary = _summary; +//# sourceMappingURL=summary.js.map + +/***/ }), + /***/ 5278: /***/ ((__unused_webpack_module, exports) => { @@ -539,6 +1118,7 @@ exports.issueCommand = issueCommand; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toCommandProperties = exports.toCommandValue = void 0; /** * Sanitizes an input into a string so it can be passed into issueCommand safely * @param input input to sanitize into a string @@ -553,10 +1133,798 @@ function toCommandValue(input) { return JSON.stringify(input); } exports.toCommandValue = toCommandValue; +/** + * + * @param annotationProperties + * @returns The command properties to send with the actual annotation command + * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 + */ +function toCommandProperties(annotationProperties) { + if (!Object.keys(annotationProperties).length) { + return {}; + } + return { + title: annotationProperties.title, + file: annotationProperties.file, + line: annotationProperties.startLine, + endLine: annotationProperties.endLine, + col: annotationProperties.startColumn, + endColumn: annotationProperties.endColumn + }; +} +exports.toCommandProperties = toCommandProperties; //# sourceMappingURL=utils.js.map /***/ }), +/***/ 6758: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0; +class BasicCredentialHandler { + constructor(username, password) { + this.username = username; + this.password = password; + } + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.BasicCredentialHandler = BasicCredentialHandler; +class BearerCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Bearer ${this.token}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.BearerCredentialHandler = BearerCredentialHandler; +class PersonalAccessTokenCredentialHandler { + constructor(token) { + this.token = token; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!options.headers) { + throw Error('The request has no headers'); + } + options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`; + } + // This handler cannot handle 401 + canHandleAuthentication() { + return false; + } + handleAuthentication() { + return __awaiter(this, void 0, void 0, function* () { + throw new Error('not implemented'); + }); + } +} +exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; +//# sourceMappingURL=auth.js.map + +/***/ }), + +/***/ 1404: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; +const http = __importStar(__nccwpck_require__(8605)); +const https = __importStar(__nccwpck_require__(7211)); +const pm = __importStar(__nccwpck_require__(2843)); +const tunnel = __importStar(__nccwpck_require__(4294)); +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +var Headers; +(function (Headers) { + Headers["Accept"] = "accept"; + Headers["ContentType"] = "content-type"; +})(Headers = exports.Headers || (exports.Headers = {})); +var MediaTypes; +(function (MediaTypes) { + MediaTypes["ApplicationJson"] = "application/json"; +})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {})); +/** + * Returns the proxy URL, depending upon the supplied url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ +function getProxyUrl(serverUrl) { + const proxyUrl = pm.getProxyUrl(new URL(serverUrl)); + return proxyUrl ? proxyUrl.href : ''; +} +exports.getProxyUrl = getProxyUrl; +const HttpRedirectCodes = [ + HttpCodes.MovedPermanently, + HttpCodes.ResourceMoved, + HttpCodes.SeeOther, + HttpCodes.TemporaryRedirect, + HttpCodes.PermanentRedirect +]; +const HttpResponseRetryCodes = [ + HttpCodes.BadGateway, + HttpCodes.ServiceUnavailable, + HttpCodes.GatewayTimeout +]; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientError extends Error { + constructor(message, statusCode) { + super(message); + this.name = 'HttpClientError'; + this.statusCode = statusCode; + Object.setPrototypeOf(this, HttpClientError.prototype); + } +} +exports.HttpClientError = HttpClientError; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () { + let output = Buffer.alloc(0); + this.message.on('data', (chunk) => { + output = Buffer.concat([output, chunk]); + }); + this.message.on('end', () => { + resolve(output.toString()); + }); + })); + }); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + const parsedUrl = new URL(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + }); + } + get(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + }); + } + del(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + }); + } + post(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + }); + } + patch(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + }); + } + put(requestUrl, data, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + }); + } + head(requestUrl, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + }); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return this.request(verb, requestUrl, stream, additionalHeaders); + }); + } + /** + * Gets a typed object from an endpoint + * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise + */ + getJson(requestUrl, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + const res = yield this.get(requestUrl, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + postJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.post(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + putJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.put(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + patchJson(requestUrl, obj, additionalHeaders = {}) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.stringify(obj, null, 2); + additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson); + additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson); + const res = yield this.patch(requestUrl, data, additionalHeaders); + return this._processResponse(res, this.requestOptions); + }); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error('Client has already been disposed.'); + } + const parsedUrl = new URL(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) + ? this._maxRetries + 1 + : 1; + let numTries = 0; + let response; + do { + response = yield this.requestRaw(info, data); + // Check if it's an authentication challenge + if (response && + response.message && + response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (const handler of this.handlers) { + if (handler.canHandleAuthentication(response)) { + authenticationHandler = handler; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (response.message.statusCode && + HttpRedirectCodes.includes(response.message.statusCode) && + this._allowRedirects && + redirectsRemaining > 0) { + const redirectUrl = response.message.headers['location']; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + const parsedRedirectUrl = new URL(redirectUrl); + if (parsedUrl.protocol === 'https:' && + parsedUrl.protocol !== parsedRedirectUrl.protocol && + !this._allowRedirectDowngrade) { + throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.'); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + yield response.readBody(); + // strip authorization header if redirected to a different hostname + if (parsedRedirectUrl.hostname !== parsedUrl.hostname) { + for (const header in headers) { + // header names are case insensitive + if (header.toLowerCase() === 'authorization') { + delete headers[header]; + } + } + } + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (!response.message.statusCode || + !HttpResponseRetryCodes.includes(response.message.statusCode)) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } while (numTries < maxTries); + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + function callbackForResult(err, res) { + if (err) { + reject(err); + } + else if (!res) { + // If `err` is not passed, then `res` must be passed. + reject(new Error('Unknown error')); + } + else { + resolve(res); + } + } + this.requestRawWithCallback(info, data, callbackForResult); + }); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + if (typeof data === 'string') { + if (!info.options.headers) { + info.options.headers = {}; + } + info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + function handleResult(err, res) { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + } + const req = info.httpModule.request(info.options, (msg) => { + const res = new HttpClientResponse(msg); + handleResult(undefined, res); + }); + let socket; + req.on('socket', sock => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.end(); + } + handleResult(new Error(`Request timeout: ${info.options.path}`)); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err); + }); + if (data && typeof data === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof data !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + /** + * Gets an http agent. This function is useful when you need an http agent that handles + * routing through a proxy server - depending upon the url and proxy environment variables. + * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com + */ + getAgent(serverUrl) { + const parsedUrl = new URL(serverUrl); + return this._getAgent(parsedUrl); + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port + ? parseInt(info.parsedUrl.port) + : defaultPort; + info.options.path = + (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers['user-agent'] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers) { + for (const handler of this.handlers) { + handler.prepareRequest(info.options); + } + } + return info; + } + _mergeHeaders(headers) { + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {})); + } + return lowercaseKeys(headers || {}); + } + _getExistingOrDefaultHeader(additionalHeaders, header, _default) { + let clientHeader; + if (this.requestOptions && this.requestOptions.headers) { + clientHeader = lowercaseKeys(this.requestOptions.headers)[header]; + } + return additionalHeaders[header] || clientHeader || _default; + } + _getAgent(parsedUrl) { + let agent; + const proxyUrl = pm.getProxyUrl(parsedUrl); + const useProxy = proxyUrl && proxyUrl.hostname; + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis. + if (proxyUrl && proxyUrl.hostname) { + const agentOptions = { + maxSockets, + keepAlive: this._keepAlive, + proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && { + proxyAuth: `${proxyUrl.username}:${proxyUrl.password}` + })), { host: proxyUrl.hostname, port: proxyUrl.port }) + }; + let tunnelAgent; + const overHttps = proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { + rejectUnauthorized: false + }); + } + return agent; + } + _performExponentialBackoff(retryNumber) { + return __awaiter(this, void 0, void 0, function* () { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + }); + } + _processResponse(res, options) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const statusCode = res.message.statusCode || 0; + const response = { + statusCode, + result: null, + headers: {} + }; + // not found leads to null obj returned + if (statusCode === HttpCodes.NotFound) { + resolve(response); + } + // get the result from the body + function dateTimeDeserializer(key, value) { + if (typeof value === 'string') { + const a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + let obj; + let contents; + try { + contents = yield res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, dateTimeDeserializer); + } + else { + obj = JSON.parse(contents); + } + response.result = obj; + } + response.headers = res.message.headers; + } + catch (err) { + // Invalid resource (contents not json); leaving result obj null + } + // note that 3xx redirects are handled by the http layer. + if (statusCode > 299) { + let msg; + // if exception/error in body, attempt to get better error + if (obj && obj.message) { + msg = obj.message; + } + else if (contents && contents.length > 0) { + // it may be the case that the exception is in the body message as string + msg = contents; + } + else { + msg = `Failed request: (${statusCode})`; + } + const err = new HttpClientError(msg, statusCode); + err.result = response.result; + reject(err); + } + else { + resolve(response); + } + })); + }); + } +} +exports.HttpClient = HttpClient; +const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {}); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 2843: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.checkBypass = exports.getProxyUrl = void 0; +function getProxyUrl(reqUrl) { + const usingSsl = reqUrl.protocol === 'https:'; + if (checkBypass(reqUrl)) { + return undefined; + } + const proxyVar = (() => { + if (usingSsl) { + return process.env['https_proxy'] || process.env['HTTPS_PROXY']; + } + else { + return process.env['http_proxy'] || process.env['HTTP_PROXY']; + } + })(); + if (proxyVar) { + return new URL(proxyVar); + } + else { + return undefined; + } +} +exports.getProxyUrl = getProxyUrl; +function checkBypass(reqUrl) { + if (!reqUrl.hostname) { + return false; + } + const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; + if (!noProxy) { + return false; + } + // Determine the request port + let reqPort; + if (reqUrl.port) { + reqPort = Number(reqUrl.port); + } + else if (reqUrl.protocol === 'http:') { + reqPort = 80; + } + else if (reqUrl.protocol === 'https:') { + reqPort = 443; + } + // Format the request hostname and hostname with port + const upperReqHosts = [reqUrl.hostname.toUpperCase()]; + if (typeof reqPort === 'number') { + upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); + } + // Compare request host against noproxy + for (const upperNoProxyItem of noProxy + .split(',') + .map(x => x.trim().toUpperCase()) + .filter(x => x)) { + if (upperReqHosts.some(x => x === upperNoProxyItem)) { + return true; + } + } + return false; +} +exports.checkBypass = checkBypass; +//# sourceMappingURL=proxy.js.map + +/***/ }), + /***/ 4087: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -33154,6 +34522,652 @@ exports.getUserAgent = getUserAgent; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 5840: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); + +var _v = _interopRequireDefault(__nccwpck_require__(8628)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(6409)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(5122)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(9120)); + +var _nil = _interopRequireDefault(__nccwpck_require__(5332)); + +var _version = _interopRequireDefault(__nccwpck_require__(1595)); + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/***/ }), + +/***/ 4569: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports.default = _default; + +/***/ }), + +/***/ 5332: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports.default = _default; + +/***/ }), + +/***/ 2746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports.default = _default; + +/***/ }), + +/***/ 814: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports.default = _default; + +/***/ }), + +/***/ 807: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = rng; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} + +/***/ }), + +/***/ 5274: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(6417)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports.default = _default; + +/***/ }), + +/***/ 8950: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports.default = _default; + +/***/ }), + +/***/ 8628: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.default)(b); +} + +var _default = v1; +exports.default = _default; + +/***/ }), + +/***/ 6409: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(5998)); + +var _md = _interopRequireDefault(__nccwpck_require__(4569)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports.default = _default; + +/***/ }), + +/***/ 5998: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = _default; +exports.URL = exports.DNS = void 0; + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +var _parse = _interopRequireDefault(__nccwpck_require__(2746)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} + +/***/ }), + +/***/ 5122: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(807)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(8950)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.default)(rnds); +} + +var _default = v4; +exports.default = _default; + +/***/ }), + +/***/ 9120: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(5998)); + +var _sha = _interopRequireDefault(__nccwpck_require__(5274)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports.default = _default; + +/***/ }), + +/***/ 6900: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _regex = _interopRequireDefault(__nccwpck_require__(814)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports.default = _default; + +/***/ }), + +/***/ 1595: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.default = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(6900)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.substr(14, 1), 16); +} + +var _default = version; +exports.default = _default; + /***/ }), /***/ 2940: @@ -38247,6 +40261,14 @@ module.exports = require("assert");; /***/ }), +/***/ 6417: +/***/ ((module) => { + +"use strict"; +module.exports = require("crypto");; + +/***/ }), + /***/ 8614: /***/ ((module) => { diff --git a/dist/index.js.map b/dist/index.js.map index e189d7c..ca62c82 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../webpack://rss-to-issues/./index.js","../webpack://rss-to-issues/./node_modules/@actions/core/lib/command.js","../webpack://rss-to-issues/./node_modules/@actions/core/lib/core.js","../webpack://rss-to-issues/./node_modules/@actions/core/lib/file-command.js","../webpack://rss-to-issues/./node_modules/@actions/core/lib/utils.js","../webpack://rss-to-issues/./node_modules/@actions/github/lib/context.js","../webpack://rss-to-issues/./node_modules/@actions/github/lib/github.js","../webpack://rss-to-issues/./node_modules/@actions/github/lib/internal/utils.js","../webpack://rss-to-issues/./node_modules/@actions/github/lib/utils.js","../webpack://rss-to-issues/./node_modules/@actions/http-client/index.js","../webpack://rss-to-issues/./node_modules/@actions/http-client/proxy.js","../webpack://rss-to-issues/./node_modules/@octokit/auth-token/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/core/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/endpoint/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/graphql/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/request-error/dist-node/index.js","../webpack://rss-to-issues/./node_modules/@octokit/request/dist-node/index.js","../webpack://rss-to-issues/./node_modules/before-after-hook/index.js","../webpack://rss-to-issues/./node_modules/before-after-hook/lib/add.js","../webpack://rss-to-issues/./node_modules/before-after-hook/lib/register.js","../webpack://rss-to-issues/./node_modules/before-after-hook/lib/remove.js","../webpack://rss-to-issues/./node_modules/deprecation/dist-node/index.js","../webpack://rss-to-issues/./node_modules/domino/lib/CSSStyleDeclaration.js","../webpack://rss-to-issues/./node_modules/domino/lib/CharacterData.js","../webpack://rss-to-issues/./node_modules/domino/lib/ChildNode.js","../webpack://rss-to-issues/./node_modules/domino/lib/Comment.js","../webpack://rss-to-issues/./node_modules/domino/lib/ContainerNode.js","../webpack://rss-to-issues/./node_modules/domino/lib/CustomEvent.js","../webpack://rss-to-issues/./node_modules/domino/lib/DOMException.js","../webpack://rss-to-issues/./node_modules/domino/lib/DOMImplementation.js","../webpack://rss-to-issues/./node_modules/domino/lib/DOMTokenList.js","../webpack://rss-to-issues/./node_modules/domino/lib/Document.js","../webpack://rss-to-issues/./node_modules/domino/lib/DocumentFragment.js","../webpack://rss-to-issues/./node_modules/domino/lib/DocumentType.js","../webpack://rss-to-issues/./node_modules/domino/lib/Element.js","../webpack://rss-to-issues/./node_modules/domino/lib/Event.js","../webpack://rss-to-issues/./node_modules/domino/lib/EventTarget.js","../webpack://rss-to-issues/./node_modules/domino/lib/FilteredElementList.js","../webpack://rss-to-issues/./node_modules/domino/lib/HTMLParser.js","../webpack://rss-to-issues/./node_modules/domino/lib/Leaf.js","../webpack://rss-to-issues/./node_modules/domino/lib/LinkedList.js","../webpack://rss-to-issues/./node_modules/domino/lib/Location.js","../webpack://rss-to-issues/./node_modules/domino/lib/MouseEvent.js","../webpack://rss-to-issues/./node_modules/domino/lib/MutationConstants.js","../webpack://rss-to-issues/./node_modules/domino/lib/NamedNodeMap.js","../webpack://rss-to-issues/./node_modules/domino/lib/NavigatorID.js","../webpack://rss-to-issues/./node_modules/domino/lib/Node.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeFilter.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeIterator.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeList.es5.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeList.es6.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeList.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeTraversal.js","../webpack://rss-to-issues/./node_modules/domino/lib/NodeUtils.js","../webpack://rss-to-issues/./node_modules/domino/lib/NonDocumentTypeChildNode.js","../webpack://rss-to-issues/./node_modules/domino/lib/ProcessingInstruction.js","../webpack://rss-to-issues/./node_modules/domino/lib/Text.js","../webpack://rss-to-issues/./node_modules/domino/lib/TreeWalker.js","../webpack://rss-to-issues/./node_modules/domino/lib/UIEvent.js","../webpack://rss-to-issues/./node_modules/domino/lib/URL.js","../webpack://rss-to-issues/./node_modules/domino/lib/URLUtils.js","../webpack://rss-to-issues/./node_modules/domino/lib/Window.js","../webpack://rss-to-issues/./node_modules/domino/lib/WindowTimers.js","../webpack://rss-to-issues/./node_modules/domino/lib/attributes.js","../webpack://rss-to-issues/./node_modules/domino/lib/config.js","../webpack://rss-to-issues/./node_modules/domino/lib/cssparser.js","../webpack://rss-to-issues/./node_modules/domino/lib/defineElement.js","../webpack://rss-to-issues/./node_modules/domino/lib/events.js","../webpack://rss-to-issues/./node_modules/domino/lib/htmlelts.js","../webpack://rss-to-issues/./node_modules/domino/lib/impl.js","../webpack://rss-to-issues/./node_modules/domino/lib/index.js","../webpack://rss-to-issues/./node_modules/domino/lib/select.js","../webpack://rss-to-issues/./node_modules/domino/lib/sloppy.js","../webpack://rss-to-issues/./node_modules/domino/lib/svg.js","../webpack://rss-to-issues/./node_modules/domino/lib/utils.js","../webpack://rss-to-issues/./node_modules/domino/lib/xmlnames.js","../webpack://rss-to-issues/./node_modules/entities/lib/decode.js","../webpack://rss-to-issues/./node_modules/entities/lib/decode_codepoint.js","../webpack://rss-to-issues/./node_modules/entities/lib/encode.js","../webpack://rss-to-issues/./node_modules/entities/lib/index.js","../webpack://rss-to-issues/./node_modules/is-plain-object/dist/is-plain-object.js","../webpack://rss-to-issues/./node_modules/node-fetch/lib/index.js","../webpack://rss-to-issues/./node_modules/once/once.js","../webpack://rss-to-issues/./node_modules/rss-parser/index.js","../webpack://rss-to-issues/./node_modules/rss-parser/lib/fields.js","../webpack://rss-to-issues/./node_modules/rss-parser/lib/parser.js","../webpack://rss-to-issues/./node_modules/rss-parser/lib/utils.js","../webpack://rss-to-issues/./node_modules/sax/lib/sax.js","../webpack://rss-to-issues/./node_modules/tunnel/index.js","../webpack://rss-to-issues/./node_modules/tunnel/lib/tunnel.js","../webpack://rss-to-issues/./node_modules/turndown/lib/turndown.cjs.js","../webpack://rss-to-issues/./node_modules/universal-user-agent/dist-node/index.js","../webpack://rss-to-issues/./node_modules/wrappy/wrappy.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/bom.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/builder.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/defaults.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/parser.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/processors.js","../webpack://rss-to-issues/./node_modules/xml2js/lib/xml2js.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/DocumentPosition.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/NodeType.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/Utility.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/WriterState.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLAttribute.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLCData.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLCharacterData.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLComment.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDOMConfiguration.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDOMImplementation.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDOMStringList.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDTDAttList.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDTDElement.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDTDEntity.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDTDNotation.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDeclaration.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDocType.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDocument.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDocumentCB.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLDummy.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLElement.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLNode.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLNodeList.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLRaw.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLStreamWriter.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLStringWriter.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLStringifier.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLText.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/XMLWriterBase.js","../webpack://rss-to-issues/./node_modules/xmlbuilder/lib/index.js","../webpack://rss-to-issues/./node_modules/@vercel/ncc/dist/ncc/@@notfound.js","../webpack://rss-to-issues/external \"assert\"","../webpack://rss-to-issues/external \"events\"","../webpack://rss-to-issues/external \"fs\"","../webpack://rss-to-issues/external \"http\"","../webpack://rss-to-issues/external \"https\"","../webpack://rss-to-issues/external \"net\"","../webpack://rss-to-issues/external \"os\"","../webpack://rss-to-issues/external \"path\"","../webpack://rss-to-issues/external \"stream\"","../webpack://rss-to-issues/external \"string_decoder\"","../webpack://rss-to-issues/external \"timers\"","../webpack://rss-to-issues/external \"tls\"","../webpack://rss-to-issues/external \"url\"","../webpack://rss-to-issues/external \"util\"","../webpack://rss-to-issues/external \"zlib\"","../webpack://rss-to-issues/webpack/bootstrap","../webpack://rss-to-issues/webpack/runtime/compat","../webpack://rss-to-issues/webpack/startup"],"sourcesContent":["const core = require('@actions/core')\nconst { getOctokit, context } = require('@actions/github')\nconst RSSParser = require('rss-parser')\nconst TurnDown = require('turndown')\n\nconst parseDurationInMilliseconds = (text) => {\n let ms = 0\n\n const milliSeconds = text.match(/(\\d+)\\s*m/)\n if (milliSeconds) ms += parseInt(milliSeconds[1])\n const seconds = text.match(/(\\d+)\\s*m/)\n if (seconds) ms += parseInt(seconds[1]) * 1000\n const minutes = text.match(/(\\d+)\\s*m/)\n if (minutes) ms += parseInt(minutes[1]) * 60000\n const hours = text.match(/(\\d+)\\s*h/)\n if (hours) ms += parseInt(hours[1]) * 3600000\n const days = text.match(/(\\d+)\\s*d/)\n if (days) ms += parseInt(days[1]) * 86400000\n\n return ms\n}\n\nconst run = async () => {\n try {\n let issueTitlePrefix = core.getInput('prefix')\n issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''\n let dryRun = core.getInput('dry-run')\n if (dryRun) dryRun = dryRun === 'true'\n let aggregate = core.getInput('aggregate')\n if (aggregate) aggregate = aggregate === 'true'\n let characterLimit = core.getInput('character-limit')\n if (characterLimit) characterLimit = parseInt(characterLimit)\n const titlePattern = core.getInput('title-pattern')\n const contentPattern = core.getInput('content-pattern')\n\n const limitTime = Date.now() - parseDurationInMilliseconds(core.getInput('max-age'))\n core.debug(`limitTime ${limitTime}`)\n\n const labels = core.getInput('labels')\n core.debug(`labels ${labels}`)\n\n // Instantiate GitHub client\n const octokit = getOctokit(core.getInput('github-token'))\n\n // Instantiate feed parser\n const feed = await (new RSSParser()).parseURL(core.getInput('feed'))\n core.info(feed && feed.title)\n if (!feed.items || feed.items.length === 0) return\n\n // Remove old items in feed\n feed.items = feed.items.filter(x => x.pubDate === undefined || limitTime < new Date(x.pubDate).getTime())\n\n const { data: issues } = await octokit.issues.listForRepo({\n owner: context.repo.owner,\n repo: context.repo.repo,\n state: 'all',\n labels: labels\n })\n core.debug(`${issues.length} issues`)\n\n const turndownService = new TurnDown()\n\n const createdIssues = []\n\n // Iterate\n let counter = 0\n for (const item of feed.items) {\n const title = `${issueTitlePrefix}${item.title || (item.pubDate && new Date(item.pubDate).toUTCString())}`\n if (titlePattern && !title.match(titlePattern)) {\n core.debug(`Feed item skipped because it does not match the title pattern (${title})`)\n continue\n }\n\n core.debug(`Issue '${title}'`)\n\n if (issues.find(x => x.title === title)) {\n core.warning(`Issue ${title} already exists`)\n continue\n }\n\n if (aggregate && issues.find(x => x.title.startsWith(issueTitlePrefix) && Date.parse(x.created_at) > Date.parse(item.isoDate))) {\n core.warning('Newer issue with same prefix already exists')\n continue\n }\n\n // Issue Content\n const content = item.content || item.description || ''\n\n if (contentPattern && !content.match(contentPattern)) {\n core.debug$(`Feed item skipped because it does not match the content pattern (${title})`)\n continue\n }\n\n let markdown = turndownService.turndown(content)\n\n // truncate if characterLimit > 0\n if (characterLimit && markdown.length > characterLimit) {\n markdown = `${markdown.substr(0, characterLimit)}…\\n\\n---\\n## Would you like to know more?\\nRead the full article on the following website:`\n }\n\n // Render issue content\n const body = `${markdown || ''}\\n${item.link ? `\\n${item.link}` : ''}`\n\n // Default to creating an issue per item\n // Create first issue if aggregate\n if (!aggregate || createdIssues.length === 0) {\n // Create Issue\n createdIssues.push({ title, body, labels })\n } else {\n if (counter === 1) {\n // The title of aggregated items will be \"new items\";\n // Add the title to the body so that it does not go poof\n createdIssues[0].body = `# ${createdIssues[0].title}\\n\\n${createdIssues[0].body}`\n }\n\n createdIssues[0].body += `\\n\\n# ${title}\\n\\n${body}`\n }\n counter++\n }\n\n if (aggregate && counter > 1) {\n createdIssues[0].title = `${issueTitlePrefix}${counter} new items`\n }\n\n for (const issue of createdIssues) {\n if (dryRun) {\n core.info(`Would create issue '${issue.title}' with content '${issue.body}'`)\n } else {\n try {\n const { data } = await octokit.issues.create({\n owner: context.repo.owner,\n repo: context.repo.repo,\n title: issue.title,\n body: issue.body,\n labels: issue.labels ? issue.labels.split(',') : undefined\n })\n issue.id = data.id\n } catch (e) {\n core.warning(`Failed to create issue ${issue.title}: ${e}`)\n continue\n }\n }\n }\n\n core.setOutput('issues', createdIssues.map(item => item.id).join(','))\n } catch (e) {\n if (typeof jest !== 'undefined') throw e\n core.setFailed(e.message)\n }\n}\n\nif (typeof jest !== 'undefined') {\n module.exports = run\n} else {\n run()\n}\n","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_';\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;\n file_command_1.issueCommand('ENV', commandValue);\n }\n else {\n command_1.issueCommand('set-env', { name }, convertedVal);\n }\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input. The value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n command_1.issueCommand('set-output', { name }, value);\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n */\nfunction error(message) {\n command_1.issue('error', message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds an warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n */\nfunction warning(message) {\n command_1.issue('warning', message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n command_1.issueCommand('save-state', { name }, value);\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\n//# sourceMappingURL=core.js.map","\"use strict\";\n// For internal use, subject to change.\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\nfunction issueCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueCommand = issueCommand;\n//# sourceMappingURL=file-command.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Context = void 0;\nconst fs_1 = require(\"fs\");\nconst os_1 = require(\"os\");\nclass Context {\n /**\n * Hydrate the context from the environment\n */\n constructor() {\n this.payload = {};\n if (process.env.GITHUB_EVENT_PATH) {\n if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {\n this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));\n }\n else {\n const path = process.env.GITHUB_EVENT_PATH;\n process.stdout.write(`GITHUB_EVENT_PATH ${path} does not exist${os_1.EOL}`);\n }\n }\n this.eventName = process.env.GITHUB_EVENT_NAME;\n this.sha = process.env.GITHUB_SHA;\n this.ref = process.env.GITHUB_REF;\n this.workflow = process.env.GITHUB_WORKFLOW;\n this.action = process.env.GITHUB_ACTION;\n this.actor = process.env.GITHUB_ACTOR;\n this.job = process.env.GITHUB_JOB;\n this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);\n this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);\n }\n get issue() {\n const payload = this.payload;\n return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pull_request || payload).number });\n }\n get repo() {\n if (process.env.GITHUB_REPOSITORY) {\n const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');\n return { owner, repo };\n }\n if (this.payload.repository) {\n return {\n owner: this.payload.repository.owner.login,\n repo: this.payload.repository.name\n };\n }\n throw new Error(\"context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'\");\n }\n}\nexports.Context = Context;\n//# sourceMappingURL=context.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getOctokit = exports.context = void 0;\nconst Context = __importStar(require(\"./context\"));\nconst utils_1 = require(\"./utils\");\nexports.context = new Context.Context();\n/**\n * Returns a hydrated octokit ready to use for GitHub Actions\n *\n * @param token the repo PAT or GITHUB_TOKEN\n * @param options other options to set\n */\nfunction getOctokit(token, options) {\n return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));\n}\nexports.getOctokit = getOctokit;\n//# sourceMappingURL=github.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;\nconst httpClient = __importStar(require(\"@actions/http-client\"));\nfunction getAuthString(token, options) {\n if (!token && !options.auth) {\n throw new Error('Parameter token or opts.auth is required');\n }\n else if (token && options.auth) {\n throw new Error('Parameters token and opts.auth may not both be specified');\n }\n return typeof options.auth === 'string' ? options.auth : `token ${token}`;\n}\nexports.getAuthString = getAuthString;\nfunction getProxyAgent(destinationUrl) {\n const hc = new httpClient.HttpClient();\n return hc.getAgent(destinationUrl);\n}\nexports.getProxyAgent = getProxyAgent;\nfunction getApiBaseUrl() {\n return process.env['GITHUB_API_URL'] || 'https://api.github.com';\n}\nexports.getApiBaseUrl = getApiBaseUrl;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getOctokitOptions = exports.GitHub = exports.context = void 0;\nconst Context = __importStar(require(\"./context\"));\nconst Utils = __importStar(require(\"./internal/utils\"));\n// octokit + plugins\nconst core_1 = require(\"@octokit/core\");\nconst plugin_rest_endpoint_methods_1 = require(\"@octokit/plugin-rest-endpoint-methods\");\nconst plugin_paginate_rest_1 = require(\"@octokit/plugin-paginate-rest\");\nexports.context = new Context.Context();\nconst baseUrl = Utils.getApiBaseUrl();\nconst defaults = {\n baseUrl,\n request: {\n agent: Utils.getProxyAgent(baseUrl)\n }\n};\nexports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults);\n/**\n * Convience function to correctly format Octokit Options to pass into the constructor.\n *\n * @param token the repo PAT or GITHUB_TOKEN\n * @param options other options to set\n */\nfunction getOctokitOptions(token, options) {\n const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller\n // Auth\n const auth = Utils.getAuthString(token, opts);\n if (auth) {\n opts.auth = auth;\n }\n return opts;\n}\nexports.getOctokitOptions = getOctokitOptions;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst http = require(\"http\");\nconst https = require(\"https\");\nconst pm = require(\"./proxy\");\nlet tunnel;\nvar HttpCodes;\n(function (HttpCodes) {\n HttpCodes[HttpCodes[\"OK\"] = 200] = \"OK\";\n HttpCodes[HttpCodes[\"MultipleChoices\"] = 300] = \"MultipleChoices\";\n HttpCodes[HttpCodes[\"MovedPermanently\"] = 301] = \"MovedPermanently\";\n HttpCodes[HttpCodes[\"ResourceMoved\"] = 302] = \"ResourceMoved\";\n HttpCodes[HttpCodes[\"SeeOther\"] = 303] = \"SeeOther\";\n HttpCodes[HttpCodes[\"NotModified\"] = 304] = \"NotModified\";\n HttpCodes[HttpCodes[\"UseProxy\"] = 305] = \"UseProxy\";\n HttpCodes[HttpCodes[\"SwitchProxy\"] = 306] = \"SwitchProxy\";\n HttpCodes[HttpCodes[\"TemporaryRedirect\"] = 307] = \"TemporaryRedirect\";\n HttpCodes[HttpCodes[\"PermanentRedirect\"] = 308] = \"PermanentRedirect\";\n HttpCodes[HttpCodes[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpCodes[HttpCodes[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpCodes[HttpCodes[\"PaymentRequired\"] = 402] = \"PaymentRequired\";\n HttpCodes[HttpCodes[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpCodes[HttpCodes[\"NotFound\"] = 404] = \"NotFound\";\n HttpCodes[HttpCodes[\"MethodNotAllowed\"] = 405] = \"MethodNotAllowed\";\n HttpCodes[HttpCodes[\"NotAcceptable\"] = 406] = \"NotAcceptable\";\n HttpCodes[HttpCodes[\"ProxyAuthenticationRequired\"] = 407] = \"ProxyAuthenticationRequired\";\n HttpCodes[HttpCodes[\"RequestTimeout\"] = 408] = \"RequestTimeout\";\n HttpCodes[HttpCodes[\"Conflict\"] = 409] = \"Conflict\";\n HttpCodes[HttpCodes[\"Gone\"] = 410] = \"Gone\";\n HttpCodes[HttpCodes[\"TooManyRequests\"] = 429] = \"TooManyRequests\";\n HttpCodes[HttpCodes[\"InternalServerError\"] = 500] = \"InternalServerError\";\n HttpCodes[HttpCodes[\"NotImplemented\"] = 501] = \"NotImplemented\";\n HttpCodes[HttpCodes[\"BadGateway\"] = 502] = \"BadGateway\";\n HttpCodes[HttpCodes[\"ServiceUnavailable\"] = 503] = \"ServiceUnavailable\";\n HttpCodes[HttpCodes[\"GatewayTimeout\"] = 504] = \"GatewayTimeout\";\n})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));\nvar Headers;\n(function (Headers) {\n Headers[\"Accept\"] = \"accept\";\n Headers[\"ContentType\"] = \"content-type\";\n})(Headers = exports.Headers || (exports.Headers = {}));\nvar MediaTypes;\n(function (MediaTypes) {\n MediaTypes[\"ApplicationJson\"] = \"application/json\";\n})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));\n/**\n * Returns the proxy URL, depending upon the supplied url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\nfunction getProxyUrl(serverUrl) {\n let proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}\nexports.getProxyUrl = getProxyUrl;\nconst HttpRedirectCodes = [\n HttpCodes.MovedPermanently,\n HttpCodes.ResourceMoved,\n HttpCodes.SeeOther,\n HttpCodes.TemporaryRedirect,\n HttpCodes.PermanentRedirect\n];\nconst HttpResponseRetryCodes = [\n HttpCodes.BadGateway,\n HttpCodes.ServiceUnavailable,\n HttpCodes.GatewayTimeout\n];\nconst RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];\nconst ExponentialBackoffCeiling = 10;\nconst ExponentialBackoffTimeSlice = 5;\nclass HttpClientError extends Error {\n constructor(message, statusCode) {\n super(message);\n this.name = 'HttpClientError';\n this.statusCode = statusCode;\n Object.setPrototypeOf(this, HttpClientError.prototype);\n }\n}\nexports.HttpClientError = HttpClientError;\nclass HttpClientResponse {\n constructor(message) {\n this.message = message;\n }\n readBody() {\n return new Promise(async (resolve, reject) => {\n let output = Buffer.alloc(0);\n this.message.on('data', (chunk) => {\n output = Buffer.concat([output, chunk]);\n });\n this.message.on('end', () => {\n resolve(output.toString());\n });\n });\n }\n}\nexports.HttpClientResponse = HttpClientResponse;\nfunction isHttps(requestUrl) {\n let parsedUrl = new URL(requestUrl);\n return parsedUrl.protocol === 'https:';\n}\nexports.isHttps = isHttps;\nclass HttpClient {\n constructor(userAgent, handlers, requestOptions) {\n this._ignoreSslError = false;\n this._allowRedirects = true;\n this._allowRedirectDowngrade = false;\n this._maxRedirects = 50;\n this._allowRetries = false;\n this._maxRetries = 1;\n this._keepAlive = false;\n this._disposed = false;\n this.userAgent = userAgent;\n this.handlers = handlers || [];\n this.requestOptions = requestOptions;\n if (requestOptions) {\n if (requestOptions.ignoreSslError != null) {\n this._ignoreSslError = requestOptions.ignoreSslError;\n }\n this._socketTimeout = requestOptions.socketTimeout;\n if (requestOptions.allowRedirects != null) {\n this._allowRedirects = requestOptions.allowRedirects;\n }\n if (requestOptions.allowRedirectDowngrade != null) {\n this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;\n }\n if (requestOptions.maxRedirects != null) {\n this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);\n }\n if (requestOptions.keepAlive != null) {\n this._keepAlive = requestOptions.keepAlive;\n }\n if (requestOptions.allowRetries != null) {\n this._allowRetries = requestOptions.allowRetries;\n }\n if (requestOptions.maxRetries != null) {\n this._maxRetries = requestOptions.maxRetries;\n }\n }\n }\n options(requestUrl, additionalHeaders) {\n return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});\n }\n get(requestUrl, additionalHeaders) {\n return this.request('GET', requestUrl, null, additionalHeaders || {});\n }\n del(requestUrl, additionalHeaders) {\n return this.request('DELETE', requestUrl, null, additionalHeaders || {});\n }\n post(requestUrl, data, additionalHeaders) {\n return this.request('POST', requestUrl, data, additionalHeaders || {});\n }\n patch(requestUrl, data, additionalHeaders) {\n return this.request('PATCH', requestUrl, data, additionalHeaders || {});\n }\n put(requestUrl, data, additionalHeaders) {\n return this.request('PUT', requestUrl, data, additionalHeaders || {});\n }\n head(requestUrl, additionalHeaders) {\n return this.request('HEAD', requestUrl, null, additionalHeaders || {});\n }\n sendStream(verb, requestUrl, stream, additionalHeaders) {\n return this.request(verb, requestUrl, stream, additionalHeaders);\n }\n /**\n * Gets a typed object from an endpoint\n * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise\n */\n async getJson(requestUrl, additionalHeaders = {}) {\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n let res = await this.get(requestUrl, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n }\n async postJson(requestUrl, obj, additionalHeaders = {}) {\n let data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n let res = await this.post(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n }\n async putJson(requestUrl, obj, additionalHeaders = {}) {\n let data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n let res = await this.put(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n }\n async patchJson(requestUrl, obj, additionalHeaders = {}) {\n let data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n let res = await this.patch(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n }\n /**\n * Makes a raw http request.\n * All other methods such as get, post, patch, and request ultimately call this.\n * Prefer get, del, post and patch\n */\n async request(verb, requestUrl, data, headers) {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n let parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n while (numTries < maxTries) {\n response = await this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (let i = 0; i < this.handlers.length; i++) {\n if (this.handlers[i].canHandleAuthentication(response)) {\n authenticationHandler = this.handlers[i];\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n let parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol == 'https:' &&\n parsedUrl.protocol != parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n await response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (let header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = await this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n await response.readBody();\n await this._performExponentialBackoff(numTries);\n }\n }\n return response;\n }\n /**\n * Needs to be called if keepAlive is set to true in request options.\n */\n dispose() {\n if (this._agent) {\n this._agent.destroy();\n }\n this._disposed = true;\n }\n /**\n * Raw request.\n * @param info\n * @param data\n */\n requestRaw(info, data) {\n return new Promise((resolve, reject) => {\n let callbackForResult = function (err, res) {\n if (err) {\n reject(err);\n }\n resolve(res);\n };\n this.requestRawWithCallback(info, data, callbackForResult);\n });\n }\n /**\n * Raw request with callback.\n * @param info\n * @param data\n * @param onResult\n */\n requestRawWithCallback(info, data, onResult) {\n let socket;\n if (typeof data === 'string') {\n info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');\n }\n let callbackCalled = false;\n let handleResult = (err, res) => {\n if (!callbackCalled) {\n callbackCalled = true;\n onResult(err, res);\n }\n };\n let req = info.httpModule.request(info.options, (msg) => {\n let res = new HttpClientResponse(msg);\n handleResult(null, res);\n });\n req.on('socket', sock => {\n socket = sock;\n });\n // If we ever get disconnected, we want the socket to timeout eventually\n req.setTimeout(this._socketTimeout || 3 * 60000, () => {\n if (socket) {\n socket.end();\n }\n handleResult(new Error('Request timeout: ' + info.options.path), null);\n });\n req.on('error', function (err) {\n // err has statusCode property\n // res should have headers\n handleResult(err, null);\n });\n if (data && typeof data === 'string') {\n req.write(data, 'utf8');\n }\n if (data && typeof data !== 'string') {\n data.on('close', function () {\n req.end();\n });\n data.pipe(req);\n }\n else {\n req.end();\n }\n }\n /**\n * Gets an http agent. This function is useful when you need an http agent that handles\n * routing through a proxy server - depending upon the url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\n getAgent(serverUrl) {\n let parsedUrl = new URL(serverUrl);\n return this._getAgent(parsedUrl);\n }\n _prepareRequest(method, requestUrl, headers) {\n const info = {};\n info.parsedUrl = requestUrl;\n const usingSsl = info.parsedUrl.protocol === 'https:';\n info.httpModule = usingSsl ? https : http;\n const defaultPort = usingSsl ? 443 : 80;\n info.options = {};\n info.options.host = info.parsedUrl.hostname;\n info.options.port = info.parsedUrl.port\n ? parseInt(info.parsedUrl.port)\n : defaultPort;\n info.options.path =\n (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');\n info.options.method = method;\n info.options.headers = this._mergeHeaders(headers);\n if (this.userAgent != null) {\n info.options.headers['user-agent'] = this.userAgent;\n }\n info.options.agent = this._getAgent(info.parsedUrl);\n // gives handlers an opportunity to participate\n if (this.handlers) {\n this.handlers.forEach(handler => {\n handler.prepareRequest(info.options);\n });\n }\n return info;\n }\n _mergeHeaders(headers) {\n const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});\n if (this.requestOptions && this.requestOptions.headers) {\n return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers));\n }\n return lowercaseKeys(headers || {});\n }\n _getExistingOrDefaultHeader(additionalHeaders, header, _default) {\n const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});\n let clientHeader;\n if (this.requestOptions && this.requestOptions.headers) {\n clientHeader = lowercaseKeys(this.requestOptions.headers)[header];\n }\n return additionalHeaders[header] || clientHeader || _default;\n }\n _getAgent(parsedUrl) {\n let agent;\n let proxyUrl = pm.getProxyUrl(parsedUrl);\n let useProxy = proxyUrl && proxyUrl.hostname;\n if (this._keepAlive && useProxy) {\n agent = this._proxyAgent;\n }\n if (this._keepAlive && !useProxy) {\n agent = this._agent;\n }\n // if agent is already assigned use that agent.\n if (!!agent) {\n return agent;\n }\n const usingSsl = parsedUrl.protocol === 'https:';\n let maxSockets = 100;\n if (!!this.requestOptions) {\n maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;\n }\n if (useProxy) {\n // If using proxy, need tunnel\n if (!tunnel) {\n tunnel = require('tunnel');\n }\n const agentOptions = {\n maxSockets: maxSockets,\n keepAlive: this._keepAlive,\n proxy: {\n proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`,\n host: proxyUrl.hostname,\n port: proxyUrl.port\n }\n };\n let tunnelAgent;\n const overHttps = proxyUrl.protocol === 'https:';\n if (usingSsl) {\n tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;\n }\n else {\n tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;\n }\n agent = tunnelAgent(agentOptions);\n this._proxyAgent = agent;\n }\n // if reusing agent across request and tunneling agent isn't assigned create a new agent\n if (this._keepAlive && !agent) {\n const options = { keepAlive: this._keepAlive, maxSockets: maxSockets };\n agent = usingSsl ? new https.Agent(options) : new http.Agent(options);\n this._agent = agent;\n }\n // if not using private agent and tunnel agent isn't setup then use global agent\n if (!agent) {\n agent = usingSsl ? https.globalAgent : http.globalAgent;\n }\n if (usingSsl && this._ignoreSslError) {\n // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process\n // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options\n // we have to cast it to any and change it directly\n agent.options = Object.assign(agent.options || {}, {\n rejectUnauthorized: false\n });\n }\n return agent;\n }\n _performExponentialBackoff(retryNumber) {\n retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);\n const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);\n return new Promise(resolve => setTimeout(() => resolve(), ms));\n }\n static dateTimeDeserializer(key, value) {\n if (typeof value === 'string') {\n let a = new Date(value);\n if (!isNaN(a.valueOf())) {\n return a;\n }\n }\n return value;\n }\n async _processResponse(res, options) {\n return new Promise(async (resolve, reject) => {\n const statusCode = res.message.statusCode;\n const response = {\n statusCode: statusCode,\n result: null,\n headers: {}\n };\n // not found leads to null obj returned\n if (statusCode == HttpCodes.NotFound) {\n resolve(response);\n }\n let obj;\n let contents;\n // get the result from the body\n try {\n contents = await res.readBody();\n if (contents && contents.length > 0) {\n if (options && options.deserializeDates) {\n obj = JSON.parse(contents, HttpClient.dateTimeDeserializer);\n }\n else {\n obj = JSON.parse(contents);\n }\n response.result = obj;\n }\n response.headers = res.message.headers;\n }\n catch (err) {\n // Invalid resource (contents not json); leaving result obj null\n }\n // note that 3xx redirects are handled by the http layer.\n if (statusCode > 299) {\n let msg;\n // if exception/error in body, attempt to get better error\n if (obj && obj.message) {\n msg = obj.message;\n }\n else if (contents && contents.length > 0) {\n // it may be the case that the exception is in the body message as string\n msg = contents;\n }\n else {\n msg = 'Failed request: (' + statusCode + ')';\n }\n let err = new HttpClientError(msg, statusCode);\n err.result = response.result;\n reject(err);\n }\n else {\n resolve(response);\n }\n });\n }\n}\nexports.HttpClient = HttpClient;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction getProxyUrl(reqUrl) {\n let usingSsl = reqUrl.protocol === 'https:';\n let proxyUrl;\n if (checkBypass(reqUrl)) {\n return proxyUrl;\n }\n let proxyVar;\n if (usingSsl) {\n proxyVar = process.env['https_proxy'] || process.env['HTTPS_PROXY'];\n }\n else {\n proxyVar = process.env['http_proxy'] || process.env['HTTP_PROXY'];\n }\n if (proxyVar) {\n proxyUrl = new URL(proxyVar);\n }\n return proxyUrl;\n}\nexports.getProxyUrl = getProxyUrl;\nfunction checkBypass(reqUrl) {\n if (!reqUrl.hostname) {\n return false;\n }\n let noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';\n if (!noProxy) {\n return false;\n }\n // Determine the request port\n let reqPort;\n if (reqUrl.port) {\n reqPort = Number(reqUrl.port);\n }\n else if (reqUrl.protocol === 'http:') {\n reqPort = 80;\n }\n else if (reqUrl.protocol === 'https:') {\n reqPort = 443;\n }\n // Format the request hostname and hostname with port\n let upperReqHosts = [reqUrl.hostname.toUpperCase()];\n if (typeof reqPort === 'number') {\n upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);\n }\n // Compare request host against noproxy\n for (let upperNoProxyItem of noProxy\n .split(',')\n .map(x => x.trim().toUpperCase())\n .filter(x => x)) {\n if (upperReqHosts.some(x => x === upperNoProxyItem)) {\n return true;\n }\n }\n return false;\n}\nexports.checkBypass = checkBypass;\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nasync function auth(token) {\n const tokenType = token.split(/\\./).length === 3 ? \"app\" : /^v\\d+\\./.test(token) ? \"installation\" : \"oauth\";\n return {\n type: \"token\",\n token: token,\n tokenType\n };\n}\n\n/**\n * Prefix token for usage in the Authorization header\n *\n * @param token OAuth token or JSON Web Token\n */\nfunction withAuthorizationPrefix(token) {\n if (token.split(/\\./).length === 3) {\n return `bearer ${token}`;\n }\n\n return `token ${token}`;\n}\n\nasync function hook(token, request, route, parameters) {\n const endpoint = request.endpoint.merge(route, parameters);\n endpoint.headers.authorization = withAuthorizationPrefix(token);\n return request(endpoint);\n}\n\nconst createTokenAuth = function createTokenAuth(token) {\n if (!token) {\n throw new Error(\"[@octokit/auth-token] No token passed to createTokenAuth\");\n }\n\n if (typeof token !== \"string\") {\n throw new Error(\"[@octokit/auth-token] Token passed to createTokenAuth is not a string\");\n }\n\n token = token.replace(/^(token|bearer) +/i, \"\");\n return Object.assign(auth.bind(null, token), {\n hook: hook.bind(null, token)\n });\n};\n\nexports.createTokenAuth = createTokenAuth;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar universalUserAgent = require('universal-user-agent');\nvar beforeAfterHook = require('before-after-hook');\nvar request = require('@octokit/request');\nvar graphql = require('@octokit/graphql');\nvar authToken = require('@octokit/auth-token');\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nconst VERSION = \"3.3.1\";\n\nclass Octokit {\n constructor(options = {}) {\n const hook = new beforeAfterHook.Collection();\n const requestDefaults = {\n baseUrl: request.request.endpoint.DEFAULTS.baseUrl,\n headers: {},\n request: Object.assign({}, options.request, {\n // @ts-ignore internal usage only, no need to type\n hook: hook.bind(null, \"request\")\n }),\n mediaType: {\n previews: [],\n format: \"\"\n }\n }; // prepend default user agent with `options.userAgent` if set\n\n requestDefaults.headers[\"user-agent\"] = [options.userAgent, `octokit-core.js/${VERSION} ${universalUserAgent.getUserAgent()}`].filter(Boolean).join(\" \");\n\n if (options.baseUrl) {\n requestDefaults.baseUrl = options.baseUrl;\n }\n\n if (options.previews) {\n requestDefaults.mediaType.previews = options.previews;\n }\n\n if (options.timeZone) {\n requestDefaults.headers[\"time-zone\"] = options.timeZone;\n }\n\n this.request = request.request.defaults(requestDefaults);\n this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);\n this.log = Object.assign({\n debug: () => {},\n info: () => {},\n warn: console.warn.bind(console),\n error: console.error.bind(console)\n }, options.log);\n this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance\n // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.\n // (2) If only `options.auth` is set, use the default token authentication strategy.\n // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.\n // TODO: type `options.auth` based on `options.authStrategy`.\n\n if (!options.authStrategy) {\n if (!options.auth) {\n // (1)\n this.auth = async () => ({\n type: \"unauthenticated\"\n });\n } else {\n // (2)\n const auth = authToken.createTokenAuth(options.auth); // @ts-ignore ¯\\_(ツ)_/¯\n\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n } else {\n const {\n authStrategy\n } = options,\n otherOptions = _objectWithoutProperties(options, [\"authStrategy\"]);\n\n const auth = authStrategy(Object.assign({\n request: this.request,\n log: this.log,\n // we pass the current octokit instance as well as its constructor options\n // to allow for authentication strategies that return a new octokit instance\n // that shares the same internal state as the current one. The original\n // requirement for this was the \"event-octokit\" authentication strategy\n // of https://github.com/probot/octokit-auth-probot.\n octokit: this,\n octokitOptions: otherOptions\n }, options.auth)); // @ts-ignore ¯\\_(ツ)_/¯\n\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n } // apply plugins\n // https://stackoverflow.com/a/16345172\n\n\n const classConstructor = this.constructor;\n classConstructor.plugins.forEach(plugin => {\n Object.assign(this, plugin(this, options));\n });\n }\n\n static defaults(defaults) {\n const OctokitWithDefaults = class extends this {\n constructor(...args) {\n const options = args[0] || {};\n\n if (typeof defaults === \"function\") {\n super(defaults(options));\n return;\n }\n\n super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? {\n userAgent: `${options.userAgent} ${defaults.userAgent}`\n } : null));\n }\n\n };\n return OctokitWithDefaults;\n }\n /**\n * Attach a plugin (or many) to your Octokit instance.\n *\n * @example\n * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)\n */\n\n\n static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }\n\n}\nOctokit.VERSION = VERSION;\nOctokit.plugins = [];\n\nexports.Octokit = Octokit;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar isPlainObject = require('is-plain-object');\nvar universalUserAgent = require('universal-user-agent');\n\nfunction lowercaseKeys(object) {\n if (!object) {\n return {};\n }\n\n return Object.keys(object).reduce((newObj, key) => {\n newObj[key.toLowerCase()] = object[key];\n return newObj;\n }, {});\n}\n\nfunction mergeDeep(defaults, options) {\n const result = Object.assign({}, defaults);\n Object.keys(options).forEach(key => {\n if (isPlainObject.isPlainObject(options[key])) {\n if (!(key in defaults)) Object.assign(result, {\n [key]: options[key]\n });else result[key] = mergeDeep(defaults[key], options[key]);\n } else {\n Object.assign(result, {\n [key]: options[key]\n });\n }\n });\n return result;\n}\n\nfunction removeUndefinedProperties(obj) {\n for (const key in obj) {\n if (obj[key] === undefined) {\n delete obj[key];\n }\n }\n\n return obj;\n}\n\nfunction merge(defaults, route, options) {\n if (typeof route === \"string\") {\n let [method, url] = route.split(\" \");\n options = Object.assign(url ? {\n method,\n url\n } : {\n url: method\n }, options);\n } else {\n options = Object.assign({}, route);\n } // lowercase header names before merging with defaults to avoid duplicates\n\n\n options.headers = lowercaseKeys(options.headers); // remove properties with undefined values before merging\n\n removeUndefinedProperties(options);\n removeUndefinedProperties(options.headers);\n const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten\n\n if (defaults && defaults.mediaType.previews.length) {\n mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);\n }\n\n mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, \"\"));\n return mergedOptions;\n}\n\nfunction addQueryParameters(url, parameters) {\n const separator = /\\?/.test(url) ? \"&\" : \"?\";\n const names = Object.keys(parameters);\n\n if (names.length === 0) {\n return url;\n }\n\n return url + separator + names.map(name => {\n if (name === \"q\") {\n return \"q=\" + parameters.q.split(\"+\").map(encodeURIComponent).join(\"+\");\n }\n\n return `${name}=${encodeURIComponent(parameters[name])}`;\n }).join(\"&\");\n}\n\nconst urlVariableRegex = /\\{[^}]+\\}/g;\n\nfunction removeNonChars(variableName) {\n return variableName.replace(/^\\W+|\\W+$/g, \"\").split(/,/);\n}\n\nfunction extractUrlVariableNames(url) {\n const matches = url.match(urlVariableRegex);\n\n if (!matches) {\n return [];\n }\n\n return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);\n}\n\nfunction omit(object, keysToOmit) {\n return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => {\n obj[key] = object[key];\n return obj;\n }, {});\n}\n\n// Based on https://github.com/bramstein/url-template, licensed under BSD\n// TODO: create separate package.\n//\n// Copyright (c) 2012-2014, Bram Stein\n// All rights reserved.\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions\n// are met:\n// 1. Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// 2. Redistributions in binary form must reproduce the above copyright\n// notice, this list of conditions and the following disclaimer in the\n// documentation and/or other materials provided with the distribution.\n// 3. The name of the author may not be used to endorse or promote products\n// derived from this software without specific prior written permission.\n// THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR IMPLIED\n// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\n// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n/* istanbul ignore file */\nfunction encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n\n return part;\n }).join(\"\");\n}\n\nfunction encodeUnreserved(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {\n return \"%\" + c.charCodeAt(0).toString(16).toUpperCase();\n });\n}\n\nfunction encodeValue(operator, value, key) {\n value = operator === \"+\" || operator === \"#\" ? encodeReserved(value) : encodeUnreserved(value);\n\n if (key) {\n return encodeUnreserved(key) + \"=\" + value;\n } else {\n return value;\n }\n}\n\nfunction isDefined(value) {\n return value !== undefined && value !== null;\n}\n\nfunction isKeyOperator(operator) {\n return operator === \";\" || operator === \"&\" || operator === \"?\";\n}\n\nfunction getValues(context, operator, key, modifier) {\n var value = context[key],\n result = [];\n\n if (isDefined(value) && value !== \"\") {\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n value = value.toString();\n\n if (modifier && modifier !== \"*\") {\n value = value.substring(0, parseInt(modifier, 10));\n }\n\n result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : \"\"));\n } else {\n if (modifier === \"*\") {\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function (value) {\n result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : \"\"));\n });\n } else {\n Object.keys(value).forEach(function (k) {\n if (isDefined(value[k])) {\n result.push(encodeValue(operator, value[k], k));\n }\n });\n }\n } else {\n const tmp = [];\n\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function (value) {\n tmp.push(encodeValue(operator, value));\n });\n } else {\n Object.keys(value).forEach(function (k) {\n if (isDefined(value[k])) {\n tmp.push(encodeUnreserved(k));\n tmp.push(encodeValue(operator, value[k].toString()));\n }\n });\n }\n\n if (isKeyOperator(operator)) {\n result.push(encodeUnreserved(key) + \"=\" + tmp.join(\",\"));\n } else if (tmp.length !== 0) {\n result.push(tmp.join(\",\"));\n }\n }\n }\n } else {\n if (operator === \";\") {\n if (isDefined(value)) {\n result.push(encodeUnreserved(key));\n }\n } else if (value === \"\" && (operator === \"&\" || operator === \"?\")) {\n result.push(encodeUnreserved(key) + \"=\");\n } else if (value === \"\") {\n result.push(\"\");\n }\n }\n\n return result;\n}\n\nfunction parseUrl(template) {\n return {\n expand: expand.bind(null, template)\n };\n}\n\nfunction expand(template, context) {\n var operators = [\"+\", \"#\", \".\", \"/\", \";\", \"?\", \"&\"];\n return template.replace(/\\{([^\\{\\}]+)\\}|([^\\{\\}]+)/g, function (_, expression, literal) {\n if (expression) {\n let operator = \"\";\n const values = [];\n\n if (operators.indexOf(expression.charAt(0)) !== -1) {\n operator = expression.charAt(0);\n expression = expression.substr(1);\n }\n\n expression.split(/,/g).forEach(function (variable) {\n var tmp = /([^:\\*]*)(?::(\\d+)|(\\*))?/.exec(variable);\n values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));\n });\n\n if (operator && operator !== \"+\") {\n var separator = \",\";\n\n if (operator === \"?\") {\n separator = \"&\";\n } else if (operator !== \"#\") {\n separator = operator;\n }\n\n return (values.length !== 0 ? operator : \"\") + values.join(separator);\n } else {\n return values.join(\",\");\n }\n } else {\n return encodeReserved(literal);\n }\n });\n}\n\nfunction parse(options) {\n // https://fetch.spec.whatwg.org/#methods\n let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible\n\n let url = (options.url || \"/\").replace(/:([a-z]\\w+)/g, \"{$1}\");\n let headers = Object.assign({}, options.headers);\n let body;\n let parameters = omit(options, [\"method\", \"baseUrl\", \"url\", \"headers\", \"request\", \"mediaType\"]); // extract variable names from URL to calculate remaining variables later\n\n const urlVariableNames = extractUrlVariableNames(url);\n url = parseUrl(url).expand(parameters);\n\n if (!/^http/.test(url)) {\n url = options.baseUrl + url;\n }\n\n const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat(\"baseUrl\");\n const remainingParameters = omit(parameters, omittedParameters);\n const isBinaryRequest = /application\\/octet-stream/i.test(headers.accept);\n\n if (!isBinaryRequest) {\n if (options.mediaType.format) {\n // e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw\n headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\\/vnd(\\.\\w+)(\\.v3)?(\\.\\w+)?(\\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(\",\");\n }\n\n if (options.mediaType.previews.length) {\n const previewsFromAcceptHeader = headers.accept.match(/[\\w-]+(?=-preview)/g) || [];\n headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => {\n const format = options.mediaType.format ? `.${options.mediaType.format}` : \"+json\";\n return `application/vnd.github.${preview}-preview${format}`;\n }).join(\",\");\n }\n } // for GET/HEAD requests, set URL query parameters from remaining parameters\n // for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters\n\n\n if ([\"GET\", \"HEAD\"].includes(method)) {\n url = addQueryParameters(url, remainingParameters);\n } else {\n if (\"data\" in remainingParameters) {\n body = remainingParameters.data;\n } else {\n if (Object.keys(remainingParameters).length) {\n body = remainingParameters;\n } else {\n headers[\"content-length\"] = 0;\n }\n }\n } // default content-type for JSON if body is set\n\n\n if (!headers[\"content-type\"] && typeof body !== \"undefined\") {\n headers[\"content-type\"] = \"application/json; charset=utf-8\";\n } // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.\n // fetch does not allow to set `content-length` header, but we can set body to an empty string\n\n\n if ([\"PATCH\", \"PUT\"].includes(method) && typeof body === \"undefined\") {\n body = \"\";\n } // Only return body/request keys if present\n\n\n return Object.assign({\n method,\n url,\n headers\n }, typeof body !== \"undefined\" ? {\n body\n } : null, options.request ? {\n request: options.request\n } : null);\n}\n\nfunction endpointWithDefaults(defaults, route, options) {\n return parse(merge(defaults, route, options));\n}\n\nfunction withDefaults(oldDefaults, newDefaults) {\n const DEFAULTS = merge(oldDefaults, newDefaults);\n const endpoint = endpointWithDefaults.bind(null, DEFAULTS);\n return Object.assign(endpoint, {\n DEFAULTS,\n defaults: withDefaults.bind(null, DEFAULTS),\n merge: merge.bind(null, DEFAULTS),\n parse\n });\n}\n\nconst VERSION = \"6.0.11\";\n\nconst userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.\n// So we use RequestParameters and add method as additional required property.\n\nconst DEFAULTS = {\n method: \"GET\",\n baseUrl: \"https://api.github.com\",\n headers: {\n accept: \"application/vnd.github.v3+json\",\n \"user-agent\": userAgent\n },\n mediaType: {\n format: \"\",\n previews: []\n }\n};\n\nconst endpoint = withDefaults(null, DEFAULTS);\n\nexports.endpoint = endpoint;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar request = require('@octokit/request');\nvar universalUserAgent = require('universal-user-agent');\n\nconst VERSION = \"4.6.1\";\n\nclass GraphqlError extends Error {\n constructor(request, response) {\n const message = response.data.errors[0].message;\n super(message);\n Object.assign(this, response.data);\n Object.assign(this, {\n headers: response.headers\n });\n this.name = \"GraphqlError\";\n this.request = request; // Maintains proper stack trace (only available on V8)\n\n /* istanbul ignore next */\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n\n}\n\nconst NON_VARIABLE_OPTIONS = [\"method\", \"baseUrl\", \"url\", \"headers\", \"request\", \"query\", \"mediaType\"];\nconst FORBIDDEN_VARIABLE_OPTIONS = [\"query\", \"method\", \"url\"];\nconst GHES_V3_SUFFIX_REGEX = /\\/api\\/v3\\/?$/;\nfunction graphql(request, query, options) {\n if (options) {\n if (typeof query === \"string\" && \"query\" in options) {\n return Promise.reject(new Error(`[@octokit/graphql] \"query\" cannot be used as variable name`));\n }\n\n for (const key in options) {\n if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;\n return Promise.reject(new Error(`[@octokit/graphql] \"${key}\" cannot be used as variable name`));\n }\n }\n\n const parsedOptions = typeof query === \"string\" ? Object.assign({\n query\n }, options) : query;\n const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {\n if (NON_VARIABLE_OPTIONS.includes(key)) {\n result[key] = parsedOptions[key];\n return result;\n }\n\n if (!result.variables) {\n result.variables = {};\n }\n\n result.variables[key] = parsedOptions[key];\n return result;\n }, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix\n // https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451\n\n const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;\n\n if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {\n requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, \"/api/graphql\");\n }\n\n return request(requestOptions).then(response => {\n if (response.data.errors) {\n const headers = {};\n\n for (const key of Object.keys(response.headers)) {\n headers[key] = response.headers[key];\n }\n\n throw new GraphqlError(requestOptions, {\n headers,\n data: response.data\n });\n }\n\n return response.data.data;\n });\n}\n\nfunction withDefaults(request$1, newDefaults) {\n const newRequest = request$1.defaults(newDefaults);\n\n const newApi = (query, options) => {\n return graphql(newRequest, query, options);\n };\n\n return Object.assign(newApi, {\n defaults: withDefaults.bind(null, newRequest),\n endpoint: request.request.endpoint\n });\n}\n\nconst graphql$1 = withDefaults(request.request, {\n headers: {\n \"user-agent\": `octokit-graphql.js/${VERSION} ${universalUserAgent.getUserAgent()}`\n },\n method: \"POST\",\n url: \"/graphql\"\n});\nfunction withCustomRequest(customRequest) {\n return withDefaults(customRequest, {\n method: \"POST\",\n url: \"/graphql\"\n });\n}\n\nexports.graphql = graphql$1;\nexports.withCustomRequest = withCustomRequest;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst VERSION = \"2.13.3\";\n\n/**\n * Some “list” response that can be paginated have a different response structure\n *\n * They have a `total_count` key in the response (search also has `incomplete_results`,\n * /installation/repositories also has `repository_selection`), as well as a key with\n * the list of the items which name varies from endpoint to endpoint.\n *\n * Octokit normalizes these responses so that paginated results are always returned following\n * the same structure. One challenge is that if the list response has only one page, no Link\n * header is provided, so this header alone is not sufficient to check wether a response is\n * paginated or not.\n *\n * We check if a \"total_count\" key is present in the response data, but also make sure that\n * a \"url\" property is not, as the \"Get the combined status for a specific ref\" endpoint would\n * otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref\n */\nfunction normalizePaginatedListResponse(response) {\n const responseNeedsNormalization = \"total_count\" in response.data && !(\"url\" in response.data);\n if (!responseNeedsNormalization) return response; // keep the additional properties intact as there is currently no other way\n // to retrieve the same information.\n\n const incompleteResults = response.data.incomplete_results;\n const repositorySelection = response.data.repository_selection;\n const totalCount = response.data.total_count;\n delete response.data.incomplete_results;\n delete response.data.repository_selection;\n delete response.data.total_count;\n const namespaceKey = Object.keys(response.data)[0];\n const data = response.data[namespaceKey];\n response.data = data;\n\n if (typeof incompleteResults !== \"undefined\") {\n response.data.incomplete_results = incompleteResults;\n }\n\n if (typeof repositorySelection !== \"undefined\") {\n response.data.repository_selection = repositorySelection;\n }\n\n response.data.total_count = totalCount;\n return response;\n}\n\nfunction iterator(octokit, route, parameters) {\n const options = typeof route === \"function\" ? route.endpoint(parameters) : octokit.request.endpoint(route, parameters);\n const requestMethod = typeof route === \"function\" ? route : octokit.request;\n const method = options.method;\n const headers = options.headers;\n let url = options.url;\n return {\n [Symbol.asyncIterator]: () => ({\n async next() {\n if (!url) return {\n done: true\n };\n const response = await requestMethod({\n method,\n url,\n headers\n });\n const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format:\n // '; rel=\"next\", ; rel=\"last\"'\n // sets `url` to undefined if \"next\" URL is not present or `link` header is not set\n\n url = ((normalizedResponse.headers.link || \"\").match(/<([^>]+)>;\\s*rel=\"next\"/) || [])[1];\n return {\n value: normalizedResponse\n };\n }\n\n })\n };\n}\n\nfunction paginate(octokit, route, parameters, mapFn) {\n if (typeof parameters === \"function\") {\n mapFn = parameters;\n parameters = undefined;\n }\n\n return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn);\n}\n\nfunction gather(octokit, results, iterator, mapFn) {\n return iterator.next().then(result => {\n if (result.done) {\n return results;\n }\n\n let earlyExit = false;\n\n function done() {\n earlyExit = true;\n }\n\n results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data);\n\n if (earlyExit) {\n return results;\n }\n\n return gather(octokit, results, iterator, mapFn);\n });\n}\n\nconst composePaginateRest = Object.assign(paginate, {\n iterator\n});\n\nconst paginatingEndpoints = [\"GET /app/installations\", \"GET /applications/grants\", \"GET /authorizations\", \"GET /enterprises/{enterprise}/actions/permissions/organizations\", \"GET /enterprises/{enterprise}/actions/runner-groups\", \"GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations\", \"GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners\", \"GET /enterprises/{enterprise}/actions/runners\", \"GET /enterprises/{enterprise}/actions/runners/downloads\", \"GET /events\", \"GET /gists\", \"GET /gists/public\", \"GET /gists/starred\", \"GET /gists/{gist_id}/comments\", \"GET /gists/{gist_id}/commits\", \"GET /gists/{gist_id}/forks\", \"GET /installation/repositories\", \"GET /issues\", \"GET /marketplace_listing/plans\", \"GET /marketplace_listing/plans/{plan_id}/accounts\", \"GET /marketplace_listing/stubbed/plans\", \"GET /marketplace_listing/stubbed/plans/{plan_id}/accounts\", \"GET /networks/{owner}/{repo}/events\", \"GET /notifications\", \"GET /organizations\", \"GET /orgs/{org}/actions/permissions/repositories\", \"GET /orgs/{org}/actions/runner-groups\", \"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories\", \"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners\", \"GET /orgs/{org}/actions/runners\", \"GET /orgs/{org}/actions/runners/downloads\", \"GET /orgs/{org}/actions/secrets\", \"GET /orgs/{org}/actions/secrets/{secret_name}/repositories\", \"GET /orgs/{org}/blocks\", \"GET /orgs/{org}/credential-authorizations\", \"GET /orgs/{org}/events\", \"GET /orgs/{org}/failed_invitations\", \"GET /orgs/{org}/hooks\", \"GET /orgs/{org}/installations\", \"GET /orgs/{org}/invitations\", \"GET /orgs/{org}/invitations/{invitation_id}/teams\", \"GET /orgs/{org}/issues\", \"GET /orgs/{org}/members\", \"GET /orgs/{org}/migrations\", \"GET /orgs/{org}/migrations/{migration_id}/repositories\", \"GET /orgs/{org}/outside_collaborators\", \"GET /orgs/{org}/projects\", \"GET /orgs/{org}/public_members\", \"GET /orgs/{org}/repos\", \"GET /orgs/{org}/team-sync/groups\", \"GET /orgs/{org}/teams\", \"GET /orgs/{org}/teams/{team_slug}/discussions\", \"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments\", \"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions\", \"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions\", \"GET /orgs/{org}/teams/{team_slug}/invitations\", \"GET /orgs/{org}/teams/{team_slug}/members\", \"GET /orgs/{org}/teams/{team_slug}/projects\", \"GET /orgs/{org}/teams/{team_slug}/repos\", \"GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings\", \"GET /orgs/{org}/teams/{team_slug}/teams\", \"GET /projects/columns/{column_id}/cards\", \"GET /projects/{project_id}/collaborators\", \"GET /projects/{project_id}/columns\", \"GET /repos/{owner}/{repo}/actions/artifacts\", \"GET /repos/{owner}/{repo}/actions/runners\", \"GET /repos/{owner}/{repo}/actions/runners/downloads\", \"GET /repos/{owner}/{repo}/actions/runs\", \"GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts\", \"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs\", \"GET /repos/{owner}/{repo}/actions/secrets\", \"GET /repos/{owner}/{repo}/actions/workflows\", \"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs\", \"GET /repos/{owner}/{repo}/assignees\", \"GET /repos/{owner}/{repo}/branches\", \"GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations\", \"GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs\", \"GET /repos/{owner}/{repo}/code-scanning/alerts\", \"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances\", \"GET /repos/{owner}/{repo}/code-scanning/analyses\", \"GET /repos/{owner}/{repo}/collaborators\", \"GET /repos/{owner}/{repo}/comments\", \"GET /repos/{owner}/{repo}/comments/{comment_id}/reactions\", \"GET /repos/{owner}/{repo}/commits\", \"GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head\", \"GET /repos/{owner}/{repo}/commits/{commit_sha}/comments\", \"GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls\", \"GET /repos/{owner}/{repo}/commits/{ref}/check-runs\", \"GET /repos/{owner}/{repo}/commits/{ref}/check-suites\", \"GET /repos/{owner}/{repo}/commits/{ref}/statuses\", \"GET /repos/{owner}/{repo}/contributors\", \"GET /repos/{owner}/{repo}/deployments\", \"GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses\", \"GET /repos/{owner}/{repo}/events\", \"GET /repos/{owner}/{repo}/forks\", \"GET /repos/{owner}/{repo}/git/matching-refs/{ref}\", \"GET /repos/{owner}/{repo}/hooks\", \"GET /repos/{owner}/{repo}/invitations\", \"GET /repos/{owner}/{repo}/issues\", \"GET /repos/{owner}/{repo}/issues/comments\", \"GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions\", \"GET /repos/{owner}/{repo}/issues/events\", \"GET /repos/{owner}/{repo}/issues/{issue_number}/comments\", \"GET /repos/{owner}/{repo}/issues/{issue_number}/events\", \"GET /repos/{owner}/{repo}/issues/{issue_number}/labels\", \"GET /repos/{owner}/{repo}/issues/{issue_number}/reactions\", \"GET /repos/{owner}/{repo}/issues/{issue_number}/timeline\", \"GET /repos/{owner}/{repo}/keys\", \"GET /repos/{owner}/{repo}/labels\", \"GET /repos/{owner}/{repo}/milestones\", \"GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels\", \"GET /repos/{owner}/{repo}/notifications\", \"GET /repos/{owner}/{repo}/pages/builds\", \"GET /repos/{owner}/{repo}/projects\", \"GET /repos/{owner}/{repo}/pulls\", \"GET /repos/{owner}/{repo}/pulls/comments\", \"GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/comments\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/files\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews\", \"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments\", \"GET /repos/{owner}/{repo}/releases\", \"GET /repos/{owner}/{repo}/releases/{release_id}/assets\", \"GET /repos/{owner}/{repo}/secret-scanning/alerts\", \"GET /repos/{owner}/{repo}/stargazers\", \"GET /repos/{owner}/{repo}/subscribers\", \"GET /repos/{owner}/{repo}/tags\", \"GET /repos/{owner}/{repo}/teams\", \"GET /repositories\", \"GET /repositories/{repository_id}/environments/{environment_name}/secrets\", \"GET /scim/v2/enterprises/{enterprise}/Groups\", \"GET /scim/v2/enterprises/{enterprise}/Users\", \"GET /scim/v2/organizations/{org}/Users\", \"GET /search/code\", \"GET /search/commits\", \"GET /search/issues\", \"GET /search/labels\", \"GET /search/repositories\", \"GET /search/topics\", \"GET /search/users\", \"GET /teams/{team_id}/discussions\", \"GET /teams/{team_id}/discussions/{discussion_number}/comments\", \"GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions\", \"GET /teams/{team_id}/discussions/{discussion_number}/reactions\", \"GET /teams/{team_id}/invitations\", \"GET /teams/{team_id}/members\", \"GET /teams/{team_id}/projects\", \"GET /teams/{team_id}/repos\", \"GET /teams/{team_id}/team-sync/group-mappings\", \"GET /teams/{team_id}/teams\", \"GET /user/blocks\", \"GET /user/emails\", \"GET /user/followers\", \"GET /user/following\", \"GET /user/gpg_keys\", \"GET /user/installations\", \"GET /user/installations/{installation_id}/repositories\", \"GET /user/issues\", \"GET /user/keys\", \"GET /user/marketplace_purchases\", \"GET /user/marketplace_purchases/stubbed\", \"GET /user/memberships/orgs\", \"GET /user/migrations\", \"GET /user/migrations/{migration_id}/repositories\", \"GET /user/orgs\", \"GET /user/public_emails\", \"GET /user/repos\", \"GET /user/repository_invitations\", \"GET /user/starred\", \"GET /user/subscriptions\", \"GET /user/teams\", \"GET /users\", \"GET /users/{username}/events\", \"GET /users/{username}/events/orgs/{org}\", \"GET /users/{username}/events/public\", \"GET /users/{username}/followers\", \"GET /users/{username}/following\", \"GET /users/{username}/gists\", \"GET /users/{username}/gpg_keys\", \"GET /users/{username}/keys\", \"GET /users/{username}/orgs\", \"GET /users/{username}/projects\", \"GET /users/{username}/received_events\", \"GET /users/{username}/received_events/public\", \"GET /users/{username}/repos\", \"GET /users/{username}/starred\", \"GET /users/{username}/subscriptions\"];\n\nfunction isPaginatingEndpoint(arg) {\n if (typeof arg === \"string\") {\n return paginatingEndpoints.includes(arg);\n } else {\n return false;\n }\n}\n\n/**\n * @param octokit Octokit instance\n * @param options Options passed to Octokit constructor\n */\n\nfunction paginateRest(octokit) {\n return {\n paginate: Object.assign(paginate.bind(null, octokit), {\n iterator: iterator.bind(null, octokit)\n })\n };\n}\npaginateRest.VERSION = VERSION;\n\nexports.composePaginateRest = composePaginateRest;\nexports.isPaginatingEndpoint = isPaginatingEndpoint;\nexports.paginateRest = paginateRest;\nexports.paginatingEndpoints = paginatingEndpoints;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst Endpoints = {\n actions: {\n addSelectedRepoToOrgSecret: [\"PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}\"],\n cancelWorkflowRun: [\"POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel\"],\n createOrUpdateEnvironmentSecret: [\"PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}\"],\n createOrUpdateOrgSecret: [\"PUT /orgs/{org}/actions/secrets/{secret_name}\"],\n createOrUpdateRepoSecret: [\"PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}\"],\n createRegistrationTokenForOrg: [\"POST /orgs/{org}/actions/runners/registration-token\"],\n createRegistrationTokenForRepo: [\"POST /repos/{owner}/{repo}/actions/runners/registration-token\"],\n createRemoveTokenForOrg: [\"POST /orgs/{org}/actions/runners/remove-token\"],\n createRemoveTokenForRepo: [\"POST /repos/{owner}/{repo}/actions/runners/remove-token\"],\n createWorkflowDispatch: [\"POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches\"],\n deleteArtifact: [\"DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}\"],\n deleteEnvironmentSecret: [\"DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}\"],\n deleteOrgSecret: [\"DELETE /orgs/{org}/actions/secrets/{secret_name}\"],\n deleteRepoSecret: [\"DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name}\"],\n deleteSelfHostedRunnerFromOrg: [\"DELETE /orgs/{org}/actions/runners/{runner_id}\"],\n deleteSelfHostedRunnerFromRepo: [\"DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}\"],\n deleteWorkflowRun: [\"DELETE /repos/{owner}/{repo}/actions/runs/{run_id}\"],\n deleteWorkflowRunLogs: [\"DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs\"],\n disableSelectedRepositoryGithubActionsOrganization: [\"DELETE /orgs/{org}/actions/permissions/repositories/{repository_id}\"],\n disableWorkflow: [\"PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable\"],\n downloadArtifact: [\"GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}\"],\n downloadJobLogsForWorkflowRun: [\"GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs\"],\n downloadWorkflowRunLogs: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs\"],\n enableSelectedRepositoryGithubActionsOrganization: [\"PUT /orgs/{org}/actions/permissions/repositories/{repository_id}\"],\n enableWorkflow: [\"PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable\"],\n getAllowedActionsOrganization: [\"GET /orgs/{org}/actions/permissions/selected-actions\"],\n getAllowedActionsRepository: [\"GET /repos/{owner}/{repo}/actions/permissions/selected-actions\"],\n getArtifact: [\"GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}\"],\n getEnvironmentPublicKey: [\"GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key\"],\n getEnvironmentSecret: [\"GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}\"],\n getGithubActionsPermissionsOrganization: [\"GET /orgs/{org}/actions/permissions\"],\n getGithubActionsPermissionsRepository: [\"GET /repos/{owner}/{repo}/actions/permissions\"],\n getJobForWorkflowRun: [\"GET /repos/{owner}/{repo}/actions/jobs/{job_id}\"],\n getOrgPublicKey: [\"GET /orgs/{org}/actions/secrets/public-key\"],\n getOrgSecret: [\"GET /orgs/{org}/actions/secrets/{secret_name}\"],\n getPendingDeploymentsForRun: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments\"],\n getRepoPermissions: [\"GET /repos/{owner}/{repo}/actions/permissions\", {}, {\n renamed: [\"actions\", \"getGithubActionsPermissionsRepository\"]\n }],\n getRepoPublicKey: [\"GET /repos/{owner}/{repo}/actions/secrets/public-key\"],\n getRepoSecret: [\"GET /repos/{owner}/{repo}/actions/secrets/{secret_name}\"],\n getReviewsForRun: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals\"],\n getSelfHostedRunnerForOrg: [\"GET /orgs/{org}/actions/runners/{runner_id}\"],\n getSelfHostedRunnerForRepo: [\"GET /repos/{owner}/{repo}/actions/runners/{runner_id}\"],\n getWorkflow: [\"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}\"],\n getWorkflowRun: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}\"],\n getWorkflowRunUsage: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing\"],\n getWorkflowUsage: [\"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing\"],\n listArtifactsForRepo: [\"GET /repos/{owner}/{repo}/actions/artifacts\"],\n listEnvironmentSecrets: [\"GET /repositories/{repository_id}/environments/{environment_name}/secrets\"],\n listJobsForWorkflowRun: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs\"],\n listOrgSecrets: [\"GET /orgs/{org}/actions/secrets\"],\n listRepoSecrets: [\"GET /repos/{owner}/{repo}/actions/secrets\"],\n listRepoWorkflows: [\"GET /repos/{owner}/{repo}/actions/workflows\"],\n listRunnerApplicationsForOrg: [\"GET /orgs/{org}/actions/runners/downloads\"],\n listRunnerApplicationsForRepo: [\"GET /repos/{owner}/{repo}/actions/runners/downloads\"],\n listSelectedReposForOrgSecret: [\"GET /orgs/{org}/actions/secrets/{secret_name}/repositories\"],\n listSelectedRepositoriesEnabledGithubActionsOrganization: [\"GET /orgs/{org}/actions/permissions/repositories\"],\n listSelfHostedRunnersForOrg: [\"GET /orgs/{org}/actions/runners\"],\n listSelfHostedRunnersForRepo: [\"GET /repos/{owner}/{repo}/actions/runners\"],\n listWorkflowRunArtifacts: [\"GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts\"],\n listWorkflowRuns: [\"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs\"],\n listWorkflowRunsForRepo: [\"GET /repos/{owner}/{repo}/actions/runs\"],\n reRunWorkflow: [\"POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun\"],\n removeSelectedRepoFromOrgSecret: [\"DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id}\"],\n reviewPendingDeploymentsForRun: [\"POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments\"],\n setAllowedActionsOrganization: [\"PUT /orgs/{org}/actions/permissions/selected-actions\"],\n setAllowedActionsRepository: [\"PUT /repos/{owner}/{repo}/actions/permissions/selected-actions\"],\n setGithubActionsPermissionsOrganization: [\"PUT /orgs/{org}/actions/permissions\"],\n setGithubActionsPermissionsRepository: [\"PUT /repos/{owner}/{repo}/actions/permissions\"],\n setSelectedReposForOrgSecret: [\"PUT /orgs/{org}/actions/secrets/{secret_name}/repositories\"],\n setSelectedRepositoriesEnabledGithubActionsOrganization: [\"PUT /orgs/{org}/actions/permissions/repositories\"]\n },\n activity: {\n checkRepoIsStarredByAuthenticatedUser: [\"GET /user/starred/{owner}/{repo}\"],\n deleteRepoSubscription: [\"DELETE /repos/{owner}/{repo}/subscription\"],\n deleteThreadSubscription: [\"DELETE /notifications/threads/{thread_id}/subscription\"],\n getFeeds: [\"GET /feeds\"],\n getRepoSubscription: [\"GET /repos/{owner}/{repo}/subscription\"],\n getThread: [\"GET /notifications/threads/{thread_id}\"],\n getThreadSubscriptionForAuthenticatedUser: [\"GET /notifications/threads/{thread_id}/subscription\"],\n listEventsForAuthenticatedUser: [\"GET /users/{username}/events\"],\n listNotificationsForAuthenticatedUser: [\"GET /notifications\"],\n listOrgEventsForAuthenticatedUser: [\"GET /users/{username}/events/orgs/{org}\"],\n listPublicEvents: [\"GET /events\"],\n listPublicEventsForRepoNetwork: [\"GET /networks/{owner}/{repo}/events\"],\n listPublicEventsForUser: [\"GET /users/{username}/events/public\"],\n listPublicOrgEvents: [\"GET /orgs/{org}/events\"],\n listReceivedEventsForUser: [\"GET /users/{username}/received_events\"],\n listReceivedPublicEventsForUser: [\"GET /users/{username}/received_events/public\"],\n listRepoEvents: [\"GET /repos/{owner}/{repo}/events\"],\n listRepoNotificationsForAuthenticatedUser: [\"GET /repos/{owner}/{repo}/notifications\"],\n listReposStarredByAuthenticatedUser: [\"GET /user/starred\"],\n listReposStarredByUser: [\"GET /users/{username}/starred\"],\n listReposWatchedByUser: [\"GET /users/{username}/subscriptions\"],\n listStargazersForRepo: [\"GET /repos/{owner}/{repo}/stargazers\"],\n listWatchedReposForAuthenticatedUser: [\"GET /user/subscriptions\"],\n listWatchersForRepo: [\"GET /repos/{owner}/{repo}/subscribers\"],\n markNotificationsAsRead: [\"PUT /notifications\"],\n markRepoNotificationsAsRead: [\"PUT /repos/{owner}/{repo}/notifications\"],\n markThreadAsRead: [\"PATCH /notifications/threads/{thread_id}\"],\n setRepoSubscription: [\"PUT /repos/{owner}/{repo}/subscription\"],\n setThreadSubscription: [\"PUT /notifications/threads/{thread_id}/subscription\"],\n starRepoForAuthenticatedUser: [\"PUT /user/starred/{owner}/{repo}\"],\n unstarRepoForAuthenticatedUser: [\"DELETE /user/starred/{owner}/{repo}\"]\n },\n apps: {\n addRepoToInstallation: [\"PUT /user/installations/{installation_id}/repositories/{repository_id}\"],\n checkToken: [\"POST /applications/{client_id}/token\"],\n createContentAttachment: [\"POST /content_references/{content_reference_id}/attachments\", {\n mediaType: {\n previews: [\"corsair\"]\n }\n }],\n createFromManifest: [\"POST /app-manifests/{code}/conversions\"],\n createInstallationAccessToken: [\"POST /app/installations/{installation_id}/access_tokens\"],\n deleteAuthorization: [\"DELETE /applications/{client_id}/grant\"],\n deleteInstallation: [\"DELETE /app/installations/{installation_id}\"],\n deleteToken: [\"DELETE /applications/{client_id}/token\"],\n getAuthenticated: [\"GET /app\"],\n getBySlug: [\"GET /apps/{app_slug}\"],\n getInstallation: [\"GET /app/installations/{installation_id}\"],\n getOrgInstallation: [\"GET /orgs/{org}/installation\"],\n getRepoInstallation: [\"GET /repos/{owner}/{repo}/installation\"],\n getSubscriptionPlanForAccount: [\"GET /marketplace_listing/accounts/{account_id}\"],\n getSubscriptionPlanForAccountStubbed: [\"GET /marketplace_listing/stubbed/accounts/{account_id}\"],\n getUserInstallation: [\"GET /users/{username}/installation\"],\n getWebhookConfigForApp: [\"GET /app/hook/config\"],\n listAccountsForPlan: [\"GET /marketplace_listing/plans/{plan_id}/accounts\"],\n listAccountsForPlanStubbed: [\"GET /marketplace_listing/stubbed/plans/{plan_id}/accounts\"],\n listInstallationReposForAuthenticatedUser: [\"GET /user/installations/{installation_id}/repositories\"],\n listInstallations: [\"GET /app/installations\"],\n listInstallationsForAuthenticatedUser: [\"GET /user/installations\"],\n listPlans: [\"GET /marketplace_listing/plans\"],\n listPlansStubbed: [\"GET /marketplace_listing/stubbed/plans\"],\n listReposAccessibleToInstallation: [\"GET /installation/repositories\"],\n listSubscriptionsForAuthenticatedUser: [\"GET /user/marketplace_purchases\"],\n listSubscriptionsForAuthenticatedUserStubbed: [\"GET /user/marketplace_purchases/stubbed\"],\n removeRepoFromInstallation: [\"DELETE /user/installations/{installation_id}/repositories/{repository_id}\"],\n resetToken: [\"PATCH /applications/{client_id}/token\"],\n revokeInstallationAccessToken: [\"DELETE /installation/token\"],\n scopeToken: [\"POST /applications/{client_id}/token/scoped\"],\n suspendInstallation: [\"PUT /app/installations/{installation_id}/suspended\"],\n unsuspendInstallation: [\"DELETE /app/installations/{installation_id}/suspended\"],\n updateWebhookConfigForApp: [\"PATCH /app/hook/config\"]\n },\n billing: {\n getGithubActionsBillingOrg: [\"GET /orgs/{org}/settings/billing/actions\"],\n getGithubActionsBillingUser: [\"GET /users/{username}/settings/billing/actions\"],\n getGithubPackagesBillingOrg: [\"GET /orgs/{org}/settings/billing/packages\"],\n getGithubPackagesBillingUser: [\"GET /users/{username}/settings/billing/packages\"],\n getSharedStorageBillingOrg: [\"GET /orgs/{org}/settings/billing/shared-storage\"],\n getSharedStorageBillingUser: [\"GET /users/{username}/settings/billing/shared-storage\"]\n },\n checks: {\n create: [\"POST /repos/{owner}/{repo}/check-runs\"],\n createSuite: [\"POST /repos/{owner}/{repo}/check-suites\"],\n get: [\"GET /repos/{owner}/{repo}/check-runs/{check_run_id}\"],\n getSuite: [\"GET /repos/{owner}/{repo}/check-suites/{check_suite_id}\"],\n listAnnotations: [\"GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations\"],\n listForRef: [\"GET /repos/{owner}/{repo}/commits/{ref}/check-runs\"],\n listForSuite: [\"GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs\"],\n listSuitesForRef: [\"GET /repos/{owner}/{repo}/commits/{ref}/check-suites\"],\n rerequestSuite: [\"POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest\"],\n setSuitesPreferences: [\"PATCH /repos/{owner}/{repo}/check-suites/preferences\"],\n update: [\"PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}\"]\n },\n codeScanning: {\n deleteAnalysis: [\"DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}{?confirm_delete}\"],\n getAlert: [\"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}\", {}, {\n renamedParameters: {\n alert_id: \"alert_number\"\n }\n }],\n getAnalysis: [\"GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}\"],\n getSarif: [\"GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id}\"],\n listAlertsForRepo: [\"GET /repos/{owner}/{repo}/code-scanning/alerts\"],\n listAlertsInstances: [\"GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances\"],\n listRecentAnalyses: [\"GET /repos/{owner}/{repo}/code-scanning/analyses\"],\n updateAlert: [\"PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}\"],\n uploadSarif: [\"POST /repos/{owner}/{repo}/code-scanning/sarifs\"]\n },\n codesOfConduct: {\n getAllCodesOfConduct: [\"GET /codes_of_conduct\", {\n mediaType: {\n previews: [\"scarlet-witch\"]\n }\n }],\n getConductCode: [\"GET /codes_of_conduct/{key}\", {\n mediaType: {\n previews: [\"scarlet-witch\"]\n }\n }],\n getForRepo: [\"GET /repos/{owner}/{repo}/community/code_of_conduct\", {\n mediaType: {\n previews: [\"scarlet-witch\"]\n }\n }]\n },\n emojis: {\n get: [\"GET /emojis\"]\n },\n enterpriseAdmin: {\n disableSelectedOrganizationGithubActionsEnterprise: [\"DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}\"],\n enableSelectedOrganizationGithubActionsEnterprise: [\"PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}\"],\n getAllowedActionsEnterprise: [\"GET /enterprises/{enterprise}/actions/permissions/selected-actions\"],\n getGithubActionsPermissionsEnterprise: [\"GET /enterprises/{enterprise}/actions/permissions\"],\n listSelectedOrganizationsEnabledGithubActionsEnterprise: [\"GET /enterprises/{enterprise}/actions/permissions/organizations\"],\n setAllowedActionsEnterprise: [\"PUT /enterprises/{enterprise}/actions/permissions/selected-actions\"],\n setGithubActionsPermissionsEnterprise: [\"PUT /enterprises/{enterprise}/actions/permissions\"],\n setSelectedOrganizationsEnabledGithubActionsEnterprise: [\"PUT /enterprises/{enterprise}/actions/permissions/organizations\"]\n },\n gists: {\n checkIsStarred: [\"GET /gists/{gist_id}/star\"],\n create: [\"POST /gists\"],\n createComment: [\"POST /gists/{gist_id}/comments\"],\n delete: [\"DELETE /gists/{gist_id}\"],\n deleteComment: [\"DELETE /gists/{gist_id}/comments/{comment_id}\"],\n fork: [\"POST /gists/{gist_id}/forks\"],\n get: [\"GET /gists/{gist_id}\"],\n getComment: [\"GET /gists/{gist_id}/comments/{comment_id}\"],\n getRevision: [\"GET /gists/{gist_id}/{sha}\"],\n list: [\"GET /gists\"],\n listComments: [\"GET /gists/{gist_id}/comments\"],\n listCommits: [\"GET /gists/{gist_id}/commits\"],\n listForUser: [\"GET /users/{username}/gists\"],\n listForks: [\"GET /gists/{gist_id}/forks\"],\n listPublic: [\"GET /gists/public\"],\n listStarred: [\"GET /gists/starred\"],\n star: [\"PUT /gists/{gist_id}/star\"],\n unstar: [\"DELETE /gists/{gist_id}/star\"],\n update: [\"PATCH /gists/{gist_id}\"],\n updateComment: [\"PATCH /gists/{gist_id}/comments/{comment_id}\"]\n },\n git: {\n createBlob: [\"POST /repos/{owner}/{repo}/git/blobs\"],\n createCommit: [\"POST /repos/{owner}/{repo}/git/commits\"],\n createRef: [\"POST /repos/{owner}/{repo}/git/refs\"],\n createTag: [\"POST /repos/{owner}/{repo}/git/tags\"],\n createTree: [\"POST /repos/{owner}/{repo}/git/trees\"],\n deleteRef: [\"DELETE /repos/{owner}/{repo}/git/refs/{ref}\"],\n getBlob: [\"GET /repos/{owner}/{repo}/git/blobs/{file_sha}\"],\n getCommit: [\"GET /repos/{owner}/{repo}/git/commits/{commit_sha}\"],\n getRef: [\"GET /repos/{owner}/{repo}/git/ref/{ref}\"],\n getTag: [\"GET /repos/{owner}/{repo}/git/tags/{tag_sha}\"],\n getTree: [\"GET /repos/{owner}/{repo}/git/trees/{tree_sha}\"],\n listMatchingRefs: [\"GET /repos/{owner}/{repo}/git/matching-refs/{ref}\"],\n updateRef: [\"PATCH /repos/{owner}/{repo}/git/refs/{ref}\"]\n },\n gitignore: {\n getAllTemplates: [\"GET /gitignore/templates\"],\n getTemplate: [\"GET /gitignore/templates/{name}\"]\n },\n interactions: {\n getRestrictionsForAuthenticatedUser: [\"GET /user/interaction-limits\"],\n getRestrictionsForOrg: [\"GET /orgs/{org}/interaction-limits\"],\n getRestrictionsForRepo: [\"GET /repos/{owner}/{repo}/interaction-limits\"],\n getRestrictionsForYourPublicRepos: [\"GET /user/interaction-limits\", {}, {\n renamed: [\"interactions\", \"getRestrictionsForAuthenticatedUser\"]\n }],\n removeRestrictionsForAuthenticatedUser: [\"DELETE /user/interaction-limits\"],\n removeRestrictionsForOrg: [\"DELETE /orgs/{org}/interaction-limits\"],\n removeRestrictionsForRepo: [\"DELETE /repos/{owner}/{repo}/interaction-limits\"],\n removeRestrictionsForYourPublicRepos: [\"DELETE /user/interaction-limits\", {}, {\n renamed: [\"interactions\", \"removeRestrictionsForAuthenticatedUser\"]\n }],\n setRestrictionsForAuthenticatedUser: [\"PUT /user/interaction-limits\"],\n setRestrictionsForOrg: [\"PUT /orgs/{org}/interaction-limits\"],\n setRestrictionsForRepo: [\"PUT /repos/{owner}/{repo}/interaction-limits\"],\n setRestrictionsForYourPublicRepos: [\"PUT /user/interaction-limits\", {}, {\n renamed: [\"interactions\", \"setRestrictionsForAuthenticatedUser\"]\n }]\n },\n issues: {\n addAssignees: [\"POST /repos/{owner}/{repo}/issues/{issue_number}/assignees\"],\n addLabels: [\"POST /repos/{owner}/{repo}/issues/{issue_number}/labels\"],\n checkUserCanBeAssigned: [\"GET /repos/{owner}/{repo}/assignees/{assignee}\"],\n create: [\"POST /repos/{owner}/{repo}/issues\"],\n createComment: [\"POST /repos/{owner}/{repo}/issues/{issue_number}/comments\"],\n createLabel: [\"POST /repos/{owner}/{repo}/labels\"],\n createMilestone: [\"POST /repos/{owner}/{repo}/milestones\"],\n deleteComment: [\"DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}\"],\n deleteLabel: [\"DELETE /repos/{owner}/{repo}/labels/{name}\"],\n deleteMilestone: [\"DELETE /repos/{owner}/{repo}/milestones/{milestone_number}\"],\n get: [\"GET /repos/{owner}/{repo}/issues/{issue_number}\"],\n getComment: [\"GET /repos/{owner}/{repo}/issues/comments/{comment_id}\"],\n getEvent: [\"GET /repos/{owner}/{repo}/issues/events/{event_id}\"],\n getLabel: [\"GET /repos/{owner}/{repo}/labels/{name}\"],\n getMilestone: [\"GET /repos/{owner}/{repo}/milestones/{milestone_number}\"],\n list: [\"GET /issues\"],\n listAssignees: [\"GET /repos/{owner}/{repo}/assignees\"],\n listComments: [\"GET /repos/{owner}/{repo}/issues/{issue_number}/comments\"],\n listCommentsForRepo: [\"GET /repos/{owner}/{repo}/issues/comments\"],\n listEvents: [\"GET /repos/{owner}/{repo}/issues/{issue_number}/events\"],\n listEventsForRepo: [\"GET /repos/{owner}/{repo}/issues/events\"],\n listEventsForTimeline: [\"GET /repos/{owner}/{repo}/issues/{issue_number}/timeline\", {\n mediaType: {\n previews: [\"mockingbird\"]\n }\n }],\n listForAuthenticatedUser: [\"GET /user/issues\"],\n listForOrg: [\"GET /orgs/{org}/issues\"],\n listForRepo: [\"GET /repos/{owner}/{repo}/issues\"],\n listLabelsForMilestone: [\"GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels\"],\n listLabelsForRepo: [\"GET /repos/{owner}/{repo}/labels\"],\n listLabelsOnIssue: [\"GET /repos/{owner}/{repo}/issues/{issue_number}/labels\"],\n listMilestones: [\"GET /repos/{owner}/{repo}/milestones\"],\n lock: [\"PUT /repos/{owner}/{repo}/issues/{issue_number}/lock\"],\n removeAllLabels: [\"DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels\"],\n removeAssignees: [\"DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees\"],\n removeLabel: [\"DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}\"],\n setLabels: [\"PUT /repos/{owner}/{repo}/issues/{issue_number}/labels\"],\n unlock: [\"DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock\"],\n update: [\"PATCH /repos/{owner}/{repo}/issues/{issue_number}\"],\n updateComment: [\"PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}\"],\n updateLabel: [\"PATCH /repos/{owner}/{repo}/labels/{name}\"],\n updateMilestone: [\"PATCH /repos/{owner}/{repo}/milestones/{milestone_number}\"]\n },\n licenses: {\n get: [\"GET /licenses/{license}\"],\n getAllCommonlyUsed: [\"GET /licenses\"],\n getForRepo: [\"GET /repos/{owner}/{repo}/license\"]\n },\n markdown: {\n render: [\"POST /markdown\"],\n renderRaw: [\"POST /markdown/raw\", {\n headers: {\n \"content-type\": \"text/plain; charset=utf-8\"\n }\n }]\n },\n meta: {\n get: [\"GET /meta\"],\n getOctocat: [\"GET /octocat\"],\n getZen: [\"GET /zen\"],\n root: [\"GET /\"]\n },\n migrations: {\n cancelImport: [\"DELETE /repos/{owner}/{repo}/import\"],\n deleteArchiveForAuthenticatedUser: [\"DELETE /user/migrations/{migration_id}/archive\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n deleteArchiveForOrg: [\"DELETE /orgs/{org}/migrations/{migration_id}/archive\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n downloadArchiveForOrg: [\"GET /orgs/{org}/migrations/{migration_id}/archive\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n getArchiveForAuthenticatedUser: [\"GET /user/migrations/{migration_id}/archive\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n getCommitAuthors: [\"GET /repos/{owner}/{repo}/import/authors\"],\n getImportStatus: [\"GET /repos/{owner}/{repo}/import\"],\n getLargeFiles: [\"GET /repos/{owner}/{repo}/import/large_files\"],\n getStatusForAuthenticatedUser: [\"GET /user/migrations/{migration_id}\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n getStatusForOrg: [\"GET /orgs/{org}/migrations/{migration_id}\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n listForAuthenticatedUser: [\"GET /user/migrations\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n listForOrg: [\"GET /orgs/{org}/migrations\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n listReposForOrg: [\"GET /orgs/{org}/migrations/{migration_id}/repositories\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n listReposForUser: [\"GET /user/migrations/{migration_id}/repositories\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n mapCommitAuthor: [\"PATCH /repos/{owner}/{repo}/import/authors/{author_id}\"],\n setLfsPreference: [\"PATCH /repos/{owner}/{repo}/import/lfs\"],\n startForAuthenticatedUser: [\"POST /user/migrations\"],\n startForOrg: [\"POST /orgs/{org}/migrations\"],\n startImport: [\"PUT /repos/{owner}/{repo}/import\"],\n unlockRepoForAuthenticatedUser: [\"DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n unlockRepoForOrg: [\"DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock\", {\n mediaType: {\n previews: [\"wyandotte\"]\n }\n }],\n updateImport: [\"PATCH /repos/{owner}/{repo}/import\"]\n },\n orgs: {\n blockUser: [\"PUT /orgs/{org}/blocks/{username}\"],\n cancelInvitation: [\"DELETE /orgs/{org}/invitations/{invitation_id}\"],\n checkBlockedUser: [\"GET /orgs/{org}/blocks/{username}\"],\n checkMembershipForUser: [\"GET /orgs/{org}/members/{username}\"],\n checkPublicMembershipForUser: [\"GET /orgs/{org}/public_members/{username}\"],\n convertMemberToOutsideCollaborator: [\"PUT /orgs/{org}/outside_collaborators/{username}\"],\n createInvitation: [\"POST /orgs/{org}/invitations\"],\n createWebhook: [\"POST /orgs/{org}/hooks\"],\n deleteWebhook: [\"DELETE /orgs/{org}/hooks/{hook_id}\"],\n get: [\"GET /orgs/{org}\"],\n getMembershipForAuthenticatedUser: [\"GET /user/memberships/orgs/{org}\"],\n getMembershipForUser: [\"GET /orgs/{org}/memberships/{username}\"],\n getWebhook: [\"GET /orgs/{org}/hooks/{hook_id}\"],\n getWebhookConfigForOrg: [\"GET /orgs/{org}/hooks/{hook_id}/config\"],\n list: [\"GET /organizations\"],\n listAppInstallations: [\"GET /orgs/{org}/installations\"],\n listBlockedUsers: [\"GET /orgs/{org}/blocks\"],\n listFailedInvitations: [\"GET /orgs/{org}/failed_invitations\"],\n listForAuthenticatedUser: [\"GET /user/orgs\"],\n listForUser: [\"GET /users/{username}/orgs\"],\n listInvitationTeams: [\"GET /orgs/{org}/invitations/{invitation_id}/teams\"],\n listMembers: [\"GET /orgs/{org}/members\"],\n listMembershipsForAuthenticatedUser: [\"GET /user/memberships/orgs\"],\n listOutsideCollaborators: [\"GET /orgs/{org}/outside_collaborators\"],\n listPendingInvitations: [\"GET /orgs/{org}/invitations\"],\n listPublicMembers: [\"GET /orgs/{org}/public_members\"],\n listWebhooks: [\"GET /orgs/{org}/hooks\"],\n pingWebhook: [\"POST /orgs/{org}/hooks/{hook_id}/pings\"],\n removeMember: [\"DELETE /orgs/{org}/members/{username}\"],\n removeMembershipForUser: [\"DELETE /orgs/{org}/memberships/{username}\"],\n removeOutsideCollaborator: [\"DELETE /orgs/{org}/outside_collaborators/{username}\"],\n removePublicMembershipForAuthenticatedUser: [\"DELETE /orgs/{org}/public_members/{username}\"],\n setMembershipForUser: [\"PUT /orgs/{org}/memberships/{username}\"],\n setPublicMembershipForAuthenticatedUser: [\"PUT /orgs/{org}/public_members/{username}\"],\n unblockUser: [\"DELETE /orgs/{org}/blocks/{username}\"],\n update: [\"PATCH /orgs/{org}\"],\n updateMembershipForAuthenticatedUser: [\"PATCH /user/memberships/orgs/{org}\"],\n updateWebhook: [\"PATCH /orgs/{org}/hooks/{hook_id}\"],\n updateWebhookConfigForOrg: [\"PATCH /orgs/{org}/hooks/{hook_id}/config\"]\n },\n packages: {\n deletePackageForAuthenticatedUser: [\"DELETE /user/packages/{package_type}/{package_name}\"],\n deletePackageForOrg: [\"DELETE /orgs/{org}/packages/{package_type}/{package_name}\"],\n deletePackageVersionForAuthenticatedUser: [\"DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id}\"],\n deletePackageVersionForOrg: [\"DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}\"],\n getAllPackageVersionsForAPackageOwnedByAnOrg: [\"GET /orgs/{org}/packages/{package_type}/{package_name}/versions\"],\n getAllPackageVersionsForAPackageOwnedByTheAuthenticatedUser: [\"GET /user/packages/{package_type}/{package_name}/versions\"],\n getAllPackageVersionsForPackageOwnedByUser: [\"GET /users/{username}/packages/{package_type}/{package_name}/versions\"],\n getPackageForAuthenticatedUser: [\"GET /user/packages/{package_type}/{package_name}\"],\n getPackageForOrganization: [\"GET /orgs/{org}/packages/{package_type}/{package_name}\"],\n getPackageForUser: [\"GET /users/{username}/packages/{package_type}/{package_name}\"],\n getPackageVersionForAuthenticatedUser: [\"GET /user/packages/{package_type}/{package_name}/versions/{package_version_id}\"],\n getPackageVersionForOrganization: [\"GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}\"],\n getPackageVersionForUser: [\"GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}\"],\n restorePackageForAuthenticatedUser: [\"POST /user/packages/{package_type}/{package_name}/restore\"],\n restorePackageForOrg: [\"POST /orgs/{org}/packages/{package_type}/{package_name}/restore\"],\n restorePackageVersionForAuthenticatedUser: [\"POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore\"],\n restorePackageVersionForOrg: [\"POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore\"]\n },\n projects: {\n addCollaborator: [\"PUT /projects/{project_id}/collaborators/{username}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n createCard: [\"POST /projects/columns/{column_id}/cards\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n createColumn: [\"POST /projects/{project_id}/columns\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n createForAuthenticatedUser: [\"POST /user/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n createForOrg: [\"POST /orgs/{org}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n createForRepo: [\"POST /repos/{owner}/{repo}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n delete: [\"DELETE /projects/{project_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n deleteCard: [\"DELETE /projects/columns/cards/{card_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n deleteColumn: [\"DELETE /projects/columns/{column_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n get: [\"GET /projects/{project_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n getCard: [\"GET /projects/columns/cards/{card_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n getColumn: [\"GET /projects/columns/{column_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n getPermissionForUser: [\"GET /projects/{project_id}/collaborators/{username}/permission\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listCards: [\"GET /projects/columns/{column_id}/cards\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listCollaborators: [\"GET /projects/{project_id}/collaborators\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listColumns: [\"GET /projects/{project_id}/columns\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listForOrg: [\"GET /orgs/{org}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listForRepo: [\"GET /repos/{owner}/{repo}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listForUser: [\"GET /users/{username}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n moveCard: [\"POST /projects/columns/cards/{card_id}/moves\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n moveColumn: [\"POST /projects/columns/{column_id}/moves\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n removeCollaborator: [\"DELETE /projects/{project_id}/collaborators/{username}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n update: [\"PATCH /projects/{project_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n updateCard: [\"PATCH /projects/columns/cards/{card_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n updateColumn: [\"PATCH /projects/columns/{column_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }]\n },\n pulls: {\n checkIfMerged: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/merge\"],\n create: [\"POST /repos/{owner}/{repo}/pulls\"],\n createReplyForReviewComment: [\"POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies\"],\n createReview: [\"POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews\"],\n createReviewComment: [\"POST /repos/{owner}/{repo}/pulls/{pull_number}/comments\"],\n deletePendingReview: [\"DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}\"],\n deleteReviewComment: [\"DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}\"],\n dismissReview: [\"PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals\"],\n get: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}\"],\n getReview: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}\"],\n getReviewComment: [\"GET /repos/{owner}/{repo}/pulls/comments/{comment_id}\"],\n list: [\"GET /repos/{owner}/{repo}/pulls\"],\n listCommentsForReview: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments\"],\n listCommits: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/commits\"],\n listFiles: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/files\"],\n listRequestedReviewers: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers\"],\n listReviewComments: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/comments\"],\n listReviewCommentsForRepo: [\"GET /repos/{owner}/{repo}/pulls/comments\"],\n listReviews: [\"GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews\"],\n merge: [\"PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge\"],\n removeRequestedReviewers: [\"DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers\"],\n requestReviewers: [\"POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers\"],\n submitReview: [\"POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events\"],\n update: [\"PATCH /repos/{owner}/{repo}/pulls/{pull_number}\"],\n updateBranch: [\"PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch\", {\n mediaType: {\n previews: [\"lydian\"]\n }\n }],\n updateReview: [\"PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}\"],\n updateReviewComment: [\"PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}\"]\n },\n rateLimit: {\n get: [\"GET /rate_limit\"]\n },\n reactions: {\n createForCommitComment: [\"POST /repos/{owner}/{repo}/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n createForIssue: [\"POST /repos/{owner}/{repo}/issues/{issue_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n createForIssueComment: [\"POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n createForPullRequestReviewComment: [\"POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n createForTeamDiscussionCommentInOrg: [\"POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n createForTeamDiscussionInOrg: [\"POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForCommitComment: [\"DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForIssue: [\"DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForIssueComment: [\"DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForPullRequestComment: [\"DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForTeamDiscussion: [\"DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteForTeamDiscussionComment: [\"DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n deleteLegacy: [\"DELETE /reactions/{reaction_id}\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }, {\n deprecated: \"octokit.reactions.deleteLegacy() is deprecated, see https://docs.github.com/rest/reference/reactions/#delete-a-reaction-legacy\"\n }],\n listForCommitComment: [\"GET /repos/{owner}/{repo}/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n listForIssue: [\"GET /repos/{owner}/{repo}/issues/{issue_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n listForIssueComment: [\"GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n listForPullRequestReviewComment: [\"GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n listForTeamDiscussionCommentInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }],\n listForTeamDiscussionInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions\", {\n mediaType: {\n previews: [\"squirrel-girl\"]\n }\n }]\n },\n repos: {\n acceptInvitation: [\"PATCH /user/repository_invitations/{invitation_id}\"],\n addAppAccessRestrictions: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps\", {}, {\n mapToData: \"apps\"\n }],\n addCollaborator: [\"PUT /repos/{owner}/{repo}/collaborators/{username}\"],\n addStatusCheckContexts: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts\", {}, {\n mapToData: \"contexts\"\n }],\n addTeamAccessRestrictions: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams\", {}, {\n mapToData: \"teams\"\n }],\n addUserAccessRestrictions: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users\", {}, {\n mapToData: \"users\"\n }],\n checkCollaborator: [\"GET /repos/{owner}/{repo}/collaborators/{username}\"],\n checkVulnerabilityAlerts: [\"GET /repos/{owner}/{repo}/vulnerability-alerts\", {\n mediaType: {\n previews: [\"dorian\"]\n }\n }],\n compareCommits: [\"GET /repos/{owner}/{repo}/compare/{base}...{head}\"],\n createCommitComment: [\"POST /repos/{owner}/{repo}/commits/{commit_sha}/comments\"],\n createCommitSignatureProtection: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures\", {\n mediaType: {\n previews: [\"zzzax\"]\n }\n }],\n createCommitStatus: [\"POST /repos/{owner}/{repo}/statuses/{sha}\"],\n createDeployKey: [\"POST /repos/{owner}/{repo}/keys\"],\n createDeployment: [\"POST /repos/{owner}/{repo}/deployments\"],\n createDeploymentStatus: [\"POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses\"],\n createDispatchEvent: [\"POST /repos/{owner}/{repo}/dispatches\"],\n createForAuthenticatedUser: [\"POST /user/repos\"],\n createFork: [\"POST /repos/{owner}/{repo}/forks\"],\n createInOrg: [\"POST /orgs/{org}/repos\"],\n createOrUpdateEnvironment: [\"PUT /repos/{owner}/{repo}/environments/{environment_name}\"],\n createOrUpdateFileContents: [\"PUT /repos/{owner}/{repo}/contents/{path}\"],\n createPagesSite: [\"POST /repos/{owner}/{repo}/pages\", {\n mediaType: {\n previews: [\"switcheroo\"]\n }\n }],\n createRelease: [\"POST /repos/{owner}/{repo}/releases\"],\n createUsingTemplate: [\"POST /repos/{template_owner}/{template_repo}/generate\", {\n mediaType: {\n previews: [\"baptiste\"]\n }\n }],\n createWebhook: [\"POST /repos/{owner}/{repo}/hooks\"],\n declineInvitation: [\"DELETE /user/repository_invitations/{invitation_id}\"],\n delete: [\"DELETE /repos/{owner}/{repo}\"],\n deleteAccessRestrictions: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions\"],\n deleteAdminBranchProtection: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins\"],\n deleteAnEnvironment: [\"DELETE /repos/{owner}/{repo}/environments/{environment_name}\"],\n deleteBranchProtection: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection\"],\n deleteCommitComment: [\"DELETE /repos/{owner}/{repo}/comments/{comment_id}\"],\n deleteCommitSignatureProtection: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures\", {\n mediaType: {\n previews: [\"zzzax\"]\n }\n }],\n deleteDeployKey: [\"DELETE /repos/{owner}/{repo}/keys/{key_id}\"],\n deleteDeployment: [\"DELETE /repos/{owner}/{repo}/deployments/{deployment_id}\"],\n deleteFile: [\"DELETE /repos/{owner}/{repo}/contents/{path}\"],\n deleteInvitation: [\"DELETE /repos/{owner}/{repo}/invitations/{invitation_id}\"],\n deletePagesSite: [\"DELETE /repos/{owner}/{repo}/pages\", {\n mediaType: {\n previews: [\"switcheroo\"]\n }\n }],\n deletePullRequestReviewProtection: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews\"],\n deleteRelease: [\"DELETE /repos/{owner}/{repo}/releases/{release_id}\"],\n deleteReleaseAsset: [\"DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}\"],\n deleteWebhook: [\"DELETE /repos/{owner}/{repo}/hooks/{hook_id}\"],\n disableAutomatedSecurityFixes: [\"DELETE /repos/{owner}/{repo}/automated-security-fixes\", {\n mediaType: {\n previews: [\"london\"]\n }\n }],\n disableVulnerabilityAlerts: [\"DELETE /repos/{owner}/{repo}/vulnerability-alerts\", {\n mediaType: {\n previews: [\"dorian\"]\n }\n }],\n downloadArchive: [\"GET /repos/{owner}/{repo}/zipball/{ref}\", {}, {\n renamed: [\"repos\", \"downloadZipballArchive\"]\n }],\n downloadTarballArchive: [\"GET /repos/{owner}/{repo}/tarball/{ref}\"],\n downloadZipballArchive: [\"GET /repos/{owner}/{repo}/zipball/{ref}\"],\n enableAutomatedSecurityFixes: [\"PUT /repos/{owner}/{repo}/automated-security-fixes\", {\n mediaType: {\n previews: [\"london\"]\n }\n }],\n enableVulnerabilityAlerts: [\"PUT /repos/{owner}/{repo}/vulnerability-alerts\", {\n mediaType: {\n previews: [\"dorian\"]\n }\n }],\n get: [\"GET /repos/{owner}/{repo}\"],\n getAccessRestrictions: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions\"],\n getAdminBranchProtection: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins\"],\n getAllEnvironments: [\"GET /repos/{owner}/{repo}/environments\"],\n getAllStatusCheckContexts: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts\"],\n getAllTopics: [\"GET /repos/{owner}/{repo}/topics\", {\n mediaType: {\n previews: [\"mercy\"]\n }\n }],\n getAppsWithAccessToProtectedBranch: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps\"],\n getBranch: [\"GET /repos/{owner}/{repo}/branches/{branch}\"],\n getBranchProtection: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection\"],\n getClones: [\"GET /repos/{owner}/{repo}/traffic/clones\"],\n getCodeFrequencyStats: [\"GET /repos/{owner}/{repo}/stats/code_frequency\"],\n getCollaboratorPermissionLevel: [\"GET /repos/{owner}/{repo}/collaborators/{username}/permission\"],\n getCombinedStatusForRef: [\"GET /repos/{owner}/{repo}/commits/{ref}/status\"],\n getCommit: [\"GET /repos/{owner}/{repo}/commits/{ref}\"],\n getCommitActivityStats: [\"GET /repos/{owner}/{repo}/stats/commit_activity\"],\n getCommitComment: [\"GET /repos/{owner}/{repo}/comments/{comment_id}\"],\n getCommitSignatureProtection: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures\", {\n mediaType: {\n previews: [\"zzzax\"]\n }\n }],\n getCommunityProfileMetrics: [\"GET /repos/{owner}/{repo}/community/profile\"],\n getContent: [\"GET /repos/{owner}/{repo}/contents/{path}\"],\n getContributorsStats: [\"GET /repos/{owner}/{repo}/stats/contributors\"],\n getDeployKey: [\"GET /repos/{owner}/{repo}/keys/{key_id}\"],\n getDeployment: [\"GET /repos/{owner}/{repo}/deployments/{deployment_id}\"],\n getDeploymentStatus: [\"GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}\"],\n getEnvironment: [\"GET /repos/{owner}/{repo}/environments/{environment_name}\"],\n getLatestPagesBuild: [\"GET /repos/{owner}/{repo}/pages/builds/latest\"],\n getLatestRelease: [\"GET /repos/{owner}/{repo}/releases/latest\"],\n getPages: [\"GET /repos/{owner}/{repo}/pages\"],\n getPagesBuild: [\"GET /repos/{owner}/{repo}/pages/builds/{build_id}\"],\n getParticipationStats: [\"GET /repos/{owner}/{repo}/stats/participation\"],\n getPullRequestReviewProtection: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews\"],\n getPunchCardStats: [\"GET /repos/{owner}/{repo}/stats/punch_card\"],\n getReadme: [\"GET /repos/{owner}/{repo}/readme\"],\n getRelease: [\"GET /repos/{owner}/{repo}/releases/{release_id}\"],\n getReleaseAsset: [\"GET /repos/{owner}/{repo}/releases/assets/{asset_id}\"],\n getReleaseByTag: [\"GET /repos/{owner}/{repo}/releases/tags/{tag}\"],\n getStatusChecksProtection: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks\"],\n getTeamsWithAccessToProtectedBranch: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams\"],\n getTopPaths: [\"GET /repos/{owner}/{repo}/traffic/popular/paths\"],\n getTopReferrers: [\"GET /repos/{owner}/{repo}/traffic/popular/referrers\"],\n getUsersWithAccessToProtectedBranch: [\"GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users\"],\n getViews: [\"GET /repos/{owner}/{repo}/traffic/views\"],\n getWebhook: [\"GET /repos/{owner}/{repo}/hooks/{hook_id}\"],\n getWebhookConfigForRepo: [\"GET /repos/{owner}/{repo}/hooks/{hook_id}/config\"],\n listBranches: [\"GET /repos/{owner}/{repo}/branches\"],\n listBranchesForHeadCommit: [\"GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head\", {\n mediaType: {\n previews: [\"groot\"]\n }\n }],\n listCollaborators: [\"GET /repos/{owner}/{repo}/collaborators\"],\n listCommentsForCommit: [\"GET /repos/{owner}/{repo}/commits/{commit_sha}/comments\"],\n listCommitCommentsForRepo: [\"GET /repos/{owner}/{repo}/comments\"],\n listCommitStatusesForRef: [\"GET /repos/{owner}/{repo}/commits/{ref}/statuses\"],\n listCommits: [\"GET /repos/{owner}/{repo}/commits\"],\n listContributors: [\"GET /repos/{owner}/{repo}/contributors\"],\n listDeployKeys: [\"GET /repos/{owner}/{repo}/keys\"],\n listDeploymentStatuses: [\"GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses\"],\n listDeployments: [\"GET /repos/{owner}/{repo}/deployments\"],\n listForAuthenticatedUser: [\"GET /user/repos\"],\n listForOrg: [\"GET /orgs/{org}/repos\"],\n listForUser: [\"GET /users/{username}/repos\"],\n listForks: [\"GET /repos/{owner}/{repo}/forks\"],\n listInvitations: [\"GET /repos/{owner}/{repo}/invitations\"],\n listInvitationsForAuthenticatedUser: [\"GET /user/repository_invitations\"],\n listLanguages: [\"GET /repos/{owner}/{repo}/languages\"],\n listPagesBuilds: [\"GET /repos/{owner}/{repo}/pages/builds\"],\n listPublic: [\"GET /repositories\"],\n listPullRequestsAssociatedWithCommit: [\"GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls\", {\n mediaType: {\n previews: [\"groot\"]\n }\n }],\n listReleaseAssets: [\"GET /repos/{owner}/{repo}/releases/{release_id}/assets\"],\n listReleases: [\"GET /repos/{owner}/{repo}/releases\"],\n listTags: [\"GET /repos/{owner}/{repo}/tags\"],\n listTeams: [\"GET /repos/{owner}/{repo}/teams\"],\n listWebhooks: [\"GET /repos/{owner}/{repo}/hooks\"],\n merge: [\"POST /repos/{owner}/{repo}/merges\"],\n pingWebhook: [\"POST /repos/{owner}/{repo}/hooks/{hook_id}/pings\"],\n removeAppAccessRestrictions: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps\", {}, {\n mapToData: \"apps\"\n }],\n removeCollaborator: [\"DELETE /repos/{owner}/{repo}/collaborators/{username}\"],\n removeStatusCheckContexts: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts\", {}, {\n mapToData: \"contexts\"\n }],\n removeStatusCheckProtection: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks\"],\n removeTeamAccessRestrictions: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams\", {}, {\n mapToData: \"teams\"\n }],\n removeUserAccessRestrictions: [\"DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users\", {}, {\n mapToData: \"users\"\n }],\n renameBranch: [\"POST /repos/{owner}/{repo}/branches/{branch}/rename\"],\n replaceAllTopics: [\"PUT /repos/{owner}/{repo}/topics\", {\n mediaType: {\n previews: [\"mercy\"]\n }\n }],\n requestPagesBuild: [\"POST /repos/{owner}/{repo}/pages/builds\"],\n setAdminBranchProtection: [\"POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins\"],\n setAppAccessRestrictions: [\"PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps\", {}, {\n mapToData: \"apps\"\n }],\n setStatusCheckContexts: [\"PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts\", {}, {\n mapToData: \"contexts\"\n }],\n setTeamAccessRestrictions: [\"PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams\", {}, {\n mapToData: \"teams\"\n }],\n setUserAccessRestrictions: [\"PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users\", {}, {\n mapToData: \"users\"\n }],\n testPushWebhook: [\"POST /repos/{owner}/{repo}/hooks/{hook_id}/tests\"],\n transfer: [\"POST /repos/{owner}/{repo}/transfer\"],\n update: [\"PATCH /repos/{owner}/{repo}\"],\n updateBranchProtection: [\"PUT /repos/{owner}/{repo}/branches/{branch}/protection\"],\n updateCommitComment: [\"PATCH /repos/{owner}/{repo}/comments/{comment_id}\"],\n updateInformationAboutPagesSite: [\"PUT /repos/{owner}/{repo}/pages\"],\n updateInvitation: [\"PATCH /repos/{owner}/{repo}/invitations/{invitation_id}\"],\n updatePullRequestReviewProtection: [\"PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews\"],\n updateRelease: [\"PATCH /repos/{owner}/{repo}/releases/{release_id}\"],\n updateReleaseAsset: [\"PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}\"],\n updateStatusCheckPotection: [\"PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks\", {}, {\n renamed: [\"repos\", \"updateStatusCheckProtection\"]\n }],\n updateStatusCheckProtection: [\"PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks\"],\n updateWebhook: [\"PATCH /repos/{owner}/{repo}/hooks/{hook_id}\"],\n updateWebhookConfigForRepo: [\"PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config\"],\n uploadReleaseAsset: [\"POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}\", {\n baseUrl: \"https://uploads.github.com\"\n }]\n },\n search: {\n code: [\"GET /search/code\"],\n commits: [\"GET /search/commits\", {\n mediaType: {\n previews: [\"cloak\"]\n }\n }],\n issuesAndPullRequests: [\"GET /search/issues\"],\n labels: [\"GET /search/labels\"],\n repos: [\"GET /search/repositories\"],\n topics: [\"GET /search/topics\", {\n mediaType: {\n previews: [\"mercy\"]\n }\n }],\n users: [\"GET /search/users\"]\n },\n secretScanning: {\n getAlert: [\"GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}\"],\n listAlertsForRepo: [\"GET /repos/{owner}/{repo}/secret-scanning/alerts\"],\n updateAlert: [\"PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}\"]\n },\n teams: {\n addOrUpdateMembershipForUserInOrg: [\"PUT /orgs/{org}/teams/{team_slug}/memberships/{username}\"],\n addOrUpdateProjectPermissionsInOrg: [\"PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n addOrUpdateRepoPermissionsInOrg: [\"PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}\"],\n checkPermissionsForProjectInOrg: [\"GET /orgs/{org}/teams/{team_slug}/projects/{project_id}\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n checkPermissionsForRepoInOrg: [\"GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}\"],\n create: [\"POST /orgs/{org}/teams\"],\n createDiscussionCommentInOrg: [\"POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments\"],\n createDiscussionInOrg: [\"POST /orgs/{org}/teams/{team_slug}/discussions\"],\n deleteDiscussionCommentInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}\"],\n deleteDiscussionInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}\"],\n deleteInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}\"],\n getByName: [\"GET /orgs/{org}/teams/{team_slug}\"],\n getDiscussionCommentInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}\"],\n getDiscussionInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}\"],\n getMembershipForUserInOrg: [\"GET /orgs/{org}/teams/{team_slug}/memberships/{username}\"],\n list: [\"GET /orgs/{org}/teams\"],\n listChildInOrg: [\"GET /orgs/{org}/teams/{team_slug}/teams\"],\n listDiscussionCommentsInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments\"],\n listDiscussionsInOrg: [\"GET /orgs/{org}/teams/{team_slug}/discussions\"],\n listForAuthenticatedUser: [\"GET /user/teams\"],\n listMembersInOrg: [\"GET /orgs/{org}/teams/{team_slug}/members\"],\n listPendingInvitationsInOrg: [\"GET /orgs/{org}/teams/{team_slug}/invitations\"],\n listProjectsInOrg: [\"GET /orgs/{org}/teams/{team_slug}/projects\", {\n mediaType: {\n previews: [\"inertia\"]\n }\n }],\n listReposInOrg: [\"GET /orgs/{org}/teams/{team_slug}/repos\"],\n removeMembershipForUserInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}\"],\n removeProjectInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}\"],\n removeRepoInOrg: [\"DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}\"],\n updateDiscussionCommentInOrg: [\"PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}\"],\n updateDiscussionInOrg: [\"PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}\"],\n updateInOrg: [\"PATCH /orgs/{org}/teams/{team_slug}\"]\n },\n users: {\n addEmailForAuthenticated: [\"POST /user/emails\"],\n block: [\"PUT /user/blocks/{username}\"],\n checkBlocked: [\"GET /user/blocks/{username}\"],\n checkFollowingForUser: [\"GET /users/{username}/following/{target_user}\"],\n checkPersonIsFollowedByAuthenticated: [\"GET /user/following/{username}\"],\n createGpgKeyForAuthenticated: [\"POST /user/gpg_keys\"],\n createPublicSshKeyForAuthenticated: [\"POST /user/keys\"],\n deleteEmailForAuthenticated: [\"DELETE /user/emails\"],\n deleteGpgKeyForAuthenticated: [\"DELETE /user/gpg_keys/{gpg_key_id}\"],\n deletePublicSshKeyForAuthenticated: [\"DELETE /user/keys/{key_id}\"],\n follow: [\"PUT /user/following/{username}\"],\n getAuthenticated: [\"GET /user\"],\n getByUsername: [\"GET /users/{username}\"],\n getContextForUser: [\"GET /users/{username}/hovercard\"],\n getGpgKeyForAuthenticated: [\"GET /user/gpg_keys/{gpg_key_id}\"],\n getPublicSshKeyForAuthenticated: [\"GET /user/keys/{key_id}\"],\n list: [\"GET /users\"],\n listBlockedByAuthenticated: [\"GET /user/blocks\"],\n listEmailsForAuthenticated: [\"GET /user/emails\"],\n listFollowedByAuthenticated: [\"GET /user/following\"],\n listFollowersForAuthenticatedUser: [\"GET /user/followers\"],\n listFollowersForUser: [\"GET /users/{username}/followers\"],\n listFollowingForUser: [\"GET /users/{username}/following\"],\n listGpgKeysForAuthenticated: [\"GET /user/gpg_keys\"],\n listGpgKeysForUser: [\"GET /users/{username}/gpg_keys\"],\n listPublicEmailsForAuthenticated: [\"GET /user/public_emails\"],\n listPublicKeysForUser: [\"GET /users/{username}/keys\"],\n listPublicSshKeysForAuthenticated: [\"GET /user/keys\"],\n setPrimaryEmailVisibilityForAuthenticated: [\"PATCH /user/email/visibility\"],\n unblock: [\"DELETE /user/blocks/{username}\"],\n unfollow: [\"DELETE /user/following/{username}\"],\n updateAuthenticated: [\"PATCH /user\"]\n }\n};\n\nconst VERSION = \"4.13.5\";\n\nfunction endpointsToMethods(octokit, endpointsMap) {\n const newMethods = {};\n\n for (const [scope, endpoints] of Object.entries(endpointsMap)) {\n for (const [methodName, endpoint] of Object.entries(endpoints)) {\n const [route, defaults, decorations] = endpoint;\n const [method, url] = route.split(/ /);\n const endpointDefaults = Object.assign({\n method,\n url\n }, defaults);\n\n if (!newMethods[scope]) {\n newMethods[scope] = {};\n }\n\n const scopeMethods = newMethods[scope];\n\n if (decorations) {\n scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations);\n continue;\n }\n\n scopeMethods[methodName] = octokit.request.defaults(endpointDefaults);\n }\n }\n\n return newMethods;\n}\n\nfunction decorate(octokit, scope, methodName, defaults, decorations) {\n const requestWithDefaults = octokit.request.defaults(defaults);\n /* istanbul ignore next */\n\n function withDecorations(...args) {\n // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488\n let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData`\n\n if (decorations.mapToData) {\n options = Object.assign({}, options, {\n data: options[decorations.mapToData],\n [decorations.mapToData]: undefined\n });\n return requestWithDefaults(options);\n }\n\n if (decorations.renamed) {\n const [newScope, newMethodName] = decorations.renamed;\n octokit.log.warn(`octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()`);\n }\n\n if (decorations.deprecated) {\n octokit.log.warn(decorations.deprecated);\n }\n\n if (decorations.renamedParameters) {\n // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488\n const options = requestWithDefaults.endpoint.merge(...args);\n\n for (const [name, alias] of Object.entries(decorations.renamedParameters)) {\n if (name in options) {\n octokit.log.warn(`\"${name}\" parameter is deprecated for \"octokit.${scope}.${methodName}()\". Use \"${alias}\" instead`);\n\n if (!(alias in options)) {\n options[alias] = options[name];\n }\n\n delete options[name];\n }\n }\n\n return requestWithDefaults(options);\n } // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488\n\n\n return requestWithDefaults(...args);\n }\n\n return Object.assign(withDecorations, requestWithDefaults);\n}\n\nfunction restEndpointMethods(octokit) {\n return endpointsToMethods(octokit, Endpoints);\n}\nrestEndpointMethods.VERSION = VERSION;\n\nexports.restEndpointMethods = restEndpointMethods;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar deprecation = require('deprecation');\nvar once = _interopDefault(require('once'));\n\nconst logOnce = once(deprecation => console.warn(deprecation));\n/**\n * Error with extra properties to help with debugging\n */\n\nclass RequestError extends Error {\n constructor(message, statusCode, options) {\n super(message); // Maintains proper stack trace (only available on V8)\n\n /* istanbul ignore next */\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n this.name = \"HttpError\";\n this.status = statusCode;\n Object.defineProperty(this, \"code\", {\n get() {\n logOnce(new deprecation.Deprecation(\"[@octokit/request-error] `error.code` is deprecated, use `error.status`.\"));\n return statusCode;\n }\n\n });\n this.headers = options.headers || {}; // redact request credentials without mutating original request options\n\n const requestCopy = Object.assign({}, options.request);\n\n if (options.request.headers.authorization) {\n requestCopy.headers = Object.assign({}, options.request.headers, {\n authorization: options.request.headers.authorization.replace(/ .*$/, \" [REDACTED]\")\n });\n }\n\n requestCopy.url = requestCopy.url // client_id & client_secret can be passed as URL query parameters to increase rate limit\n // see https://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications\n .replace(/\\bclient_secret=\\w+/g, \"client_secret=[REDACTED]\") // OAuth tokens can be passed as URL query parameters, although it is not recommended\n // see https://developer.github.com/v3/#oauth2-token-sent-in-a-header\n .replace(/\\baccess_token=\\w+/g, \"access_token=[REDACTED]\");\n this.request = requestCopy;\n }\n\n}\n\nexports.RequestError = RequestError;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar endpoint = require('@octokit/endpoint');\nvar universalUserAgent = require('universal-user-agent');\nvar isPlainObject = require('is-plain-object');\nvar nodeFetch = _interopDefault(require('node-fetch'));\nvar requestError = require('@octokit/request-error');\n\nconst VERSION = \"5.4.14\";\n\nfunction getBufferResponse(response) {\n return response.arrayBuffer();\n}\n\nfunction fetchWrapper(requestOptions) {\n if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {\n requestOptions.body = JSON.stringify(requestOptions.body);\n }\n\n let headers = {};\n let status;\n let url;\n const fetch = requestOptions.request && requestOptions.request.fetch || nodeFetch;\n return fetch(requestOptions.url, Object.assign({\n method: requestOptions.method,\n body: requestOptions.body,\n headers: requestOptions.headers,\n redirect: requestOptions.redirect\n }, requestOptions.request)).then(response => {\n url = response.url;\n status = response.status;\n\n for (const keyAndValue of response.headers) {\n headers[keyAndValue[0]] = keyAndValue[1];\n }\n\n if (status === 204 || status === 205) {\n return;\n } // GitHub API returns 200 for HEAD requests\n\n\n if (requestOptions.method === \"HEAD\") {\n if (status < 400) {\n return;\n }\n\n throw new requestError.RequestError(response.statusText, status, {\n headers,\n request: requestOptions\n });\n }\n\n if (status === 304) {\n throw new requestError.RequestError(\"Not modified\", status, {\n headers,\n request: requestOptions\n });\n }\n\n if (status >= 400) {\n return response.text().then(message => {\n const error = new requestError.RequestError(message, status, {\n headers,\n request: requestOptions\n });\n\n try {\n let responseBody = JSON.parse(error.message);\n Object.assign(error, responseBody);\n let errors = responseBody.errors; // Assumption `errors` would always be in Array format\n\n error.message = error.message + \": \" + errors.map(JSON.stringify).join(\", \");\n } catch (e) {// ignore, see octokit/rest.js#684\n }\n\n throw error;\n });\n }\n\n const contentType = response.headers.get(\"content-type\");\n\n if (/application\\/json/.test(contentType)) {\n return response.json();\n }\n\n if (!contentType || /^text\\/|charset=utf-8$/.test(contentType)) {\n return response.text();\n }\n\n return getBufferResponse(response);\n }).then(data => {\n return {\n status,\n url,\n headers,\n data\n };\n }).catch(error => {\n if (error instanceof requestError.RequestError) {\n throw error;\n }\n\n throw new requestError.RequestError(error.message, 500, {\n headers,\n request: requestOptions\n });\n });\n}\n\nfunction withDefaults(oldEndpoint, newDefaults) {\n const endpoint = oldEndpoint.defaults(newDefaults);\n\n const newApi = function (route, parameters) {\n const endpointOptions = endpoint.merge(route, parameters);\n\n if (!endpointOptions.request || !endpointOptions.request.hook) {\n return fetchWrapper(endpoint.parse(endpointOptions));\n }\n\n const request = (route, parameters) => {\n return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));\n };\n\n Object.assign(request, {\n endpoint,\n defaults: withDefaults.bind(null, endpoint)\n });\n return endpointOptions.request.hook(request, endpointOptions);\n };\n\n return Object.assign(newApi, {\n endpoint,\n defaults: withDefaults.bind(null, endpoint)\n });\n}\n\nconst request = withDefaults(endpoint.endpoint, {\n headers: {\n \"user-agent\": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`\n }\n});\n\nexports.request = request;\n//# sourceMappingURL=index.js.map\n","var register = require('./lib/register')\nvar addHook = require('./lib/add')\nvar removeHook = require('./lib/remove')\n\n// bind with array of arguments: https://stackoverflow.com/a/21792913\nvar bind = Function.bind\nvar bindable = bind.bind(bind)\n\nfunction bindApi (hook, state, name) {\n var removeHookRef = bindable(removeHook, null).apply(null, name ? [state, name] : [state])\n hook.api = { remove: removeHookRef }\n hook.remove = removeHookRef\n\n ;['before', 'error', 'after', 'wrap'].forEach(function (kind) {\n var args = name ? [state, kind, name] : [state, kind]\n hook[kind] = hook.api[kind] = bindable(addHook, null).apply(null, args)\n })\n}\n\nfunction HookSingular () {\n var singularHookName = 'h'\n var singularHookState = {\n registry: {}\n }\n var singularHook = register.bind(null, singularHookState, singularHookName)\n bindApi(singularHook, singularHookState, singularHookName)\n return singularHook\n}\n\nfunction HookCollection () {\n var state = {\n registry: {}\n }\n\n var hook = register.bind(null, state)\n bindApi(hook, state)\n\n return hook\n}\n\nvar collectionHookDeprecationMessageDisplayed = false\nfunction Hook () {\n if (!collectionHookDeprecationMessageDisplayed) {\n console.warn('[before-after-hook]: \"Hook()\" repurposing warning, use \"Hook.Collection()\". Read more: https://git.io/upgrade-before-after-hook-to-1.4')\n collectionHookDeprecationMessageDisplayed = true\n }\n return HookCollection()\n}\n\nHook.Singular = HookSingular.bind()\nHook.Collection = HookCollection.bind()\n\nmodule.exports = Hook\n// expose constructors as a named property for TypeScript\nmodule.exports.Hook = Hook\nmodule.exports.Singular = Hook.Singular\nmodule.exports.Collection = Hook.Collection\n","module.exports = addHook;\n\nfunction addHook(state, kind, name, hook) {\n var orig = hook;\n if (!state.registry[name]) {\n state.registry[name] = [];\n }\n\n if (kind === \"before\") {\n hook = function (method, options) {\n return Promise.resolve()\n .then(orig.bind(null, options))\n .then(method.bind(null, options));\n };\n }\n\n if (kind === \"after\") {\n hook = function (method, options) {\n var result;\n return Promise.resolve()\n .then(method.bind(null, options))\n .then(function (result_) {\n result = result_;\n return orig(result, options);\n })\n .then(function () {\n return result;\n });\n };\n }\n\n if (kind === \"error\") {\n hook = function (method, options) {\n return Promise.resolve()\n .then(method.bind(null, options))\n .catch(function (error) {\n return orig(error, options);\n });\n };\n }\n\n state.registry[name].push({\n hook: hook,\n orig: orig,\n });\n}\n","module.exports = register;\n\nfunction register(state, name, method, options) {\n if (typeof method !== \"function\") {\n throw new Error(\"method for before hook must be a function\");\n }\n\n if (!options) {\n options = {};\n }\n\n if (Array.isArray(name)) {\n return name.reverse().reduce(function (callback, name) {\n return register.bind(null, state, name, callback, options);\n }, method)();\n }\n\n return Promise.resolve().then(function () {\n if (!state.registry[name]) {\n return method(options);\n }\n\n return state.registry[name].reduce(function (method, registered) {\n return registered.hook.bind(null, method, options);\n }, method)();\n });\n}\n","module.exports = removeHook;\n\nfunction removeHook(state, name, method) {\n if (!state.registry[name]) {\n return;\n }\n\n var index = state.registry[name]\n .map(function (registered) {\n return registered.orig;\n })\n .indexOf(method);\n\n if (index === -1) {\n return;\n }\n\n state.registry[name].splice(index, 1);\n}\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nclass Deprecation extends Error {\n constructor(message) {\n super(message); // Maintains proper stack trace (only available on V8)\n\n /* istanbul ignore next */\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n\n this.name = 'Deprecation';\n }\n\n}\n\nexports.Deprecation = Deprecation;\n","\"use strict\";\nvar parserlib = require('./cssparser');\n\nmodule.exports = CSSStyleDeclaration;\n\nfunction CSSStyleDeclaration(elt) {\n this._element = elt;\n}\n\n// Utility function for parsing style declarations\n// Pass in a string like \"margin-left: 5px; border-style: solid\"\n// and this function returns an object like\n// {\"margin-left\":\"5px\", \"border-style\":\"solid\"}\nfunction parseStyles(s) {\n var parser = new parserlib.css.Parser();\n var result = { property: Object.create(null), priority: Object.create(null) };\n parser.addListener(\"property\", function(e) {\n if (e.invalid) return; // Skip errors\n result.property[e.property.text] = e.value.text;\n if (e.important) result.priority[e.property.text] = 'important';\n });\n s = (''+s).replace(/^;/, '');\n parser.parseStyleAttribute(s);\n return result;\n}\n\nvar NO_CHANGE = {}; // Private marker object\n\nCSSStyleDeclaration.prototype = Object.create(Object.prototype, {\n\n // Return the parsed form of the element's style attribute.\n // If the element's style attribute has never been parsed\n // or if it has changed since the last parse, then reparse it\n // Note that the styles don't get parsed until they're actually needed\n _parsed: { get: function() {\n if (!this._parsedStyles || this.cssText !== this._lastParsedText) {\n var text = this.cssText;\n this._parsedStyles = parseStyles(text);\n this._lastParsedText = text;\n delete this._names;\n }\n return this._parsedStyles;\n }},\n\n // Call this method any time the parsed representation of the\n // style changes. It converts the style properties to a string and\n // sets cssText and the element's style attribute\n _serialize: { value: function() {\n var styles = this._parsed;\n var s = \"\";\n\n for(var name in styles.property) {\n if (s) s += \" \";\n s += name + \": \" + styles.property[name];\n if (styles.priority[name]) {\n s += \" !\" + styles.priority[name];\n }\n s += \";\";\n }\n\n this.cssText = s; // also sets the style attribute\n this._lastParsedText = s; // so we don't reparse\n delete this._names;\n }},\n\n cssText: {\n get: function() {\n // XXX: this is a CSSStyleDeclaration for an element.\n // A different impl might be necessary for a set of styles\n // associated returned by getComputedStyle(), e.g.\n return this._element.getAttribute(\"style\");\n },\n set: function(value) {\n // XXX: I should parse and serialize the value to\n // normalize it and remove errors. FF and chrome do that.\n this._element.setAttribute(\"style\", value);\n }\n },\n\n length: { get: function() {\n if (!this._names)\n this._names = Object.getOwnPropertyNames(this._parsed.property);\n return this._names.length;\n }},\n\n item: { value: function(n) {\n if (!this._names)\n this._names = Object.getOwnPropertyNames(this._parsed.property);\n return this._names[n];\n }},\n\n getPropertyValue: { value: function(property) {\n property = property.toLowerCase();\n return this._parsed.property[property] || \"\";\n }},\n\n getPropertyPriority: { value: function(property) {\n property = property.toLowerCase();\n return this._parsed.priority[property] || \"\";\n }},\n\n setProperty: { value: function(property, value, priority) {\n property = property.toLowerCase();\n if (value === null || value === undefined) {\n value = \"\";\n }\n if (priority === null || priority === undefined) {\n priority = \"\";\n }\n\n // String coercion\n if (value !== NO_CHANGE) {\n value = \"\" + value;\n }\n\n if (value === \"\") {\n this.removeProperty(property);\n return;\n }\n\n if (priority !== \"\" && priority !== NO_CHANGE &&\n !/^important$/i.test(priority)) {\n return;\n }\n\n var styles = this._parsed;\n if (value === NO_CHANGE) {\n if (!styles.property[property]) {\n return; // Not a valid property name.\n }\n if (priority !== \"\") {\n styles.priority[property] = \"important\";\n } else {\n delete styles.priority[property];\n }\n } else {\n // We don't just accept the property value. Instead\n // we parse it to ensure that it is something valid.\n // If it contains a semicolon it is invalid\n if (value.indexOf(\";\") !== -1) return;\n\n var newprops = parseStyles(property + \":\" + value);\n if (Object.getOwnPropertyNames(newprops.property).length === 0) {\n return; // no valid property found\n }\n if (Object.getOwnPropertyNames(newprops.priority).length !== 0) {\n return; // if the value included '!important' it wasn't valid.\n }\n\n // XXX handle shorthand properties\n\n for (var p in newprops.property) {\n styles.property[p] = newprops.property[p];\n if (priority === NO_CHANGE) {\n continue;\n } else if (priority !== \"\") {\n styles.priority[p] = \"important\";\n } else if (styles.priority[p]) {\n delete styles.priority[p];\n }\n }\n }\n\n // Serialize and update cssText and element.style!\n this._serialize();\n }},\n\n setPropertyValue: { value: function(property, value) {\n return this.setProperty(property, value, NO_CHANGE);\n }},\n\n setPropertyPriority: { value: function(property, priority) {\n return this.setProperty(property, NO_CHANGE, priority);\n }},\n\n removeProperty: { value: function(property) {\n property = property.toLowerCase();\n var styles = this._parsed;\n if (property in styles.property) {\n delete styles.property[property];\n delete styles.priority[property];\n\n // Serialize and update cssText and element.style!\n this._serialize();\n }\n }},\n});\n\nvar cssProperties = {\n alignContent: \"align-content\",\n alignItems: \"align-items\",\n alignmentBaseline: \"alignment-baseline\",\n alignSelf: \"align-self\",\n animation: \"animation\",\n animationDelay: \"animation-delay\",\n animationDirection: \"animation-direction\",\n animationDuration: \"animation-duration\",\n animationFillMode: \"animation-fill-mode\",\n animationIterationCount: \"animation-iteration-count\",\n animationName: \"animation-name\",\n animationPlayState: \"animation-play-state\",\n animationTimingFunction: \"animation-timing-function\",\n backfaceVisibility: \"backface-visibility\",\n background: \"background\",\n backgroundAttachment: \"background-attachment\",\n backgroundClip: \"background-clip\",\n backgroundColor: \"background-color\",\n backgroundImage: \"background-image\",\n backgroundOrigin: \"background-origin\",\n backgroundPosition: \"background-position\",\n backgroundPositionX: \"background-position-x\",\n backgroundPositionY: \"background-position-y\",\n backgroundRepeat: \"background-repeat\",\n backgroundSize: \"background-size\",\n baselineShift: \"baseline-shift\",\n border: \"border\",\n borderBottom: \"border-bottom\",\n borderBottomColor: \"border-bottom-color\",\n borderBottomLeftRadius: \"border-bottom-left-radius\",\n borderBottomRightRadius: \"border-bottom-right-radius\",\n borderBottomStyle: \"border-bottom-style\",\n borderBottomWidth: \"border-bottom-width\",\n borderCollapse: \"border-collapse\",\n borderColor: \"border-color\",\n borderImage: \"border-image\",\n borderImageOutset: \"border-image-outset\",\n borderImageRepeat: \"border-image-repeat\",\n borderImageSlice: \"border-image-slice\",\n borderImageSource: \"border-image-source\",\n borderImageWidth: \"border-image-width\",\n borderLeft: \"border-left\",\n borderLeftColor: \"border-left-color\",\n borderLeftStyle: \"border-left-style\",\n borderLeftWidth: \"border-left-width\",\n borderRadius: \"border-radius\",\n borderRight: \"border-right\",\n borderRightColor: \"border-right-color\",\n borderRightStyle: \"border-right-style\",\n borderRightWidth: \"border-right-width\",\n borderSpacing: \"border-spacing\",\n borderStyle: \"border-style\",\n borderTop: \"border-top\",\n borderTopColor: \"border-top-color\",\n borderTopLeftRadius: \"border-top-left-radius\",\n borderTopRightRadius: \"border-top-right-radius\",\n borderTopStyle: \"border-top-style\",\n borderTopWidth: \"border-top-width\",\n borderWidth: \"border-width\",\n bottom: \"bottom\",\n boxShadow: \"box-shadow\",\n boxSizing: \"box-sizing\",\n breakAfter: \"break-after\",\n breakBefore: \"break-before\",\n breakInside: \"break-inside\",\n captionSide: \"caption-side\",\n clear: \"clear\",\n clip: \"clip\",\n clipPath: \"clip-path\",\n clipRule: \"clip-rule\",\n color: \"color\",\n colorInterpolationFilters: \"color-interpolation-filters\",\n columnCount: \"column-count\",\n columnFill: \"column-fill\",\n columnGap: \"column-gap\",\n columnRule: \"column-rule\",\n columnRuleColor: \"column-rule-color\",\n columnRuleStyle: \"column-rule-style\",\n columnRuleWidth: \"column-rule-width\",\n columns: \"columns\",\n columnSpan: \"column-span\",\n columnWidth: \"column-width\",\n content: \"content\",\n counterIncrement: \"counter-increment\",\n counterReset: \"counter-reset\",\n cssFloat: \"float\",\n cursor: \"cursor\",\n direction: \"direction\",\n display: \"display\",\n dominantBaseline: \"dominant-baseline\",\n emptyCells: \"empty-cells\",\n enableBackground: \"enable-background\",\n fill: \"fill\",\n fillOpacity: \"fill-opacity\",\n fillRule: \"fill-rule\",\n filter: \"filter\",\n flex: \"flex\",\n flexBasis: \"flex-basis\",\n flexDirection: \"flex-direction\",\n flexFlow: \"flex-flow\",\n flexGrow: \"flex-grow\",\n flexShrink: \"flex-shrink\",\n flexWrap: \"flex-wrap\",\n floodColor: \"flood-color\",\n floodOpacity: \"flood-opacity\",\n font: \"font\",\n fontFamily: \"font-family\",\n fontFeatureSettings: \"font-feature-settings\",\n fontSize: \"font-size\",\n fontSizeAdjust: \"font-size-adjust\",\n fontStretch: \"font-stretch\",\n fontStyle: \"font-style\",\n fontVariant: \"font-variant\",\n fontWeight: \"font-weight\",\n glyphOrientationHorizontal: \"glyph-orientation-horizontal\",\n glyphOrientationVertical: \"glyph-orientation-vertical\",\n grid: \"grid\",\n gridArea: \"grid-area\",\n gridAutoColumns: \"grid-auto-columns\",\n gridAutoFlow: \"grid-auto-flow\",\n gridAutoRows: \"grid-auto-rows\",\n gridColumn: \"grid-column\",\n gridColumnEnd: \"grid-column-end\",\n gridColumnGap: \"grid-column-gap\",\n gridColumnStart: \"grid-column-start\",\n gridGap: \"grid-gap\",\n gridRow: \"grid-row\",\n gridRowEnd: \"grid-row-end\",\n gridRowGap: \"grid-row-gap\",\n gridRowStart: \"grid-row-start\",\n gridTemplate: \"grid-template\",\n gridTemplateAreas: \"grid-template-areas\",\n gridTemplateColumns: \"grid-template-columns\",\n gridTemplateRows: \"grid-template-rows\",\n height: \"height\",\n imeMode: \"ime-mode\",\n justifyContent: \"justify-content\",\n kerning: \"kerning\",\n layoutGrid: \"layout-grid\",\n layoutGridChar: \"layout-grid-char\",\n layoutGridLine: \"layout-grid-line\",\n layoutGridMode: \"layout-grid-mode\",\n layoutGridType: \"layout-grid-type\",\n left: \"left\",\n letterSpacing: \"letter-spacing\",\n lightingColor: \"lighting-color\",\n lineBreak: \"line-break\",\n lineHeight: \"line-height\",\n listStyle: \"list-style\",\n listStyleImage: \"list-style-image\",\n listStylePosition: \"list-style-position\",\n listStyleType: \"list-style-type\",\n margin: \"margin\",\n marginBottom: \"margin-bottom\",\n marginLeft: \"margin-left\",\n marginRight: \"margin-right\",\n marginTop: \"margin-top\",\n marker: \"marker\",\n markerEnd: \"marker-end\",\n markerMid: \"marker-mid\",\n markerStart: \"marker-start\",\n mask: \"mask\",\n maxHeight: \"max-height\",\n maxWidth: \"max-width\",\n minHeight: \"min-height\",\n minWidth: \"min-width\",\n msContentZoomChaining: \"-ms-content-zoom-chaining\",\n msContentZooming: \"-ms-content-zooming\",\n msContentZoomLimit: \"-ms-content-zoom-limit\",\n msContentZoomLimitMax: \"-ms-content-zoom-limit-max\",\n msContentZoomLimitMin: \"-ms-content-zoom-limit-min\",\n msContentZoomSnap: \"-ms-content-zoom-snap\",\n msContentZoomSnapPoints: \"-ms-content-zoom-snap-points\",\n msContentZoomSnapType: \"-ms-content-zoom-snap-type\",\n msFlowFrom: \"-ms-flow-from\",\n msFlowInto: \"-ms-flow-into\",\n msFontFeatureSettings: \"-ms-font-feature-settings\",\n msGridColumn: \"-ms-grid-column\",\n msGridColumnAlign: \"-ms-grid-column-align\",\n msGridColumns: \"-ms-grid-columns\",\n msGridColumnSpan: \"-ms-grid-column-span\",\n msGridRow: \"-ms-grid-row\",\n msGridRowAlign: \"-ms-grid-row-align\",\n msGridRows: \"-ms-grid-rows\",\n msGridRowSpan: \"-ms-grid-row-span\",\n msHighContrastAdjust: \"-ms-high-contrast-adjust\",\n msHyphenateLimitChars: \"-ms-hyphenate-limit-chars\",\n msHyphenateLimitLines: \"-ms-hyphenate-limit-lines\",\n msHyphenateLimitZone: \"-ms-hyphenate-limit-zone\",\n msHyphens: \"-ms-hyphens\",\n msImeAlign: \"-ms-ime-align\",\n msOverflowStyle: \"-ms-overflow-style\",\n msScrollChaining: \"-ms-scroll-chaining\",\n msScrollLimit: \"-ms-scroll-limit\",\n msScrollLimitXMax: \"-ms-scroll-limit-x-max\",\n msScrollLimitXMin: \"-ms-scroll-limit-x-min\",\n msScrollLimitYMax: \"-ms-scroll-limit-y-max\",\n msScrollLimitYMin: \"-ms-scroll-limit-y-min\",\n msScrollRails: \"-ms-scroll-rails\",\n msScrollSnapPointsX: \"-ms-scroll-snap-points-x\",\n msScrollSnapPointsY: \"-ms-scroll-snap-points-y\",\n msScrollSnapType: \"-ms-scroll-snap-type\",\n msScrollSnapX: \"-ms-scroll-snap-x\",\n msScrollSnapY: \"-ms-scroll-snap-y\",\n msScrollTranslation: \"-ms-scroll-translation\",\n msTextCombineHorizontal: \"-ms-text-combine-horizontal\",\n msTextSizeAdjust: \"-ms-text-size-adjust\",\n msTouchAction: \"-ms-touch-action\",\n msTouchSelect: \"-ms-touch-select\",\n msUserSelect: \"-ms-user-select\",\n msWrapFlow: \"-ms-wrap-flow\",\n msWrapMargin: \"-ms-wrap-margin\",\n msWrapThrough: \"-ms-wrap-through\",\n opacity: \"opacity\",\n order: \"order\",\n orphans: \"orphans\",\n outline: \"outline\",\n outlineColor: \"outline-color\",\n outlineOffset: \"outline-offset\",\n outlineStyle: \"outline-style\",\n outlineWidth: \"outline-width\",\n overflow: \"overflow\",\n overflowX: \"overflow-x\",\n overflowY: \"overflow-y\",\n padding: \"padding\",\n paddingBottom: \"padding-bottom\",\n paddingLeft: \"padding-left\",\n paddingRight: \"padding-right\",\n paddingTop: \"padding-top\",\n page: \"page\",\n pageBreakAfter: \"page-break-after\",\n pageBreakBefore: \"page-break-before\",\n pageBreakInside: \"page-break-inside\",\n perspective: \"perspective\",\n perspectiveOrigin: \"perspective-origin\",\n pointerEvents: \"pointer-events\",\n position: \"position\",\n quotes: \"quotes\",\n right: \"right\",\n rotate: \"rotate\",\n rubyAlign: \"ruby-align\",\n rubyOverhang: \"ruby-overhang\",\n rubyPosition: \"ruby-position\",\n scale: \"scale\",\n size: \"size\",\n stopColor: \"stop-color\",\n stopOpacity: \"stop-opacity\",\n stroke: \"stroke\",\n strokeDasharray: \"stroke-dasharray\",\n strokeDashoffset: \"stroke-dashoffset\",\n strokeLinecap: \"stroke-linecap\",\n strokeLinejoin: \"stroke-linejoin\",\n strokeMiterlimit: \"stroke-miterlimit\",\n strokeOpacity: \"stroke-opacity\",\n strokeWidth: \"stroke-width\",\n tableLayout: \"table-layout\",\n textAlign: \"text-align\",\n textAlignLast: \"text-align-last\",\n textAnchor: \"text-anchor\",\n textDecoration: \"text-decoration\",\n textIndent: \"text-indent\",\n textJustify: \"text-justify\",\n textKashida: \"text-kashida\",\n textKashidaSpace: \"text-kashida-space\",\n textOverflow: \"text-overflow\",\n textShadow: \"text-shadow\",\n textTransform: \"text-transform\",\n textUnderlinePosition: \"text-underline-position\",\n top: \"top\",\n touchAction: \"touch-action\",\n transform: \"transform\",\n transformOrigin: \"transform-origin\",\n transformStyle: \"transform-style\",\n transition: \"transition\",\n transitionDelay: \"transition-delay\",\n transitionDuration: \"transition-duration\",\n transitionProperty: \"transition-property\",\n transitionTimingFunction: \"transition-timing-function\",\n translate: \"translate\",\n unicodeBidi: \"unicode-bidi\",\n verticalAlign: \"vertical-align\",\n visibility: \"visibility\",\n webkitAlignContent: \"-webkit-align-content\",\n webkitAlignItems: \"-webkit-align-items\",\n webkitAlignSelf: \"-webkit-align-self\",\n webkitAnimation: \"-webkit-animation\",\n webkitAnimationDelay: \"-webkit-animation-delay\",\n webkitAnimationDirection: \"-webkit-animation-direction\",\n webkitAnimationDuration: \"-webkit-animation-duration\",\n webkitAnimationFillMode: \"-webkit-animation-fill-mode\",\n webkitAnimationIterationCount: \"-webkit-animation-iteration-count\",\n webkitAnimationName: \"-webkit-animation-name\",\n webkitAnimationPlayState: \"-webkit-animation-play-state\",\n webkitAnimationTimingFunction: \"-webkit-animation-timing-funciton\",\n webkitAppearance: \"-webkit-appearance\",\n webkitBackfaceVisibility: \"-webkit-backface-visibility\",\n webkitBackgroundClip: \"-webkit-background-clip\",\n webkitBackgroundOrigin: \"-webkit-background-origin\",\n webkitBackgroundSize: \"-webkit-background-size\",\n webkitBorderBottomLeftRadius: \"-webkit-border-bottom-left-radius\",\n webkitBorderBottomRightRadius: \"-webkit-border-bottom-right-radius\",\n webkitBorderImage: \"-webkit-border-image\",\n webkitBorderRadius: \"-webkit-border-radius\",\n webkitBorderTopLeftRadius: \"-webkit-border-top-left-radius\",\n webkitBorderTopRightRadius: \"-webkit-border-top-right-radius\",\n webkitBoxAlign: \"-webkit-box-align\",\n webkitBoxDirection: \"-webkit-box-direction\",\n webkitBoxFlex: \"-webkit-box-flex\",\n webkitBoxOrdinalGroup: \"-webkit-box-ordinal-group\",\n webkitBoxOrient: \"-webkit-box-orient\",\n webkitBoxPack: \"-webkit-box-pack\",\n webkitBoxSizing: \"-webkit-box-sizing\",\n webkitColumnBreakAfter: \"-webkit-column-break-after\",\n webkitColumnBreakBefore: \"-webkit-column-break-before\",\n webkitColumnBreakInside: \"-webkit-column-break-inside\",\n webkitColumnCount: \"-webkit-column-count\",\n webkitColumnGap: \"-webkit-column-gap\",\n webkitColumnRule: \"-webkit-column-rule\",\n webkitColumnRuleColor: \"-webkit-column-rule-color\",\n webkitColumnRuleStyle: \"-webkit-column-rule-style\",\n webkitColumnRuleWidth: \"-webkit-column-rule-width\",\n webkitColumns: \"-webkit-columns\",\n webkitColumnSpan: \"-webkit-column-span\",\n webkitColumnWidth: \"-webkit-column-width\",\n webkitFilter: \"-webkit-filter\",\n webkitFlex: \"-webkit-flex\",\n webkitFlexBasis: \"-webkit-flex-basis\",\n webkitFlexDirection: \"-webkit-flex-direction\",\n webkitFlexFlow: \"-webkit-flex-flow\",\n webkitFlexGrow: \"-webkit-flex-grow\",\n webkitFlexShrink: \"-webkit-flex-shrink\",\n webkitFlexWrap: \"-webkit-flex-wrap\",\n webkitJustifyContent: \"-webkit-justify-content\",\n webkitOrder: \"-webkit-order\",\n webkitPerspective: \"-webkit-perspective-origin\",\n webkitPerspectiveOrigin: \"-webkit-perspective-origin\",\n webkitTapHighlightColor: \"-webkit-tap-highlight-color\",\n webkitTextFillColor: \"-webkit-text-fill-color\",\n webkitTextSizeAdjust: \"-webkit-text-size-adjust\",\n webkitTextStroke: \"-webkit-text-stroke\",\n webkitTextStrokeColor: \"-webkit-text-stroke-color\",\n webkitTextStrokeWidth: \"-webkit-text-stroke-width\",\n webkitTransform: \"-webkit-transform\",\n webkitTransformOrigin: \"-webkit-transform-origin\",\n webkitTransformStyle: \"-webkit-transform-style\",\n webkitTransition: \"-webkit-transition\",\n webkitTransitionDelay: \"-webkit-transition-delay\",\n webkitTransitionDuration: \"-webkit-transition-duration\",\n webkitTransitionProperty: \"-webkit-transition-property\",\n webkitTransitionTimingFunction: \"-webkit-transition-timing-function\",\n webkitUserModify: \"-webkit-user-modify\",\n webkitUserSelect: \"-webkit-user-select\",\n webkitWritingMode: \"-webkit-writing-mode\",\n whiteSpace: \"white-space\",\n widows: \"widows\",\n width: \"width\",\n wordBreak: \"word-break\",\n wordSpacing: \"word-spacing\",\n wordWrap: \"word-wrap\",\n writingMode: \"writing-mode\",\n zIndex: \"z-index\",\n zoom: \"zoom\",\n resize: \"resize\",\n userSelect: \"user-select\",\n};\n\nfor(var prop in cssProperties) defineStyleProperty(prop);\n\nfunction defineStyleProperty(jsname) {\n var cssname = cssProperties[jsname];\n Object.defineProperty(CSSStyleDeclaration.prototype, jsname, {\n get: function() {\n return this.getPropertyValue(cssname);\n },\n set: function(value) {\n this.setProperty(cssname, value);\n }\n });\n\n if (!CSSStyleDeclaration.prototype.hasOwnProperty(cssname)) {\n Object.defineProperty(CSSStyleDeclaration.prototype, cssname, {\n get: function() {\n return this.getPropertyValue(cssname);\n },\n set: function(value) {\n this.setProperty(cssname, value);\n }\n });\n }\n}\n","/* jshint bitwise: false */\n\"use strict\";\nmodule.exports = CharacterData;\n\nvar Leaf = require('./Leaf');\nvar utils = require('./utils');\nvar ChildNode = require('./ChildNode');\nvar NonDocumentTypeChildNode = require('./NonDocumentTypeChildNode');\n\nfunction CharacterData() {\n Leaf.call(this);\n}\n\nCharacterData.prototype = Object.create(Leaf.prototype, {\n // DOMString substringData(unsigned long offset,\n // unsigned long count);\n // The substringData(offset, count) method must run these steps:\n //\n // If offset is greater than the context object's\n // length, throw an INDEX_SIZE_ERR exception and\n // terminate these steps.\n //\n // If offset+count is greater than the context\n // object's length, return a DOMString whose value is\n // the UTF-16 code units from the offsetth UTF-16 code\n // unit to the end of data.\n //\n // Return a DOMString whose value is the UTF-16 code\n // units from the offsetth UTF-16 code unit to the\n // offset+countth UTF-16 code unit in data.\n substringData: { value: function substringData(offset, count) {\n if (arguments.length < 2) { throw new TypeError(\"Not enough arguments\"); }\n // Convert arguments to WebIDL \"unsigned long\"\n offset = offset >>> 0;\n count = count >>> 0;\n if (offset > this.data.length || offset < 0 || count < 0) {\n utils.IndexSizeError();\n }\n return this.data.substring(offset, offset+count);\n }},\n\n // void appendData(DOMString data);\n // The appendData(data) method must append data to the context\n // object's data.\n appendData: { value: function appendData(data) {\n if (arguments.length < 1) { throw new TypeError(\"Not enough arguments\"); }\n this.data += String(data);\n }},\n\n // void insertData(unsigned long offset, DOMString data);\n // The insertData(offset, data) method must run these steps:\n //\n // If offset is greater than the context object's\n // length, throw an INDEX_SIZE_ERR exception and\n // terminate these steps.\n //\n // Insert data into the context object's data after\n // offset UTF-16 code units.\n //\n insertData: { value: function insertData(offset, data) {\n return this.replaceData(offset, 0, data);\n }},\n\n\n // void deleteData(unsigned long offset, unsigned long count);\n // The deleteData(offset, count) method must run these steps:\n //\n // If offset is greater than the context object's\n // length, throw an INDEX_SIZE_ERR exception and\n // terminate these steps.\n //\n // If offset+count is greater than the context\n // object's length var count be length-offset.\n //\n // Starting from offset UTF-16 code units remove count\n // UTF-16 code units from the context object's data.\n deleteData: { value: function deleteData(offset, count) {\n return this.replaceData(offset, count, '');\n }},\n\n\n // void replaceData(unsigned long offset, unsigned long count,\n // DOMString data);\n //\n // The replaceData(offset, count, data) method must act as\n // if the deleteData() method is invoked with offset and\n // count as arguments followed by the insertData() method\n // with offset and data as arguments and re-throw any\n // exceptions these methods might have thrown.\n replaceData: { value: function replaceData(offset, count, data) {\n var curtext = this.data, len = curtext.length;\n // Convert arguments to correct WebIDL type\n offset = offset >>> 0;\n count = count >>> 0;\n data = String(data);\n\n if (offset > len || offset < 0) utils.IndexSizeError();\n\n if (offset+count > len)\n count = len - offset;\n\n var prefix = curtext.substring(0, offset),\n suffix = curtext.substring(offset+count);\n\n this.data = prefix + data + suffix;\n }},\n\n // Utility method that Node.isEqualNode() calls to test Text and\n // Comment nodes for equality. It is okay to put it here, since\n // Node will have already verified that nodeType is equal\n isEqual: { value: function isEqual(n) {\n return this._data === n._data;\n }},\n\n length: { get: function() { return this.data.length; }}\n\n});\n\nObject.defineProperties(CharacterData.prototype, ChildNode);\nObject.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode);\n","\"use strict\";\n\nvar Node = require('./Node');\nvar LinkedList = require('./LinkedList');\n\nvar createDocumentFragmentFromArguments = function(document, args) {\n var docFrag = document.createDocumentFragment();\n\n for (var i=0; i 0;\n }\n return this._firstChild !== null;\n }},\n\n childNodes: { get: function() {\n this._ensureChildNodes();\n return this._childNodes;\n }},\n\n firstChild: { get: function() {\n if (this._childNodes) {\n return this._childNodes.length === 0 ? null : this._childNodes[0];\n }\n return this._firstChild;\n }},\n\n lastChild: { get: function() {\n var kids = this._childNodes, first;\n if (kids) {\n return kids.length === 0 ? null: kids[kids.length-1];\n }\n first = this._firstChild;\n if (first === null) { return null; }\n return first._previousSibling; // circular linked list\n }},\n\n _ensureChildNodes: { value: function() {\n if (this._childNodes) { return; }\n var first = this._firstChild,\n kid = first,\n childNodes = this._childNodes = new NodeList();\n if (first) do {\n childNodes.push(kid);\n kid = kid._nextSibling;\n } while (kid !== first); // circular linked list\n this._firstChild = null; // free memory\n }},\n\n // Remove all of this node's children. This is a minor\n // optimization that only calls modify() once.\n removeChildren: { value: function removeChildren() {\n var root = this.rooted ? this.ownerDocument : null,\n next = this.firstChild,\n kid;\n while (next !== null) {\n kid = next;\n next = kid.nextSibling;\n\n if (root) root.mutateRemove(kid);\n kid.parentNode = null;\n }\n if (this._childNodes) {\n this._childNodes.length = 0;\n } else {\n this._firstChild = null;\n }\n this.modify(); // Update last modified type once only\n }},\n\n});\n","\"use strict\";\nmodule.exports = CustomEvent;\n\nvar Event = require('./Event');\n\nfunction CustomEvent(type, dictionary) {\n // Just use the superclass constructor to initialize\n Event.call(this, type, dictionary);\n}\nCustomEvent.prototype = Object.create(Event.prototype, {\n constructor: { value: CustomEvent }\n});\n","\"use strict\";\nmodule.exports = DOMException;\n\nvar INDEX_SIZE_ERR = 1;\nvar HIERARCHY_REQUEST_ERR = 3;\nvar WRONG_DOCUMENT_ERR = 4;\nvar INVALID_CHARACTER_ERR = 5;\nvar NO_MODIFICATION_ALLOWED_ERR = 7;\nvar NOT_FOUND_ERR = 8;\nvar NOT_SUPPORTED_ERR = 9;\nvar INVALID_STATE_ERR = 11;\nvar SYNTAX_ERR = 12;\nvar INVALID_MODIFICATION_ERR = 13;\nvar NAMESPACE_ERR = 14;\nvar INVALID_ACCESS_ERR = 15;\nvar TYPE_MISMATCH_ERR = 17;\nvar SECURITY_ERR = 18;\nvar NETWORK_ERR = 19;\nvar ABORT_ERR = 20;\nvar URL_MISMATCH_ERR = 21;\nvar QUOTA_EXCEEDED_ERR = 22;\nvar TIMEOUT_ERR = 23;\nvar INVALID_NODE_TYPE_ERR = 24;\nvar DATA_CLONE_ERR = 25;\n\n// Code to name\nvar names = [\n null, // No error with code 0\n 'INDEX_SIZE_ERR',\n null, // historical\n 'HIERARCHY_REQUEST_ERR',\n 'WRONG_DOCUMENT_ERR',\n 'INVALID_CHARACTER_ERR',\n null, // historical\n 'NO_MODIFICATION_ALLOWED_ERR',\n 'NOT_FOUND_ERR',\n 'NOT_SUPPORTED_ERR',\n 'INUSE_ATTRIBUTE_ERR', // historical\n 'INVALID_STATE_ERR',\n 'SYNTAX_ERR',\n 'INVALID_MODIFICATION_ERR',\n 'NAMESPACE_ERR',\n 'INVALID_ACCESS_ERR',\n null, // historical\n 'TYPE_MISMATCH_ERR',\n 'SECURITY_ERR',\n 'NETWORK_ERR',\n 'ABORT_ERR',\n 'URL_MISMATCH_ERR',\n 'QUOTA_EXCEEDED_ERR',\n 'TIMEOUT_ERR',\n 'INVALID_NODE_TYPE_ERR',\n 'DATA_CLONE_ERR',\n];\n\n// Code to message\n// These strings are from the 13 May 2011 Editor's Draft of DOM Core.\n// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html\n// Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved.\n// Used under the terms of the W3C Document License:\n// http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231\nvar messages = [\n null, // No error with code 0\n 'INDEX_SIZE_ERR (1): the index is not in the allowed range',\n null,\n 'HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model',\n 'WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required',\n 'INVALID_CHARACTER_ERR (5): the string contains invalid characters',\n null,\n 'NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified',\n 'NOT_FOUND_ERR (8): the object can not be found here',\n 'NOT_SUPPORTED_ERR (9): this operation is not supported',\n 'INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute',\n 'INVALID_STATE_ERR (11): the object is in an invalid state',\n 'SYNTAX_ERR (12): the string did not match the expected pattern',\n 'INVALID_MODIFICATION_ERR (13): the object can not be modified in this way',\n 'NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML',\n 'INVALID_ACCESS_ERR (15): the object does not support the operation or argument',\n null,\n 'TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type',\n 'SECURITY_ERR (18): the operation is insecure',\n 'NETWORK_ERR (19): a network error occurred',\n 'ABORT_ERR (20): the user aborted an operation',\n 'URL_MISMATCH_ERR (21): the given URL does not match another URL',\n 'QUOTA_EXCEEDED_ERR (22): the quota has been exceeded',\n 'TIMEOUT_ERR (23): a timeout occurred',\n 'INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation',\n 'DATA_CLONE_ERR (25): the object can not be cloned.'\n];\n\n// Name to code\nvar constants = {\n INDEX_SIZE_ERR: INDEX_SIZE_ERR,\n DOMSTRING_SIZE_ERR: 2, // historical\n HIERARCHY_REQUEST_ERR: HIERARCHY_REQUEST_ERR,\n WRONG_DOCUMENT_ERR: WRONG_DOCUMENT_ERR,\n INVALID_CHARACTER_ERR: INVALID_CHARACTER_ERR,\n NO_DATA_ALLOWED_ERR: 6, // historical\n NO_MODIFICATION_ALLOWED_ERR: NO_MODIFICATION_ALLOWED_ERR,\n NOT_FOUND_ERR: NOT_FOUND_ERR,\n NOT_SUPPORTED_ERR: NOT_SUPPORTED_ERR,\n INUSE_ATTRIBUTE_ERR: 10, // historical\n INVALID_STATE_ERR: INVALID_STATE_ERR,\n SYNTAX_ERR: SYNTAX_ERR,\n INVALID_MODIFICATION_ERR: INVALID_MODIFICATION_ERR,\n NAMESPACE_ERR: NAMESPACE_ERR,\n INVALID_ACCESS_ERR: INVALID_ACCESS_ERR,\n VALIDATION_ERR: 16, // historical\n TYPE_MISMATCH_ERR: TYPE_MISMATCH_ERR,\n SECURITY_ERR: SECURITY_ERR,\n NETWORK_ERR: NETWORK_ERR,\n ABORT_ERR: ABORT_ERR,\n URL_MISMATCH_ERR: URL_MISMATCH_ERR,\n QUOTA_EXCEEDED_ERR: QUOTA_EXCEEDED_ERR,\n TIMEOUT_ERR: TIMEOUT_ERR,\n INVALID_NODE_TYPE_ERR: INVALID_NODE_TYPE_ERR,\n DATA_CLONE_ERR: DATA_CLONE_ERR\n};\n\nfunction DOMException(code) {\n Error.call(this);\n Error.captureStackTrace(this, this.constructor);\n this.code = code;\n this.message = messages[code];\n this.name = names[code];\n}\nDOMException.prototype.__proto__ = Error.prototype;\n\n// Initialize the constants on DOMException and DOMException.prototype\nfor(var c in constants) {\n var v = { value: constants[c] };\n Object.defineProperty(DOMException, c, v);\n Object.defineProperty(DOMException.prototype, c, v);\n}\n","\"use strict\";\nmodule.exports = DOMImplementation;\n\nvar Document = require('./Document');\nvar DocumentType = require('./DocumentType');\nvar HTMLParser = require('./HTMLParser');\nvar utils = require('./utils');\nvar xml = require('./xmlnames');\n\n// Each document must have its own instance of the domimplementation object\nfunction DOMImplementation(contextObject) {\n this.contextObject = contextObject;\n}\n\n\n// Feature/version pairs that DOMImplementation.hasFeature() returns\n// true for. It returns false for anything else.\nvar supportedFeatures = {\n 'xml': { '': true, '1.0': true, '2.0': true }, // DOM Core\n 'core': { '': true, '2.0': true }, // DOM Core\n 'html': { '': true, '1.0': true, '2.0': true} , // HTML\n 'xhtml': { '': true, '1.0': true, '2.0': true} , // HTML\n};\n\nDOMImplementation.prototype = {\n hasFeature: function hasFeature(feature, version) {\n var f = supportedFeatures[(feature || '').toLowerCase()];\n return (f && f[version || '']) || false;\n },\n\n createDocumentType: function createDocumentType(qualifiedName, publicId, systemId) {\n if (!xml.isValidQName(qualifiedName)) utils.InvalidCharacterError();\n\n return new DocumentType(this.contextObject, qualifiedName, publicId, systemId);\n },\n\n createDocument: function createDocument(namespace, qualifiedName, doctype) {\n //\n // Note that the current DOMCore spec makes it impossible to\n // create an HTML document with this function, even if the\n // namespace and doctype are propertly set. See this thread:\n // http://lists.w3.org/Archives/Public/www-dom/2011AprJun/0132.html\n //\n var d = new Document(false, null);\n var e;\n\n if (qualifiedName)\n e = d.createElementNS(namespace, qualifiedName);\n else\n e = null;\n\n if (doctype) {\n d.appendChild(doctype);\n }\n\n if (e) d.appendChild(e);\n if (namespace === utils.NAMESPACE.HTML) {\n d._contentType = 'application/xhtml+xml';\n } else if (namespace === utils.NAMESPACE.SVG) {\n d._contentType = 'image/svg+xml';\n } else {\n d._contentType = 'application/xml';\n }\n\n return d;\n },\n\n createHTMLDocument: function createHTMLDocument(titleText) {\n var d = new Document(true, null);\n d.appendChild(new DocumentType(d, 'html'));\n var html = d.createElement('html');\n d.appendChild(html);\n var head = d.createElement('head');\n html.appendChild(head);\n if (titleText !== undefined) {\n var title = d.createElement('title');\n head.appendChild(title);\n title.appendChild(d.createTextNode(titleText));\n }\n html.appendChild(d.createElement('body'));\n d.modclock = 1; // Start tracking modifications\n return d;\n },\n\n mozSetOutputMutationHandler: function(doc, handler) {\n doc.mutationHandler = handler;\n },\n\n mozGetInputMutationHandler: function(doc) {\n utils.nyi();\n },\n\n mozHTMLParser: HTMLParser,\n};\n","\"use strict\";\n// DOMTokenList implementation based on https://github.com/Raynos/DOM-shim\nvar utils = require('./utils');\n\nmodule.exports = DOMTokenList;\n\nfunction DOMTokenList(getter, setter) {\n this._getString = getter;\n this._setString = setter;\n this._length = 0;\n this._lastStringValue = '';\n this._update();\n}\n\nObject.defineProperties(DOMTokenList.prototype, {\n length: { get: function() { return this._length; } },\n item: { value: function(index) {\n var list = getList(this);\n if (index < 0 || index >= list.length) {\n return null;\n }\n return list[index];\n }},\n\n contains: { value: function(token) {\n token = String(token); // no error checking for contains()\n var list = getList(this);\n return list.indexOf(token) > -1;\n }},\n\n add: { value: function() {\n var list = getList(this);\n for (var i = 0, len = arguments.length; i < len; i++) {\n var token = handleErrors(arguments[i]);\n if (list.indexOf(token) < 0) {\n list.push(token);\n }\n }\n // Note: as per spec, if handleErrors() throws any errors, we never\n // make it here and none of the changes take effect.\n // Also per spec: we run the \"update steps\" even if no change was\n // made (ie, if the token already existed)\n this._update(list);\n }},\n\n remove: { value: function() {\n var list = getList(this);\n for (var i = 0, len = arguments.length; i < len; i++) {\n var token = handleErrors(arguments[i]);\n var index = list.indexOf(token);\n if (index > -1) {\n list.splice(index, 1);\n }\n }\n // Note: as per spec, if handleErrors() throws any errors, we never\n // make it here and none of the changes take effect.\n // Also per spec: we run the \"update steps\" even if no change was\n // made (ie, if the token wasn't previously present)\n this._update(list);\n }},\n\n toggle: { value: function toggle(token, force) {\n token = handleErrors(token);\n if (this.contains(token)) {\n if (force === undefined || force === false) {\n this.remove(token);\n return false;\n }\n return true;\n } else {\n if (force === undefined || force === true) {\n this.add(token);\n return true;\n }\n return false;\n }\n }},\n\n replace: { value: function replace(token, newToken) {\n // weird corner case of spec: if `token` contains whitespace, but\n // `newToken` is the empty string, we must throw SyntaxError not\n // InvalidCharacterError (sigh)\n if (String(newToken)==='') { utils.SyntaxError(); }\n token = handleErrors(token);\n newToken = handleErrors(newToken);\n var list = getList(this);\n var idx = list.indexOf(token);\n if (idx < 0) {\n // Note that, per spec, we do not run the update steps on this path.\n return false;\n }\n var idx2 = list.indexOf(newToken);\n if (idx2 < 0) {\n list[idx] = newToken;\n } else {\n // \"replace the first instance of either `token` or `newToken` with\n // `newToken` and remove all other instances\"\n if (idx < idx2) {\n list[idx] = newToken;\n list.splice(idx2, 1);\n } else {\n // idx2 is already `newToken`\n list.splice(idx, 1);\n }\n }\n this._update(list);\n return true;\n }},\n\n toString: { value: function() {\n return this._getString();\n }},\n\n value: {\n get: function() {\n return this._getString();\n },\n set: function(v) {\n this._setString(v);\n this._update();\n }\n },\n\n // Called when the setter is called from outside this interface.\n _update: { value: function(list) {\n if (list) {\n fixIndex(this, list);\n this._setString(list.join(\" \").trim());\n } else {\n fixIndex(this, getList(this));\n }\n this._lastStringValue = this._getString();\n } },\n});\n\nfunction fixIndex(clist, list) {\n var oldLength = clist._length;\n var i;\n clist._length = list.length;\n for (i = 0; i < list.length; i++) {\n clist[i] = list[i];\n }\n // Clear/free old entries.\n for (; i < oldLength; i++) {\n clist[i] = undefined;\n }\n}\n\nfunction handleErrors(token) {\n token = String(token);\n if (token === \"\") {\n utils.SyntaxError();\n }\n if (/[ \\t\\r\\n\\f]/.test(token)) {\n utils.InvalidCharacterError();\n }\n return token;\n}\n\nfunction toArray(clist) {\n var length = clist._length;\n var arr = Array(length);\n for (var i = 0; i < length; i++) {\n arr[i] = clist[i];\n }\n return arr;\n}\n\nfunction getList(clist) {\n var strProp = clist._getString();\n if (strProp === clist._lastStringValue) {\n return toArray(clist);\n }\n var str = strProp.replace(/(^[ \\t\\r\\n\\f]+)|([ \\t\\r\\n\\f]+$)/g, '');\n if (str === \"\") {\n return [];\n } else {\n var seen = Object.create(null);\n return str.split(/[ \\t\\r\\n\\f]+/g).filter(function(n) {\n var key = '$' + n;\n if (seen[key]) { return false; }\n seen[key] = true;\n return true;\n });\n }\n}\n","\"use strict\";\nmodule.exports = Document;\n\nvar Node = require('./Node');\nvar NodeList = require('./NodeList');\nvar ContainerNode = require('./ContainerNode');\nvar Element = require('./Element');\nvar Text = require('./Text');\nvar Comment = require('./Comment');\nvar Event = require('./Event');\nvar DocumentFragment = require('./DocumentFragment');\nvar ProcessingInstruction = require('./ProcessingInstruction');\nvar DOMImplementation = require('./DOMImplementation');\nvar TreeWalker = require('./TreeWalker');\nvar NodeIterator = require('./NodeIterator');\nvar NodeFilter = require('./NodeFilter');\nvar URL = require('./URL');\nvar select = require('./select');\nvar events = require('./events');\nvar xml = require('./xmlnames');\nvar html = require('./htmlelts');\nvar svg = require('./svg');\nvar utils = require('./utils');\nvar MUTATE = require('./MutationConstants');\nvar NAMESPACE = utils.NAMESPACE;\nvar isApiWritable = require(\"./config\").isApiWritable;\n\nfunction Document(isHTML, address) {\n ContainerNode.call(this);\n this.nodeType = Node.DOCUMENT_NODE;\n this.isHTML = isHTML;\n this._address = address || 'about:blank';\n this.readyState = 'loading';\n this.implementation = new DOMImplementation(this);\n\n // DOMCore says that documents are always associated with themselves\n this.ownerDocument = null; // ... but W3C tests expect null\n this._contentType = isHTML ? 'text/html' : 'application/xml';\n\n // These will be initialized by our custom versions of\n // appendChild and insertBefore that override the inherited\n // Node methods.\n // XXX: override those methods!\n this.doctype = null;\n this.documentElement = null;\n\n // \"Associated inert template document\"\n this._templateDocCache = null;\n // List of active NodeIterators, see NodeIterator#_preremove()\n this._nodeIterators = null;\n\n // Documents are always rooted, by definition\n this._nid = 1;\n this._nextnid = 2; // For numbering children of the document\n this._nodes = [null, this]; // nid to node map\n\n // This maintains the mapping from element ids to element nodes.\n // We may need to update this mapping every time a node is rooted\n // or uprooted, and any time an attribute is added, removed or changed\n // on a rooted element.\n this.byId = Object.create(null);\n\n // This property holds a monotonically increasing value akin to\n // a timestamp used to record the last modification time of nodes\n // and their subtrees. See the lastModTime attribute and modify()\n // method of the Node class. And see FilteredElementList for an example\n // of the use of lastModTime\n this.modclock = 0;\n}\n\n// Map from lowercase event category names (used as arguments to\n// createEvent()) to the property name in the impl object of the\n// event constructor.\nvar supportedEvents = {\n event: 'Event',\n customevent: 'CustomEvent',\n uievent: 'UIEvent',\n mouseevent: 'MouseEvent'\n};\n\n// Certain arguments to document.createEvent() must be treated specially\nvar replacementEvent = {\n events: 'event',\n htmlevents: 'event',\n mouseevents: 'mouseevent',\n mutationevents: 'mutationevent',\n uievents: 'uievent'\n};\n\nvar mirrorAttr = function(f, name, defaultValue) {\n return {\n get: function() {\n var o = f.call(this);\n if (o) { return o[name]; }\n return defaultValue;\n },\n set: function(value) {\n var o = f.call(this);\n if (o) { o[name] = value; }\n },\n };\n};\n\n/** @spec https://dom.spec.whatwg.org/#validate-and-extract */\nfunction validateAndExtract(namespace, qualifiedName) {\n var prefix, localName, pos;\n if (namespace==='') { namespace = null; }\n // See https://github.com/whatwg/dom/issues/671\n // and https://github.com/whatwg/dom/issues/319\n if (!xml.isValidQName(qualifiedName)) {\n utils.InvalidCharacterError();\n }\n prefix = null;\n localName = qualifiedName;\n\n pos = qualifiedName.indexOf(':');\n if (pos >= 0) {\n prefix = qualifiedName.substring(0, pos);\n localName = qualifiedName.substring(pos+1);\n }\n if (prefix !== null && namespace === null) {\n utils.NamespaceError();\n }\n if (prefix === 'xml' && namespace !== NAMESPACE.XML) {\n utils.NamespaceError();\n }\n if ((prefix === 'xmlns' || qualifiedName === 'xmlns') &&\n namespace !== NAMESPACE.XMLNS) {\n utils.NamespaceError();\n }\n if (namespace === NAMESPACE.XMLNS && !(prefix==='xmlns' || qualifiedName==='xmlns')) {\n utils.NamespaceError();\n }\n return { namespace: namespace, prefix: prefix, localName: localName };\n}\n\nDocument.prototype = Object.create(ContainerNode.prototype, {\n // This method allows dom.js to communicate with a renderer\n // that displays the document in some way\n // XXX: I should probably move this to the window object\n _setMutationHandler: { value: function(handler) {\n this.mutationHandler = handler;\n }},\n\n // This method allows dom.js to receive event notifications\n // from the renderer.\n // XXX: I should probably move this to the window object\n _dispatchRendererEvent: { value: function(targetNid, type, details) {\n var target = this._nodes[targetNid];\n if (!target) return;\n target._dispatchEvent(new Event(type, details), true);\n }},\n\n nodeName: { value: '#document'},\n nodeValue: {\n get: function() {\n return null;\n },\n set: function() {}\n },\n\n // XXX: DOMCore may remove documentURI, so it is NYI for now\n documentURI: { get: function() { return this._address; }, set: utils.nyi },\n compatMode: { get: function() {\n // The _quirks property is set by the HTML parser\n return this._quirks ? 'BackCompat' : 'CSS1Compat';\n }},\n\n createTextNode: { value: function(data) {\n return new Text(this, String(data));\n }},\n createComment: { value: function(data) {\n return new Comment(this, data);\n }},\n createDocumentFragment: { value: function() {\n return new DocumentFragment(this);\n }},\n createProcessingInstruction: { value: function(target, data) {\n if (!xml.isValidName(target) || data.indexOf('?>') !== -1)\n utils.InvalidCharacterError();\n return new ProcessingInstruction(this, target, data);\n }},\n\n createAttribute: { value: function(localName) {\n localName = String(localName);\n if (!xml.isValidName(localName)) utils.InvalidCharacterError();\n if (this.isHTML) {\n localName = utils.toASCIILowerCase(localName);\n }\n return new Element._Attr(null, localName, null, null, '');\n }},\n createAttributeNS: { value: function(namespace, qualifiedName) {\n // Convert parameter types according to WebIDL\n namespace =\n (namespace === null || namespace === undefined || namespace === '') ? null :\n String(namespace);\n qualifiedName = String(qualifiedName);\n var ve = validateAndExtract(namespace, qualifiedName);\n return new Element._Attr(null, ve.localName, ve.prefix, ve.namespace, '');\n }},\n\n createElement: { value: function(localName) {\n localName = String(localName);\n if (!xml.isValidName(localName)) utils.InvalidCharacterError();\n // Per spec, namespace should be HTML namespace if \"context object is\n // an HTML document or context object's content type is\n // \"application/xhtml+xml\", and null otherwise.\n if (this.isHTML) {\n if (/[A-Z]/.test(localName))\n localName = utils.toASCIILowerCase(localName);\n return html.createElement(this, localName, null);\n } else if (this.contentType === 'application/xhtml+xml') {\n return html.createElement(this, localName, null);\n } else {\n return new Element(this, localName, null, null);\n }\n }, writable: isApiWritable },\n\n createElementNS: { value: function(namespace, qualifiedName) {\n // Convert parameter types according to WebIDL\n namespace =\n (namespace === null || namespace === undefined || namespace === '') ? null :\n String(namespace);\n qualifiedName = String(qualifiedName);\n var ve = validateAndExtract(namespace, qualifiedName);\n return this._createElementNS(ve.localName, ve.namespace, ve.prefix);\n }, writable: isApiWritable },\n\n // This is used directly by HTML parser, which allows it to create\n // elements with localNames containing ':' and non-default namespaces\n _createElementNS: { value: function(localName, namespace, prefix) {\n if (namespace === NAMESPACE.HTML) {\n return html.createElement(this, localName, prefix);\n }\n else if (namespace === NAMESPACE.SVG) {\n return svg.createElement(this, localName, prefix);\n }\n\n return new Element(this, localName, namespace, prefix);\n }},\n\n createEvent: { value: function createEvent(interfaceName) {\n interfaceName = interfaceName.toLowerCase();\n var name = replacementEvent[interfaceName] || interfaceName;\n var constructor = events[supportedEvents[name]];\n\n if (constructor) {\n var e = new constructor();\n e._initialized = false;\n return e;\n }\n else {\n utils.NotSupportedError();\n }\n }},\n\n // See: http://www.w3.org/TR/dom/#dom-document-createtreewalker\n createTreeWalker: {value: function (root, whatToShow, filter) {\n if (!root) { throw new TypeError(\"root argument is required\"); }\n if (!(root instanceof Node)) { throw new TypeError(\"root not a node\"); }\n whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow);\n filter = filter === undefined ? null : filter;\n\n return new TreeWalker(root, whatToShow, filter);\n }},\n\n // See: http://www.w3.org/TR/dom/#dom-document-createnodeiterator\n createNodeIterator: {value: function (root, whatToShow, filter) {\n if (!root) { throw new TypeError(\"root argument is required\"); }\n if (!(root instanceof Node)) { throw new TypeError(\"root not a node\"); }\n whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow);\n filter = filter === undefined ? null : filter;\n\n return new NodeIterator(root, whatToShow, filter);\n }},\n\n _attachNodeIterator: { value: function(ni) {\n // XXX ideally this should be a weak reference from Document to NodeIterator\n if (!this._nodeIterators) { this._nodeIterators = []; }\n this._nodeIterators.push(ni);\n }},\n\n _detachNodeIterator: { value: function(ni) {\n // ni should always be in list of node iterators\n var idx = this._nodeIterators.indexOf(ni);\n this._nodeIterators.splice(idx, 1);\n }},\n\n _preremoveNodeIterators: { value: function(toBeRemoved) {\n if (this._nodeIterators) {\n this._nodeIterators.forEach(function(ni) { ni._preremove(toBeRemoved); });\n }\n }},\n\n // Maintain the documentElement and\n // doctype properties of the document. Each of the following\n // methods chains to the Node implementation of the method\n // to do the actual inserting, removal or replacement.\n\n _updateDocTypeElement: { value: function _updateDocTypeElement() {\n this.doctype = this.documentElement = null;\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === Node.DOCUMENT_TYPE_NODE)\n this.doctype = kid;\n else if (kid.nodeType === Node.ELEMENT_NODE)\n this.documentElement = kid;\n }\n }},\n\n insertBefore: { value: function insertBefore(child, refChild) {\n Node.prototype.insertBefore.call(this, child, refChild);\n this._updateDocTypeElement();\n return child;\n }},\n\n replaceChild: { value: function replaceChild(node, child) {\n Node.prototype.replaceChild.call(this, node, child);\n this._updateDocTypeElement();\n return child;\n }},\n\n removeChild: { value: function removeChild(child) {\n Node.prototype.removeChild.call(this, child);\n this._updateDocTypeElement();\n return child;\n }},\n\n getElementById: { value: function(id) {\n var n = this.byId[id];\n if (!n) return null;\n if (n instanceof MultiId) { // there was more than one element with this id\n return n.getFirst();\n }\n return n;\n }},\n\n _hasMultipleElementsWithId: { value: function(id) {\n // Used internally by querySelectorAll optimization\n return (this.byId[id] instanceof MultiId);\n }},\n\n // Just copy this method from the Element prototype\n getElementsByName: { value: Element.prototype.getElementsByName },\n getElementsByTagName: { value: Element.prototype.getElementsByTagName },\n getElementsByTagNameNS: { value: Element.prototype.getElementsByTagNameNS },\n getElementsByClassName: { value: Element.prototype.getElementsByClassName },\n\n adoptNode: { value: function adoptNode(node) {\n if (node.nodeType === Node.DOCUMENT_NODE) utils.NotSupportedError();\n if (node.nodeType === Node.ATTRIBUTE_NODE) { return node; }\n\n if (node.parentNode) node.parentNode.removeChild(node);\n\n if (node.ownerDocument !== this)\n recursivelySetOwner(node, this);\n\n return node;\n }},\n\n importNode: { value: function importNode(node, deep) {\n return this.adoptNode(node.cloneNode(deep));\n }, writable: isApiWritable },\n\n // The following attributes and methods are from the HTML spec\n origin: { get: function origin() { return null; } },\n characterSet: { get: function characterSet() { return \"UTF-8\"; } },\n contentType: { get: function contentType() { return this._contentType; } },\n URL: { get: function URL() { return this._address; } },\n domain: { get: utils.nyi, set: utils.nyi },\n referrer: { get: utils.nyi },\n cookie: { get: utils.nyi, set: utils.nyi },\n lastModified: { get: utils.nyi },\n location: {\n\tget: function() {\n\t return this.defaultView ? this.defaultView.location : null; // gh #75\n\t},\n\tset: utils.nyi\n },\n _titleElement: {\n get: function() {\n // The title element of a document is the first title element in the\n // document in tree order, if there is one, or null otherwise.\n return this.getElementsByTagName('title').item(0) || null;\n }\n },\n title: {\n get: function() {\n var elt = this._titleElement;\n // The child text content of the title element, or '' if null.\n var value = elt ? elt.textContent : '';\n // Strip and collapse whitespace in value\n return value.replace(/[ \\t\\n\\r\\f]+/g, ' ').replace(/(^ )|( $)/g, '');\n },\n set: function(value) {\n var elt = this._titleElement;\n var head = this.head;\n if (!elt && !head) { return; /* according to spec */ }\n if (!elt) {\n elt = this.createElement('title');\n head.appendChild(elt);\n }\n elt.textContent = value;\n }\n },\n dir: mirrorAttr(function() {\n var htmlElement = this.documentElement;\n if (htmlElement && htmlElement.tagName === 'HTML') { return htmlElement; }\n }, 'dir', ''),\n fgColor: mirrorAttr(function() { return this.body; }, 'text', ''),\n linkColor: mirrorAttr(function() { return this.body; }, 'link', ''),\n vlinkColor: mirrorAttr(function() { return this.body; }, 'vLink', ''),\n alinkColor: mirrorAttr(function() { return this.body; }, 'aLink', ''),\n bgColor: mirrorAttr(function() { return this.body; }, 'bgColor', ''),\n\n // Historical aliases of Document#characterSet\n charset: { get: function() { return this.characterSet; } },\n inputEncoding: { get: function() { return this.characterSet; } },\n\n scrollingElement: {\n get: function() {\n return this._quirks ? this.body : this.documentElement;\n }\n },\n\n // Return the first child of the document element.\n // XXX For now, setting this attribute is not implemented.\n body: {\n get: function() {\n return namedHTMLChild(this.documentElement, 'body');\n },\n set: utils.nyi\n },\n // Return the first child of the document element.\n head: { get: function() {\n return namedHTMLChild(this.documentElement, 'head');\n }},\n images: { get: utils.nyi },\n embeds: { get: utils.nyi },\n plugins: { get: utils.nyi },\n links: { get: utils.nyi },\n forms: { get: utils.nyi },\n scripts: { get: utils.nyi },\n applets: { get: function() { return []; } },\n activeElement: { get: function() { return null; } },\n innerHTML: {\n get: function() { return this.serialize(); },\n set: utils.nyi\n },\n outerHTML: {\n get: function() { return this.serialize(); },\n set: utils.nyi\n },\n\n write: { value: function(args) {\n if (!this.isHTML) utils.InvalidStateError();\n\n // XXX: still have to implement the ignore part\n if (!this._parser /* && this._ignore_destructive_writes > 0 */ )\n return;\n\n if (!this._parser) {\n // XXX call document.open, etc.\n }\n\n var s = arguments.join('');\n\n // If the Document object's reload override flag is set, then\n // append the string consisting of the concatenation of all the\n // arguments to the method to the Document's reload override\n // buffer.\n // XXX: don't know what this is about. Still have to do it\n\n // If there is no pending parsing-blocking script, have the\n // tokenizer process the characters that were inserted, one at a\n // time, processing resulting tokens as they are emitted, and\n // stopping when the tokenizer reaches the insertion point or when\n // the processing of the tokenizer is aborted by the tree\n // construction stage (this can happen if a script end tag token is\n // emitted by the tokenizer).\n\n // XXX: still have to do the above. Sounds as if we don't\n // always call parse() here. If we're blocked, then we just\n // insert the text into the stream but don't parse it reentrantly...\n\n // Invoke the parser reentrantly\n this._parser.parse(s);\n }},\n\n writeln: { value: function writeln(args) {\n this.write(Array.prototype.join.call(arguments, '') + '\\n');\n }},\n\n open: { value: function() {\n this.documentElement = null;\n }},\n\n close: { value: function() {\n this.readyState = 'interactive';\n this._dispatchEvent(new Event('readystatechange'), true);\n this._dispatchEvent(new Event('DOMContentLoaded'), true);\n this.readyState = 'complete';\n this._dispatchEvent(new Event('readystatechange'), true);\n if (this.defaultView) {\n this.defaultView._dispatchEvent(new Event('load'), true);\n }\n }},\n\n // Utility methods\n clone: { value: function clone() {\n var d = new Document(this.isHTML, this._address);\n d._quirks = this._quirks;\n d._contentType = this._contentType;\n return d;\n }},\n\n // We need to adopt the nodes if we do a deep clone\n cloneNode: { value: function cloneNode(deep) {\n var clone = Node.prototype.cloneNode.call(this, false);\n if (deep) {\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n clone._appendChild(clone.importNode(kid, true));\n }\n }\n clone._updateDocTypeElement();\n return clone;\n }},\n\n isEqual: { value: function isEqual(n) {\n // Any two documents are shallowly equal.\n // Node.isEqualNode will also test the children\n return true;\n }},\n\n // Implementation-specific function. Called when a text, comment,\n // or pi value changes.\n mutateValue: { value: function(node) {\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.VALUE,\n target: node,\n data: node.data\n });\n }\n }},\n\n // Invoked when an attribute's value changes. Attr holds the new\n // value. oldval is the old value. Attribute mutations can also\n // involve changes to the prefix (and therefore the qualified name)\n mutateAttr: { value: function(attr, oldval) {\n // Manage id->element mapping for getElementsById()\n // XXX: this special case id handling should not go here,\n // but in the attribute declaration for the id attribute\n /*\n if (attr.localName === 'id' && attr.namespaceURI === null) {\n if (oldval) delId(oldval, attr.ownerElement);\n addId(attr.value, attr.ownerElement);\n }\n */\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.ATTR,\n target: attr.ownerElement,\n attr: attr\n });\n }\n }},\n\n // Used by removeAttribute and removeAttributeNS for attributes.\n mutateRemoveAttr: { value: function(attr) {\n/*\n* This is now handled in Attributes.js\n // Manage id to element mapping\n if (attr.localName === 'id' && attr.namespaceURI === null) {\n this.delId(attr.value, attr.ownerElement);\n }\n*/\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.REMOVE_ATTR,\n target: attr.ownerElement,\n attr: attr\n });\n }\n }},\n\n // Called by Node.removeChild, etc. to remove a rooted element from\n // the tree. Only needs to generate a single mutation event when a\n // node is removed, but must recursively mark all descendants as not\n // rooted.\n mutateRemove: { value: function(node) {\n // Send a single mutation event\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.REMOVE,\n target: node.parentNode,\n node: node\n });\n }\n\n // Mark this and all descendants as not rooted\n recursivelyUproot(node);\n }},\n\n // Called when a new element becomes rooted. It must recursively\n // generate mutation events for each of the children, and mark them all\n // as rooted.\n mutateInsert: { value: function(node) {\n // Mark node and its descendants as rooted\n recursivelyRoot(node);\n\n // Send a single mutation event\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.INSERT,\n target: node.parentNode,\n node: node\n });\n }\n }},\n\n // Called when a rooted element is moved within the document\n mutateMove: { value: function(node) {\n if (this.mutationHandler) {\n this.mutationHandler({\n type: MUTATE.MOVE,\n target: node\n });\n }\n }},\n\n\n // Add a mapping from id to n for n.ownerDocument\n addId: { value: function addId(id, n) {\n var val = this.byId[id];\n if (!val) {\n this.byId[id] = n;\n }\n else {\n // TODO: Add a way to opt-out console warnings\n //console.warn('Duplicate element id ' + id);\n if (!(val instanceof MultiId)) {\n val = new MultiId(val);\n this.byId[id] = val;\n }\n val.add(n);\n }\n }},\n\n // Delete the mapping from id to n for n.ownerDocument\n delId: { value: function delId(id, n) {\n var val = this.byId[id];\n utils.assert(val);\n\n if (val instanceof MultiId) {\n val.del(n);\n if (val.length === 1) { // convert back to a single node\n this.byId[id] = val.downgrade();\n }\n }\n else {\n this.byId[id] = undefined;\n }\n }},\n\n _resolve: { value: function(href) {\n //XXX: Cache the URL\n return new URL(this._documentBaseURL).resolve(href);\n }},\n\n _documentBaseURL: { get: function() {\n // XXX: This is not implemented correctly yet\n var url = this._address;\n if (url === 'about:blank') url = '/';\n\n var base = this.querySelector('base[href]');\n if (base) {\n return new URL(url).resolve(base.getAttribute('href'));\n }\n return url;\n\n // The document base URL of a Document object is the\n // absolute URL obtained by running these substeps:\n\n // Let fallback base url be the document's address.\n\n // If fallback base url is about:blank, and the\n // Document's browsing context has a creator browsing\n // context, then let fallback base url be the document\n // base URL of the creator Document instead.\n\n // If the Document is an iframe srcdoc document, then\n // let fallback base url be the document base URL of\n // the Document's browsing context's browsing context\n // container's Document instead.\n\n // If there is no base element that has an href\n // attribute, then the document base URL is fallback\n // base url; abort these steps. Otherwise, let url be\n // the value of the href attribute of the first such\n // element.\n\n // Resolve url relative to fallback base url (thus,\n // the base href attribute isn't affected by xml:base\n // attributes).\n\n // The document base URL is the result of the previous\n // step if it was successful; otherwise it is fallback\n // base url.\n }},\n\n _templateDoc: { get: function() {\n if (!this._templateDocCache) {\n // \"associated inert template document\"\n var newDoc = new Document(this.isHTML, this._address);\n this._templateDocCache = newDoc._templateDocCache = newDoc;\n }\n return this._templateDocCache;\n }},\n\n querySelector: { value: function(selector) {\n return select(selector, this)[0];\n }},\n\n querySelectorAll: { value: function(selector) {\n var nodes = select(selector, this);\n return nodes.item ? nodes : new NodeList(nodes);\n }}\n\n});\n\n\nvar eventHandlerTypes = [\n 'abort', 'canplay', 'canplaythrough', 'change', 'click', 'contextmenu',\n 'cuechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave',\n 'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended',\n 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'loadeddata',\n 'loadedmetadata', 'loadstart', 'mousedown', 'mousemove', 'mouseout',\n 'mouseover', 'mouseup', 'mousewheel', 'pause', 'play', 'playing',\n 'progress', 'ratechange', 'readystatechange', 'reset', 'seeked',\n 'seeking', 'select', 'show', 'stalled', 'submit', 'suspend',\n 'timeupdate', 'volumechange', 'waiting',\n\n 'blur', 'error', 'focus', 'load', 'scroll'\n];\n\n// Add event handler idl attribute getters and setters to Document\neventHandlerTypes.forEach(function(type) {\n // Define the event handler registration IDL attribute for this type\n Object.defineProperty(Document.prototype, 'on' + type, {\n get: function() {\n return this._getEventHandler(type);\n },\n set: function(v) {\n this._setEventHandler(type, v);\n }\n });\n});\n\nfunction namedHTMLChild(parent, name) {\n if (parent && parent.isHTML) {\n for (var kid = parent.firstChild; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === Node.ELEMENT_NODE &&\n kid.localName === name &&\n kid.namespaceURI === NAMESPACE.HTML) {\n return kid;\n }\n }\n }\n return null;\n}\n\nfunction root(n) {\n n._nid = n.ownerDocument._nextnid++;\n n.ownerDocument._nodes[n._nid] = n;\n // Manage id to element mapping\n if (n.nodeType === Node.ELEMENT_NODE) {\n var id = n.getAttribute('id');\n if (id) n.ownerDocument.addId(id, n);\n\n // Script elements need to know when they're inserted\n // into the document\n if (n._roothook) n._roothook();\n }\n}\n\nfunction uproot(n) {\n // Manage id to element mapping\n if (n.nodeType === Node.ELEMENT_NODE) {\n var id = n.getAttribute('id');\n if (id) n.ownerDocument.delId(id, n);\n }\n n.ownerDocument._nodes[n._nid] = undefined;\n n._nid = undefined;\n}\n\nfunction recursivelyRoot(node) {\n root(node);\n // XXX:\n // accessing childNodes on a leaf node creates a new array the\n // first time, so be careful to write this loop so that it\n // doesn't do that. node is polymorphic, so maybe this is hard to\n // optimize? Try switching on nodeType?\n/*\n if (node.hasChildNodes()) {\n var kids = node.childNodes;\n for(var i = 0, n = kids.length; i < n; i++)\n recursivelyRoot(kids[i]);\n }\n*/\n if (node.nodeType === Node.ELEMENT_NODE) {\n for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)\n recursivelyRoot(kid);\n }\n}\n\nfunction recursivelyUproot(node) {\n uproot(node);\n for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)\n recursivelyUproot(kid);\n}\n\nfunction recursivelySetOwner(node, owner) {\n node.ownerDocument = owner;\n node._lastModTime = undefined; // mod times are document-based\n if (Object.prototype.hasOwnProperty.call(node, '_tagName')) {\n node._tagName = undefined; // Element subclasses might need to change case\n }\n for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling)\n recursivelySetOwner(kid, owner);\n}\n\n// A class for storing multiple nodes with the same ID\nfunction MultiId(node) {\n this.nodes = Object.create(null);\n this.nodes[node._nid] = node;\n this.length = 1;\n this.firstNode = undefined;\n}\n\n// Add a node to the list, with O(1) time\nMultiId.prototype.add = function(node) {\n if (!this.nodes[node._nid]) {\n this.nodes[node._nid] = node;\n this.length++;\n this.firstNode = undefined;\n }\n};\n\n// Remove a node from the list, with O(1) time\nMultiId.prototype.del = function(node) {\n if (this.nodes[node._nid]) {\n delete this.nodes[node._nid];\n this.length--;\n this.firstNode = undefined;\n }\n};\n\n// Get the first node from the list, in the document order\n// Takes O(N) time in the size of the list, with a cache that is invalidated\n// when the list is modified.\nMultiId.prototype.getFirst = function() {\n /* jshint bitwise: false */\n if (!this.firstNode) {\n var nid;\n for (nid in this.nodes) {\n if (this.firstNode === undefined ||\n this.firstNode.compareDocumentPosition(this.nodes[nid]) & Node.DOCUMENT_POSITION_PRECEDING) {\n this.firstNode = this.nodes[nid];\n }\n }\n }\n return this.firstNode;\n};\n\n// If there is only one node left, return it. Otherwise return \"this\".\nMultiId.prototype.downgrade = function() {\n if (this.length === 1) {\n var nid;\n for (nid in this.nodes) {\n return this.nodes[nid];\n }\n }\n return this;\n};\n","\"use strict\";\nmodule.exports = DocumentFragment;\n\nvar Node = require('./Node');\nvar NodeList = require('./NodeList');\nvar ContainerNode = require('./ContainerNode');\nvar Element = require('./Element');\nvar select = require('./select');\nvar utils = require('./utils');\n\nfunction DocumentFragment(doc) {\n ContainerNode.call(this);\n this.nodeType = Node.DOCUMENT_FRAGMENT_NODE;\n this.ownerDocument = doc;\n}\n\nDocumentFragment.prototype = Object.create(ContainerNode.prototype, {\n nodeName: { value: '#document-fragment' },\n nodeValue: { \n get: function() { \n return null;\n },\n set: function() {}\n },\n // Copy the text content getter/setter from Element\n textContent: Object.getOwnPropertyDescriptor(Element.prototype, 'textContent'),\n\n querySelector: { value: function(selector) {\n // implement in terms of querySelectorAll\n var nodes = this.querySelectorAll(selector);\n return nodes.length ? nodes[0] : null;\n }},\n querySelectorAll: { value: function(selector) {\n // create a context\n var context = Object.create(this);\n // add some methods to the context for zest implementation, without\n // adding them to the public DocumentFragment API\n context.isHTML = true; // in HTML namespace (case-insensitive match)\n context.getElementsByTagName = Element.prototype.getElementsByTagName;\n context.nextElement =\n Object.getOwnPropertyDescriptor(Element.prototype, 'firstElementChild').\n get;\n // invoke zest\n var nodes = select(selector, context);\n return nodes.item ? nodes : new NodeList(nodes);\n }},\n\n // Utility methods\n clone: { value: function clone() {\n return new DocumentFragment(this.ownerDocument);\n }},\n isEqual: { value: function isEqual(n) {\n // Any two document fragments are shallowly equal.\n // Node.isEqualNode() will test their children for equality\n return true;\n }},\n\n // Non-standard, but useful (github issue #73)\n innerHTML: {\n get: function() { return this.serialize(); },\n set: utils.nyi\n },\n outerHTML: {\n get: function() { return this.serialize(); },\n set: utils.nyi\n },\n\n});\n","\"use strict\";\nmodule.exports = DocumentType;\n\nvar Node = require('./Node');\nvar Leaf = require('./Leaf');\nvar ChildNode = require('./ChildNode');\n\nfunction DocumentType(ownerDocument, name, publicId, systemId) {\n Leaf.call(this);\n this.nodeType = Node.DOCUMENT_TYPE_NODE;\n this.ownerDocument = ownerDocument || null;\n this.name = name;\n this.publicId = publicId || \"\";\n this.systemId = systemId || \"\";\n}\n\nDocumentType.prototype = Object.create(Leaf.prototype, {\n nodeName: { get: function() { return this.name; }},\n nodeValue: {\n get: function() { return null; },\n set: function() {}\n },\n\n // Utility methods\n clone: { value: function clone() {\n return new DocumentType(this.ownerDocument, this.name, this.publicId, this.systemId);\n }},\n\n isEqual: { value: function isEqual(n) {\n return this.name === n.name &&\n this.publicId === n.publicId &&\n this.systemId === n.systemId;\n }}\n});\n\nObject.defineProperties(DocumentType.prototype, ChildNode);\n","\"use strict\";\nmodule.exports = Element;\n\nvar xml = require('./xmlnames');\nvar utils = require('./utils');\nvar NAMESPACE = utils.NAMESPACE;\nvar attributes = require('./attributes');\nvar Node = require('./Node');\nvar NodeList = require('./NodeList');\nvar NodeUtils = require('./NodeUtils');\nvar FilteredElementList = require('./FilteredElementList');\nvar DOMException = require('./DOMException');\nvar DOMTokenList = require('./DOMTokenList');\nvar select = require('./select');\nvar ContainerNode = require('./ContainerNode');\nvar ChildNode = require('./ChildNode');\nvar NonDocumentTypeChildNode = require('./NonDocumentTypeChildNode');\nvar NamedNodeMap = require('./NamedNodeMap');\n\nvar uppercaseCache = Object.create(null);\n\nfunction Element(doc, localName, namespaceURI, prefix) {\n ContainerNode.call(this);\n this.nodeType = Node.ELEMENT_NODE;\n this.ownerDocument = doc;\n this.localName = localName;\n this.namespaceURI = namespaceURI;\n this.prefix = prefix;\n this._tagName = undefined;\n\n // These properties maintain the set of attributes\n this._attrsByQName = Object.create(null); // The qname->Attr map\n this._attrsByLName = Object.create(null); // The ns|lname->Attr map\n this._attrKeys = []; // attr index -> ns|lname\n}\n\nfunction recursiveGetText(node, a) {\n if (node.nodeType === Node.TEXT_NODE) {\n a.push(node._data);\n }\n else {\n for(var i = 0, n = node.childNodes.length; i < n; i++)\n recursiveGetText(node.childNodes[i], a);\n }\n}\n\nElement.prototype = Object.create(ContainerNode.prototype, {\n isHTML: { get: function isHTML() {\n return this.namespaceURI === NAMESPACE.HTML && this.ownerDocument.isHTML;\n }},\n tagName: { get: function tagName() {\n if (this._tagName === undefined) {\n var tn;\n if (this.prefix === null) {\n tn = this.localName;\n } else {\n tn = this.prefix + ':' + this.localName;\n }\n if (this.isHTML) {\n var up = uppercaseCache[tn];\n if (!up) {\n // Converting to uppercase can be slow, so cache the conversion.\n uppercaseCache[tn] = up = utils.toASCIIUpperCase(tn);\n }\n tn = up;\n }\n this._tagName = tn;\n }\n return this._tagName;\n }},\n nodeName: { get: function() { return this.tagName; }},\n nodeValue: {\n get: function() {\n return null;\n },\n set: function() {}\n },\n textContent: {\n get: function() {\n var strings = [];\n recursiveGetText(this, strings);\n return strings.join('');\n },\n set: function(newtext) {\n this.removeChildren();\n if (newtext !== null && newtext !== undefined && newtext !== '') {\n this._appendChild(this.ownerDocument.createTextNode(newtext));\n }\n }\n },\n innerHTML: {\n get: function() {\n return this.serialize();\n },\n set: utils.nyi\n },\n outerHTML: {\n get: function() {\n // \"the attribute must return the result of running the HTML fragment\n // serialization algorithm on a fictional node whose only child is\n // the context object\"\n //\n // The serialization logic is intentionally implemented in a separate\n // `NodeUtils` helper instead of the more obvious choice of a private\n // `_serializeOne()` method on the `Node.prototype` in order to avoid\n // the megamorphic `this._serializeOne` property access, which reduces\n // performance unnecessarily. If you need specialized behavior for a\n // certain subclass, you'll need to implement that in `NodeUtils`.\n // See https://github.com/fgnass/domino/pull/142 for more information.\n return NodeUtils.serializeOne(this, { nodeType: 0 });\n },\n set: function(v) {\n var document = this.ownerDocument;\n var parent = this.parentNode;\n if (parent === null) { return; }\n if (parent.nodeType === Node.DOCUMENT_NODE) {\n utils.NoModificationAllowedError();\n }\n if (parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n parent = parent.ownerDocument.createElement(\"body\");\n }\n var parser = document.implementation.mozHTMLParser(\n document._address,\n parent\n );\n parser.parse(v===null?'':String(v), true);\n this.replaceWith(parser._asDocumentFragment());\n },\n },\n\n _insertAdjacent: { value: function _insertAdjacent(position, node) {\n var first = false;\n switch(position) {\n case 'beforebegin':\n first = true;\n /* falls through */\n case 'afterend':\n var parent = this.parentNode;\n if (parent === null) { return null; }\n return parent.insertBefore(node, first ? this : this.nextSibling);\n case 'afterbegin':\n first = true;\n /* falls through */\n case 'beforeend':\n return this.insertBefore(node, first ? this.firstChild : null);\n default:\n return utils.SyntaxError();\n }\n }},\n\n insertAdjacentElement: { value: function insertAdjacentElement(position, element) {\n if (element.nodeType !== Node.ELEMENT_NODE) {\n throw new TypeError('not an element');\n }\n position = utils.toASCIILowerCase(String(position));\n return this._insertAdjacent(position, element);\n }},\n\n insertAdjacentText: { value: function insertAdjacentText(position, data) {\n var textNode = this.ownerDocument.createTextNode(data);\n position = utils.toASCIILowerCase(String(position));\n this._insertAdjacent(position, textNode);\n // \"This method returns nothing because it existed before we had a chance\n // to design it.\"\n }},\n\n insertAdjacentHTML: { value: function insertAdjacentHTML(position, text) {\n position = utils.toASCIILowerCase(String(position));\n text = String(text);\n var context;\n switch(position) {\n case 'beforebegin':\n case 'afterend':\n context = this.parentNode;\n if (context === null || context.nodeType === Node.DOCUMENT_NODE) {\n utils.NoModificationAllowedError();\n }\n break;\n case 'afterbegin':\n case 'beforeend':\n context = this;\n break;\n default:\n utils.SyntaxError();\n }\n if ( (!(context instanceof Element)) || (\n context.ownerDocument.isHTML &&\n context.localName === 'html' &&\n context.namespaceURI === NAMESPACE.HTML\n ) ) {\n context = context.ownerDocument.createElementNS(NAMESPACE.HTML, 'body');\n }\n var parser = this.ownerDocument.implementation.mozHTMLParser(\n this.ownerDocument._address, context\n );\n parser.parse(text, true);\n this._insertAdjacent(position, parser._asDocumentFragment());\n }},\n\n children: { get: function() {\n if (!this._children) {\n this._children = new ChildrenCollection(this);\n }\n return this._children;\n }},\n\n attributes: { get: function() {\n if (!this._attributes) {\n this._attributes = new AttributesArray(this);\n }\n return this._attributes;\n }},\n\n\n firstElementChild: { get: function() {\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === Node.ELEMENT_NODE) return kid;\n }\n return null;\n }},\n\n lastElementChild: { get: function() {\n for (var kid = this.lastChild; kid !== null; kid = kid.previousSibling) {\n if (kid.nodeType === Node.ELEMENT_NODE) return kid;\n }\n return null;\n }},\n\n childElementCount: { get: function() {\n return this.children.length;\n }},\n\n\n // Return the next element, in source order, after this one or\n // null if there are no more. If root element is specified,\n // then don't traverse beyond its subtree.\n //\n // This is not a DOM method, but is convenient for\n // lazy traversals of the tree.\n nextElement: { value: function(root) {\n if (!root) root = this.ownerDocument.documentElement;\n var next = this.firstElementChild;\n if (!next) {\n // don't use sibling if we're at root\n if (this===root) return null;\n next = this.nextElementSibling;\n }\n if (next) return next;\n\n // If we can't go down or across, then we have to go up\n // and across to the parent sibling or another ancestor's\n // sibling. Be careful, though: if we reach the root\n // element, or if we reach the documentElement, then\n // the traversal ends.\n for(var parent = this.parentElement;\n parent && parent !== root;\n parent = parent.parentElement) {\n\n next = parent.nextElementSibling;\n if (next) return next;\n }\n\n return null;\n }},\n\n // XXX:\n // Tests are currently failing for this function.\n // Awaiting resolution of:\n // http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0016.html\n getElementsByTagName: { value: function getElementsByTagName(lname) {\n var filter;\n if (!lname) return new NodeList();\n if (lname === '*')\n filter = function() { return true; };\n else if (this.isHTML)\n filter = htmlLocalNameElementFilter(lname);\n else\n filter = localNameElementFilter(lname);\n\n return new FilteredElementList(this, filter);\n }},\n\n getElementsByTagNameNS: { value: function getElementsByTagNameNS(ns, lname){\n var filter;\n if (ns === '*' && lname === '*')\n filter = function() { return true; };\n else if (ns === '*')\n filter = localNameElementFilter(lname);\n else if (lname === '*')\n filter = namespaceElementFilter(ns);\n else\n filter = namespaceLocalNameElementFilter(ns, lname);\n\n return new FilteredElementList(this, filter);\n }},\n\n getElementsByClassName: { value: function getElementsByClassName(names){\n names = String(names).trim();\n if (names === '') {\n var result = new NodeList(); // Empty node list\n return result;\n }\n names = names.split(/[ \\t\\r\\n\\f]+/); // Split on ASCII whitespace\n return new FilteredElementList(this, classNamesElementFilter(names));\n }},\n\n getElementsByName: { value: function getElementsByName(name) {\n return new FilteredElementList(this, elementNameFilter(String(name)));\n }},\n\n // Utility methods used by the public API methods above\n clone: { value: function clone() {\n var e;\n\n // XXX:\n // Modify this to use the constructor directly or\n // avoid error checking in some other way. In case we try\n // to clone an invalid node that the parser inserted.\n //\n if (this.namespaceURI !== NAMESPACE.HTML || this.prefix || !this.ownerDocument.isHTML) {\n e = this.ownerDocument.createElementNS(\n this.namespaceURI, (this.prefix !== null) ?\n (this.prefix + ':' + this.localName) : this.localName\n );\n } else {\n e = this.ownerDocument.createElement(this.localName);\n }\n\n for(var i = 0, n = this._attrKeys.length; i < n; i++) {\n var lname = this._attrKeys[i];\n var a = this._attrsByLName[lname];\n var b = a.cloneNode();\n b._setOwnerElement(e);\n e._attrsByLName[lname] = b;\n e._addQName(b);\n }\n e._attrKeys = this._attrKeys.concat();\n\n return e;\n }},\n\n isEqual: { value: function isEqual(that) {\n if (this.localName !== that.localName ||\n this.namespaceURI !== that.namespaceURI ||\n this.prefix !== that.prefix ||\n this._numattrs !== that._numattrs)\n return false;\n\n // Compare the sets of attributes, ignoring order\n // and ignoring attribute prefixes.\n for(var i = 0, n = this._numattrs; i < n; i++) {\n var a = this._attr(i);\n if (!that.hasAttributeNS(a.namespaceURI, a.localName))\n return false;\n if (that.getAttributeNS(a.namespaceURI,a.localName) !== a.value)\n return false;\n }\n\n return true;\n }},\n\n // This is the 'locate a namespace prefix' algorithm from the\n // DOM specification. It is used by Node.lookupPrefix()\n // (Be sure to compare DOM3 and DOM4 versions of spec.)\n _lookupNamespacePrefix: { value: function _lookupNamespacePrefix(ns, originalElement) {\n if (\n this.namespaceURI &&\n this.namespaceURI === ns &&\n this.prefix !== null &&\n originalElement.lookupNamespaceURI(this.prefix) === ns\n ) {\n return this.prefix;\n }\n\n for(var i = 0, n = this._numattrs; i < n; i++) {\n var a = this._attr(i);\n if (\n a.prefix === 'xmlns' &&\n a.value === ns &&\n originalElement.lookupNamespaceURI(a.localName) === ns\n ) {\n return a.localName;\n }\n }\n\n var parent = this.parentElement;\n return parent ? parent._lookupNamespacePrefix(ns, originalElement) : null;\n }},\n\n // This is the 'locate a namespace' algorithm for Element nodes\n // from the DOM Core spec. It is used by Node#lookupNamespaceURI()\n lookupNamespaceURI: { value: function lookupNamespaceURI(prefix) {\n if (prefix === '' || prefix === undefined) { prefix = null; }\n if (this.namespaceURI !== null && this.prefix === prefix)\n return this.namespaceURI;\n\n for(var i = 0, n = this._numattrs; i < n; i++) {\n var a = this._attr(i);\n if (a.namespaceURI === NAMESPACE.XMLNS) {\n if (\n (a.prefix === 'xmlns' && a.localName === prefix) ||\n (prefix === null && a.prefix === null && a.localName === 'xmlns')\n ) {\n return a.value || null;\n }\n }\n }\n\n var parent = this.parentElement;\n return parent ? parent.lookupNamespaceURI(prefix) : null;\n }},\n\n //\n // Attribute handling methods and utilities\n //\n\n /*\n * Attributes in the DOM are tricky:\n *\n * - there are the 8 basic get/set/has/removeAttribute{NS} methods\n *\n * - but many HTML attributes are also 'reflected' through IDL\n * attributes which means that they can be queried and set through\n * regular properties of the element. There is just one attribute\n * value, but two ways to get and set it.\n *\n * - Different HTML element types have different sets of reflected\n attributes.\n *\n * - attributes can also be queried and set through the .attributes\n * property of an element. This property behaves like an array of\n * Attr objects. The value property of each Attr is writeable, so\n * this is a third way to read and write attributes.\n *\n * - for efficiency, we really want to store attributes in some kind\n * of name->attr map. But the attributes[] array is an array, not a\n * map, which is kind of unnatural.\n *\n * - When using namespaces and prefixes, and mixing the NS methods\n * with the non-NS methods, it is apparently actually possible for\n * an attributes[] array to have more than one attribute with the\n * same qualified name. And certain methods must operate on only\n * the first attribute with such a name. So for these methods, an\n * inefficient array-like data structure would be easier to\n * implement.\n *\n * - The attributes[] array is live, not a snapshot, so changes to the\n * attributes must be immediately visible through existing arrays.\n *\n * - When attributes are queried and set through IDL properties\n * (instead of the get/setAttributes() method or the attributes[]\n * array) they may be subject to type conversions, URL\n * normalization, etc., so some extra processing is required in that\n * case.\n *\n * - But access through IDL properties is probably the most common\n * case, so we'd like that to be as fast as possible.\n *\n * - We can't just store attribute values in their parsed idl form,\n * because setAttribute() has to return whatever string is passed to\n * getAttribute even if it is not a legal, parseable value. So\n * attribute values must be stored in unparsed string form.\n *\n * - We need to be able to send change notifications or mutation\n * events of some sort to the renderer whenever an attribute value\n * changes, regardless of the way in which it changes.\n *\n * - Some attributes, such as id and class affect other parts of the\n * DOM API, like getElementById and getElementsByClassName and so\n * for efficiency, we need to specially track changes to these\n * special attributes.\n *\n * - Some attributes like class have different names (className) when\n * reflected.\n *\n * - Attributes whose names begin with the string 'data-' are treated\n specially.\n *\n * - Reflected attributes that have a boolean type in IDL have special\n * behavior: setting them to false (in IDL) is the same as removing\n * them with removeAttribute()\n *\n * - numeric attributes (like HTMLElement.tabIndex) can have default\n * values that must be returned by the idl getter even if the\n * content attribute does not exist. (The default tabIndex value\n * actually varies based on the type of the element, so that is a\n * tricky one).\n *\n * See\n * http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflect\n * for rules on how attributes are reflected.\n *\n */\n\n getAttribute: { value: function getAttribute(qname) {\n var attr = this.getAttributeNode(qname);\n return attr ? attr.value : null;\n }},\n\n getAttributeNS: { value: function getAttributeNS(ns, lname) {\n var attr = this.getAttributeNodeNS(ns, lname);\n return attr ? attr.value : null;\n }},\n\n getAttributeNode: { value: function getAttributeNode(qname) {\n qname = String(qname);\n if (/[A-Z]/.test(qname) && this.isHTML)\n qname = utils.toASCIILowerCase(qname);\n var attr = this._attrsByQName[qname];\n if (!attr) return null;\n\n if (Array.isArray(attr)) // If there is more than one\n attr = attr[0]; // use the first\n\n return attr;\n }},\n\n getAttributeNodeNS: { value: function getAttributeNodeNS(ns, lname) {\n ns = (ns === undefined || ns === null) ? '' : String(ns);\n lname = String(lname);\n var attr = this._attrsByLName[ns + '|' + lname];\n return attr ? attr : null;\n }},\n\n hasAttribute: { value: function hasAttribute(qname) {\n qname = String(qname);\n if (/[A-Z]/.test(qname) && this.isHTML)\n qname = utils.toASCIILowerCase(qname);\n return this._attrsByQName[qname] !== undefined;\n }},\n\n hasAttributeNS: { value: function hasAttributeNS(ns, lname) {\n ns = (ns === undefined || ns === null) ? '' : String(ns);\n lname = String(lname);\n var key = ns + '|' + lname;\n return this._attrsByLName[key] !== undefined;\n }},\n\n hasAttributes: { value: function hasAttributes() {\n return this._numattrs > 0;\n }},\n\n toggleAttribute: { value: function toggleAttribute(qname, force) {\n qname = String(qname);\n if (!xml.isValidName(qname)) utils.InvalidCharacterError();\n if (/[A-Z]/.test(qname) && this.isHTML)\n qname = utils.toASCIILowerCase(qname);\n var a = this._attrsByQName[qname];\n if (a === undefined) {\n if (force === undefined || force === true) {\n this._setAttribute(qname, '');\n return true;\n }\n return false;\n } else {\n if (force === undefined || force === false) {\n this.removeAttribute(qname);\n return false;\n }\n return true;\n }\n }},\n\n // Set the attribute without error checking. The parser uses this.\n _setAttribute: { value: function _setAttribute(qname, value) {\n // XXX: the spec says that this next search should be done\n // on the local name, but I think that is an error.\n // email pending on www-dom about it.\n var attr = this._attrsByQName[qname];\n var isnew;\n if (!attr) {\n attr = this._newattr(qname);\n isnew = true;\n }\n else {\n if (Array.isArray(attr)) attr = attr[0];\n }\n\n // Now set the attribute value on the new or existing Attr object.\n // The Attr.value setter method handles mutation events, etc.\n attr.value = value;\n if (this._attributes) this._attributes[qname] = attr;\n if (isnew && this._newattrhook) this._newattrhook(qname, value);\n }},\n\n // Check for errors, and then set the attribute\n setAttribute: { value: function setAttribute(qname, value) {\n qname = String(qname);\n if (!xml.isValidName(qname)) utils.InvalidCharacterError();\n if (/[A-Z]/.test(qname) && this.isHTML)\n qname = utils.toASCIILowerCase(qname);\n this._setAttribute(qname, String(value));\n }},\n\n\n // The version with no error checking used by the parser\n _setAttributeNS: { value: function _setAttributeNS(ns, qname, value) {\n var pos = qname.indexOf(':'), prefix, lname;\n if (pos < 0) {\n prefix = null;\n lname = qname;\n }\n else {\n prefix = qname.substring(0, pos);\n lname = qname.substring(pos+1);\n }\n\n if (ns === '' || ns === undefined) ns = null;\n var key = (ns === null ? '' : ns) + '|' + lname;\n\n var attr = this._attrsByLName[key];\n var isnew;\n if (!attr) {\n attr = new Attr(this, lname, prefix, ns);\n isnew = true;\n this._attrsByLName[key] = attr;\n if (this._attributes) {\n this._attributes[this._attrKeys.length] = attr;\n }\n this._attrKeys.push(key);\n\n // We also have to make the attr searchable by qname.\n // But we have to be careful because there may already\n // be an attr with this qname.\n this._addQName(attr);\n }\n else if (false /* changed in DOM 4 */) {\n // Calling setAttributeNS() can change the prefix of an\n // existing attribute in DOM 2/3.\n if (attr.prefix !== prefix) {\n // Unbind the old qname\n this._removeQName(attr);\n // Update the prefix\n attr.prefix = prefix;\n // Bind the new qname\n this._addQName(attr);\n }\n\n }\n attr.value = value; // Automatically sends mutation event\n if (isnew && this._newattrhook) this._newattrhook(qname, value);\n }},\n\n // Do error checking then call _setAttributeNS\n setAttributeNS: { value: function setAttributeNS(ns, qname, value) {\n // Convert parameter types according to WebIDL\n ns = (ns === null || ns === undefined || ns === '') ? null : String(ns);\n qname = String(qname);\n if (!xml.isValidQName(qname)) utils.InvalidCharacterError();\n\n var pos = qname.indexOf(':');\n var prefix = (pos < 0) ? null : qname.substring(0, pos);\n\n if ((prefix !== null && ns === null) ||\n (prefix === 'xml' && ns !== NAMESPACE.XML) ||\n ((qname === 'xmlns' || prefix === 'xmlns') &&\n (ns !== NAMESPACE.XMLNS)) ||\n (ns === NAMESPACE.XMLNS &&\n !(qname === 'xmlns' || prefix === 'xmlns')))\n utils.NamespaceError();\n\n this._setAttributeNS(ns, qname, String(value));\n }},\n\n setAttributeNode: { value: function setAttributeNode(attr) {\n if (attr.ownerElement !== null && attr.ownerElement !== this) {\n throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);\n }\n var result = null;\n var oldAttrs = this._attrsByQName[attr.name];\n if (oldAttrs) {\n if (!Array.isArray(oldAttrs)) { oldAttrs = [ oldAttrs ]; }\n if (oldAttrs.some(function(a) { return a===attr; })) {\n return attr;\n } else if (attr.ownerElement !== null) {\n throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);\n }\n oldAttrs.forEach(function(a) { this.removeAttributeNode(a); }, this);\n result = oldAttrs[0];\n }\n this.setAttributeNodeNS(attr);\n return result;\n }},\n\n setAttributeNodeNS: { value: function setAttributeNodeNS(attr) {\n if (attr.ownerElement !== null) {\n throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR);\n }\n var ns = attr.namespaceURI;\n var key = (ns === null ? '' : ns) + '|' + attr.localName;\n var oldAttr = this._attrsByLName[key];\n if (oldAttr) { this.removeAttributeNode(oldAttr); }\n attr._setOwnerElement(this);\n this._attrsByLName[key] = attr;\n if (this._attributes) {\n this._attributes[this._attrKeys.length] = attr;\n }\n this._attrKeys.push(key);\n this._addQName(attr);\n if (this._newattrhook) this._newattrhook(attr.name, attr.value);\n return oldAttr || null;\n }},\n\n removeAttribute: { value: function removeAttribute(qname) {\n qname = String(qname);\n if (/[A-Z]/.test(qname) && this.isHTML)\n qname = utils.toASCIILowerCase(qname);\n\n var attr = this._attrsByQName[qname];\n if (!attr) return;\n\n // If there is more than one match for this qname\n // so don't delete the qname mapping, just remove the first\n // element from it.\n if (Array.isArray(attr)) {\n if (attr.length > 2) {\n attr = attr.shift(); // remove it from the array\n }\n else {\n this._attrsByQName[qname] = attr[1];\n attr = attr[0];\n }\n }\n else {\n // only a single match, so remove the qname mapping\n this._attrsByQName[qname] = undefined;\n }\n\n var ns = attr.namespaceURI;\n // Now attr is the removed attribute. Figure out its\n // ns+lname key and remove it from the other mapping as well.\n var key = (ns === null ? '' : ns) + '|' + attr.localName;\n this._attrsByLName[key] = undefined;\n\n var i = this._attrKeys.indexOf(key);\n if (this._attributes) {\n Array.prototype.splice.call(this._attributes, i, 1);\n this._attributes[qname] = undefined;\n }\n this._attrKeys.splice(i, 1);\n\n // Onchange handler for the attribute\n var onchange = attr.onchange;\n attr._setOwnerElement(null);\n if (onchange) {\n onchange.call(attr, this, attr.localName, attr.value, null);\n }\n // Mutation event\n if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr);\n }},\n\n removeAttributeNS: { value: function removeAttributeNS(ns, lname) {\n ns = (ns === undefined || ns === null) ? '' : String(ns);\n lname = String(lname);\n var key = ns + '|' + lname;\n var attr = this._attrsByLName[key];\n if (!attr) return;\n\n this._attrsByLName[key] = undefined;\n\n var i = this._attrKeys.indexOf(key);\n if (this._attributes) {\n Array.prototype.splice.call(this._attributes, i, 1);\n }\n this._attrKeys.splice(i, 1);\n\n // Now find the same Attr object in the qname mapping and remove it\n // But be careful because there may be more than one match.\n this._removeQName(attr);\n\n // Onchange handler for the attribute\n var onchange = attr.onchange;\n attr._setOwnerElement(null);\n if (onchange) {\n onchange.call(attr, this, attr.localName, attr.value, null);\n }\n // Mutation event\n if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr);\n }},\n\n removeAttributeNode: { value: function removeAttributeNode(attr) {\n var ns = attr.namespaceURI;\n var key = (ns === null ? '' : ns) + '|' + attr.localName;\n if (this._attrsByLName[key] !== attr) {\n utils.NotFoundError();\n }\n this.removeAttributeNS(ns, attr.localName);\n return attr;\n }},\n\n getAttributeNames: { value: function getAttributeNames() {\n var elt = this;\n return this._attrKeys.map(function(key) {\n return elt._attrsByLName[key].name;\n });\n }},\n\n // This 'raw' version of getAttribute is used by the getter functions\n // of reflected attributes. It skips some error checking and\n // namespace steps\n _getattr: { value: function _getattr(qname) {\n // Assume that qname is already lowercased, so don't do it here.\n // Also don't check whether attr is an array: a qname with no\n // prefix will never have two matching Attr objects (because\n // setAttributeNS doesn't allow a non-null namespace with a\n // null prefix.\n var attr = this._attrsByQName[qname];\n return attr ? attr.value : null;\n }},\n\n // The raw version of setAttribute for reflected idl attributes.\n _setattr: { value: function _setattr(qname, value) {\n var attr = this._attrsByQName[qname];\n var isnew;\n if (!attr) {\n attr = this._newattr(qname);\n isnew = true;\n }\n attr.value = String(value);\n if (this._attributes) this._attributes[qname] = attr;\n if (isnew && this._newattrhook) this._newattrhook(qname, value);\n }},\n\n // Create a new Attr object, insert it, and return it.\n // Used by setAttribute() and by set()\n _newattr: { value: function _newattr(qname) {\n var attr = new Attr(this, qname, null, null);\n var key = '|' + qname;\n this._attrsByQName[qname] = attr;\n this._attrsByLName[key] = attr;\n if (this._attributes) {\n this._attributes[this._attrKeys.length] = attr;\n }\n this._attrKeys.push(key);\n return attr;\n }},\n\n // Add a qname->Attr mapping to the _attrsByQName object, taking into\n // account that there may be more than one attr object with the\n // same qname\n _addQName: { value: function(attr) {\n var qname = attr.name;\n var existing = this._attrsByQName[qname];\n if (!existing) {\n this._attrsByQName[qname] = attr;\n }\n else if (Array.isArray(existing)) {\n existing.push(attr);\n }\n else {\n this._attrsByQName[qname] = [existing, attr];\n }\n if (this._attributes) this._attributes[qname] = attr;\n }},\n\n // Remove a qname->Attr mapping to the _attrsByQName object, taking into\n // account that there may be more than one attr object with the\n // same qname\n _removeQName: { value: function(attr) {\n var qname = attr.name;\n var target = this._attrsByQName[qname];\n\n if (Array.isArray(target)) {\n var idx = target.indexOf(attr);\n utils.assert(idx !== -1); // It must be here somewhere\n if (target.length === 2) {\n this._attrsByQName[qname] = target[1-idx];\n if (this._attributes) {\n this._attributes[qname] = this._attrsByQName[qname];\n }\n } else {\n target.splice(idx, 1);\n if (this._attributes && this._attributes[qname] === attr) {\n this._attributes[qname] = target[0];\n }\n }\n }\n else {\n utils.assert(target === attr); // If only one, it must match\n this._attrsByQName[qname] = undefined;\n if (this._attributes) {\n this._attributes[qname] = undefined;\n }\n }\n }},\n\n // Return the number of attributes\n _numattrs: { get: function() { return this._attrKeys.length; }},\n // Return the nth Attr object\n _attr: { value: function(n) {\n return this._attrsByLName[this._attrKeys[n]];\n }},\n\n // Define getters and setters for an 'id' property that reflects\n // the content attribute 'id'.\n id: attributes.property({name: 'id'}),\n\n // Define getters and setters for a 'className' property that reflects\n // the content attribute 'class'.\n className: attributes.property({name: 'class'}),\n\n classList: { get: function() {\n var self = this;\n if (this._classList) {\n return this._classList;\n }\n var dtlist = new DOMTokenList(\n function() {\n return self.className || \"\";\n },\n function(v) {\n self.className = v;\n }\n );\n this._classList = dtlist;\n return dtlist;\n }, set: function(v) { this.className = v; }},\n\n matches: { value: function(selector) {\n return select.matches(this, selector);\n }},\n\n closest: { value: function(selector) {\n var el = this;\n\tdo {\n\t if (el.matches && el.matches(selector)) { return el; }\n\t el = el.parentElement || el.parentNode;\n\t} while (el !== null && el.nodeType === Node.ELEMENT_NODE);\n\treturn null;\n }},\n\n querySelector: { value: function(selector) {\n return select(selector, this)[0];\n }},\n\n querySelectorAll: { value: function(selector) {\n var nodes = select(selector, this);\n return nodes.item ? nodes : new NodeList(nodes);\n }}\n\n});\n\nObject.defineProperties(Element.prototype, ChildNode);\nObject.defineProperties(Element.prototype, NonDocumentTypeChildNode);\n\n// Register special handling for the id attribute\nattributes.registerChangeHandler(Element, 'id',\n function(element, lname, oldval, newval) {\n if (element.rooted) {\n if (oldval) {\n element.ownerDocument.delId(oldval, element);\n }\n if (newval) {\n element.ownerDocument.addId(newval, element);\n }\n }\n }\n);\nattributes.registerChangeHandler(Element, 'class',\n function(element, lname, oldval, newval) {\n if (element._classList) { element._classList._update(); }\n }\n);\n\n// The Attr class represents a single attribute. The values in\n// _attrsByQName and _attrsByLName are instances of this class.\nfunction Attr(elt, lname, prefix, namespace, value) {\n // localName and namespace are constant for any attr object.\n // But value may change. And so can prefix, and so, therefore can name.\n this.localName = lname;\n this.prefix = (prefix===null || prefix==='') ? null : ('' + prefix);\n this.namespaceURI = (namespace===null || namespace==='') ? null : ('' + namespace);\n this.data = value;\n // Set ownerElement last to ensure it is hooked up to onchange handler\n this._setOwnerElement(elt);\n}\n\n// In DOM 3 Attr was supposed to extend Node; in DOM 4 that was abandoned.\nAttr.prototype = Object.create(Object.prototype, {\n ownerElement: {\n get: function() { return this._ownerElement; },\n },\n _setOwnerElement: { value: function _setOwnerElement(elt) {\n this._ownerElement = elt;\n if (this.prefix === null && this.namespaceURI === null && elt) {\n this.onchange = elt._attributeChangeHandlers[this.localName];\n } else {\n this.onchange = null;\n }\n }},\n\n name: { get: function() {\n return this.prefix ? this.prefix + ':' + this.localName : this.localName;\n }},\n\n specified: { get: function() {\n // Deprecated\n return true;\n }},\n\n value: {\n get: function() {\n return this.data;\n },\n set: function(value) {\n var oldval = this.data;\n value = (value === undefined) ? '' : value + '';\n if (value === oldval) return;\n\n this.data = value;\n\n // Run the onchange hook for the attribute\n // if there is one.\n if (this.ownerElement) {\n if (this.onchange)\n this.onchange(this.ownerElement,this.localName, oldval, value);\n\n // Generate a mutation event if the element is rooted\n if (this.ownerElement.rooted)\n this.ownerElement.ownerDocument.mutateAttr(this, oldval);\n }\n },\n },\n\n cloneNode: { value: function cloneNode(deep) {\n // Both this method and Document#createAttribute*() create unowned Attrs\n return new Attr(\n null, this.localName, this.prefix, this.namespaceURI, this.data\n );\n }},\n\n // Legacy aliases (see gh#70 and https://dom.spec.whatwg.org/#interface-attr)\n nodeType: { get: function() { return Node.ATTRIBUTE_NODE; } },\n nodeName: { get: function() { return this.name; } },\n nodeValue: {\n get: function() { return this.value; },\n set: function(v) { this.value = v; },\n },\n textContent: {\n get: function() { return this.value; },\n set: function(v) {\n if (v === null || v === undefined) { v = ''; }\n this.value = v;\n },\n },\n});\n// Sneakily export this class for use by Document.createAttribute()\nElement._Attr = Attr;\n\n// The attributes property of an Element will be an instance of this class.\n// This class is really just a dummy, though. It only defines a length\n// property and an item() method. The AttrArrayProxy that\n// defines the public API just uses the Element object itself.\nfunction AttributesArray(elt) {\n NamedNodeMap.call(this, elt);\n for (var name in elt._attrsByQName) {\n this[name] = elt._attrsByQName[name];\n }\n for (var i = 0; i < elt._attrKeys.length; i++) {\n this[i] = elt._attrsByLName[elt._attrKeys[i]];\n }\n}\nAttributesArray.prototype = Object.create(NamedNodeMap.prototype, {\n length: { get: function() {\n return this.element._attrKeys.length;\n }, set: function() { /* ignore */ } },\n item: { value: function(n) {\n /* jshint bitwise: false */\n n = n >>> 0;\n if (n >= this.length) { return null; }\n return this.element._attrsByLName[this.element._attrKeys[n]];\n /* jshint bitwise: true */\n } },\n});\n\n// We can't make direct array access work (without Proxies, node >=6)\n// but we can make `Array.from(node.attributes)` and for-of loops work.\nif (global.Symbol && global.Symbol.iterator) {\n AttributesArray.prototype[global.Symbol.iterator] = function() {\n var i=0, n=this.length, self=this;\n return {\n next: function() {\n if (ielement map.\n // It is not part of the HTMLCollection API, but we need it in\n // src/HTMLCollectionProxy\n namedItems: { get: function() {\n this.updateCache();\n return this.childrenByName;\n } },\n\n updateCache: { value: function updateCache() {\n var namedElts = /^(a|applet|area|embed|form|frame|frameset|iframe|img|object)$/;\n if (this.lastModTime !== this.element.lastModTime) {\n this.lastModTime = this.element.lastModTime;\n\n var n = this.childrenByNumber && this.childrenByNumber.length || 0;\n for(var i = 0; i < n; i++) {\n this[i] = undefined;\n }\n\n this.childrenByNumber = [];\n this.childrenByName = Object.create(null);\n\n for (var c = this.element.firstChild; c !== null; c = c.nextSibling) {\n if (c.nodeType === Node.ELEMENT_NODE) {\n\n this[this.childrenByNumber.length] = c;\n this.childrenByNumber.push(c);\n\n // XXX Are there any requirements about the namespace\n // of the id property?\n var id = c.getAttribute('id');\n\n // If there is an id that is not already in use...\n if (id && !this.childrenByName[id])\n this.childrenByName[id] = c;\n\n // For certain HTML elements we check the name attribute\n var name = c.getAttribute('name');\n if (name &&\n this.element.namespaceURI === NAMESPACE.HTML &&\n namedElts.test(this.element.localName) &&\n !this.childrenByName[name])\n this.childrenByName[id] = c;\n }\n }\n }\n } },\n});\n\n// These functions return predicates for filtering elements.\n// They're used by the Document and Element classes for methods like\n// getElementsByTagName and getElementsByClassName\n\nfunction localNameElementFilter(lname) {\n return function(e) { return e.localName === lname; };\n}\n\nfunction htmlLocalNameElementFilter(lname) {\n var lclname = utils.toASCIILowerCase(lname);\n if (lclname === lname)\n return localNameElementFilter(lname);\n\n return function(e) {\n return e.isHTML ? e.localName === lclname : e.localName === lname;\n };\n}\n\nfunction namespaceElementFilter(ns) {\n return function(e) { return e.namespaceURI === ns; };\n}\n\nfunction namespaceLocalNameElementFilter(ns, lname) {\n return function(e) {\n return e.namespaceURI === ns && e.localName === lname;\n };\n}\n\nfunction classNamesElementFilter(names) {\n return function(e) {\n return names.every(function(n) { return e.classList.contains(n); });\n };\n}\n\nfunction elementNameFilter(name) {\n return function(e) {\n // All the *HTML elements* in the document with the given name attribute\n if (e.namespaceURI !== NAMESPACE.HTML) { return false; }\n return e.getAttribute('name') === name;\n };\n}\n","\"use strict\";\nmodule.exports = Event;\n\nEvent.CAPTURING_PHASE = 1;\nEvent.AT_TARGET = 2;\nEvent.BUBBLING_PHASE = 3;\n\nfunction Event(type, dictionary) {\n // Initialize basic event properties\n this.type = '';\n this.target = null;\n this.currentTarget = null;\n this.eventPhase = Event.AT_TARGET;\n this.bubbles = false;\n this.cancelable = false;\n this.isTrusted = false;\n this.defaultPrevented = false;\n this.timeStamp = Date.now();\n\n // Initialize internal flags\n // XXX: Would it be better to inherit these defaults from the prototype?\n this._propagationStopped = false;\n this._immediatePropagationStopped = false;\n this._initialized = true;\n this._dispatching = false;\n\n // Now initialize based on the constructor arguments (if any)\n if (type) this.type = type;\n if (dictionary) {\n for(var p in dictionary) {\n this[p] = dictionary[p];\n }\n }\n}\n\nEvent.prototype = Object.create(Object.prototype, {\n constructor: { value: Event },\n stopPropagation: { value: function stopPropagation() {\n this._propagationStopped = true;\n }},\n\n stopImmediatePropagation: { value: function stopImmediatePropagation() {\n this._propagationStopped = true;\n this._immediatePropagationStopped = true;\n }},\n\n preventDefault: { value: function preventDefault() {\n if (this.cancelable) this.defaultPrevented = true;\n }},\n\n initEvent: { value: function initEvent(type, bubbles, cancelable) {\n this._initialized = true;\n if (this._dispatching) return;\n\n this._propagationStopped = false;\n this._immediatePropagationStopped = false;\n this.defaultPrevented = false;\n this.isTrusted = false;\n\n this.target = null;\n this.type = type;\n this.bubbles = bubbles;\n this.cancelable = cancelable;\n }},\n\n});\n","\"use strict\";\nvar Event = require('./Event');\nvar MouseEvent = require('./MouseEvent');\nvar utils = require('./utils');\n\nmodule.exports = EventTarget;\n\nfunction EventTarget() {}\n\nEventTarget.prototype = {\n // XXX\n // See WebIDL §4.8 for details on object event handlers\n // and how they should behave. We actually have to accept\n // any object to addEventListener... Can't type check it.\n // on registration.\n\n // XXX:\n // Capturing event listeners are sort of rare. I think I can optimize\n // them so that dispatchEvent can skip the capturing phase (or much of\n // it). Each time a capturing listener is added, increment a flag on\n // the target node and each of its ancestors. Decrement when removed.\n // And update the counter when nodes are added and removed from the\n // tree as well. Then, in dispatch event, the capturing phase can\n // abort if it sees any node with a zero count.\n addEventListener: function addEventListener(type, listener, capture) {\n if (!listener) return;\n if (capture === undefined) capture = false;\n if (!this._listeners) this._listeners = Object.create(null);\n if (!this._listeners[type]) this._listeners[type] = [];\n var list = this._listeners[type];\n\n // If this listener has already been registered, just return\n for(var i = 0, n = list.length; i < n; i++) {\n var l = list[i];\n if (l.listener === listener && l.capture === capture)\n return;\n }\n\n // Add an object to the list of listeners\n var obj = { listener: listener, capture: capture };\n if (typeof listener === 'function') obj.f = listener;\n list.push(obj);\n },\n\n removeEventListener: function removeEventListener(type,\n listener,\n capture) {\n if (capture === undefined) capture = false;\n if (this._listeners) {\n var list = this._listeners[type];\n if (list) {\n // Find the listener in the list and remove it\n for(var i = 0, n = list.length; i < n; i++) {\n var l = list[i];\n if (l.listener === listener && l.capture === capture) {\n if (list.length === 1) {\n this._listeners[type] = undefined;\n }\n else {\n list.splice(i, 1);\n }\n return;\n }\n }\n }\n }\n },\n\n // This is the public API for dispatching untrusted public events.\n // See _dispatchEvent for the implementation\n dispatchEvent: function dispatchEvent(event) {\n // Dispatch an untrusted event\n return this._dispatchEvent(event, false);\n },\n\n //\n // See DOMCore §4.4\n // XXX: I'll probably need another version of this method for\n // internal use, one that does not set isTrusted to false.\n // XXX: see Document._dispatchEvent: perhaps that and this could\n // call a common internal function with different settings of\n // a trusted boolean argument\n //\n // XXX:\n // The spec has changed in how to deal with handlers registered\n // on idl or content attributes rather than with addEventListener.\n // Used to say that they always ran first. That's how webkit does it\n // Spec now says that they run in a position determined by\n // when they were first set. FF does it that way. See:\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-handlers\n //\n _dispatchEvent: function _dispatchEvent(event, trusted) {\n if (typeof trusted !== 'boolean') trusted = false;\n function invoke(target, event) {\n var type = event.type, phase = event.eventPhase;\n event.currentTarget = target;\n\n // If there was an individual handler defined, invoke it first\n // XXX: see comment above: this shouldn't always be first.\n if (phase !== Event.CAPTURING_PHASE &&\n target._handlers && target._handlers[type])\n {\n var handler = target._handlers[type];\n var rv;\n if (typeof handler === 'function') {\n rv=handler.call(event.currentTarget, event);\n }\n else {\n var f = handler.handleEvent;\n if (typeof f !== 'function')\n throw new TypeError('handleEvent property of ' +\n 'event handler object is' +\n 'not a function.');\n rv=f.call(handler, event);\n }\n\n switch(event.type) {\n case 'mouseover':\n if (rv === true) // Historical baggage\n event.preventDefault();\n break;\n case 'beforeunload':\n // XXX: eventually we need a special case here\n /* falls through */\n default:\n if (rv === false)\n event.preventDefault();\n break;\n }\n }\n\n // Now invoke list list of listeners for this target and type\n var list = target._listeners && target._listeners[type];\n if (!list) return;\n list = list.slice();\n for(var i = 0, n = list.length; i < n; i++) {\n if (event._immediatePropagationStopped) return;\n var l = list[i];\n if ((phase === Event.CAPTURING_PHASE && !l.capture) ||\n (phase === Event.BUBBLING_PHASE && l.capture))\n continue;\n if (l.f) {\n l.f.call(event.currentTarget, event);\n }\n else {\n var fn = l.listener.handleEvent;\n if (typeof fn !== 'function')\n throw new TypeError('handleEvent property of event listener object is not a function.');\n fn.call(l.listener, event);\n }\n }\n }\n\n if (!event._initialized || event._dispatching) utils.InvalidStateError();\n event.isTrusted = trusted;\n\n // Begin dispatching the event now\n event._dispatching = true;\n event.target = this;\n\n // Build the list of targets for the capturing and bubbling phases\n // XXX: we'll eventually have to add Window to this list.\n var ancestors = [];\n for(var n = this.parentNode; n; n = n.parentNode)\n ancestors.push(n);\n\n // Capturing phase\n event.eventPhase = Event.CAPTURING_PHASE;\n for(var i = ancestors.length-1; i >= 0; i--) {\n invoke(ancestors[i], event);\n if (event._propagationStopped) break;\n }\n\n // At target phase\n if (!event._propagationStopped) {\n event.eventPhase = Event.AT_TARGET;\n invoke(this, event);\n }\n\n // Bubbling phase\n if (event.bubbles && !event._propagationStopped) {\n event.eventPhase = Event.BUBBLING_PHASE;\n for(var ii = 0, nn = ancestors.length; ii < nn; ii++) {\n invoke(ancestors[ii], event);\n if (event._propagationStopped) break;\n }\n }\n\n event._dispatching = false;\n event.eventPhase = Event.AT_TARGET;\n event.currentTarget = null;\n\n // Deal with mouse events and figure out when\n // a click has happened\n if (trusted && !event.defaultPrevented && event instanceof MouseEvent) {\n switch(event.type) {\n case 'mousedown':\n this._armed = {\n x: event.clientX,\n y: event.clientY,\n t: event.timeStamp\n };\n break;\n case 'mouseout':\n case 'mouseover':\n this._armed = null;\n break;\n case 'mouseup':\n if (this._isClick(event)) this._doClick(event);\n this._armed = null;\n break;\n }\n }\n\n\n\n return !event.defaultPrevented;\n },\n\n // Determine whether a click occurred\n // XXX We don't support double clicks for now\n _isClick: function(event) {\n return (this._armed !== null &&\n event.type === 'mouseup' &&\n event.isTrusted &&\n event.button === 0 &&\n event.timeStamp - this._armed.t < 1000 &&\n Math.abs(event.clientX - this._armed.x) < 10 &&\n Math.abs(event.clientY - this._armed.Y) < 10);\n },\n\n // Clicks are handled like this:\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content-0\n //\n // Note that this method is similar to the HTMLElement.click() method\n // The event argument must be the trusted mouseup event\n _doClick: function(event) {\n if (this._click_in_progress) return;\n this._click_in_progress = true;\n\n // Find the nearest enclosing element that is activatable\n // An element is activatable if it has a\n // _post_click_activation_steps hook\n var activated = this;\n while(activated && !activated._post_click_activation_steps)\n activated = activated.parentNode;\n\n if (activated && activated._pre_click_activation_steps) {\n activated._pre_click_activation_steps();\n }\n\n var click = this.ownerDocument.createEvent('MouseEvent');\n click.initMouseEvent('click', true, true,\n this.ownerDocument.defaultView, 1,\n event.screenX, event.screenY,\n event.clientX, event.clientY,\n event.ctrlKey, event.altKey,\n event.shiftKey, event.metaKey,\n event.button, null);\n\n var result = this._dispatchEvent(click, true);\n\n if (activated) {\n if (result) {\n // This is where hyperlinks get followed, for example.\n if (activated._post_click_activation_steps)\n activated._post_click_activation_steps(click);\n }\n else {\n if (activated._cancelled_activation_steps)\n activated._cancelled_activation_steps();\n }\n }\n },\n\n //\n // An event handler is like an event listener, but it registered\n // by setting an IDL or content attribute like onload or onclick.\n // There can only be one of these at a time for any event type.\n // This is an internal method for the attribute accessors and\n // content attribute handlers that need to register events handlers.\n // The type argument is the same as in addEventListener().\n // The handler argument is the same as listeners in addEventListener:\n // it can be a function or an object. Pass null to remove any existing\n // handler. Handlers are always invoked before any listeners of\n // the same type. They are not invoked during the capturing phase\n // of event dispatch.\n //\n _setEventHandler: function _setEventHandler(type, handler) {\n if (!this._handlers) this._handlers = Object.create(null);\n this._handlers[type] = handler;\n },\n\n _getEventHandler: function _getEventHandler(type) {\n return (this._handlers && this._handlers[type]) || null;\n }\n\n};\n","\"use strict\";\nmodule.exports = FilteredElementList;\n\nvar Node = require('./Node');\n\n//\n// This file defines node list implementation that lazily traverses\n// the document tree (or a subtree rooted at any element) and includes\n// only those elements for which a specified filter function returns true.\n// It is used to implement the\n// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods.\n//\n// XXX this should inherit from NodeList\n\nfunction FilteredElementList(root, filter) {\n this.root = root;\n this.filter = filter;\n this.lastModTime = root.lastModTime;\n this.done = false;\n this.cache = [];\n this.traverse();\n}\n\nFilteredElementList.prototype = Object.create(Object.prototype, {\n length: { get: function() {\n this.checkcache();\n if (!this.done) this.traverse();\n return this.cache.length;\n } },\n\n item: { value: function(n) {\n this.checkcache();\n if (!this.done && n >= this.cache.length) {\n // This can lead to O(N^2) behavior if we stop when we get to n\n // and the caller is iterating through the items in order; so\n // be sure to do the full traverse here.\n this.traverse(/*n*/);\n }\n return this.cache[n];\n } },\n\n checkcache: { value: function() {\n if (this.lastModTime !== this.root.lastModTime) {\n // subtree has changed, so invalidate cache\n for (var i = this.cache.length-1; i>=0; i--) {\n this[i] = undefined;\n }\n this.cache.length = 0;\n this.done = false;\n this.lastModTime = this.root.lastModTime;\n }\n } },\n\n // If n is specified, then traverse the tree until we've found the nth\n // item (or until we've found all items). If n is not specified,\n // traverse until we've found all items.\n traverse: { value: function(n) {\n // increment n so we can compare to length, and so it is never falsy\n if (n !== undefined) n++;\n\n var elt;\n while ((elt = this.next()) !== null) {\n this[this.cache.length] = elt; //XXX Use proxy instead\n this.cache.push(elt);\n if (n && this.cache.length === n) return;\n }\n\n // no next element, so we've found everything\n this.done = true;\n } },\n\n // Return the next element under root that matches filter\n next: { value: function() {\n var start = (this.cache.length === 0) ? this.root // Start at the root or at\n : this.cache[this.cache.length-1]; // the last element we found\n\n var elt;\n if (start.nodeType === Node.DOCUMENT_NODE)\n elt = start.documentElement;\n else\n elt = start.nextElement(this.root);\n\n while(elt) {\n if (this.filter(elt)) {\n return elt;\n }\n\n elt = elt.nextElement(this.root);\n }\n return null;\n } },\n});\n","\"use strict\";\nmodule.exports = HTMLParser;\n\nvar Document = require('./Document');\nvar DocumentType = require('./DocumentType');\nvar Node = require('./Node');\nvar NAMESPACE = require('./utils').NAMESPACE;\nvar html = require('./htmlelts');\nvar impl = html.elements;\n\nvar pushAll = Function.prototype.apply.bind(Array.prototype.push);\n\n/*\n * This file contains an implementation of the HTML parsing algorithm.\n * The algorithm and the implementation are complex because HTML\n * explicitly defines how the parser should behave for all possible\n * valid and invalid inputs.\n *\n * Usage:\n *\n * The file defines a single HTMLParser() function, which dom.js exposes\n * publicly as document.implementation.mozHTMLParser(). This is a\n * factory function, not a constructor.\n *\n * When you call document.implementation.mozHTMLParser(), it returns\n * an object that has parse() and document() methods. To parse HTML text,\n * pass the text (in one or more chunks) to the parse() method. When\n * you've passed all the text (on the last chunk, or afterward) pass\n * true as the second argument to parse() to tell the parser that there\n * is no more coming. Call document() to get the document object that\n * the parser is parsing into. You can call this at any time, before\n * or after calling parse().\n *\n * The first argument to mozHTMLParser is the absolute URL of the document.\n *\n * The second argument is optional and is for internal use only. Pass an\n * element as the fragmentContext to do innerHTML parsing for the\n * element. To do innerHTML parsing on a document, pass null. Otherwise,\n * omit the 2nd argument. See HTMLElement.innerHTML for an example. Note\n * that if you pass a context element, the end() method will return an\n * unwrapped document instead of a wrapped one.\n *\n * Implementation details:\n *\n * This is a long file of almost 7000 lines. It is structured as one\n * big function nested within another big function. The outer\n * function defines a bunch of constant data, utility functions\n * that use that data, and a couple of classes used by the parser.\n * The outer function also defines and returns the\n * inner function. This inner function is the HTMLParser factory\n * function that implements the parser and holds all the parser state\n * as local variables. The HTMLParser function is quite big because\n * it defines many nested functions that use those local variables.\n *\n * There are three tightly coupled parser stages: a scanner, a\n * tokenizer and a tree builder. In a (possibly misguided) attempt at\n * efficiency, the stages are not implemented as separate classes:\n * everything shares state and is (mostly) implemented in imperative\n * (rather than OO) style.\n *\n * The stages of the parser work like this: When the client code calls\n * the parser's parse() method, the specified string is passed to\n * scanChars(). The scanner loops through that string and passes characters\n * (sometimes one at a time, sometimes in chunks) to the tokenizer stage.\n * The tokenizer groups the characters into tokens: tags, endtags, runs\n * of text, comments, doctype declarations, and the end-of-file (EOF)\n * token. These tokens are then passed to the tree building stage via\n * the insertToken() function. The tree building stage builds up the\n * document tree.\n *\n * The tokenizer stage is a finite state machine. Each state is\n * implemented as a function with a name that ends in \"_state\". The\n * initial state is data_state(). The current tokenizer state is stored\n * in the variable 'tokenizer'. Most state functions expect a single\n * integer argument which represents a single UTF-16 codepoint. Some\n * states want more characters and set a lookahead property on\n * themselves. The scanChars() function in the scanner checks for this\n * lookahead property. If it doesn't exist, then scanChars() just passes\n * the next input character to the current tokenizer state function.\n * Otherwise, scanChars() looks ahead (a given # of characters, or for a\n * matching string, or for a matching regexp) and passes a string of\n * characters to the current tokenizer state function.\n *\n * As a shortcut, certain states of the tokenizer use regular expressions\n * to look ahead in the scanner's input buffer for runs of text, simple\n * tags and attributes. For well-formed input, these shortcuts skip a\n * lot of state transitions and speed things up a bit.\n *\n * When a tokenizer state function has consumed a complete token, it\n * emits that token, by calling insertToken(), or by calling a utility\n * function that itself calls insertToken(). These tokens are passed to\n * the tree building stage, which is also a state machine. Like the\n * tokenizer, the tree building states are implemented as functions, and\n * these functions have names that end with _mode (because the HTML spec\n * refers to them as insertion modes). The current insertion mode is held\n * by the 'parser' variable. Each insertion mode function takes up to 4\n * arguments. The first is a token type, represented by the constants\n * TAG, ENDTAG, TEXT, COMMENT, DOCTYPE and EOF. The second argument is\n * the value of the token: the text or comment data, or tagname or\n * doctype. For tags, the 3rd argument is an array of attributes. For\n * DOCTYPES it is the optional public id. For tags, the 4th argument is\n * true if the tag is self-closing. For doctypes, the 4th argument is the\n * optional system id.\n *\n * Search for \"***\" to find the major sub-divisions in the code.\n */\n\n\n/***\n * Data prolog. Lots of constants declared here, including some\n * very large objects. They're used throughout the code that follows\n */\n// Token types for the tree builder.\nvar EOF = -1;\nvar TEXT = 1;\nvar TAG = 2;\nvar ENDTAG = 3;\nvar COMMENT = 4;\nvar DOCTYPE = 5;\n\n// A re-usable empty array\nvar NOATTRS = [];\n\n// These DTD public ids put the browser in quirks mode\nvar quirkyPublicIds = /^HTML$|^-\\/\\/W3O\\/\\/DTD W3 HTML Strict 3\\.0\\/\\/EN\\/\\/$|^-\\/W3C\\/DTD HTML 4\\.0 Transitional\\/EN$|^\\+\\/\\/Silmaril\\/\\/dtd html Pro v0r11 19970101\\/\\/|^-\\/\\/AdvaSoft Ltd\\/\\/DTD HTML 3\\.0 asWedit \\+ extensions\\/\\/|^-\\/\\/AS\\/\\/DTD HTML 3\\.0 asWedit \\+ extensions\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0 Level 1\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0 Level 2\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0 Strict Level 1\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0 Strict Level 2\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0 Strict\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.0\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 2\\.1E\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 3\\.0\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 3\\.2 Final\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 3\\.2\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML 3\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Level 0\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Level 1\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Level 2\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Level 3\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Strict Level 0\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Strict Level 1\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Strict Level 2\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Strict Level 3\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML Strict\\/\\/|^-\\/\\/IETF\\/\\/DTD HTML\\/\\/|^-\\/\\/Metrius\\/\\/DTD Metrius Presentational\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 2\\.0 HTML Strict\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 2\\.0 HTML\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 2\\.0 Tables\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 3\\.0 HTML Strict\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 3\\.0 HTML\\/\\/|^-\\/\\/Microsoft\\/\\/DTD Internet Explorer 3\\.0 Tables\\/\\/|^-\\/\\/Netscape Comm\\. Corp\\.\\/\\/DTD HTML\\/\\/|^-\\/\\/Netscape Comm\\. Corp\\.\\/\\/DTD Strict HTML\\/\\/|^-\\/\\/O'Reilly and Associates\\/\\/DTD HTML 2\\.0\\/\\/|^-\\/\\/O'Reilly and Associates\\/\\/DTD HTML Extended 1\\.0\\/\\/|^-\\/\\/O'Reilly and Associates\\/\\/DTD HTML Extended Relaxed 1\\.0\\/\\/|^-\\/\\/SoftQuad Software\\/\\/DTD HoTMetaL PRO 6\\.0::19990601::extensions to HTML 4\\.0\\/\\/|^-\\/\\/SoftQuad\\/\\/DTD HoTMetaL PRO 4\\.0::19971010::extensions to HTML 4\\.0\\/\\/|^-\\/\\/Spyglass\\/\\/DTD HTML 2\\.0 Extended\\/\\/|^-\\/\\/SQ\\/\\/DTD HTML 2\\.0 HoTMetaL \\+ extensions\\/\\/|^-\\/\\/Sun Microsystems Corp\\.\\/\\/DTD HotJava HTML\\/\\/|^-\\/\\/Sun Microsystems Corp\\.\\/\\/DTD HotJava Strict HTML\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 3 1995-03-24\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 3\\.2 Draft\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 3\\.2 Final\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 3\\.2\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 3\\.2S Draft\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 4\\.0 Frameset\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 4\\.0 Transitional\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML Experimental 19960712\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML Experimental 970421\\/\\/|^-\\/\\/W3C\\/\\/DTD W3 HTML\\/\\/|^-\\/\\/W3O\\/\\/DTD W3 HTML 3\\.0\\/\\/|^-\\/\\/WebTechs\\/\\/DTD Mozilla HTML 2\\.0\\/\\/|^-\\/\\/WebTechs\\/\\/DTD Mozilla HTML\\/\\//i;\n\nvar quirkySystemId = \"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\";\n\nvar conditionallyQuirkyPublicIds = /^-\\/\\/W3C\\/\\/DTD HTML 4\\.01 Frameset\\/\\/|^-\\/\\/W3C\\/\\/DTD HTML 4\\.01 Transitional\\/\\//i;\n\n// These DTD public ids put the browser in limited quirks mode\nvar limitedQuirkyPublicIds = /^-\\/\\/W3C\\/\\/DTD XHTML 1\\.0 Frameset\\/\\/|^-\\/\\/W3C\\/\\/DTD XHTML 1\\.0 Transitional\\/\\//i;\n\n\n// Element sets below. See the isA() function for a way to test\n// whether an element is a member of a set\nvar specialSet = Object.create(null);\nspecialSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"address\":true, \"applet\":true, \"area\":true, \"article\":true,\n \"aside\":true, \"base\":true, \"basefont\":true, \"bgsound\":true,\n \"blockquote\":true, \"body\":true, \"br\":true, \"button\":true,\n \"caption\":true, \"center\":true, \"col\":true, \"colgroup\":true,\n \"dd\":true, \"details\":true, \"dir\":true,\n \"div\":true, \"dl\":true, \"dt\":true, \"embed\":true,\n \"fieldset\":true, \"figcaption\":true, \"figure\":true, \"footer\":true,\n \"form\":true, \"frame\":true, \"frameset\":true, \"h1\":true,\n \"h2\":true, \"h3\":true, \"h4\":true, \"h5\":true,\n \"h6\":true, \"head\":true, \"header\":true, \"hgroup\":true,\n \"hr\":true, \"html\":true, \"iframe\":true, \"img\":true,\n \"input\":true, \"li\":true, \"link\":true,\n \"listing\":true, \"main\":true, \"marquee\":true, \"menu\":true, \"meta\":true,\n \"nav\":true, \"noembed\":true, \"noframes\":true, \"noscript\":true,\n \"object\":true, \"ol\":true, \"p\":true, \"param\":true,\n \"plaintext\":true, \"pre\":true, \"script\":true, \"section\":true,\n \"select\":true, \"source\":true, \"style\":true, \"summary\":true, \"table\":true,\n \"tbody\":true, \"td\":true, \"template\":true, \"textarea\":true, \"tfoot\":true,\n \"th\":true, \"thead\":true, \"title\":true, \"tr\":true, \"track\":true,\n // Note that \"xmp\" was removed from the \"special\" set in the latest\n // spec, apparently by accident; see\n // https://github.com/whatwg/html/pull/1919\n \"ul\":true, \"wbr\":true, \"xmp\":true\n};\nspecialSet[NAMESPACE.SVG] = {\n __proto__: null,\n \"foreignObject\": true, \"desc\": true, \"title\": true\n};\nspecialSet[NAMESPACE.MATHML] = {\n __proto__: null,\n \"mi\":true, \"mo\":true, \"mn\":true, \"ms\":true,\n \"mtext\":true, \"annotation-xml\":true\n};\n\n// The set of address, div, and p HTML tags\nvar addressdivpSet = Object.create(null);\naddressdivpSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"address\":true, \"div\":true, \"p\":true\n};\n\nvar dddtSet = Object.create(null);\ndddtSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"dd\":true, \"dt\":true\n};\n\nvar tablesectionrowSet = Object.create(null);\ntablesectionrowSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"table\":true, \"thead\":true, \"tbody\":true, \"tfoot\":true, \"tr\":true\n};\n\nvar impliedEndTagsSet = Object.create(null);\nimpliedEndTagsSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"dd\": true, \"dt\": true, \"li\": true, \"menuitem\": true, \"optgroup\": true,\n \"option\": true, \"p\": true, \"rb\": true, \"rp\": true, \"rt\": true, \"rtc\": true\n};\n\nvar thoroughImpliedEndTagsSet = Object.create(null);\nthoroughImpliedEndTagsSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"caption\": true, \"colgroup\": true, \"dd\": true, \"dt\": true, \"li\": true,\n \"optgroup\": true, \"option\": true, \"p\": true, \"rb\": true, \"rp\": true,\n \"rt\": true, \"rtc\": true, \"tbody\": true, \"td\": true, \"tfoot\": true,\n \"th\": true, \"thead\": true, \"tr\": true\n};\n\nvar tableContextSet = Object.create(null);\ntableContextSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"table\": true, \"template\": true, \"html\": true\n};\n\nvar tableBodyContextSet = Object.create(null);\ntableBodyContextSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"tbody\": true, \"tfoot\": true, \"thead\": true, \"template\": true, \"html\": true\n};\n\nvar tableRowContextSet = Object.create(null);\ntableRowContextSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"tr\": true, \"template\": true, \"html\": true\n};\n\n// See http://www.w3.org/TR/html5/forms.html#form-associated-element\nvar formassociatedSet = Object.create(null);\nformassociatedSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"button\": true, \"fieldset\": true, \"input\": true, \"keygen\": true,\n \"object\": true, \"output\": true, \"select\": true, \"textarea\": true,\n \"img\": true\n};\n\nvar inScopeSet = Object.create(null);\ninScopeSet[NAMESPACE.HTML]= {\n __proto__: null,\n \"applet\":true, \"caption\":true, \"html\":true, \"table\":true,\n \"td\":true, \"th\":true, \"marquee\":true, \"object\":true,\n \"template\":true\n};\ninScopeSet[NAMESPACE.MATHML] = {\n __proto__: null,\n \"mi\":true, \"mo\":true, \"mn\":true, \"ms\":true,\n \"mtext\":true, \"annotation-xml\":true\n};\ninScopeSet[NAMESPACE.SVG] = {\n __proto__: null,\n \"foreignObject\":true, \"desc\":true, \"title\":true\n};\n\nvar inListItemScopeSet = Object.create(inScopeSet);\ninListItemScopeSet[NAMESPACE.HTML] =\n Object.create(inScopeSet[NAMESPACE.HTML]);\ninListItemScopeSet[NAMESPACE.HTML].ol = true;\ninListItemScopeSet[NAMESPACE.HTML].ul = true;\n\nvar inButtonScopeSet = Object.create(inScopeSet);\ninButtonScopeSet[NAMESPACE.HTML] =\n Object.create(inScopeSet[NAMESPACE.HTML]);\ninButtonScopeSet[NAMESPACE.HTML].button = true;\n\nvar inTableScopeSet = Object.create(null);\ninTableScopeSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"html\":true, \"table\":true, \"template\":true\n};\n\n// The set of elements for select scope is the everything *except* these\nvar invertedSelectScopeSet = Object.create(null);\ninvertedSelectScopeSet[NAMESPACE.HTML] = {\n __proto__: null,\n \"optgroup\":true, \"option\":true\n};\n\nvar mathmlTextIntegrationPointSet = Object.create(null);\nmathmlTextIntegrationPointSet[NAMESPACE.MATHML] = {\n __proto__: null,\n mi: true,\n mo: true,\n mn: true,\n ms: true,\n mtext: true\n};\n\nvar htmlIntegrationPointSet = Object.create(null);\nhtmlIntegrationPointSet[NAMESPACE.SVG] = {\n __proto__: null,\n foreignObject: true,\n desc: true,\n title: true\n};\n\nvar foreignAttributes = {\n __proto__: null,\n \"xlink:actuate\": NAMESPACE.XLINK, \"xlink:arcrole\": NAMESPACE.XLINK,\n \"xlink:href\": NAMESPACE.XLINK, \"xlink:role\": NAMESPACE.XLINK,\n \"xlink:show\": NAMESPACE.XLINK, \"xlink:title\": NAMESPACE.XLINK,\n \"xlink:type\": NAMESPACE.XLINK, \"xml:base\": NAMESPACE.XML,\n \"xml:lang\": NAMESPACE.XML, \"xml:space\": NAMESPACE.XML,\n \"xmlns\": NAMESPACE.XMLNS, \"xmlns:xlink\": NAMESPACE.XMLNS\n};\n\n\n// Lowercase to mixed case mapping for SVG attributes and tagnames\nvar svgAttrAdjustments = {\n __proto__: null,\n attributename: \"attributeName\", attributetype: \"attributeType\",\n basefrequency: \"baseFrequency\", baseprofile: \"baseProfile\",\n calcmode: \"calcMode\", clippathunits: \"clipPathUnits\",\n diffuseconstant: \"diffuseConstant\",\n edgemode: \"edgeMode\",\n filterunits: \"filterUnits\",\n glyphref: \"glyphRef\", gradienttransform: \"gradientTransform\",\n gradientunits: \"gradientUnits\", kernelmatrix: \"kernelMatrix\",\n kernelunitlength: \"kernelUnitLength\", keypoints: \"keyPoints\",\n keysplines: \"keySplines\", keytimes: \"keyTimes\",\n lengthadjust: \"lengthAdjust\", limitingconeangle: \"limitingConeAngle\",\n markerheight: \"markerHeight\", markerunits: \"markerUnits\",\n markerwidth: \"markerWidth\", maskcontentunits: \"maskContentUnits\",\n maskunits: \"maskUnits\", numoctaves: \"numOctaves\",\n pathlength: \"pathLength\", patterncontentunits: \"patternContentUnits\",\n patterntransform: \"patternTransform\", patternunits: \"patternUnits\",\n pointsatx: \"pointsAtX\", pointsaty: \"pointsAtY\",\n pointsatz: \"pointsAtZ\", preservealpha: \"preserveAlpha\",\n preserveaspectratio: \"preserveAspectRatio\",\n primitiveunits: \"primitiveUnits\", refx: \"refX\",\n refy: \"refY\", repeatcount: \"repeatCount\",\n repeatdur: \"repeatDur\", requiredextensions: \"requiredExtensions\",\n requiredfeatures: \"requiredFeatures\",\n specularconstant: \"specularConstant\",\n specularexponent: \"specularExponent\", spreadmethod: \"spreadMethod\",\n startoffset: \"startOffset\", stddeviation: \"stdDeviation\",\n stitchtiles: \"stitchTiles\", surfacescale: \"surfaceScale\",\n systemlanguage: \"systemLanguage\", tablevalues: \"tableValues\",\n targetx: \"targetX\", targety: \"targetY\",\n textlength: \"textLength\", viewbox: \"viewBox\",\n viewtarget: \"viewTarget\", xchannelselector: \"xChannelSelector\",\n ychannelselector: \"yChannelSelector\", zoomandpan: \"zoomAndPan\"\n};\n\nvar svgTagNameAdjustments = {\n __proto__: null,\n altglyph: \"altGlyph\", altglyphdef: \"altGlyphDef\",\n altglyphitem: \"altGlyphItem\", animatecolor: \"animateColor\",\n animatemotion: \"animateMotion\", animatetransform: \"animateTransform\",\n clippath: \"clipPath\", feblend: \"feBlend\",\n fecolormatrix: \"feColorMatrix\",\n fecomponenttransfer: \"feComponentTransfer\", fecomposite: \"feComposite\",\n feconvolvematrix: \"feConvolveMatrix\",\n fediffuselighting: \"feDiffuseLighting\",\n fedisplacementmap: \"feDisplacementMap\",\n fedistantlight: \"feDistantLight\", feflood: \"feFlood\",\n fefunca: \"feFuncA\", fefuncb: \"feFuncB\",\n fefuncg: \"feFuncG\", fefuncr: \"feFuncR\",\n fegaussianblur: \"feGaussianBlur\", feimage: \"feImage\",\n femerge: \"feMerge\", femergenode: \"feMergeNode\",\n femorphology: \"feMorphology\", feoffset: \"feOffset\",\n fepointlight: \"fePointLight\", fespecularlighting: \"feSpecularLighting\",\n fespotlight: \"feSpotLight\", fetile: \"feTile\",\n feturbulence: \"feTurbulence\", foreignobject: \"foreignObject\",\n glyphref: \"glyphRef\", lineargradient: \"linearGradient\",\n radialgradient: \"radialGradient\", textpath: \"textPath\"\n};\n\n\n// Data for parsing numeric and named character references\n// These next 3 objects are direct translations of tables\n// in the HTML spec into JavaScript object format\nvar numericCharRefReplacements = {\n __proto__: null,\n 0x00:0xFFFD, 0x80:0x20AC, 0x82:0x201A, 0x83:0x0192, 0x84:0x201E,\n 0x85:0x2026, 0x86:0x2020, 0x87:0x2021, 0x88:0x02C6, 0x89:0x2030,\n 0x8A:0x0160, 0x8B:0x2039, 0x8C:0x0152, 0x8E:0x017D, 0x91:0x2018,\n 0x92:0x2019, 0x93:0x201C, 0x94:0x201D, 0x95:0x2022, 0x96:0x2013,\n 0x97:0x2014, 0x98:0x02DC, 0x99:0x2122, 0x9A:0x0161, 0x9B:0x203A,\n 0x9C:0x0153, 0x9E:0x017E, 0x9F:0x0178\n};\n\n/*\n * This table is generated with test/tools/update-entities.js\n */\nvar namedCharRefs = {\n __proto__: null,\n \"AElig\":0xc6, \"AElig;\":0xc6,\n \"AMP\":0x26, \"AMP;\":0x26,\n \"Aacute\":0xc1, \"Aacute;\":0xc1,\n \"Abreve;\":0x102, \"Acirc\":0xc2,\n \"Acirc;\":0xc2, \"Acy;\":0x410,\n \"Afr;\":[0xd835,0xdd04], \"Agrave\":0xc0,\n \"Agrave;\":0xc0, \"Alpha;\":0x391,\n \"Amacr;\":0x100, \"And;\":0x2a53,\n \"Aogon;\":0x104, \"Aopf;\":[0xd835,0xdd38],\n \"ApplyFunction;\":0x2061, \"Aring\":0xc5,\n \"Aring;\":0xc5, \"Ascr;\":[0xd835,0xdc9c],\n \"Assign;\":0x2254, \"Atilde\":0xc3,\n \"Atilde;\":0xc3, \"Auml\":0xc4,\n \"Auml;\":0xc4, \"Backslash;\":0x2216,\n \"Barv;\":0x2ae7, \"Barwed;\":0x2306,\n \"Bcy;\":0x411, \"Because;\":0x2235,\n \"Bernoullis;\":0x212c, \"Beta;\":0x392,\n \"Bfr;\":[0xd835,0xdd05], \"Bopf;\":[0xd835,0xdd39],\n \"Breve;\":0x2d8, \"Bscr;\":0x212c,\n \"Bumpeq;\":0x224e, \"CHcy;\":0x427,\n \"COPY\":0xa9, \"COPY;\":0xa9,\n \"Cacute;\":0x106, \"Cap;\":0x22d2,\n \"CapitalDifferentialD;\":0x2145, \"Cayleys;\":0x212d,\n \"Ccaron;\":0x10c, \"Ccedil\":0xc7,\n \"Ccedil;\":0xc7, \"Ccirc;\":0x108,\n \"Cconint;\":0x2230, \"Cdot;\":0x10a,\n \"Cedilla;\":0xb8, \"CenterDot;\":0xb7,\n \"Cfr;\":0x212d, \"Chi;\":0x3a7,\n \"CircleDot;\":0x2299, \"CircleMinus;\":0x2296,\n \"CirclePlus;\":0x2295, \"CircleTimes;\":0x2297,\n \"ClockwiseContourIntegral;\":0x2232, \"CloseCurlyDoubleQuote;\":0x201d,\n \"CloseCurlyQuote;\":0x2019, \"Colon;\":0x2237,\n \"Colone;\":0x2a74, \"Congruent;\":0x2261,\n \"Conint;\":0x222f, \"ContourIntegral;\":0x222e,\n \"Copf;\":0x2102, \"Coproduct;\":0x2210,\n \"CounterClockwiseContourIntegral;\":0x2233, \"Cross;\":0x2a2f,\n \"Cscr;\":[0xd835,0xdc9e], \"Cup;\":0x22d3,\n \"CupCap;\":0x224d, \"DD;\":0x2145,\n \"DDotrahd;\":0x2911, \"DJcy;\":0x402,\n \"DScy;\":0x405, \"DZcy;\":0x40f,\n \"Dagger;\":0x2021, \"Darr;\":0x21a1,\n \"Dashv;\":0x2ae4, \"Dcaron;\":0x10e,\n \"Dcy;\":0x414, \"Del;\":0x2207,\n \"Delta;\":0x394, \"Dfr;\":[0xd835,0xdd07],\n \"DiacriticalAcute;\":0xb4, \"DiacriticalDot;\":0x2d9,\n \"DiacriticalDoubleAcute;\":0x2dd, \"DiacriticalGrave;\":0x60,\n \"DiacriticalTilde;\":0x2dc, \"Diamond;\":0x22c4,\n \"DifferentialD;\":0x2146, \"Dopf;\":[0xd835,0xdd3b],\n \"Dot;\":0xa8, \"DotDot;\":0x20dc,\n \"DotEqual;\":0x2250, \"DoubleContourIntegral;\":0x222f,\n \"DoubleDot;\":0xa8, \"DoubleDownArrow;\":0x21d3,\n \"DoubleLeftArrow;\":0x21d0, \"DoubleLeftRightArrow;\":0x21d4,\n \"DoubleLeftTee;\":0x2ae4, \"DoubleLongLeftArrow;\":0x27f8,\n \"DoubleLongLeftRightArrow;\":0x27fa, \"DoubleLongRightArrow;\":0x27f9,\n \"DoubleRightArrow;\":0x21d2, \"DoubleRightTee;\":0x22a8,\n \"DoubleUpArrow;\":0x21d1, \"DoubleUpDownArrow;\":0x21d5,\n \"DoubleVerticalBar;\":0x2225, \"DownArrow;\":0x2193,\n \"DownArrowBar;\":0x2913, \"DownArrowUpArrow;\":0x21f5,\n \"DownBreve;\":0x311, \"DownLeftRightVector;\":0x2950,\n \"DownLeftTeeVector;\":0x295e, \"DownLeftVector;\":0x21bd,\n \"DownLeftVectorBar;\":0x2956, \"DownRightTeeVector;\":0x295f,\n \"DownRightVector;\":0x21c1, \"DownRightVectorBar;\":0x2957,\n \"DownTee;\":0x22a4, \"DownTeeArrow;\":0x21a7,\n \"Downarrow;\":0x21d3, \"Dscr;\":[0xd835,0xdc9f],\n \"Dstrok;\":0x110, \"ENG;\":0x14a,\n \"ETH\":0xd0, \"ETH;\":0xd0,\n \"Eacute\":0xc9, \"Eacute;\":0xc9,\n \"Ecaron;\":0x11a, \"Ecirc\":0xca,\n \"Ecirc;\":0xca, \"Ecy;\":0x42d,\n \"Edot;\":0x116, \"Efr;\":[0xd835,0xdd08],\n \"Egrave\":0xc8, \"Egrave;\":0xc8,\n \"Element;\":0x2208, \"Emacr;\":0x112,\n \"EmptySmallSquare;\":0x25fb, \"EmptyVerySmallSquare;\":0x25ab,\n \"Eogon;\":0x118, \"Eopf;\":[0xd835,0xdd3c],\n \"Epsilon;\":0x395, \"Equal;\":0x2a75,\n \"EqualTilde;\":0x2242, \"Equilibrium;\":0x21cc,\n \"Escr;\":0x2130, \"Esim;\":0x2a73,\n \"Eta;\":0x397, \"Euml\":0xcb,\n \"Euml;\":0xcb, \"Exists;\":0x2203,\n \"ExponentialE;\":0x2147, \"Fcy;\":0x424,\n \"Ffr;\":[0xd835,0xdd09], \"FilledSmallSquare;\":0x25fc,\n \"FilledVerySmallSquare;\":0x25aa, \"Fopf;\":[0xd835,0xdd3d],\n \"ForAll;\":0x2200, \"Fouriertrf;\":0x2131,\n \"Fscr;\":0x2131, \"GJcy;\":0x403,\n \"GT\":0x3e, \"GT;\":0x3e,\n \"Gamma;\":0x393, \"Gammad;\":0x3dc,\n \"Gbreve;\":0x11e, \"Gcedil;\":0x122,\n \"Gcirc;\":0x11c, \"Gcy;\":0x413,\n \"Gdot;\":0x120, \"Gfr;\":[0xd835,0xdd0a],\n \"Gg;\":0x22d9, \"Gopf;\":[0xd835,0xdd3e],\n \"GreaterEqual;\":0x2265, \"GreaterEqualLess;\":0x22db,\n \"GreaterFullEqual;\":0x2267, \"GreaterGreater;\":0x2aa2,\n \"GreaterLess;\":0x2277, \"GreaterSlantEqual;\":0x2a7e,\n \"GreaterTilde;\":0x2273, \"Gscr;\":[0xd835,0xdca2],\n \"Gt;\":0x226b, \"HARDcy;\":0x42a,\n \"Hacek;\":0x2c7, \"Hat;\":0x5e,\n \"Hcirc;\":0x124, \"Hfr;\":0x210c,\n \"HilbertSpace;\":0x210b, \"Hopf;\":0x210d,\n \"HorizontalLine;\":0x2500, \"Hscr;\":0x210b,\n \"Hstrok;\":0x126, \"HumpDownHump;\":0x224e,\n \"HumpEqual;\":0x224f, \"IEcy;\":0x415,\n \"IJlig;\":0x132, \"IOcy;\":0x401,\n \"Iacute\":0xcd, \"Iacute;\":0xcd,\n \"Icirc\":0xce, \"Icirc;\":0xce,\n \"Icy;\":0x418, \"Idot;\":0x130,\n \"Ifr;\":0x2111, \"Igrave\":0xcc,\n \"Igrave;\":0xcc, \"Im;\":0x2111,\n \"Imacr;\":0x12a, \"ImaginaryI;\":0x2148,\n \"Implies;\":0x21d2, \"Int;\":0x222c,\n \"Integral;\":0x222b, \"Intersection;\":0x22c2,\n \"InvisibleComma;\":0x2063, \"InvisibleTimes;\":0x2062,\n \"Iogon;\":0x12e, \"Iopf;\":[0xd835,0xdd40],\n \"Iota;\":0x399, \"Iscr;\":0x2110,\n \"Itilde;\":0x128, \"Iukcy;\":0x406,\n \"Iuml\":0xcf, \"Iuml;\":0xcf,\n \"Jcirc;\":0x134, \"Jcy;\":0x419,\n \"Jfr;\":[0xd835,0xdd0d], \"Jopf;\":[0xd835,0xdd41],\n \"Jscr;\":[0xd835,0xdca5], \"Jsercy;\":0x408,\n \"Jukcy;\":0x404, \"KHcy;\":0x425,\n \"KJcy;\":0x40c, \"Kappa;\":0x39a,\n \"Kcedil;\":0x136, \"Kcy;\":0x41a,\n \"Kfr;\":[0xd835,0xdd0e], \"Kopf;\":[0xd835,0xdd42],\n \"Kscr;\":[0xd835,0xdca6], \"LJcy;\":0x409,\n \"LT\":0x3c, \"LT;\":0x3c,\n \"Lacute;\":0x139, \"Lambda;\":0x39b,\n \"Lang;\":0x27ea, \"Laplacetrf;\":0x2112,\n \"Larr;\":0x219e, \"Lcaron;\":0x13d,\n \"Lcedil;\":0x13b, \"Lcy;\":0x41b,\n \"LeftAngleBracket;\":0x27e8, \"LeftArrow;\":0x2190,\n \"LeftArrowBar;\":0x21e4, \"LeftArrowRightArrow;\":0x21c6,\n \"LeftCeiling;\":0x2308, \"LeftDoubleBracket;\":0x27e6,\n \"LeftDownTeeVector;\":0x2961, \"LeftDownVector;\":0x21c3,\n \"LeftDownVectorBar;\":0x2959, \"LeftFloor;\":0x230a,\n \"LeftRightArrow;\":0x2194, \"LeftRightVector;\":0x294e,\n \"LeftTee;\":0x22a3, \"LeftTeeArrow;\":0x21a4,\n \"LeftTeeVector;\":0x295a, \"LeftTriangle;\":0x22b2,\n \"LeftTriangleBar;\":0x29cf, \"LeftTriangleEqual;\":0x22b4,\n \"LeftUpDownVector;\":0x2951, \"LeftUpTeeVector;\":0x2960,\n \"LeftUpVector;\":0x21bf, \"LeftUpVectorBar;\":0x2958,\n \"LeftVector;\":0x21bc, \"LeftVectorBar;\":0x2952,\n \"Leftarrow;\":0x21d0, \"Leftrightarrow;\":0x21d4,\n \"LessEqualGreater;\":0x22da, \"LessFullEqual;\":0x2266,\n \"LessGreater;\":0x2276, \"LessLess;\":0x2aa1,\n \"LessSlantEqual;\":0x2a7d, \"LessTilde;\":0x2272,\n \"Lfr;\":[0xd835,0xdd0f], \"Ll;\":0x22d8,\n \"Lleftarrow;\":0x21da, \"Lmidot;\":0x13f,\n \"LongLeftArrow;\":0x27f5, \"LongLeftRightArrow;\":0x27f7,\n \"LongRightArrow;\":0x27f6, \"Longleftarrow;\":0x27f8,\n \"Longleftrightarrow;\":0x27fa, \"Longrightarrow;\":0x27f9,\n \"Lopf;\":[0xd835,0xdd43], \"LowerLeftArrow;\":0x2199,\n \"LowerRightArrow;\":0x2198, \"Lscr;\":0x2112,\n \"Lsh;\":0x21b0, \"Lstrok;\":0x141,\n \"Lt;\":0x226a, \"Map;\":0x2905,\n \"Mcy;\":0x41c, \"MediumSpace;\":0x205f,\n \"Mellintrf;\":0x2133, \"Mfr;\":[0xd835,0xdd10],\n \"MinusPlus;\":0x2213, \"Mopf;\":[0xd835,0xdd44],\n \"Mscr;\":0x2133, \"Mu;\":0x39c,\n \"NJcy;\":0x40a, \"Nacute;\":0x143,\n \"Ncaron;\":0x147, \"Ncedil;\":0x145,\n \"Ncy;\":0x41d, \"NegativeMediumSpace;\":0x200b,\n \"NegativeThickSpace;\":0x200b, \"NegativeThinSpace;\":0x200b,\n \"NegativeVeryThinSpace;\":0x200b, \"NestedGreaterGreater;\":0x226b,\n \"NestedLessLess;\":0x226a, \"NewLine;\":0xa,\n \"Nfr;\":[0xd835,0xdd11], \"NoBreak;\":0x2060,\n \"NonBreakingSpace;\":0xa0, \"Nopf;\":0x2115,\n \"Not;\":0x2aec, \"NotCongruent;\":0x2262,\n \"NotCupCap;\":0x226d, \"NotDoubleVerticalBar;\":0x2226,\n \"NotElement;\":0x2209, \"NotEqual;\":0x2260,\n \"NotEqualTilde;\":[0x2242,0x338], \"NotExists;\":0x2204,\n \"NotGreater;\":0x226f, \"NotGreaterEqual;\":0x2271,\n \"NotGreaterFullEqual;\":[0x2267,0x338], \"NotGreaterGreater;\":[0x226b,0x338],\n \"NotGreaterLess;\":0x2279, \"NotGreaterSlantEqual;\":[0x2a7e,0x338],\n \"NotGreaterTilde;\":0x2275, \"NotHumpDownHump;\":[0x224e,0x338],\n \"NotHumpEqual;\":[0x224f,0x338], \"NotLeftTriangle;\":0x22ea,\n \"NotLeftTriangleBar;\":[0x29cf,0x338], \"NotLeftTriangleEqual;\":0x22ec,\n \"NotLess;\":0x226e, \"NotLessEqual;\":0x2270,\n \"NotLessGreater;\":0x2278, \"NotLessLess;\":[0x226a,0x338],\n \"NotLessSlantEqual;\":[0x2a7d,0x338], \"NotLessTilde;\":0x2274,\n \"NotNestedGreaterGreater;\":[0x2aa2,0x338], \"NotNestedLessLess;\":[0x2aa1,0x338],\n \"NotPrecedes;\":0x2280, \"NotPrecedesEqual;\":[0x2aaf,0x338],\n \"NotPrecedesSlantEqual;\":0x22e0, \"NotReverseElement;\":0x220c,\n \"NotRightTriangle;\":0x22eb, \"NotRightTriangleBar;\":[0x29d0,0x338],\n \"NotRightTriangleEqual;\":0x22ed, \"NotSquareSubset;\":[0x228f,0x338],\n \"NotSquareSubsetEqual;\":0x22e2, \"NotSquareSuperset;\":[0x2290,0x338],\n \"NotSquareSupersetEqual;\":0x22e3, \"NotSubset;\":[0x2282,0x20d2],\n \"NotSubsetEqual;\":0x2288, \"NotSucceeds;\":0x2281,\n \"NotSucceedsEqual;\":[0x2ab0,0x338], \"NotSucceedsSlantEqual;\":0x22e1,\n \"NotSucceedsTilde;\":[0x227f,0x338], \"NotSuperset;\":[0x2283,0x20d2],\n \"NotSupersetEqual;\":0x2289, \"NotTilde;\":0x2241,\n \"NotTildeEqual;\":0x2244, \"NotTildeFullEqual;\":0x2247,\n \"NotTildeTilde;\":0x2249, \"NotVerticalBar;\":0x2224,\n \"Nscr;\":[0xd835,0xdca9], \"Ntilde\":0xd1,\n \"Ntilde;\":0xd1, \"Nu;\":0x39d,\n \"OElig;\":0x152, \"Oacute\":0xd3,\n \"Oacute;\":0xd3, \"Ocirc\":0xd4,\n \"Ocirc;\":0xd4, \"Ocy;\":0x41e,\n \"Odblac;\":0x150, \"Ofr;\":[0xd835,0xdd12],\n \"Ograve\":0xd2, \"Ograve;\":0xd2,\n \"Omacr;\":0x14c, \"Omega;\":0x3a9,\n \"Omicron;\":0x39f, \"Oopf;\":[0xd835,0xdd46],\n \"OpenCurlyDoubleQuote;\":0x201c, \"OpenCurlyQuote;\":0x2018,\n \"Or;\":0x2a54, \"Oscr;\":[0xd835,0xdcaa],\n \"Oslash\":0xd8, \"Oslash;\":0xd8,\n \"Otilde\":0xd5, \"Otilde;\":0xd5,\n \"Otimes;\":0x2a37, \"Ouml\":0xd6,\n \"Ouml;\":0xd6, \"OverBar;\":0x203e,\n \"OverBrace;\":0x23de, \"OverBracket;\":0x23b4,\n \"OverParenthesis;\":0x23dc, \"PartialD;\":0x2202,\n \"Pcy;\":0x41f, \"Pfr;\":[0xd835,0xdd13],\n \"Phi;\":0x3a6, \"Pi;\":0x3a0,\n \"PlusMinus;\":0xb1, \"Poincareplane;\":0x210c,\n \"Popf;\":0x2119, \"Pr;\":0x2abb,\n \"Precedes;\":0x227a, \"PrecedesEqual;\":0x2aaf,\n \"PrecedesSlantEqual;\":0x227c, \"PrecedesTilde;\":0x227e,\n \"Prime;\":0x2033, \"Product;\":0x220f,\n \"Proportion;\":0x2237, \"Proportional;\":0x221d,\n \"Pscr;\":[0xd835,0xdcab], \"Psi;\":0x3a8,\n \"QUOT\":0x22, \"QUOT;\":0x22,\n \"Qfr;\":[0xd835,0xdd14], \"Qopf;\":0x211a,\n \"Qscr;\":[0xd835,0xdcac], \"RBarr;\":0x2910,\n \"REG\":0xae, \"REG;\":0xae,\n \"Racute;\":0x154, \"Rang;\":0x27eb,\n \"Rarr;\":0x21a0, \"Rarrtl;\":0x2916,\n \"Rcaron;\":0x158, \"Rcedil;\":0x156,\n \"Rcy;\":0x420, \"Re;\":0x211c,\n \"ReverseElement;\":0x220b, \"ReverseEquilibrium;\":0x21cb,\n \"ReverseUpEquilibrium;\":0x296f, \"Rfr;\":0x211c,\n \"Rho;\":0x3a1, \"RightAngleBracket;\":0x27e9,\n \"RightArrow;\":0x2192, \"RightArrowBar;\":0x21e5,\n \"RightArrowLeftArrow;\":0x21c4, \"RightCeiling;\":0x2309,\n \"RightDoubleBracket;\":0x27e7, \"RightDownTeeVector;\":0x295d,\n \"RightDownVector;\":0x21c2, \"RightDownVectorBar;\":0x2955,\n \"RightFloor;\":0x230b, \"RightTee;\":0x22a2,\n \"RightTeeArrow;\":0x21a6, \"RightTeeVector;\":0x295b,\n \"RightTriangle;\":0x22b3, \"RightTriangleBar;\":0x29d0,\n \"RightTriangleEqual;\":0x22b5, \"RightUpDownVector;\":0x294f,\n \"RightUpTeeVector;\":0x295c, \"RightUpVector;\":0x21be,\n \"RightUpVectorBar;\":0x2954, \"RightVector;\":0x21c0,\n \"RightVectorBar;\":0x2953, \"Rightarrow;\":0x21d2,\n \"Ropf;\":0x211d, \"RoundImplies;\":0x2970,\n \"Rrightarrow;\":0x21db, \"Rscr;\":0x211b,\n \"Rsh;\":0x21b1, \"RuleDelayed;\":0x29f4,\n \"SHCHcy;\":0x429, \"SHcy;\":0x428,\n \"SOFTcy;\":0x42c, \"Sacute;\":0x15a,\n \"Sc;\":0x2abc, \"Scaron;\":0x160,\n \"Scedil;\":0x15e, \"Scirc;\":0x15c,\n \"Scy;\":0x421, \"Sfr;\":[0xd835,0xdd16],\n \"ShortDownArrow;\":0x2193, \"ShortLeftArrow;\":0x2190,\n \"ShortRightArrow;\":0x2192, \"ShortUpArrow;\":0x2191,\n \"Sigma;\":0x3a3, \"SmallCircle;\":0x2218,\n \"Sopf;\":[0xd835,0xdd4a], \"Sqrt;\":0x221a,\n \"Square;\":0x25a1, \"SquareIntersection;\":0x2293,\n \"SquareSubset;\":0x228f, \"SquareSubsetEqual;\":0x2291,\n \"SquareSuperset;\":0x2290, \"SquareSupersetEqual;\":0x2292,\n \"SquareUnion;\":0x2294, \"Sscr;\":[0xd835,0xdcae],\n \"Star;\":0x22c6, \"Sub;\":0x22d0,\n \"Subset;\":0x22d0, \"SubsetEqual;\":0x2286,\n \"Succeeds;\":0x227b, \"SucceedsEqual;\":0x2ab0,\n \"SucceedsSlantEqual;\":0x227d, \"SucceedsTilde;\":0x227f,\n \"SuchThat;\":0x220b, \"Sum;\":0x2211,\n \"Sup;\":0x22d1, \"Superset;\":0x2283,\n \"SupersetEqual;\":0x2287, \"Supset;\":0x22d1,\n \"THORN\":0xde, \"THORN;\":0xde,\n \"TRADE;\":0x2122, \"TSHcy;\":0x40b,\n \"TScy;\":0x426, \"Tab;\":0x9,\n \"Tau;\":0x3a4, \"Tcaron;\":0x164,\n \"Tcedil;\":0x162, \"Tcy;\":0x422,\n \"Tfr;\":[0xd835,0xdd17], \"Therefore;\":0x2234,\n \"Theta;\":0x398, \"ThickSpace;\":[0x205f,0x200a],\n \"ThinSpace;\":0x2009, \"Tilde;\":0x223c,\n \"TildeEqual;\":0x2243, \"TildeFullEqual;\":0x2245,\n \"TildeTilde;\":0x2248, \"Topf;\":[0xd835,0xdd4b],\n \"TripleDot;\":0x20db, \"Tscr;\":[0xd835,0xdcaf],\n \"Tstrok;\":0x166, \"Uacute\":0xda,\n \"Uacute;\":0xda, \"Uarr;\":0x219f,\n \"Uarrocir;\":0x2949, \"Ubrcy;\":0x40e,\n \"Ubreve;\":0x16c, \"Ucirc\":0xdb,\n \"Ucirc;\":0xdb, \"Ucy;\":0x423,\n \"Udblac;\":0x170, \"Ufr;\":[0xd835,0xdd18],\n \"Ugrave\":0xd9, \"Ugrave;\":0xd9,\n \"Umacr;\":0x16a, \"UnderBar;\":0x5f,\n \"UnderBrace;\":0x23df, \"UnderBracket;\":0x23b5,\n \"UnderParenthesis;\":0x23dd, \"Union;\":0x22c3,\n \"UnionPlus;\":0x228e, \"Uogon;\":0x172,\n \"Uopf;\":[0xd835,0xdd4c], \"UpArrow;\":0x2191,\n \"UpArrowBar;\":0x2912, \"UpArrowDownArrow;\":0x21c5,\n \"UpDownArrow;\":0x2195, \"UpEquilibrium;\":0x296e,\n \"UpTee;\":0x22a5, \"UpTeeArrow;\":0x21a5,\n \"Uparrow;\":0x21d1, \"Updownarrow;\":0x21d5,\n \"UpperLeftArrow;\":0x2196, \"UpperRightArrow;\":0x2197,\n \"Upsi;\":0x3d2, \"Upsilon;\":0x3a5,\n \"Uring;\":0x16e, \"Uscr;\":[0xd835,0xdcb0],\n \"Utilde;\":0x168, \"Uuml\":0xdc,\n \"Uuml;\":0xdc, \"VDash;\":0x22ab,\n \"Vbar;\":0x2aeb, \"Vcy;\":0x412,\n \"Vdash;\":0x22a9, \"Vdashl;\":0x2ae6,\n \"Vee;\":0x22c1, \"Verbar;\":0x2016,\n \"Vert;\":0x2016, \"VerticalBar;\":0x2223,\n \"VerticalLine;\":0x7c, \"VerticalSeparator;\":0x2758,\n \"VerticalTilde;\":0x2240, \"VeryThinSpace;\":0x200a,\n \"Vfr;\":[0xd835,0xdd19], \"Vopf;\":[0xd835,0xdd4d],\n \"Vscr;\":[0xd835,0xdcb1], \"Vvdash;\":0x22aa,\n \"Wcirc;\":0x174, \"Wedge;\":0x22c0,\n \"Wfr;\":[0xd835,0xdd1a], \"Wopf;\":[0xd835,0xdd4e],\n \"Wscr;\":[0xd835,0xdcb2], \"Xfr;\":[0xd835,0xdd1b],\n \"Xi;\":0x39e, \"Xopf;\":[0xd835,0xdd4f],\n \"Xscr;\":[0xd835,0xdcb3], \"YAcy;\":0x42f,\n \"YIcy;\":0x407, \"YUcy;\":0x42e,\n \"Yacute\":0xdd, \"Yacute;\":0xdd,\n \"Ycirc;\":0x176, \"Ycy;\":0x42b,\n \"Yfr;\":[0xd835,0xdd1c], \"Yopf;\":[0xd835,0xdd50],\n \"Yscr;\":[0xd835,0xdcb4], \"Yuml;\":0x178,\n \"ZHcy;\":0x416, \"Zacute;\":0x179,\n \"Zcaron;\":0x17d, \"Zcy;\":0x417,\n \"Zdot;\":0x17b, \"ZeroWidthSpace;\":0x200b,\n \"Zeta;\":0x396, \"Zfr;\":0x2128,\n \"Zopf;\":0x2124, \"Zscr;\":[0xd835,0xdcb5],\n \"aacute\":0xe1, \"aacute;\":0xe1,\n \"abreve;\":0x103, \"ac;\":0x223e,\n \"acE;\":[0x223e,0x333], \"acd;\":0x223f,\n \"acirc\":0xe2, \"acirc;\":0xe2,\n \"acute\":0xb4, \"acute;\":0xb4,\n \"acy;\":0x430, \"aelig\":0xe6,\n \"aelig;\":0xe6, \"af;\":0x2061,\n \"afr;\":[0xd835,0xdd1e], \"agrave\":0xe0,\n \"agrave;\":0xe0, \"alefsym;\":0x2135,\n \"aleph;\":0x2135, \"alpha;\":0x3b1,\n \"amacr;\":0x101, \"amalg;\":0x2a3f,\n \"amp\":0x26, \"amp;\":0x26,\n \"and;\":0x2227, \"andand;\":0x2a55,\n \"andd;\":0x2a5c, \"andslope;\":0x2a58,\n \"andv;\":0x2a5a, \"ang;\":0x2220,\n \"ange;\":0x29a4, \"angle;\":0x2220,\n \"angmsd;\":0x2221, \"angmsdaa;\":0x29a8,\n \"angmsdab;\":0x29a9, \"angmsdac;\":0x29aa,\n \"angmsdad;\":0x29ab, \"angmsdae;\":0x29ac,\n \"angmsdaf;\":0x29ad, \"angmsdag;\":0x29ae,\n \"angmsdah;\":0x29af, \"angrt;\":0x221f,\n \"angrtvb;\":0x22be, \"angrtvbd;\":0x299d,\n \"angsph;\":0x2222, \"angst;\":0xc5,\n \"angzarr;\":0x237c, \"aogon;\":0x105,\n \"aopf;\":[0xd835,0xdd52], \"ap;\":0x2248,\n \"apE;\":0x2a70, \"apacir;\":0x2a6f,\n \"ape;\":0x224a, \"apid;\":0x224b,\n \"apos;\":0x27, \"approx;\":0x2248,\n \"approxeq;\":0x224a, \"aring\":0xe5,\n \"aring;\":0xe5, \"ascr;\":[0xd835,0xdcb6],\n \"ast;\":0x2a, \"asymp;\":0x2248,\n \"asympeq;\":0x224d, \"atilde\":0xe3,\n \"atilde;\":0xe3, \"auml\":0xe4,\n \"auml;\":0xe4, \"awconint;\":0x2233,\n \"awint;\":0x2a11, \"bNot;\":0x2aed,\n \"backcong;\":0x224c, \"backepsilon;\":0x3f6,\n \"backprime;\":0x2035, \"backsim;\":0x223d,\n \"backsimeq;\":0x22cd, \"barvee;\":0x22bd,\n \"barwed;\":0x2305, \"barwedge;\":0x2305,\n \"bbrk;\":0x23b5, \"bbrktbrk;\":0x23b6,\n \"bcong;\":0x224c, \"bcy;\":0x431,\n \"bdquo;\":0x201e, \"becaus;\":0x2235,\n \"because;\":0x2235, \"bemptyv;\":0x29b0,\n \"bepsi;\":0x3f6, \"bernou;\":0x212c,\n \"beta;\":0x3b2, \"beth;\":0x2136,\n \"between;\":0x226c, \"bfr;\":[0xd835,0xdd1f],\n \"bigcap;\":0x22c2, \"bigcirc;\":0x25ef,\n \"bigcup;\":0x22c3, \"bigodot;\":0x2a00,\n \"bigoplus;\":0x2a01, \"bigotimes;\":0x2a02,\n \"bigsqcup;\":0x2a06, \"bigstar;\":0x2605,\n \"bigtriangledown;\":0x25bd, \"bigtriangleup;\":0x25b3,\n \"biguplus;\":0x2a04, \"bigvee;\":0x22c1,\n \"bigwedge;\":0x22c0, \"bkarow;\":0x290d,\n \"blacklozenge;\":0x29eb, \"blacksquare;\":0x25aa,\n \"blacktriangle;\":0x25b4, \"blacktriangledown;\":0x25be,\n \"blacktriangleleft;\":0x25c2, \"blacktriangleright;\":0x25b8,\n \"blank;\":0x2423, \"blk12;\":0x2592,\n \"blk14;\":0x2591, \"blk34;\":0x2593,\n \"block;\":0x2588, \"bne;\":[0x3d,0x20e5],\n \"bnequiv;\":[0x2261,0x20e5], \"bnot;\":0x2310,\n \"bopf;\":[0xd835,0xdd53], \"bot;\":0x22a5,\n \"bottom;\":0x22a5, \"bowtie;\":0x22c8,\n \"boxDL;\":0x2557, \"boxDR;\":0x2554,\n \"boxDl;\":0x2556, \"boxDr;\":0x2553,\n \"boxH;\":0x2550, \"boxHD;\":0x2566,\n \"boxHU;\":0x2569, \"boxHd;\":0x2564,\n \"boxHu;\":0x2567, \"boxUL;\":0x255d,\n \"boxUR;\":0x255a, \"boxUl;\":0x255c,\n \"boxUr;\":0x2559, \"boxV;\":0x2551,\n \"boxVH;\":0x256c, \"boxVL;\":0x2563,\n \"boxVR;\":0x2560, \"boxVh;\":0x256b,\n \"boxVl;\":0x2562, \"boxVr;\":0x255f,\n \"boxbox;\":0x29c9, \"boxdL;\":0x2555,\n \"boxdR;\":0x2552, \"boxdl;\":0x2510,\n \"boxdr;\":0x250c, \"boxh;\":0x2500,\n \"boxhD;\":0x2565, \"boxhU;\":0x2568,\n \"boxhd;\":0x252c, \"boxhu;\":0x2534,\n \"boxminus;\":0x229f, \"boxplus;\":0x229e,\n \"boxtimes;\":0x22a0, \"boxuL;\":0x255b,\n \"boxuR;\":0x2558, \"boxul;\":0x2518,\n \"boxur;\":0x2514, \"boxv;\":0x2502,\n \"boxvH;\":0x256a, \"boxvL;\":0x2561,\n \"boxvR;\":0x255e, \"boxvh;\":0x253c,\n \"boxvl;\":0x2524, \"boxvr;\":0x251c,\n \"bprime;\":0x2035, \"breve;\":0x2d8,\n \"brvbar\":0xa6, \"brvbar;\":0xa6,\n \"bscr;\":[0xd835,0xdcb7], \"bsemi;\":0x204f,\n \"bsim;\":0x223d, \"bsime;\":0x22cd,\n \"bsol;\":0x5c, \"bsolb;\":0x29c5,\n \"bsolhsub;\":0x27c8, \"bull;\":0x2022,\n \"bullet;\":0x2022, \"bump;\":0x224e,\n \"bumpE;\":0x2aae, \"bumpe;\":0x224f,\n \"bumpeq;\":0x224f, \"cacute;\":0x107,\n \"cap;\":0x2229, \"capand;\":0x2a44,\n \"capbrcup;\":0x2a49, \"capcap;\":0x2a4b,\n \"capcup;\":0x2a47, \"capdot;\":0x2a40,\n \"caps;\":[0x2229,0xfe00], \"caret;\":0x2041,\n \"caron;\":0x2c7, \"ccaps;\":0x2a4d,\n \"ccaron;\":0x10d, \"ccedil\":0xe7,\n \"ccedil;\":0xe7, \"ccirc;\":0x109,\n \"ccups;\":0x2a4c, \"ccupssm;\":0x2a50,\n \"cdot;\":0x10b, \"cedil\":0xb8,\n \"cedil;\":0xb8, \"cemptyv;\":0x29b2,\n \"cent\":0xa2, \"cent;\":0xa2,\n \"centerdot;\":0xb7, \"cfr;\":[0xd835,0xdd20],\n \"chcy;\":0x447, \"check;\":0x2713,\n \"checkmark;\":0x2713, \"chi;\":0x3c7,\n \"cir;\":0x25cb, \"cirE;\":0x29c3,\n \"circ;\":0x2c6, \"circeq;\":0x2257,\n \"circlearrowleft;\":0x21ba, \"circlearrowright;\":0x21bb,\n \"circledR;\":0xae, \"circledS;\":0x24c8,\n \"circledast;\":0x229b, \"circledcirc;\":0x229a,\n \"circleddash;\":0x229d, \"cire;\":0x2257,\n \"cirfnint;\":0x2a10, \"cirmid;\":0x2aef,\n \"cirscir;\":0x29c2, \"clubs;\":0x2663,\n \"clubsuit;\":0x2663, \"colon;\":0x3a,\n \"colone;\":0x2254, \"coloneq;\":0x2254,\n \"comma;\":0x2c, \"commat;\":0x40,\n \"comp;\":0x2201, \"compfn;\":0x2218,\n \"complement;\":0x2201, \"complexes;\":0x2102,\n \"cong;\":0x2245, \"congdot;\":0x2a6d,\n \"conint;\":0x222e, \"copf;\":[0xd835,0xdd54],\n \"coprod;\":0x2210, \"copy\":0xa9,\n \"copy;\":0xa9, \"copysr;\":0x2117,\n \"crarr;\":0x21b5, \"cross;\":0x2717,\n \"cscr;\":[0xd835,0xdcb8], \"csub;\":0x2acf,\n \"csube;\":0x2ad1, \"csup;\":0x2ad0,\n \"csupe;\":0x2ad2, \"ctdot;\":0x22ef,\n \"cudarrl;\":0x2938, \"cudarrr;\":0x2935,\n \"cuepr;\":0x22de, \"cuesc;\":0x22df,\n \"cularr;\":0x21b6, \"cularrp;\":0x293d,\n \"cup;\":0x222a, \"cupbrcap;\":0x2a48,\n \"cupcap;\":0x2a46, \"cupcup;\":0x2a4a,\n \"cupdot;\":0x228d, \"cupor;\":0x2a45,\n \"cups;\":[0x222a,0xfe00], \"curarr;\":0x21b7,\n \"curarrm;\":0x293c, \"curlyeqprec;\":0x22de,\n \"curlyeqsucc;\":0x22df, \"curlyvee;\":0x22ce,\n \"curlywedge;\":0x22cf, \"curren\":0xa4,\n \"curren;\":0xa4, \"curvearrowleft;\":0x21b6,\n \"curvearrowright;\":0x21b7, \"cuvee;\":0x22ce,\n \"cuwed;\":0x22cf, \"cwconint;\":0x2232,\n \"cwint;\":0x2231, \"cylcty;\":0x232d,\n \"dArr;\":0x21d3, \"dHar;\":0x2965,\n \"dagger;\":0x2020, \"daleth;\":0x2138,\n \"darr;\":0x2193, \"dash;\":0x2010,\n \"dashv;\":0x22a3, \"dbkarow;\":0x290f,\n \"dblac;\":0x2dd, \"dcaron;\":0x10f,\n \"dcy;\":0x434, \"dd;\":0x2146,\n \"ddagger;\":0x2021, \"ddarr;\":0x21ca,\n \"ddotseq;\":0x2a77, \"deg\":0xb0,\n \"deg;\":0xb0, \"delta;\":0x3b4,\n \"demptyv;\":0x29b1, \"dfisht;\":0x297f,\n \"dfr;\":[0xd835,0xdd21], \"dharl;\":0x21c3,\n \"dharr;\":0x21c2, \"diam;\":0x22c4,\n \"diamond;\":0x22c4, \"diamondsuit;\":0x2666,\n \"diams;\":0x2666, \"die;\":0xa8,\n \"digamma;\":0x3dd, \"disin;\":0x22f2,\n \"div;\":0xf7, \"divide\":0xf7,\n \"divide;\":0xf7, \"divideontimes;\":0x22c7,\n \"divonx;\":0x22c7, \"djcy;\":0x452,\n \"dlcorn;\":0x231e, \"dlcrop;\":0x230d,\n \"dollar;\":0x24, \"dopf;\":[0xd835,0xdd55],\n \"dot;\":0x2d9, \"doteq;\":0x2250,\n \"doteqdot;\":0x2251, \"dotminus;\":0x2238,\n \"dotplus;\":0x2214, \"dotsquare;\":0x22a1,\n \"doublebarwedge;\":0x2306, \"downarrow;\":0x2193,\n \"downdownarrows;\":0x21ca, \"downharpoonleft;\":0x21c3,\n \"downharpoonright;\":0x21c2, \"drbkarow;\":0x2910,\n \"drcorn;\":0x231f, \"drcrop;\":0x230c,\n \"dscr;\":[0xd835,0xdcb9], \"dscy;\":0x455,\n \"dsol;\":0x29f6, \"dstrok;\":0x111,\n \"dtdot;\":0x22f1, \"dtri;\":0x25bf,\n \"dtrif;\":0x25be, \"duarr;\":0x21f5,\n \"duhar;\":0x296f, \"dwangle;\":0x29a6,\n \"dzcy;\":0x45f, \"dzigrarr;\":0x27ff,\n \"eDDot;\":0x2a77, \"eDot;\":0x2251,\n \"eacute\":0xe9, \"eacute;\":0xe9,\n \"easter;\":0x2a6e, \"ecaron;\":0x11b,\n \"ecir;\":0x2256, \"ecirc\":0xea,\n \"ecirc;\":0xea, \"ecolon;\":0x2255,\n \"ecy;\":0x44d, \"edot;\":0x117,\n \"ee;\":0x2147, \"efDot;\":0x2252,\n \"efr;\":[0xd835,0xdd22], \"eg;\":0x2a9a,\n \"egrave\":0xe8, \"egrave;\":0xe8,\n \"egs;\":0x2a96, \"egsdot;\":0x2a98,\n \"el;\":0x2a99, \"elinters;\":0x23e7,\n \"ell;\":0x2113, \"els;\":0x2a95,\n \"elsdot;\":0x2a97, \"emacr;\":0x113,\n \"empty;\":0x2205, \"emptyset;\":0x2205,\n \"emptyv;\":0x2205, \"emsp13;\":0x2004,\n \"emsp14;\":0x2005, \"emsp;\":0x2003,\n \"eng;\":0x14b, \"ensp;\":0x2002,\n \"eogon;\":0x119, \"eopf;\":[0xd835,0xdd56],\n \"epar;\":0x22d5, \"eparsl;\":0x29e3,\n \"eplus;\":0x2a71, \"epsi;\":0x3b5,\n \"epsilon;\":0x3b5, \"epsiv;\":0x3f5,\n \"eqcirc;\":0x2256, \"eqcolon;\":0x2255,\n \"eqsim;\":0x2242, \"eqslantgtr;\":0x2a96,\n \"eqslantless;\":0x2a95, \"equals;\":0x3d,\n \"equest;\":0x225f, \"equiv;\":0x2261,\n \"equivDD;\":0x2a78, \"eqvparsl;\":0x29e5,\n \"erDot;\":0x2253, \"erarr;\":0x2971,\n \"escr;\":0x212f, \"esdot;\":0x2250,\n \"esim;\":0x2242, \"eta;\":0x3b7,\n \"eth\":0xf0, \"eth;\":0xf0,\n \"euml\":0xeb, \"euml;\":0xeb,\n \"euro;\":0x20ac, \"excl;\":0x21,\n \"exist;\":0x2203, \"expectation;\":0x2130,\n \"exponentiale;\":0x2147, \"fallingdotseq;\":0x2252,\n \"fcy;\":0x444, \"female;\":0x2640,\n \"ffilig;\":0xfb03, \"fflig;\":0xfb00,\n \"ffllig;\":0xfb04, \"ffr;\":[0xd835,0xdd23],\n \"filig;\":0xfb01, \"fjlig;\":[0x66,0x6a],\n \"flat;\":0x266d, \"fllig;\":0xfb02,\n \"fltns;\":0x25b1, \"fnof;\":0x192,\n \"fopf;\":[0xd835,0xdd57], \"forall;\":0x2200,\n \"fork;\":0x22d4, \"forkv;\":0x2ad9,\n \"fpartint;\":0x2a0d, \"frac12\":0xbd,\n \"frac12;\":0xbd, \"frac13;\":0x2153,\n \"frac14\":0xbc, \"frac14;\":0xbc,\n \"frac15;\":0x2155, \"frac16;\":0x2159,\n \"frac18;\":0x215b, \"frac23;\":0x2154,\n \"frac25;\":0x2156, \"frac34\":0xbe,\n \"frac34;\":0xbe, \"frac35;\":0x2157,\n \"frac38;\":0x215c, \"frac45;\":0x2158,\n \"frac56;\":0x215a, \"frac58;\":0x215d,\n \"frac78;\":0x215e, \"frasl;\":0x2044,\n \"frown;\":0x2322, \"fscr;\":[0xd835,0xdcbb],\n \"gE;\":0x2267, \"gEl;\":0x2a8c,\n \"gacute;\":0x1f5, \"gamma;\":0x3b3,\n \"gammad;\":0x3dd, \"gap;\":0x2a86,\n \"gbreve;\":0x11f, \"gcirc;\":0x11d,\n \"gcy;\":0x433, \"gdot;\":0x121,\n \"ge;\":0x2265, \"gel;\":0x22db,\n \"geq;\":0x2265, \"geqq;\":0x2267,\n \"geqslant;\":0x2a7e, \"ges;\":0x2a7e,\n \"gescc;\":0x2aa9, \"gesdot;\":0x2a80,\n \"gesdoto;\":0x2a82, \"gesdotol;\":0x2a84,\n \"gesl;\":[0x22db,0xfe00], \"gesles;\":0x2a94,\n \"gfr;\":[0xd835,0xdd24], \"gg;\":0x226b,\n \"ggg;\":0x22d9, \"gimel;\":0x2137,\n \"gjcy;\":0x453, \"gl;\":0x2277,\n \"glE;\":0x2a92, \"gla;\":0x2aa5,\n \"glj;\":0x2aa4, \"gnE;\":0x2269,\n \"gnap;\":0x2a8a, \"gnapprox;\":0x2a8a,\n \"gne;\":0x2a88, \"gneq;\":0x2a88,\n \"gneqq;\":0x2269, \"gnsim;\":0x22e7,\n \"gopf;\":[0xd835,0xdd58], \"grave;\":0x60,\n \"gscr;\":0x210a, \"gsim;\":0x2273,\n \"gsime;\":0x2a8e, \"gsiml;\":0x2a90,\n \"gt\":0x3e, \"gt;\":0x3e,\n \"gtcc;\":0x2aa7, \"gtcir;\":0x2a7a,\n \"gtdot;\":0x22d7, \"gtlPar;\":0x2995,\n \"gtquest;\":0x2a7c, \"gtrapprox;\":0x2a86,\n \"gtrarr;\":0x2978, \"gtrdot;\":0x22d7,\n \"gtreqless;\":0x22db, \"gtreqqless;\":0x2a8c,\n \"gtrless;\":0x2277, \"gtrsim;\":0x2273,\n \"gvertneqq;\":[0x2269,0xfe00], \"gvnE;\":[0x2269,0xfe00],\n \"hArr;\":0x21d4, \"hairsp;\":0x200a,\n \"half;\":0xbd, \"hamilt;\":0x210b,\n \"hardcy;\":0x44a, \"harr;\":0x2194,\n \"harrcir;\":0x2948, \"harrw;\":0x21ad,\n \"hbar;\":0x210f, \"hcirc;\":0x125,\n \"hearts;\":0x2665, \"heartsuit;\":0x2665,\n \"hellip;\":0x2026, \"hercon;\":0x22b9,\n \"hfr;\":[0xd835,0xdd25], \"hksearow;\":0x2925,\n \"hkswarow;\":0x2926, \"hoarr;\":0x21ff,\n \"homtht;\":0x223b, \"hookleftarrow;\":0x21a9,\n \"hookrightarrow;\":0x21aa, \"hopf;\":[0xd835,0xdd59],\n \"horbar;\":0x2015, \"hscr;\":[0xd835,0xdcbd],\n \"hslash;\":0x210f, \"hstrok;\":0x127,\n \"hybull;\":0x2043, \"hyphen;\":0x2010,\n \"iacute\":0xed, \"iacute;\":0xed,\n \"ic;\":0x2063, \"icirc\":0xee,\n \"icirc;\":0xee, \"icy;\":0x438,\n \"iecy;\":0x435, \"iexcl\":0xa1,\n \"iexcl;\":0xa1, \"iff;\":0x21d4,\n \"ifr;\":[0xd835,0xdd26], \"igrave\":0xec,\n \"igrave;\":0xec, \"ii;\":0x2148,\n \"iiiint;\":0x2a0c, \"iiint;\":0x222d,\n \"iinfin;\":0x29dc, \"iiota;\":0x2129,\n \"ijlig;\":0x133, \"imacr;\":0x12b,\n \"image;\":0x2111, \"imagline;\":0x2110,\n \"imagpart;\":0x2111, \"imath;\":0x131,\n \"imof;\":0x22b7, \"imped;\":0x1b5,\n \"in;\":0x2208, \"incare;\":0x2105,\n \"infin;\":0x221e, \"infintie;\":0x29dd,\n \"inodot;\":0x131, \"int;\":0x222b,\n \"intcal;\":0x22ba, \"integers;\":0x2124,\n \"intercal;\":0x22ba, \"intlarhk;\":0x2a17,\n \"intprod;\":0x2a3c, \"iocy;\":0x451,\n \"iogon;\":0x12f, \"iopf;\":[0xd835,0xdd5a],\n \"iota;\":0x3b9, \"iprod;\":0x2a3c,\n \"iquest\":0xbf, \"iquest;\":0xbf,\n \"iscr;\":[0xd835,0xdcbe], \"isin;\":0x2208,\n \"isinE;\":0x22f9, \"isindot;\":0x22f5,\n \"isins;\":0x22f4, \"isinsv;\":0x22f3,\n \"isinv;\":0x2208, \"it;\":0x2062,\n \"itilde;\":0x129, \"iukcy;\":0x456,\n \"iuml\":0xef, \"iuml;\":0xef,\n \"jcirc;\":0x135, \"jcy;\":0x439,\n \"jfr;\":[0xd835,0xdd27], \"jmath;\":0x237,\n \"jopf;\":[0xd835,0xdd5b], \"jscr;\":[0xd835,0xdcbf],\n \"jsercy;\":0x458, \"jukcy;\":0x454,\n \"kappa;\":0x3ba, \"kappav;\":0x3f0,\n \"kcedil;\":0x137, \"kcy;\":0x43a,\n \"kfr;\":[0xd835,0xdd28], \"kgreen;\":0x138,\n \"khcy;\":0x445, \"kjcy;\":0x45c,\n \"kopf;\":[0xd835,0xdd5c], \"kscr;\":[0xd835,0xdcc0],\n \"lAarr;\":0x21da, \"lArr;\":0x21d0,\n \"lAtail;\":0x291b, \"lBarr;\":0x290e,\n \"lE;\":0x2266, \"lEg;\":0x2a8b,\n \"lHar;\":0x2962, \"lacute;\":0x13a,\n \"laemptyv;\":0x29b4, \"lagran;\":0x2112,\n \"lambda;\":0x3bb, \"lang;\":0x27e8,\n \"langd;\":0x2991, \"langle;\":0x27e8,\n \"lap;\":0x2a85, \"laquo\":0xab,\n \"laquo;\":0xab, \"larr;\":0x2190,\n \"larrb;\":0x21e4, \"larrbfs;\":0x291f,\n \"larrfs;\":0x291d, \"larrhk;\":0x21a9,\n \"larrlp;\":0x21ab, \"larrpl;\":0x2939,\n \"larrsim;\":0x2973, \"larrtl;\":0x21a2,\n \"lat;\":0x2aab, \"latail;\":0x2919,\n \"late;\":0x2aad, \"lates;\":[0x2aad,0xfe00],\n \"lbarr;\":0x290c, \"lbbrk;\":0x2772,\n \"lbrace;\":0x7b, \"lbrack;\":0x5b,\n \"lbrke;\":0x298b, \"lbrksld;\":0x298f,\n \"lbrkslu;\":0x298d, \"lcaron;\":0x13e,\n \"lcedil;\":0x13c, \"lceil;\":0x2308,\n \"lcub;\":0x7b, \"lcy;\":0x43b,\n \"ldca;\":0x2936, \"ldquo;\":0x201c,\n \"ldquor;\":0x201e, \"ldrdhar;\":0x2967,\n \"ldrushar;\":0x294b, \"ldsh;\":0x21b2,\n \"le;\":0x2264, \"leftarrow;\":0x2190,\n \"leftarrowtail;\":0x21a2, \"leftharpoondown;\":0x21bd,\n \"leftharpoonup;\":0x21bc, \"leftleftarrows;\":0x21c7,\n \"leftrightarrow;\":0x2194, \"leftrightarrows;\":0x21c6,\n \"leftrightharpoons;\":0x21cb, \"leftrightsquigarrow;\":0x21ad,\n \"leftthreetimes;\":0x22cb, \"leg;\":0x22da,\n \"leq;\":0x2264, \"leqq;\":0x2266,\n \"leqslant;\":0x2a7d, \"les;\":0x2a7d,\n \"lescc;\":0x2aa8, \"lesdot;\":0x2a7f,\n \"lesdoto;\":0x2a81, \"lesdotor;\":0x2a83,\n \"lesg;\":[0x22da,0xfe00], \"lesges;\":0x2a93,\n \"lessapprox;\":0x2a85, \"lessdot;\":0x22d6,\n \"lesseqgtr;\":0x22da, \"lesseqqgtr;\":0x2a8b,\n \"lessgtr;\":0x2276, \"lesssim;\":0x2272,\n \"lfisht;\":0x297c, \"lfloor;\":0x230a,\n \"lfr;\":[0xd835,0xdd29], \"lg;\":0x2276,\n \"lgE;\":0x2a91, \"lhard;\":0x21bd,\n \"lharu;\":0x21bc, \"lharul;\":0x296a,\n \"lhblk;\":0x2584, \"ljcy;\":0x459,\n \"ll;\":0x226a, \"llarr;\":0x21c7,\n \"llcorner;\":0x231e, \"llhard;\":0x296b,\n \"lltri;\":0x25fa, \"lmidot;\":0x140,\n \"lmoust;\":0x23b0, \"lmoustache;\":0x23b0,\n \"lnE;\":0x2268, \"lnap;\":0x2a89,\n \"lnapprox;\":0x2a89, \"lne;\":0x2a87,\n \"lneq;\":0x2a87, \"lneqq;\":0x2268,\n \"lnsim;\":0x22e6, \"loang;\":0x27ec,\n \"loarr;\":0x21fd, \"lobrk;\":0x27e6,\n \"longleftarrow;\":0x27f5, \"longleftrightarrow;\":0x27f7,\n \"longmapsto;\":0x27fc, \"longrightarrow;\":0x27f6,\n \"looparrowleft;\":0x21ab, \"looparrowright;\":0x21ac,\n \"lopar;\":0x2985, \"lopf;\":[0xd835,0xdd5d],\n \"loplus;\":0x2a2d, \"lotimes;\":0x2a34,\n \"lowast;\":0x2217, \"lowbar;\":0x5f,\n \"loz;\":0x25ca, \"lozenge;\":0x25ca,\n \"lozf;\":0x29eb, \"lpar;\":0x28,\n \"lparlt;\":0x2993, \"lrarr;\":0x21c6,\n \"lrcorner;\":0x231f, \"lrhar;\":0x21cb,\n \"lrhard;\":0x296d, \"lrm;\":0x200e,\n \"lrtri;\":0x22bf, \"lsaquo;\":0x2039,\n \"lscr;\":[0xd835,0xdcc1], \"lsh;\":0x21b0,\n \"lsim;\":0x2272, \"lsime;\":0x2a8d,\n \"lsimg;\":0x2a8f, \"lsqb;\":0x5b,\n \"lsquo;\":0x2018, \"lsquor;\":0x201a,\n \"lstrok;\":0x142, \"lt\":0x3c,\n \"lt;\":0x3c, \"ltcc;\":0x2aa6,\n \"ltcir;\":0x2a79, \"ltdot;\":0x22d6,\n \"lthree;\":0x22cb, \"ltimes;\":0x22c9,\n \"ltlarr;\":0x2976, \"ltquest;\":0x2a7b,\n \"ltrPar;\":0x2996, \"ltri;\":0x25c3,\n \"ltrie;\":0x22b4, \"ltrif;\":0x25c2,\n \"lurdshar;\":0x294a, \"luruhar;\":0x2966,\n \"lvertneqq;\":[0x2268,0xfe00], \"lvnE;\":[0x2268,0xfe00],\n \"mDDot;\":0x223a, \"macr\":0xaf,\n \"macr;\":0xaf, \"male;\":0x2642,\n \"malt;\":0x2720, \"maltese;\":0x2720,\n \"map;\":0x21a6, \"mapsto;\":0x21a6,\n \"mapstodown;\":0x21a7, \"mapstoleft;\":0x21a4,\n \"mapstoup;\":0x21a5, \"marker;\":0x25ae,\n \"mcomma;\":0x2a29, \"mcy;\":0x43c,\n \"mdash;\":0x2014, \"measuredangle;\":0x2221,\n \"mfr;\":[0xd835,0xdd2a], \"mho;\":0x2127,\n \"micro\":0xb5, \"micro;\":0xb5,\n \"mid;\":0x2223, \"midast;\":0x2a,\n \"midcir;\":0x2af0, \"middot\":0xb7,\n \"middot;\":0xb7, \"minus;\":0x2212,\n \"minusb;\":0x229f, \"minusd;\":0x2238,\n \"minusdu;\":0x2a2a, \"mlcp;\":0x2adb,\n \"mldr;\":0x2026, \"mnplus;\":0x2213,\n \"models;\":0x22a7, \"mopf;\":[0xd835,0xdd5e],\n \"mp;\":0x2213, \"mscr;\":[0xd835,0xdcc2],\n \"mstpos;\":0x223e, \"mu;\":0x3bc,\n \"multimap;\":0x22b8, \"mumap;\":0x22b8,\n \"nGg;\":[0x22d9,0x338], \"nGt;\":[0x226b,0x20d2],\n \"nGtv;\":[0x226b,0x338], \"nLeftarrow;\":0x21cd,\n \"nLeftrightarrow;\":0x21ce, \"nLl;\":[0x22d8,0x338],\n \"nLt;\":[0x226a,0x20d2], \"nLtv;\":[0x226a,0x338],\n \"nRightarrow;\":0x21cf, \"nVDash;\":0x22af,\n \"nVdash;\":0x22ae, \"nabla;\":0x2207,\n \"nacute;\":0x144, \"nang;\":[0x2220,0x20d2],\n \"nap;\":0x2249, \"napE;\":[0x2a70,0x338],\n \"napid;\":[0x224b,0x338], \"napos;\":0x149,\n \"napprox;\":0x2249, \"natur;\":0x266e,\n \"natural;\":0x266e, \"naturals;\":0x2115,\n \"nbsp\":0xa0, \"nbsp;\":0xa0,\n \"nbump;\":[0x224e,0x338], \"nbumpe;\":[0x224f,0x338],\n \"ncap;\":0x2a43, \"ncaron;\":0x148,\n \"ncedil;\":0x146, \"ncong;\":0x2247,\n \"ncongdot;\":[0x2a6d,0x338], \"ncup;\":0x2a42,\n \"ncy;\":0x43d, \"ndash;\":0x2013,\n \"ne;\":0x2260, \"neArr;\":0x21d7,\n \"nearhk;\":0x2924, \"nearr;\":0x2197,\n \"nearrow;\":0x2197, \"nedot;\":[0x2250,0x338],\n \"nequiv;\":0x2262, \"nesear;\":0x2928,\n \"nesim;\":[0x2242,0x338], \"nexist;\":0x2204,\n \"nexists;\":0x2204, \"nfr;\":[0xd835,0xdd2b],\n \"ngE;\":[0x2267,0x338], \"nge;\":0x2271,\n \"ngeq;\":0x2271, \"ngeqq;\":[0x2267,0x338],\n \"ngeqslant;\":[0x2a7e,0x338], \"nges;\":[0x2a7e,0x338],\n \"ngsim;\":0x2275, \"ngt;\":0x226f,\n \"ngtr;\":0x226f, \"nhArr;\":0x21ce,\n \"nharr;\":0x21ae, \"nhpar;\":0x2af2,\n \"ni;\":0x220b, \"nis;\":0x22fc,\n \"nisd;\":0x22fa, \"niv;\":0x220b,\n \"njcy;\":0x45a, \"nlArr;\":0x21cd,\n \"nlE;\":[0x2266,0x338], \"nlarr;\":0x219a,\n \"nldr;\":0x2025, \"nle;\":0x2270,\n \"nleftarrow;\":0x219a, \"nleftrightarrow;\":0x21ae,\n \"nleq;\":0x2270, \"nleqq;\":[0x2266,0x338],\n \"nleqslant;\":[0x2a7d,0x338], \"nles;\":[0x2a7d,0x338],\n \"nless;\":0x226e, \"nlsim;\":0x2274,\n \"nlt;\":0x226e, \"nltri;\":0x22ea,\n \"nltrie;\":0x22ec, \"nmid;\":0x2224,\n \"nopf;\":[0xd835,0xdd5f], \"not\":0xac,\n \"not;\":0xac, \"notin;\":0x2209,\n \"notinE;\":[0x22f9,0x338], \"notindot;\":[0x22f5,0x338],\n \"notinva;\":0x2209, \"notinvb;\":0x22f7,\n \"notinvc;\":0x22f6, \"notni;\":0x220c,\n \"notniva;\":0x220c, \"notnivb;\":0x22fe,\n \"notnivc;\":0x22fd, \"npar;\":0x2226,\n \"nparallel;\":0x2226, \"nparsl;\":[0x2afd,0x20e5],\n \"npart;\":[0x2202,0x338], \"npolint;\":0x2a14,\n \"npr;\":0x2280, \"nprcue;\":0x22e0,\n \"npre;\":[0x2aaf,0x338], \"nprec;\":0x2280,\n \"npreceq;\":[0x2aaf,0x338], \"nrArr;\":0x21cf,\n \"nrarr;\":0x219b, \"nrarrc;\":[0x2933,0x338],\n \"nrarrw;\":[0x219d,0x338], \"nrightarrow;\":0x219b,\n \"nrtri;\":0x22eb, \"nrtrie;\":0x22ed,\n \"nsc;\":0x2281, \"nsccue;\":0x22e1,\n \"nsce;\":[0x2ab0,0x338], \"nscr;\":[0xd835,0xdcc3],\n \"nshortmid;\":0x2224, \"nshortparallel;\":0x2226,\n \"nsim;\":0x2241, \"nsime;\":0x2244,\n \"nsimeq;\":0x2244, \"nsmid;\":0x2224,\n \"nspar;\":0x2226, \"nsqsube;\":0x22e2,\n \"nsqsupe;\":0x22e3, \"nsub;\":0x2284,\n \"nsubE;\":[0x2ac5,0x338], \"nsube;\":0x2288,\n \"nsubset;\":[0x2282,0x20d2], \"nsubseteq;\":0x2288,\n \"nsubseteqq;\":[0x2ac5,0x338], \"nsucc;\":0x2281,\n \"nsucceq;\":[0x2ab0,0x338], \"nsup;\":0x2285,\n \"nsupE;\":[0x2ac6,0x338], \"nsupe;\":0x2289,\n \"nsupset;\":[0x2283,0x20d2], \"nsupseteq;\":0x2289,\n \"nsupseteqq;\":[0x2ac6,0x338], \"ntgl;\":0x2279,\n \"ntilde\":0xf1, \"ntilde;\":0xf1,\n \"ntlg;\":0x2278, \"ntriangleleft;\":0x22ea,\n \"ntrianglelefteq;\":0x22ec, \"ntriangleright;\":0x22eb,\n \"ntrianglerighteq;\":0x22ed, \"nu;\":0x3bd,\n \"num;\":0x23, \"numero;\":0x2116,\n \"numsp;\":0x2007, \"nvDash;\":0x22ad,\n \"nvHarr;\":0x2904, \"nvap;\":[0x224d,0x20d2],\n \"nvdash;\":0x22ac, \"nvge;\":[0x2265,0x20d2],\n \"nvgt;\":[0x3e,0x20d2], \"nvinfin;\":0x29de,\n \"nvlArr;\":0x2902, \"nvle;\":[0x2264,0x20d2],\n \"nvlt;\":[0x3c,0x20d2], \"nvltrie;\":[0x22b4,0x20d2],\n \"nvrArr;\":0x2903, \"nvrtrie;\":[0x22b5,0x20d2],\n \"nvsim;\":[0x223c,0x20d2], \"nwArr;\":0x21d6,\n \"nwarhk;\":0x2923, \"nwarr;\":0x2196,\n \"nwarrow;\":0x2196, \"nwnear;\":0x2927,\n \"oS;\":0x24c8, \"oacute\":0xf3,\n \"oacute;\":0xf3, \"oast;\":0x229b,\n \"ocir;\":0x229a, \"ocirc\":0xf4,\n \"ocirc;\":0xf4, \"ocy;\":0x43e,\n \"odash;\":0x229d, \"odblac;\":0x151,\n \"odiv;\":0x2a38, \"odot;\":0x2299,\n \"odsold;\":0x29bc, \"oelig;\":0x153,\n \"ofcir;\":0x29bf, \"ofr;\":[0xd835,0xdd2c],\n \"ogon;\":0x2db, \"ograve\":0xf2,\n \"ograve;\":0xf2, \"ogt;\":0x29c1,\n \"ohbar;\":0x29b5, \"ohm;\":0x3a9,\n \"oint;\":0x222e, \"olarr;\":0x21ba,\n \"olcir;\":0x29be, \"olcross;\":0x29bb,\n \"oline;\":0x203e, \"olt;\":0x29c0,\n \"omacr;\":0x14d, \"omega;\":0x3c9,\n \"omicron;\":0x3bf, \"omid;\":0x29b6,\n \"ominus;\":0x2296, \"oopf;\":[0xd835,0xdd60],\n \"opar;\":0x29b7, \"operp;\":0x29b9,\n \"oplus;\":0x2295, \"or;\":0x2228,\n \"orarr;\":0x21bb, \"ord;\":0x2a5d,\n \"order;\":0x2134, \"orderof;\":0x2134,\n \"ordf\":0xaa, \"ordf;\":0xaa,\n \"ordm\":0xba, \"ordm;\":0xba,\n \"origof;\":0x22b6, \"oror;\":0x2a56,\n \"orslope;\":0x2a57, \"orv;\":0x2a5b,\n \"oscr;\":0x2134, \"oslash\":0xf8,\n \"oslash;\":0xf8, \"osol;\":0x2298,\n \"otilde\":0xf5, \"otilde;\":0xf5,\n \"otimes;\":0x2297, \"otimesas;\":0x2a36,\n \"ouml\":0xf6, \"ouml;\":0xf6,\n \"ovbar;\":0x233d, \"par;\":0x2225,\n \"para\":0xb6, \"para;\":0xb6,\n \"parallel;\":0x2225, \"parsim;\":0x2af3,\n \"parsl;\":0x2afd, \"part;\":0x2202,\n \"pcy;\":0x43f, \"percnt;\":0x25,\n \"period;\":0x2e, \"permil;\":0x2030,\n \"perp;\":0x22a5, \"pertenk;\":0x2031,\n \"pfr;\":[0xd835,0xdd2d], \"phi;\":0x3c6,\n \"phiv;\":0x3d5, \"phmmat;\":0x2133,\n \"phone;\":0x260e, \"pi;\":0x3c0,\n \"pitchfork;\":0x22d4, \"piv;\":0x3d6,\n \"planck;\":0x210f, \"planckh;\":0x210e,\n \"plankv;\":0x210f, \"plus;\":0x2b,\n \"plusacir;\":0x2a23, \"plusb;\":0x229e,\n \"pluscir;\":0x2a22, \"plusdo;\":0x2214,\n \"plusdu;\":0x2a25, \"pluse;\":0x2a72,\n \"plusmn\":0xb1, \"plusmn;\":0xb1,\n \"plussim;\":0x2a26, \"plustwo;\":0x2a27,\n \"pm;\":0xb1, \"pointint;\":0x2a15,\n \"popf;\":[0xd835,0xdd61], \"pound\":0xa3,\n \"pound;\":0xa3, \"pr;\":0x227a,\n \"prE;\":0x2ab3, \"prap;\":0x2ab7,\n \"prcue;\":0x227c, \"pre;\":0x2aaf,\n \"prec;\":0x227a, \"precapprox;\":0x2ab7,\n \"preccurlyeq;\":0x227c, \"preceq;\":0x2aaf,\n \"precnapprox;\":0x2ab9, \"precneqq;\":0x2ab5,\n \"precnsim;\":0x22e8, \"precsim;\":0x227e,\n \"prime;\":0x2032, \"primes;\":0x2119,\n \"prnE;\":0x2ab5, \"prnap;\":0x2ab9,\n \"prnsim;\":0x22e8, \"prod;\":0x220f,\n \"profalar;\":0x232e, \"profline;\":0x2312,\n \"profsurf;\":0x2313, \"prop;\":0x221d,\n \"propto;\":0x221d, \"prsim;\":0x227e,\n \"prurel;\":0x22b0, \"pscr;\":[0xd835,0xdcc5],\n \"psi;\":0x3c8, \"puncsp;\":0x2008,\n \"qfr;\":[0xd835,0xdd2e], \"qint;\":0x2a0c,\n \"qopf;\":[0xd835,0xdd62], \"qprime;\":0x2057,\n \"qscr;\":[0xd835,0xdcc6], \"quaternions;\":0x210d,\n \"quatint;\":0x2a16, \"quest;\":0x3f,\n \"questeq;\":0x225f, \"quot\":0x22,\n \"quot;\":0x22, \"rAarr;\":0x21db,\n \"rArr;\":0x21d2, \"rAtail;\":0x291c,\n \"rBarr;\":0x290f, \"rHar;\":0x2964,\n \"race;\":[0x223d,0x331], \"racute;\":0x155,\n \"radic;\":0x221a, \"raemptyv;\":0x29b3,\n \"rang;\":0x27e9, \"rangd;\":0x2992,\n \"range;\":0x29a5, \"rangle;\":0x27e9,\n \"raquo\":0xbb, \"raquo;\":0xbb,\n \"rarr;\":0x2192, \"rarrap;\":0x2975,\n \"rarrb;\":0x21e5, \"rarrbfs;\":0x2920,\n \"rarrc;\":0x2933, \"rarrfs;\":0x291e,\n \"rarrhk;\":0x21aa, \"rarrlp;\":0x21ac,\n \"rarrpl;\":0x2945, \"rarrsim;\":0x2974,\n \"rarrtl;\":0x21a3, \"rarrw;\":0x219d,\n \"ratail;\":0x291a, \"ratio;\":0x2236,\n \"rationals;\":0x211a, \"rbarr;\":0x290d,\n \"rbbrk;\":0x2773, \"rbrace;\":0x7d,\n \"rbrack;\":0x5d, \"rbrke;\":0x298c,\n \"rbrksld;\":0x298e, \"rbrkslu;\":0x2990,\n \"rcaron;\":0x159, \"rcedil;\":0x157,\n \"rceil;\":0x2309, \"rcub;\":0x7d,\n \"rcy;\":0x440, \"rdca;\":0x2937,\n \"rdldhar;\":0x2969, \"rdquo;\":0x201d,\n \"rdquor;\":0x201d, \"rdsh;\":0x21b3,\n \"real;\":0x211c, \"realine;\":0x211b,\n \"realpart;\":0x211c, \"reals;\":0x211d,\n \"rect;\":0x25ad, \"reg\":0xae,\n \"reg;\":0xae, \"rfisht;\":0x297d,\n \"rfloor;\":0x230b, \"rfr;\":[0xd835,0xdd2f],\n \"rhard;\":0x21c1, \"rharu;\":0x21c0,\n \"rharul;\":0x296c, \"rho;\":0x3c1,\n \"rhov;\":0x3f1, \"rightarrow;\":0x2192,\n \"rightarrowtail;\":0x21a3, \"rightharpoondown;\":0x21c1,\n \"rightharpoonup;\":0x21c0, \"rightleftarrows;\":0x21c4,\n \"rightleftharpoons;\":0x21cc, \"rightrightarrows;\":0x21c9,\n \"rightsquigarrow;\":0x219d, \"rightthreetimes;\":0x22cc,\n \"ring;\":0x2da, \"risingdotseq;\":0x2253,\n \"rlarr;\":0x21c4, \"rlhar;\":0x21cc,\n \"rlm;\":0x200f, \"rmoust;\":0x23b1,\n \"rmoustache;\":0x23b1, \"rnmid;\":0x2aee,\n \"roang;\":0x27ed, \"roarr;\":0x21fe,\n \"robrk;\":0x27e7, \"ropar;\":0x2986,\n \"ropf;\":[0xd835,0xdd63], \"roplus;\":0x2a2e,\n \"rotimes;\":0x2a35, \"rpar;\":0x29,\n \"rpargt;\":0x2994, \"rppolint;\":0x2a12,\n \"rrarr;\":0x21c9, \"rsaquo;\":0x203a,\n \"rscr;\":[0xd835,0xdcc7], \"rsh;\":0x21b1,\n \"rsqb;\":0x5d, \"rsquo;\":0x2019,\n \"rsquor;\":0x2019, \"rthree;\":0x22cc,\n \"rtimes;\":0x22ca, \"rtri;\":0x25b9,\n \"rtrie;\":0x22b5, \"rtrif;\":0x25b8,\n \"rtriltri;\":0x29ce, \"ruluhar;\":0x2968,\n \"rx;\":0x211e, \"sacute;\":0x15b,\n \"sbquo;\":0x201a, \"sc;\":0x227b,\n \"scE;\":0x2ab4, \"scap;\":0x2ab8,\n \"scaron;\":0x161, \"sccue;\":0x227d,\n \"sce;\":0x2ab0, \"scedil;\":0x15f,\n \"scirc;\":0x15d, \"scnE;\":0x2ab6,\n \"scnap;\":0x2aba, \"scnsim;\":0x22e9,\n \"scpolint;\":0x2a13, \"scsim;\":0x227f,\n \"scy;\":0x441, \"sdot;\":0x22c5,\n \"sdotb;\":0x22a1, \"sdote;\":0x2a66,\n \"seArr;\":0x21d8, \"searhk;\":0x2925,\n \"searr;\":0x2198, \"searrow;\":0x2198,\n \"sect\":0xa7, \"sect;\":0xa7,\n \"semi;\":0x3b, \"seswar;\":0x2929,\n \"setminus;\":0x2216, \"setmn;\":0x2216,\n \"sext;\":0x2736, \"sfr;\":[0xd835,0xdd30],\n \"sfrown;\":0x2322, \"sharp;\":0x266f,\n \"shchcy;\":0x449, \"shcy;\":0x448,\n \"shortmid;\":0x2223, \"shortparallel;\":0x2225,\n \"shy\":0xad, \"shy;\":0xad,\n \"sigma;\":0x3c3, \"sigmaf;\":0x3c2,\n \"sigmav;\":0x3c2, \"sim;\":0x223c,\n \"simdot;\":0x2a6a, \"sime;\":0x2243,\n \"simeq;\":0x2243, \"simg;\":0x2a9e,\n \"simgE;\":0x2aa0, \"siml;\":0x2a9d,\n \"simlE;\":0x2a9f, \"simne;\":0x2246,\n \"simplus;\":0x2a24, \"simrarr;\":0x2972,\n \"slarr;\":0x2190, \"smallsetminus;\":0x2216,\n \"smashp;\":0x2a33, \"smeparsl;\":0x29e4,\n \"smid;\":0x2223, \"smile;\":0x2323,\n \"smt;\":0x2aaa, \"smte;\":0x2aac,\n \"smtes;\":[0x2aac,0xfe00], \"softcy;\":0x44c,\n \"sol;\":0x2f, \"solb;\":0x29c4,\n \"solbar;\":0x233f, \"sopf;\":[0xd835,0xdd64],\n \"spades;\":0x2660, \"spadesuit;\":0x2660,\n \"spar;\":0x2225, \"sqcap;\":0x2293,\n \"sqcaps;\":[0x2293,0xfe00], \"sqcup;\":0x2294,\n \"sqcups;\":[0x2294,0xfe00], \"sqsub;\":0x228f,\n \"sqsube;\":0x2291, \"sqsubset;\":0x228f,\n \"sqsubseteq;\":0x2291, \"sqsup;\":0x2290,\n \"sqsupe;\":0x2292, \"sqsupset;\":0x2290,\n \"sqsupseteq;\":0x2292, \"squ;\":0x25a1,\n \"square;\":0x25a1, \"squarf;\":0x25aa,\n \"squf;\":0x25aa, \"srarr;\":0x2192,\n \"sscr;\":[0xd835,0xdcc8], \"ssetmn;\":0x2216,\n \"ssmile;\":0x2323, \"sstarf;\":0x22c6,\n \"star;\":0x2606, \"starf;\":0x2605,\n \"straightepsilon;\":0x3f5, \"straightphi;\":0x3d5,\n \"strns;\":0xaf, \"sub;\":0x2282,\n \"subE;\":0x2ac5, \"subdot;\":0x2abd,\n \"sube;\":0x2286, \"subedot;\":0x2ac3,\n \"submult;\":0x2ac1, \"subnE;\":0x2acb,\n \"subne;\":0x228a, \"subplus;\":0x2abf,\n \"subrarr;\":0x2979, \"subset;\":0x2282,\n \"subseteq;\":0x2286, \"subseteqq;\":0x2ac5,\n \"subsetneq;\":0x228a, \"subsetneqq;\":0x2acb,\n \"subsim;\":0x2ac7, \"subsub;\":0x2ad5,\n \"subsup;\":0x2ad3, \"succ;\":0x227b,\n \"succapprox;\":0x2ab8, \"succcurlyeq;\":0x227d,\n \"succeq;\":0x2ab0, \"succnapprox;\":0x2aba,\n \"succneqq;\":0x2ab6, \"succnsim;\":0x22e9,\n \"succsim;\":0x227f, \"sum;\":0x2211,\n \"sung;\":0x266a, \"sup1\":0xb9,\n \"sup1;\":0xb9, \"sup2\":0xb2,\n \"sup2;\":0xb2, \"sup3\":0xb3,\n \"sup3;\":0xb3, \"sup;\":0x2283,\n \"supE;\":0x2ac6, \"supdot;\":0x2abe,\n \"supdsub;\":0x2ad8, \"supe;\":0x2287,\n \"supedot;\":0x2ac4, \"suphsol;\":0x27c9,\n \"suphsub;\":0x2ad7, \"suplarr;\":0x297b,\n \"supmult;\":0x2ac2, \"supnE;\":0x2acc,\n \"supne;\":0x228b, \"supplus;\":0x2ac0,\n \"supset;\":0x2283, \"supseteq;\":0x2287,\n \"supseteqq;\":0x2ac6, \"supsetneq;\":0x228b,\n \"supsetneqq;\":0x2acc, \"supsim;\":0x2ac8,\n \"supsub;\":0x2ad4, \"supsup;\":0x2ad6,\n \"swArr;\":0x21d9, \"swarhk;\":0x2926,\n \"swarr;\":0x2199, \"swarrow;\":0x2199,\n \"swnwar;\":0x292a, \"szlig\":0xdf,\n \"szlig;\":0xdf, \"target;\":0x2316,\n \"tau;\":0x3c4, \"tbrk;\":0x23b4,\n \"tcaron;\":0x165, \"tcedil;\":0x163,\n \"tcy;\":0x442, \"tdot;\":0x20db,\n \"telrec;\":0x2315, \"tfr;\":[0xd835,0xdd31],\n \"there4;\":0x2234, \"therefore;\":0x2234,\n \"theta;\":0x3b8, \"thetasym;\":0x3d1,\n \"thetav;\":0x3d1, \"thickapprox;\":0x2248,\n \"thicksim;\":0x223c, \"thinsp;\":0x2009,\n \"thkap;\":0x2248, \"thksim;\":0x223c,\n \"thorn\":0xfe, \"thorn;\":0xfe,\n \"tilde;\":0x2dc, \"times\":0xd7,\n \"times;\":0xd7, \"timesb;\":0x22a0,\n \"timesbar;\":0x2a31, \"timesd;\":0x2a30,\n \"tint;\":0x222d, \"toea;\":0x2928,\n \"top;\":0x22a4, \"topbot;\":0x2336,\n \"topcir;\":0x2af1, \"topf;\":[0xd835,0xdd65],\n \"topfork;\":0x2ada, \"tosa;\":0x2929,\n \"tprime;\":0x2034, \"trade;\":0x2122,\n \"triangle;\":0x25b5, \"triangledown;\":0x25bf,\n \"triangleleft;\":0x25c3, \"trianglelefteq;\":0x22b4,\n \"triangleq;\":0x225c, \"triangleright;\":0x25b9,\n \"trianglerighteq;\":0x22b5, \"tridot;\":0x25ec,\n \"trie;\":0x225c, \"triminus;\":0x2a3a,\n \"triplus;\":0x2a39, \"trisb;\":0x29cd,\n \"tritime;\":0x2a3b, \"trpezium;\":0x23e2,\n \"tscr;\":[0xd835,0xdcc9], \"tscy;\":0x446,\n \"tshcy;\":0x45b, \"tstrok;\":0x167,\n \"twixt;\":0x226c, \"twoheadleftarrow;\":0x219e,\n \"twoheadrightarrow;\":0x21a0, \"uArr;\":0x21d1,\n \"uHar;\":0x2963, \"uacute\":0xfa,\n \"uacute;\":0xfa, \"uarr;\":0x2191,\n \"ubrcy;\":0x45e, \"ubreve;\":0x16d,\n \"ucirc\":0xfb, \"ucirc;\":0xfb,\n \"ucy;\":0x443, \"udarr;\":0x21c5,\n \"udblac;\":0x171, \"udhar;\":0x296e,\n \"ufisht;\":0x297e, \"ufr;\":[0xd835,0xdd32],\n \"ugrave\":0xf9, \"ugrave;\":0xf9,\n \"uharl;\":0x21bf, \"uharr;\":0x21be,\n \"uhblk;\":0x2580, \"ulcorn;\":0x231c,\n \"ulcorner;\":0x231c, \"ulcrop;\":0x230f,\n \"ultri;\":0x25f8, \"umacr;\":0x16b,\n \"uml\":0xa8, \"uml;\":0xa8,\n \"uogon;\":0x173, \"uopf;\":[0xd835,0xdd66],\n \"uparrow;\":0x2191, \"updownarrow;\":0x2195,\n \"upharpoonleft;\":0x21bf, \"upharpoonright;\":0x21be,\n \"uplus;\":0x228e, \"upsi;\":0x3c5,\n \"upsih;\":0x3d2, \"upsilon;\":0x3c5,\n \"upuparrows;\":0x21c8, \"urcorn;\":0x231d,\n \"urcorner;\":0x231d, \"urcrop;\":0x230e,\n \"uring;\":0x16f, \"urtri;\":0x25f9,\n \"uscr;\":[0xd835,0xdcca], \"utdot;\":0x22f0,\n \"utilde;\":0x169, \"utri;\":0x25b5,\n \"utrif;\":0x25b4, \"uuarr;\":0x21c8,\n \"uuml\":0xfc, \"uuml;\":0xfc,\n \"uwangle;\":0x29a7, \"vArr;\":0x21d5,\n \"vBar;\":0x2ae8, \"vBarv;\":0x2ae9,\n \"vDash;\":0x22a8, \"vangrt;\":0x299c,\n \"varepsilon;\":0x3f5, \"varkappa;\":0x3f0,\n \"varnothing;\":0x2205, \"varphi;\":0x3d5,\n \"varpi;\":0x3d6, \"varpropto;\":0x221d,\n \"varr;\":0x2195, \"varrho;\":0x3f1,\n \"varsigma;\":0x3c2, \"varsubsetneq;\":[0x228a,0xfe00],\n \"varsubsetneqq;\":[0x2acb,0xfe00], \"varsupsetneq;\":[0x228b,0xfe00],\n \"varsupsetneqq;\":[0x2acc,0xfe00], \"vartheta;\":0x3d1,\n \"vartriangleleft;\":0x22b2, \"vartriangleright;\":0x22b3,\n \"vcy;\":0x432, \"vdash;\":0x22a2,\n \"vee;\":0x2228, \"veebar;\":0x22bb,\n \"veeeq;\":0x225a, \"vellip;\":0x22ee,\n \"verbar;\":0x7c, \"vert;\":0x7c,\n \"vfr;\":[0xd835,0xdd33], \"vltri;\":0x22b2,\n \"vnsub;\":[0x2282,0x20d2], \"vnsup;\":[0x2283,0x20d2],\n \"vopf;\":[0xd835,0xdd67], \"vprop;\":0x221d,\n \"vrtri;\":0x22b3, \"vscr;\":[0xd835,0xdccb],\n \"vsubnE;\":[0x2acb,0xfe00], \"vsubne;\":[0x228a,0xfe00],\n \"vsupnE;\":[0x2acc,0xfe00], \"vsupne;\":[0x228b,0xfe00],\n \"vzigzag;\":0x299a, \"wcirc;\":0x175,\n \"wedbar;\":0x2a5f, \"wedge;\":0x2227,\n \"wedgeq;\":0x2259, \"weierp;\":0x2118,\n \"wfr;\":[0xd835,0xdd34], \"wopf;\":[0xd835,0xdd68],\n \"wp;\":0x2118, \"wr;\":0x2240,\n \"wreath;\":0x2240, \"wscr;\":[0xd835,0xdccc],\n \"xcap;\":0x22c2, \"xcirc;\":0x25ef,\n \"xcup;\":0x22c3, \"xdtri;\":0x25bd,\n \"xfr;\":[0xd835,0xdd35], \"xhArr;\":0x27fa,\n \"xharr;\":0x27f7, \"xi;\":0x3be,\n \"xlArr;\":0x27f8, \"xlarr;\":0x27f5,\n \"xmap;\":0x27fc, \"xnis;\":0x22fb,\n \"xodot;\":0x2a00, \"xopf;\":[0xd835,0xdd69],\n \"xoplus;\":0x2a01, \"xotime;\":0x2a02,\n \"xrArr;\":0x27f9, \"xrarr;\":0x27f6,\n \"xscr;\":[0xd835,0xdccd], \"xsqcup;\":0x2a06,\n \"xuplus;\":0x2a04, \"xutri;\":0x25b3,\n \"xvee;\":0x22c1, \"xwedge;\":0x22c0,\n \"yacute\":0xfd, \"yacute;\":0xfd,\n \"yacy;\":0x44f, \"ycirc;\":0x177,\n \"ycy;\":0x44b, \"yen\":0xa5,\n \"yen;\":0xa5, \"yfr;\":[0xd835,0xdd36],\n \"yicy;\":0x457, \"yopf;\":[0xd835,0xdd6a],\n \"yscr;\":[0xd835,0xdcce], \"yucy;\":0x44e,\n \"yuml\":0xff, \"yuml;\":0xff,\n \"zacute;\":0x17a, \"zcaron;\":0x17e,\n \"zcy;\":0x437, \"zdot;\":0x17c,\n \"zeetrf;\":0x2128, \"zeta;\":0x3b6,\n \"zfr;\":[0xd835,0xdd37], \"zhcy;\":0x436,\n \"zigrarr;\":0x21dd, \"zopf;\":[0xd835,0xdd6b],\n \"zscr;\":[0xd835,0xdccf], \"zwj;\":0x200d,\n \"zwnj;\":0x200c,\n};\n/*\n * This regexp is generated with test/tools/update-entities.js\n * It will always match at least one character -- but note that there\n * are no entities whose names are a single character long.\n */\nvar NAMEDCHARREF = /(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\\s\\S]/g;\n\nvar NAMEDCHARREF_MAXLEN = 32;\n\n// Regular expression constants used by the tokenizer and parser\n\n// Note that \\r is included in all of these regexps because it will need\n// to be converted to LF by the scanChars() function.\nvar DBLQUOTEATTRVAL = /[^\\r\"&\\u0000]+/g;\nvar SINGLEQUOTEATTRVAL = /[^\\r'&\\u0000]+/g;\nvar UNQUOTEDATTRVAL = /[^\\r\\t\\n\\f &>\\u0000]+/g;\nvar TAGNAME = /[^\\r\\t\\n\\f \\/>A-Z\\u0000]+/g;\nvar ATTRNAME = /[^\\r\\t\\n\\f \\/=>A-Z\\u0000]+/g;\n\nvar CDATATEXT = /[^\\]\\r\\u0000\\uffff]*/g;\nvar DATATEXT = /[^&<\\r\\u0000\\uffff]*/g;\nvar RAWTEXT = /[^<\\r\\u0000\\uffff]*/g;\nvar PLAINTEXT = /[^\\r\\u0000\\uffff]*/g;\n// Since we don't have the 'sticky tag', add '|.' to the end of SIMPLETAG\n// and SIMPLEATTR so that we are guaranteed to always match. This prevents\n// us from scanning past the lastIndex set. (Note that the desired matches\n// are always greater than 1 char long, so longest-match will ensure that .\n// is not matched unless the desired match fails.)\nvar SIMPLETAG = /(?:(\\/)?([a-z]+)>)|[\\s\\S]/g;\nvar SIMPLEATTR = /(?:([-a-z]+)[ \\t\\n\\f]*=[ \\t\\n\\f]*('[^'&\\r\\u0000]*'|\"[^\"&\\r\\u0000]*\"|[^\\t\\n\\r\\f \"&'\\u0000>][^&> \\t\\n\\r\\f\\u0000]*[ \\t\\n\\f]))|[\\s\\S]/g;\n\nvar NONWS = /[^\\x09\\x0A\\x0C\\x0D\\x20]/;\nvar ALLNONWS = /[^\\x09\\x0A\\x0C\\x0D\\x20]/g; // like above, with g flag\nvar NONWSNONNUL = /[^\\x00\\x09\\x0A\\x0C\\x0D\\x20]/; // don't allow NUL either\nvar LEADINGWS = /^[\\x09\\x0A\\x0C\\x0D\\x20]+/;\nvar NULCHARS = /\\x00/g;\n\n/***\n * These are utility functions that don't use any of the parser's\n * internal state.\n */\nfunction buf2str(buf) {\n var CHUNKSIZE=16384;\n if (buf.length < CHUNKSIZE) {\n return String.fromCharCode.apply(String, buf);\n }\n // special case for large strings, to avoid busting the stack.\n var result = '';\n for (var i = 0; i < buf.length; i += CHUNKSIZE) {\n result += String.fromCharCode.apply(String, buf.slice(i, i+CHUNKSIZE));\n }\n return result;\n}\n\nfunction str2buf(s) {\n var result = [];\n for (var i=0; i 0; i--) {\n var e = this.elements[i];\n if (isA(e, tag)) break;\n }\n this.elements.length = i;\n this.top = this.elements[i-1];\n};\n\n// Pop elements off the stack up to and including the first\n// element that is an instance of the specified type\nHTMLParser.ElementStack.prototype.popElementType = function(type) {\n for(var i = this.elements.length-1; i > 0; i--) {\n if (this.elements[i] instanceof type) break;\n }\n this.elements.length = i;\n this.top = this.elements[i-1];\n};\n\n// Pop elements off the stack up to and including the element e.\n// Note that this is very different from removeElement()\n// This requires that e is on the stack.\nHTMLParser.ElementStack.prototype.popElement = function(e) {\n for(var i = this.elements.length-1; i > 0; i--) {\n if (this.elements[i] === e) break;\n }\n this.elements.length = i;\n this.top = this.elements[i-1];\n};\n\n// Remove a specific element from the stack.\n// Do nothing if the element is not on the stack\nHTMLParser.ElementStack.prototype.removeElement = function(e) {\n if (this.top === e) this.pop();\n else {\n var idx = this.elements.lastIndexOf(e);\n if (idx !== -1)\n this.elements.splice(idx, 1);\n }\n};\n\nHTMLParser.ElementStack.prototype.clearToContext = function(set) {\n // Note that we don't loop to 0. Never pop the elt off.\n for(var i = this.elements.length-1; i > 0; i--) {\n if (isA(this.elements[i], set)) break;\n }\n this.elements.length = i+1;\n this.top = this.elements[i];\n};\n\nHTMLParser.ElementStack.prototype.contains = function(tag) {\n return this.inSpecificScope(tag, Object.create(null));\n};\n\nHTMLParser.ElementStack.prototype.inSpecificScope = function(tag, set) {\n for(var i = this.elements.length-1; i >= 0; i--) {\n var elt = this.elements[i];\n if (isA(elt, tag)) return true;\n if (isA(elt, set)) return false;\n }\n return false;\n};\n\n// Like the above, but for a specific element, not a tagname\nHTMLParser.ElementStack.prototype.elementInSpecificScope = function(target, set) {\n for(var i = this.elements.length-1; i >= 0; i--) {\n var elt = this.elements[i];\n if (elt === target) return true;\n if (isA(elt, set)) return false;\n }\n return false;\n};\n\n// Like the above, but for an element interface, not a tagname\nHTMLParser.ElementStack.prototype.elementTypeInSpecificScope = function(target, set) {\n for(var i = this.elements.length-1; i >= 0; i--) {\n var elt = this.elements[i];\n if (elt instanceof target) return true;\n if (isA(elt, set)) return false;\n }\n return false;\n};\n\nHTMLParser.ElementStack.prototype.inScope = function(tag) {\n return this.inSpecificScope(tag, inScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.elementInScope = function(e) {\n return this.elementInSpecificScope(e, inScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.elementTypeInScope = function(type) {\n return this.elementTypeInSpecificScope(type, inScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.inButtonScope = function(tag) {\n return this.inSpecificScope(tag, inButtonScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.inListItemScope = function(tag) {\n return this.inSpecificScope(tag, inListItemScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.inTableScope = function(tag) {\n return this.inSpecificScope(tag, inTableScopeSet);\n};\n\nHTMLParser.ElementStack.prototype.inSelectScope = function(tag) {\n // Can't implement this one with inSpecificScope, since it involves\n // a set defined by inverting another set. So implement manually.\n for(var i = this.elements.length-1; i >= 0; i--) {\n var elt = this.elements[i];\n if (elt.namespaceURI !== NAMESPACE.HTML) return false;\n var localname = elt.localName;\n if (localname === tag) return true;\n if (localname !== \"optgroup\" && localname !== \"option\")\n return false;\n }\n return false;\n};\n\nHTMLParser.ElementStack.prototype.generateImpliedEndTags = function(butnot, thorough) {\n var endTagSet = thorough ? thoroughImpliedEndTagsSet : impliedEndTagsSet;\n for(var i = this.elements.length-1; i >= 0; i--) {\n var e = this.elements[i];\n if (butnot && isA(e, butnot)) break;\n if (!isA(this.elements[i], endTagSet)) break;\n }\n\n this.elements.length = i+1;\n this.top = this.elements[i];\n};\n\n/***\n * The ActiveFormattingElements class\n */\nHTMLParser.ActiveFormattingElements = function AFE() {\n this.list = []; // elements\n this.attrs = []; // attribute tokens for cloning\n};\n\nHTMLParser.ActiveFormattingElements.prototype.MARKER = { localName: \"|\" };\n\n/*\n// For debugging\nHTMLParser.ActiveFormattingElements.prototype.toString = function() {\n return \"AFE: \" +\n this.list.map(function(e) { return e.localName; }).join(\"-\");\n}\n*/\n\nHTMLParser.ActiveFormattingElements.prototype.insertMarker = function() {\n this.list.push(this.MARKER);\n this.attrs.push(this.MARKER);\n};\n\nHTMLParser.ActiveFormattingElements.prototype.push = function(elt, attrs) {\n // Scan backwards: if there are already 3 copies of this element\n // before we encounter a marker, then drop the last one\n var count = 0;\n for(var i = this.list.length-1; i >= 0; i--) {\n if (this.list[i] === this.MARKER) break;\n // equal() is defined below\n if (equal(elt, this.list[i], this.attrs[i])) {\n count++;\n if (count === 3) {\n this.list.splice(i, 1);\n this.attrs.splice(i, 1);\n break;\n }\n }\n }\n\n\n // Now push the element onto the list\n this.list.push(elt);\n\n // Copy the attributes and push those on, too\n var attrcopy = [];\n for(var ii = 0; ii < attrs.length; ii++) {\n attrcopy[ii] = attrs[ii];\n }\n\n this.attrs.push(attrcopy);\n\n // This function defines equality of two elements for the purposes\n // of the AFE list. Note that it compares the new elements\n // attributes to the saved array of attributes associated with\n // the old element because a script could have changed the\n // old element's set of attributes\n function equal(newelt, oldelt, oldattrs) {\n if (newelt.localName !== oldelt.localName) return false;\n if (newelt._numattrs !== oldattrs.length) return false;\n for(var i = 0, n = oldattrs.length; i < n; i++) {\n var oldname = oldattrs[i][0];\n var oldval = oldattrs[i][1];\n if (!newelt.hasAttribute(oldname)) return false;\n if (newelt.getAttribute(oldname) !== oldval) return false;\n }\n return true;\n }\n};\n\nHTMLParser.ActiveFormattingElements.prototype.clearToMarker = function() {\n for(var i = this.list.length-1; i >= 0; i--) {\n if (this.list[i] === this.MARKER) break;\n }\n if (i < 0) i = 0;\n this.list.length = i;\n this.attrs.length = i;\n};\n\n// Find and return the last element with the specified tag between the\n// end of the list and the last marker on the list.\n// Used when parsing in_body_mode()\nHTMLParser.ActiveFormattingElements.prototype.findElementByTag = function(tag) {\n for(var i = this.list.length-1; i >= 0; i--) {\n var elt = this.list[i];\n if (elt === this.MARKER) break;\n if (elt.localName === tag) return elt;\n }\n return null;\n};\n\nHTMLParser.ActiveFormattingElements.prototype.indexOf = function(e) {\n return this.list.lastIndexOf(e);\n};\n\n// Find the element e in the list and remove it\n// Used when parsing in_body()\nHTMLParser.ActiveFormattingElements.prototype.remove = function(e) {\n var idx = this.list.lastIndexOf(e);\n if (idx !== -1) {\n this.list.splice(idx, 1);\n this.attrs.splice(idx, 1);\n }\n};\n\n// Find element a in the list and replace it with element b\n// XXX: Do I need to handle attributes here?\nHTMLParser.ActiveFormattingElements.prototype.replace = function(a, b, attrs) {\n var idx = this.list.lastIndexOf(a);\n if (idx !== -1) {\n this.list[idx] = b;\n this.attrs[idx] = attrs;\n }\n};\n\n// Find a in the list and insert b after it\n// This is only used for insert a bookmark object, so the\n// attrs array doesn't really matter\nHTMLParser.ActiveFormattingElements.prototype.insertAfter = function(a,b) {\n var idx = this.list.lastIndexOf(a);\n if (idx !== -1) {\n this.list.splice(idx, 0, b);\n this.attrs.splice(idx, 0, b);\n }\n};\n\n\n\n\n/***\n * This is the parser factory function. It is the return value of\n * the outer closure that it is defined within. Most of the parser\n * implementation details are inside this function.\n */\nfunction HTMLParser(address, fragmentContext, options) {\n /***\n * These are the parser's state variables\n */\n // Scanner state\n var chars = null;\n var numchars = 0; // Length of chars\n var nextchar = 0; // Index of next char\n var input_complete = false; // Becomes true when end() called.\n var scanner_skip_newline = false; // If previous char was CR\n var reentrant_invocations = 0;\n var saved_scanner_state = [];\n var leftovers = \"\";\n var first_batch = true;\n var paused = 0; // Becomes non-zero while loading scripts\n\n\n // Tokenizer state\n var tokenizer = data_state; // Current tokenizer state\n var return_state;\n var character_reference_code;\n var tagnamebuf = \"\";\n var lasttagname = \"\"; // holds the target end tag for text states\n var tempbuf = [];\n var attrnamebuf = \"\";\n var attrvaluebuf = \"\";\n var commentbuf = [];\n var doctypenamebuf = [];\n var doctypepublicbuf = [];\n var doctypesystembuf = [];\n var attributes = [];\n var is_end_tag = false;\n\n // Tree builder state\n var parser = initial_mode; // Current insertion mode\n var originalInsertionMode = null; // A saved insertion mode\n var templateInsertionModes = []; // Stack of template insertion modes.\n var stack = new HTMLParser.ElementStack(); // Stack of open elements\n var afe = new HTMLParser.ActiveFormattingElements(); // mis-nested tags\n var fragment = (fragmentContext!==undefined); // For innerHTML, etc.\n var head_element_pointer = null;\n var form_element_pointer = null;\n var scripting_enabled = true;\n if (fragmentContext) {\n\tscripting_enabled = fragmentContext.ownerDocument._scripting_enabled;\n }\n if (options && options.scripting_enabled === false)\n scripting_enabled = false;\n var frameset_ok = true;\n var force_quirks = false;\n var pending_table_text;\n var text_integration_mode; // XXX a spec bug workaround?\n\n // A single run of characters, buffered up to be sent to\n // the parser as a single string.\n var textrun = [];\n var textIncludesNUL = false;\n var ignore_linefeed = false;\n\n /***\n * This is the parser object that will be the return value of this\n * factory function, which is some 5000 lines below.\n * Note that the variable \"parser\" is the current state of the\n * parser's state machine. This variable \"htmlparser\" is the\n * return value and defines the public API of the parser\n */\n var htmlparser = {\n document: function() {\n return doc;\n },\n\n // Convenience function for internal use. Can only be called once,\n // as it removes the nodes from `doc` to add them to fragment.\n _asDocumentFragment: function() {\n var frag = doc.createDocumentFragment();\n var root = doc.firstChild;\n while(root.hasChildNodes()) {\n frag.appendChild(root.firstChild);\n }\n return frag;\n },\n\n // Internal function used from HTMLScriptElement to pause the\n // parser while a script is being loaded from the network\n pause: function() {\n // print(\"pausing parser\");\n paused++;\n },\n\n // Called when a script finishes loading\n resume: function() {\n // print(\"resuming parser\");\n paused--;\n // XXX: added this to force a resumption.\n // Is this the right thing to do?\n this.parse(\"\");\n },\n\n // Parse the HTML text s.\n // The second argument should be true if there is no more\n // text to be parsed, and should be false or omitted otherwise.\n // The second argument must not be set for recursive invocations\n // from document.write()\n parse: function(s, end, shouldPauseFunc) {\n var moreToDo;\n\n // If we're paused, remember the text to parse, but\n // don't parse it now.\n // (Don't invoke shouldPauseFunc because we haven't handled 'end' yet.)\n if (paused > 0) {\n leftovers += s;\n return true; // more to do\n }\n\n\n if (reentrant_invocations === 0) {\n // A normal, top-level invocation\n if (leftovers) {\n s = leftovers + s;\n leftovers = \"\";\n }\n\n // Add a special marker character to the end of\n // the buffer. If the scanner is at the end of\n // the buffer and input_complete is set, then this\n // character will transform into an EOF token.\n // Having an actual character that represents EOF\n // in the character buffer makes lookahead regexp\n // matching work more easily, and this is\n // important for character references.\n if (end) {\n s += \"\\uFFFF\";\n input_complete = true; // Makes scanChars() send EOF\n }\n\n chars = s;\n numchars = s.length;\n nextchar = 0;\n\n if (first_batch) {\n // We skip a leading Byte Order Mark (\\uFEFF)\n // on first batch of text we're given\n first_batch = false;\n if (chars.charCodeAt(0) === 0xFEFF) nextchar = 1;\n }\n\n reentrant_invocations++;\n moreToDo = scanChars(shouldPauseFunc);\n leftovers = chars.substring(nextchar, numchars);\n reentrant_invocations--;\n }\n else {\n // This is the re-entrant case, which we have to\n // handle a little differently.\n reentrant_invocations++;\n\n // Save current scanner state\n saved_scanner_state.push(chars, numchars, nextchar);\n\n // Set new scanner state\n chars = s;\n numchars = s.length;\n nextchar = 0;\n\n // Now scan as many of these new chars as we can\n scanChars();\n moreToDo = false;\n\n leftovers = chars.substring(nextchar, numchars);\n\n // restore old scanner state\n nextchar = saved_scanner_state.pop();\n numchars = saved_scanner_state.pop();\n chars = saved_scanner_state.pop();\n\n // If there were leftover chars from this invocation\n // insert them into the pending invocation's buffer\n // and trim already processed chars at the same time\n if (leftovers) {\n chars = leftovers + chars.substring(nextchar);\n numchars = chars.length;\n nextchar = 0;\n leftovers = \"\";\n }\n\n // Decrement the counter\n reentrant_invocations--;\n }\n return moreToDo;\n }\n };\n\n\n // This is the document we'll be building up\n var doc = new Document(true, address);\n\n // The document needs to know about the parser, for document.write().\n // This _parser property will be deleted when we're done parsing.\n doc._parser = htmlparser;\n\n // XXX I think that any document we use this parser on should support\n // scripts. But I may need to configure that through a parser parameter\n // Only documents with windows (\"browsing contexts\" to be precise)\n // allow scripting.\n doc._scripting_enabled = scripting_enabled;\n\n\n /***\n * The actual code of the HTMLParser() factory function begins here.\n */\n\n if (fragmentContext) { // for innerHTML parsing\n if (fragmentContext.ownerDocument._quirks)\n doc._quirks = true;\n if (fragmentContext.ownerDocument._limitedQuirks)\n doc._limitedQuirks = true;\n\n // Set the initial tokenizer state\n if (fragmentContext.namespaceURI === NAMESPACE.HTML) {\n switch(fragmentContext.localName) {\n case \"title\":\n case \"textarea\":\n tokenizer = rcdata_state;\n break;\n case \"style\":\n case \"xmp\":\n case \"iframe\":\n case \"noembed\":\n case \"noframes\":\n case \"script\":\n case \"plaintext\":\n tokenizer = plaintext_state;\n break;\n case \"noscript\":\n if (scripting_enabled)\n tokenizer = plaintext_state;\n }\n }\n\n var root = doc.createElement(\"html\");\n doc._appendChild(root);\n stack.push(root);\n if (fragmentContext instanceof impl.HTMLTemplateElement) {\n templateInsertionModes.push(in_template_mode);\n }\n resetInsertionMode();\n\n for(var e = fragmentContext; e !== null; e = e.parentElement) {\n if (e instanceof impl.HTMLFormElement) {\n form_element_pointer = e;\n break;\n }\n }\n }\n\n /***\n * Scanner functions\n */\n // Loop through the characters in chars, and pass them one at a time\n // to the tokenizer FSM. Return when no more characters can be processed\n // (This may leave 1 or more characters in the buffer: like a CR\n // waiting to see if the next char is LF, or for states that require\n // lookahead...)\n function scanChars(shouldPauseFunc) {\n var codepoint, s, pattern, eof;\n\n while(nextchar < numchars) {\n\n // If we just tokenized a tag, then the paused flag\n // may have been set to tell us to stop tokenizing while\n // the script is loading\n if (paused > 0 || (shouldPauseFunc && shouldPauseFunc())) {\n return true;\n }\n\n\n switch(typeof tokenizer.lookahead) {\n case 'undefined':\n codepoint = chars.charCodeAt(nextchar++);\n if (scanner_skip_newline) {\n scanner_skip_newline = false;\n if (codepoint === 0x000A) {\n nextchar++;\n continue;\n }\n }\n switch(codepoint) {\n case 0x000D:\n // CR always turns into LF, but if the next character\n // is LF, then that second LF is skipped.\n if (nextchar < numchars) {\n if (chars.charCodeAt(nextchar) === 0x000A)\n nextchar++;\n }\n else {\n // We don't know the next char right now, so we\n // can't check if it is a LF. So set a flag\n scanner_skip_newline = true;\n }\n\n // In either case, emit a LF\n tokenizer(0x000A);\n\n break;\n case 0xFFFF:\n if (input_complete && nextchar === numchars) {\n tokenizer(EOF); // codepoint will be 0xFFFF here\n break;\n }\n /* falls through */\n default:\n tokenizer(codepoint);\n break;\n }\n break;\n\n case 'number':\n codepoint = chars.charCodeAt(nextchar);\n\n // The only tokenizer states that require fixed lookahead\n // only consume alphanum characters, so we don't have\n // to worry about CR and LF in this case\n\n // tokenizer wants n chars of lookahead\n var n = tokenizer.lookahead;\n var needsString = true;\n if (n < 0) {\n needsString = false;\n n = -n;\n }\n\n if (n < numchars - nextchar) {\n // If we can look ahead that far\n s = needsString ? chars.substring(nextchar, nextchar+n) : null;\n eof = false;\n }\n else { // if we don't have that many characters\n if (input_complete) { // If no more are coming\n // Just return what we have\n s = needsString ? chars.substring(nextchar, numchars) : null;\n eof = true;\n if (codepoint === 0xFFFF && nextchar === numchars-1)\n codepoint = EOF;\n }\n else {\n // Return now and wait for more chars later\n return true;\n }\n }\n tokenizer(codepoint, s, eof);\n break;\n case 'string':\n codepoint = chars.charCodeAt(nextchar);\n\n // tokenizer wants characters up to a matching string\n pattern = tokenizer.lookahead;\n var pos = chars.indexOf(pattern, nextchar);\n if (pos !== -1) {\n s = chars.substring(nextchar, pos + pattern.length);\n eof = false;\n }\n else { // No match\n // If more characters coming, wait for them\n if (!input_complete) return true;\n\n // Otherwise, we've got to return what we've got\n s = chars.substring(nextchar, numchars);\n if (codepoint === 0xFFFF && nextchar === numchars-1)\n codepoint = EOF;\n eof = true;\n }\n\n // The tokenizer states that require this kind of\n // lookahead have to be careful to handle CR characters\n // correctly\n tokenizer(codepoint, s, eof);\n break;\n }\n }\n return false; // no more characters to scan!\n }\n\n\n /***\n * Tokenizer utility functions\n */\n function addAttribute(name,value) {\n // Make sure there isn't already an attribute with this name\n // If there is, ignore this one.\n for(var i = 0; i < attributes.length; i++) {\n if (attributes[i][0] === name) return;\n }\n\n if (value !== undefined) {\n attributes.push([name, value]);\n }\n else {\n attributes.push([name]);\n }\n }\n\n // Shortcut for simple attributes\n function handleSimpleAttribute() {\n SIMPLEATTR.lastIndex = nextchar-1;\n var matched = SIMPLEATTR.exec(chars);\n if (!matched) throw new Error(\"should never happen\");\n var name = matched[1];\n if (!name) return false;\n var value = matched[2];\n var len = value.length;\n switch(value[0]) {\n case '\"':\n case \"'\":\n value = value.substring(1, len-1);\n nextchar += (matched[0].length-1);\n tokenizer = after_attribute_value_quoted_state;\n break;\n default:\n tokenizer = before_attribute_name_state;\n nextchar += (matched[0].length-1);\n value = value.substring(0, len-1);\n break;\n }\n\n // Make sure there isn't already an attribute with this name\n // If there is, ignore this one.\n for(var i = 0; i < attributes.length; i++) {\n if (attributes[i][0] === name) return true;\n }\n\n attributes.push([name, value]);\n return true;\n }\n\n function beginTagName() {\n is_end_tag = false;\n tagnamebuf = \"\";\n attributes.length = 0;\n }\n function beginEndTagName() {\n is_end_tag = true;\n tagnamebuf = \"\";\n attributes.length = 0;\n }\n\n function beginTempBuf() { tempbuf.length = 0; }\n function beginAttrName() { attrnamebuf = \"\"; }\n function beginAttrValue() { attrvaluebuf = \"\"; }\n function beginComment() { commentbuf.length = 0; }\n function beginDoctype() {\n doctypenamebuf.length = 0;\n doctypepublicbuf = null;\n doctypesystembuf = null;\n }\n function beginDoctypePublicId() { doctypepublicbuf = []; }\n function beginDoctypeSystemId() { doctypesystembuf = []; }\n function forcequirks() { force_quirks = true; }\n function cdataAllowed() {\n return stack.top &&\n stack.top.namespaceURI !== \"http://www.w3.org/1999/xhtml\";\n }\n\n // Return true if the codepoints in the specified buffer match the\n // characters of lasttagname\n function appropriateEndTag(buf) {\n return lasttagname === buf;\n }\n\n function flushText() {\n if (textrun.length > 0) {\n var s = buf2str(textrun);\n textrun.length = 0;\n\n if (ignore_linefeed) {\n ignore_linefeed = false;\n if (s[0] === \"\\n\") s = s.substring(1);\n if (s.length === 0) return;\n }\n\n insertToken(TEXT, s);\n textIncludesNUL = false;\n }\n ignore_linefeed = false;\n }\n\n // Consume chars matched by the pattern and return them as a string. Starts\n // matching at the current position, so users should drop the current char\n // otherwise.\n function getMatchingChars(pattern) {\n pattern.lastIndex = nextchar - 1;\n var match = pattern.exec(chars);\n if (match && match.index === nextchar - 1) {\n match = match[0];\n nextchar += match.length - 1;\n /* Careful! Make sure we haven't matched the EOF character! */\n if (input_complete && nextchar === numchars) {\n // Oops, backup one.\n match = match.slice(0, -1);\n nextchar--;\n }\n return match;\n } else {\n throw new Error(\"should never happen\");\n }\n }\n\n // emit a string of chars that match a regexp\n // Returns false if no chars matched.\n function emitCharsWhile(pattern) {\n pattern.lastIndex = nextchar-1;\n var match = pattern.exec(chars)[0];\n if (!match) return false;\n emitCharString(match);\n nextchar += match.length - 1;\n return true;\n }\n\n // This is used by CDATA sections\n function emitCharString(s) {\n if (textrun.length > 0) flushText();\n\n if (ignore_linefeed) {\n ignore_linefeed = false;\n if (s[0] === \"\\n\") s = s.substring(1);\n if (s.length === 0) return;\n }\n\n insertToken(TEXT, s);\n }\n\n function emitTag() {\n if (is_end_tag) insertToken(ENDTAG, tagnamebuf);\n else {\n // Remember the last open tag we emitted\n var tagname = tagnamebuf;\n tagnamebuf = \"\";\n lasttagname = tagname;\n insertToken(TAG, tagname, attributes);\n }\n }\n\n\n // A shortcut: look ahead and if this is a open or close tag\n // in lowercase with no spaces and no attributes, just emit it now.\n function emitSimpleTag() {\n if (nextchar === numchars) { return false; /* not even 1 char left */ }\n SIMPLETAG.lastIndex = nextchar;\n var matched = SIMPLETAG.exec(chars);\n if (!matched) throw new Error(\"should never happen\");\n var tagname = matched[2];\n if (!tagname) return false;\n var endtag = matched[1];\n if (endtag) {\n nextchar += (tagname.length+2);\n insertToken(ENDTAG, tagname);\n }\n else {\n nextchar += (tagname.length+1);\n lasttagname = tagname;\n insertToken(TAG, tagname, NOATTRS);\n }\n return true;\n }\n\n function emitSelfClosingTag() {\n if (is_end_tag) insertToken(ENDTAG, tagnamebuf, null, true);\n else {\n insertToken(TAG, tagnamebuf, attributes, true);\n }\n }\n\n function emitDoctype() {\n insertToken(DOCTYPE,\n buf2str(doctypenamebuf),\n doctypepublicbuf ? buf2str(doctypepublicbuf) : undefined,\n doctypesystembuf ? buf2str(doctypesystembuf) : undefined);\n }\n\n function emitEOF() {\n flushText();\n parser(EOF); // EOF never goes to insertForeignContent()\n doc.modclock = 1; // Start tracking modifications\n }\n\n // Insert a token, either using the current parser insertion mode\n // (for HTML stuff) or using the insertForeignToken() method.\n var insertToken = htmlparser.insertToken = function insertToken(t, value, arg3, arg4) {\n flushText();\n var current = stack.top;\n\n if (!current || current.namespaceURI === NAMESPACE.HTML) {\n // This is the common case\n parser(t, value, arg3, arg4);\n }\n else {\n // Otherwise we may need to insert this token as foreign content\n if (t !== TAG && t !== TEXT) {\n insertForeignToken(t, value, arg3, arg4);\n }\n else {\n // But in some cases we treat it as regular content\n if ((isMathmlTextIntegrationPoint(current) &&\n (t === TEXT ||\n (t === TAG &&\n value !== \"mglyph\" && value !== \"malignmark\"))) ||\n (t === TAG &&\n value === \"svg\" &&\n current.namespaceURI === NAMESPACE.MATHML &&\n current.localName === \"annotation-xml\") ||\n isHTMLIntegrationPoint(current)) {\n\n // XXX: the text_integration_mode stuff is an\n // attempted bug workaround of mine\n text_integration_mode = true;\n parser(t, value, arg3, arg4);\n text_integration_mode = false;\n }\n // Otherwise it is foreign content\n else {\n insertForeignToken(t, value, arg3, arg4);\n }\n }\n }\n };\n\n\n /***\n * Tree building utility functions\n */\n function insertComment(data) {\n var parent = stack.top;\n if (foster_parent_mode && isA(parent, tablesectionrowSet)) {\n fosterParent(function(doc) { return doc.createComment(data); });\n } else {\n // \"If the adjusted insertion location is inside a template element,\n // let it instead be inside the template element's template contents\"\n if (parent instanceof impl.HTMLTemplateElement) {\n parent = parent.content;\n }\n parent._appendChild(parent.ownerDocument.createComment(data));\n }\n }\n\n function insertText(s) {\n var parent = stack.top;\n if (foster_parent_mode && isA(parent, tablesectionrowSet)) {\n fosterParent(function(doc) { return doc.createTextNode(s); });\n } else {\n // \"If the adjusted insertion location is inside a template element,\n // let it instead be inside the template element's template contents\"\n if (parent instanceof impl.HTMLTemplateElement) {\n parent = parent.content;\n }\n // \"If there is a Text node immediately before the adjusted insertion\n // location, then append data to that Text node's data.\"\n var lastChild = parent.lastChild;\n if (lastChild && lastChild.nodeType === Node.TEXT_NODE) {\n lastChild.appendData(s);\n } else {\n parent._appendChild(parent.ownerDocument.createTextNode(s));\n }\n }\n }\n\n function createHTMLElt(doc, name, attrs) {\n // Create the element this way, rather than with\n // doc.createElement because createElement() does error\n // checking on the element name that we need to avoid here.\n var elt = html.createElement(doc, name, null);\n\n if (attrs) {\n for(var i = 0, n = attrs.length; i < n; i++) {\n // Use the _ version to avoid testing the validity\n // of the attribute name\n elt._setAttribute(attrs[i][0], attrs[i][1]);\n }\n }\n // XXX\n // If the element is a resettable form element,\n // run its reset algorithm now\n // XXX\n // handle case where form-element-pointer is not null\n return elt;\n }\n\n // The in_table insertion mode turns on this flag, and that makes\n // insertHTMLElement use the foster parenting algorithm for elements\n // tags inside a table\n var foster_parent_mode = false;\n\n function insertHTMLElement(name, attrs) {\n var elt = insertElement(function(doc) {\n return createHTMLElt(doc, name, attrs);\n });\n\n // XXX\n // If this is a form element, set its form attribute property here\n if (isA(elt, formassociatedSet)) {\n elt._form = form_element_pointer;\n }\n\n return elt;\n }\n\n // Insert the element into the open element or foster parent it\n function insertElement(eltFunc) {\n var elt;\n if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) {\n elt = fosterParent(eltFunc);\n }\n else if (stack.top instanceof impl.HTMLTemplateElement) {\n // \"If the adjusted insertion location is inside a template element,\n // let it instead be inside the template element's template contents\"\n elt = eltFunc(stack.top.content.ownerDocument);\n stack.top.content._appendChild(elt);\n } else {\n elt = eltFunc(stack.top.ownerDocument);\n stack.top._appendChild(elt);\n }\n\n stack.push(elt);\n return elt;\n }\n\n function insertForeignElement(name, attrs, ns) {\n return insertElement(function(doc) {\n // We need to prevent createElementNS from trying to parse `name` as a\n // `qname`, so use an internal Document#_createElementNS() interface.\n var elt = doc._createElementNS(name, ns, null);\n if (attrs) {\n for(var i = 0, n = attrs.length; i < n; i++) {\n var attr = attrs[i];\n if (attr.length === 2)\n elt._setAttribute(attr[0], attr[1]);\n else {\n elt._setAttributeNS(attr[2], attr[0], attr[1]);\n }\n }\n }\n return elt;\n });\n }\n\n function lastElementOfType(type) {\n for(var i = stack.elements.length-1; i >= 0; i--) {\n if (stack.elements[i] instanceof type) {\n return i;\n }\n }\n return -1;\n }\n\n function fosterParent(eltFunc) {\n var parent, before, lastTable = -1, lastTemplate = -1, elt;\n\n lastTable = lastElementOfType(impl.HTMLTableElement);\n lastTemplate = lastElementOfType(impl.HTMLTemplateElement);\n\n if (lastTemplate >= 0 && (lastTable < 0 || lastTemplate > lastTable)) {\n parent = stack.elements[lastTemplate];\n } else if (lastTable >= 0) {\n parent = stack.elements[lastTable].parentNode;\n if (parent) {\n before = stack.elements[lastTable];\n } else {\n parent = stack.elements[lastTable - 1];\n }\n }\n if (!parent) parent = stack.elements[0]; // the `html` element.\n\n // \"If the adjusted insertion location is inside a template element,\n // let it instead be inside the template element's template contents\"\n if (parent instanceof impl.HTMLTemplateElement) {\n parent = parent.content;\n }\n // Create element in the appropriate document.\n elt = eltFunc(parent.ownerDocument);\n\n if (elt.nodeType === Node.TEXT_NODE) {\n var prev;\n if (before) prev = before.previousSibling;\n else prev = parent.lastChild;\n if (prev && prev.nodeType === Node.TEXT_NODE) {\n prev.appendData(elt.data);\n return elt;\n }\n }\n if (before)\n parent.insertBefore(elt, before);\n else\n parent._appendChild(elt);\n return elt;\n }\n\n\n function resetInsertionMode() {\n var last = false;\n for(var i = stack.elements.length-1; i >= 0; i--) {\n var node = stack.elements[i];\n if (i === 0) {\n last = true;\n if (fragment) {\n node = fragmentContext;\n }\n }\n if (node.namespaceURI === NAMESPACE.HTML) {\n var tag = node.localName;\n switch(tag) {\n case \"select\":\n for(var j = i; j > 0; ) {\n var ancestor = stack.elements[--j];\n if (ancestor instanceof impl.HTMLTemplateElement) {\n break;\n } else if (ancestor instanceof impl.HTMLTableElement) {\n parser = in_select_in_table_mode;\n return;\n }\n }\n parser = in_select_mode;\n return;\n case \"tr\":\n parser = in_row_mode;\n return;\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n parser = in_table_body_mode;\n return;\n case \"caption\":\n parser = in_caption_mode;\n return;\n case \"colgroup\":\n parser = in_column_group_mode;\n return;\n case \"table\":\n parser = in_table_mode;\n return;\n case \"template\":\n parser = templateInsertionModes[templateInsertionModes.length-1];\n return;\n case \"body\":\n parser = in_body_mode;\n return;\n case \"frameset\":\n parser = in_frameset_mode;\n return;\n case \"html\":\n if (head_element_pointer === null) {\n parser = before_head_mode;\n } else {\n parser = after_head_mode;\n }\n return;\n default:\n if (!last) {\n if (tag === \"head\") {\n parser = in_head_mode;\n return;\n }\n if (tag === \"td\" || tag === \"th\") {\n parser = in_cell_mode;\n return;\n }\n }\n }\n }\n if (last) {\n parser = in_body_mode;\n return;\n }\n }\n }\n\n\n function parseRawText(name, attrs) {\n insertHTMLElement(name, attrs);\n tokenizer = rawtext_state;\n originalInsertionMode = parser;\n parser = text_mode;\n }\n\n function parseRCDATA(name, attrs) {\n insertHTMLElement(name, attrs);\n tokenizer = rcdata_state;\n originalInsertionMode = parser;\n parser = text_mode;\n }\n\n // Make a copy of element i on the list of active formatting\n // elements, using its original attributes, not current\n // attributes (which may have been modified by a script)\n function afeclone(doc, i) {\n return {\n elt: createHTMLElt(doc, afe.list[i].localName, afe.attrs[i]),\n attrs: afe.attrs[i],\n };\n }\n\n\n function afereconstruct() {\n if (afe.list.length === 0) return;\n var entry = afe.list[afe.list.length-1];\n // If the last is a marker , do nothing\n if (entry === afe.MARKER) return;\n // Or if it is an open element, do nothing\n if (stack.elements.lastIndexOf(entry) !== -1) return;\n\n // Loop backward through the list until we find a marker or an\n // open element, and then move forward one from there.\n for(var i = afe.list.length-2; i >= 0; i--) {\n entry = afe.list[i];\n if (entry === afe.MARKER) break;\n if (stack.elements.lastIndexOf(entry) !== -1) break;\n }\n\n // Now loop forward, starting from the element after the current\n // one, recreating formatting elements and pushing them back onto\n // the list of open elements\n for(i = i+1; i < afe.list.length; i++) {\n var newelt = insertElement(function(doc) { return afeclone(doc, i).elt; });\n afe.list[i] = newelt;\n }\n }\n\n // Used by the adoptionAgency() function\n var BOOKMARK = {localName:\"BM\"};\n\n function adoptionAgency(tag) {\n // If the current node is an HTML element whose tag name is subject,\n // and the current node is not in the list of active formatting\n // elements, then pop the current node off the stack of open\n // elements and abort these steps.\n if (isA(stack.top, tag) && afe.indexOf(stack.top) === -1) {\n stack.pop();\n return true; // no more handling required\n }\n\n // Let outer loop counter be zero.\n var outer = 0;\n\n // Outer loop: If outer loop counter is greater than or\n // equal to eight, then abort these steps.\n while(outer < 8) {\n // Increment outer loop counter by one.\n outer++;\n\n // Let the formatting element be the last element in the list\n // of active formatting elements that: is between the end of\n // the list and the last scope marker in the list, if any, or\n // the start of the list otherwise, and has the same tag name\n // as the token.\n var fmtelt = afe.findElementByTag(tag);\n\n // If there is no such node, then abort these steps and instead\n // act as described in the \"any other end tag\" entry below.\n if (!fmtelt) {\n return false; // false means handle by the default case\n }\n\n // Otherwise, if there is such a node, but that node is not in\n // the stack of open elements, then this is a parse error;\n // remove the element from the list, and abort these steps.\n var index = stack.elements.lastIndexOf(fmtelt);\n if (index === -1) {\n afe.remove(fmtelt);\n return true; // true means no more handling required\n }\n\n // Otherwise, if there is such a node, and that node is also in\n // the stack of open elements, but the element is not in scope,\n // then this is a parse error; ignore the token, and abort\n // these steps.\n if (!stack.elementInScope(fmtelt)) {\n return true;\n }\n\n // Let the furthest block be the topmost node in the stack of\n // open elements that is lower in the stack than the formatting\n // element, and is an element in the special category. There\n // might not be one.\n var furthestblock = null, furthestblockindex;\n for(var i = index+1; i < stack.elements.length; i++) {\n if (isA(stack.elements[i], specialSet)) {\n furthestblock = stack.elements[i];\n furthestblockindex = i;\n break;\n }\n }\n\n // If there is no furthest block, then the UA must skip the\n // subsequent steps and instead just pop all the nodes from the\n // bottom of the stack of open elements, from the current node\n // up to and including the formatting element, and remove the\n // formatting element from the list of active formatting\n // elements.\n if (!furthestblock) {\n stack.popElement(fmtelt);\n afe.remove(fmtelt);\n return true;\n }\n else {\n // Let the common ancestor be the element immediately above\n // the formatting element in the stack of open elements.\n var ancestor = stack.elements[index-1];\n\n // Let a bookmark note the position of the formatting\n // element in the list of active formatting elements\n // relative to the elements on either side of it in the\n // list.\n afe.insertAfter(fmtelt, BOOKMARK);\n\n // Let node and last node be the furthest block.\n var node = furthestblock;\n var lastnode = furthestblock;\n var nodeindex = furthestblockindex;\n var nodeafeindex;\n\n // Let inner loop counter be zero.\n var inner = 0;\n\n while (true) {\n\n // Increment inner loop counter by one.\n inner++;\n\n // Let node be the element immediately above node in\n // the stack of open elements, or if node is no longer\n // in the stack of open elements (e.g. because it got\n // removed by this algorithm), the element that was\n // immediately above node in the stack of open elements\n // before node was removed.\n node = stack.elements[--nodeindex];\n\n // If node is the formatting element, then go\n // to the next step in the overall algorithm.\n if (node === fmtelt) break;\n\n // If the inner loop counter is greater than three and node\n // is in the list of active formatting elements, then remove\n // node from the list of active formatting elements.\n nodeafeindex = afe.indexOf(node);\n if (inner > 3 && nodeafeindex !== -1) {\n afe.remove(node);\n nodeafeindex = -1;\n }\n\n // If node is not in the list of active formatting\n // elements, then remove node from the stack of open\n // elements and then go back to the step labeled inner\n // loop.\n if (nodeafeindex === -1) {\n stack.removeElement(node);\n continue;\n }\n\n // Create an element for the token for which the\n // element node was created with common ancestor as\n // the intended parent, replace the entry for node\n // in the list of active formatting elements with an\n // entry for the new element, replace the entry for\n // node in the stack of open elements with an entry for\n // the new element, and let node be the new element.\n var newelt = afeclone(ancestor.ownerDocument, nodeafeindex);\n afe.replace(node, newelt.elt, newelt.attrs);\n stack.elements[nodeindex] = newelt.elt;\n node = newelt.elt;\n\n // If last node is the furthest block, then move the\n // aforementioned bookmark to be immediately after the\n // new node in the list of active formatting elements.\n if (lastnode === furthestblock) {\n afe.remove(BOOKMARK);\n afe.insertAfter(newelt.elt, BOOKMARK);\n }\n\n // Insert last node into node, first removing it from\n // its previous parent node if any.\n node._appendChild(lastnode);\n\n // Let last node be node.\n lastnode = node;\n }\n\n // If the common ancestor node is a table, tbody, tfoot,\n // thead, or tr element, then, foster parent whatever last\n // node ended up being in the previous step, first removing\n // it from its previous parent node if any.\n if (foster_parent_mode && isA(ancestor, tablesectionrowSet)) {\n fosterParent(function() { return lastnode; });\n }\n // Otherwise, append whatever last node ended up being in\n // the previous step to the common ancestor node, first\n // removing it from its previous parent node if any.\n else if (ancestor instanceof impl.HTMLTemplateElement) {\n ancestor.content._appendChild(lastnode);\n } else {\n ancestor._appendChild(lastnode);\n }\n\n // Create an element for the token for which the\n // formatting element was created, with furthest block\n // as the intended parent.\n var newelt2 = afeclone(furthestblock.ownerDocument, afe.indexOf(fmtelt));\n\n // Take all of the child nodes of the furthest block and\n // append them to the element created in the last step.\n while(furthestblock.hasChildNodes()) {\n newelt2.elt._appendChild(furthestblock.firstChild);\n }\n\n // Append that new element to the furthest block.\n furthestblock._appendChild(newelt2.elt);\n\n // Remove the formatting element from the list of active\n // formatting elements, and insert the new element into the\n // list of active formatting elements at the position of\n // the aforementioned bookmark.\n afe.remove(fmtelt);\n afe.replace(BOOKMARK, newelt2.elt, newelt2.attrs);\n\n // Remove the formatting element from the stack of open\n // elements, and insert the new element into the stack of\n // open elements immediately below the position of the\n // furthest block in that stack.\n stack.removeElement(fmtelt);\n var pos = stack.elements.lastIndexOf(furthestblock);\n stack.elements.splice(pos+1, 0, newelt2.elt);\n }\n }\n\n return true;\n }\n\n // We do this when we get /script in in_text_mode\n function handleScriptEnd() {\n // XXX:\n // This is just a stub implementation right now and doesn't run scripts.\n // Getting this method right involves the event loop, URL resolution\n // script fetching etc. For now I just want to be able to parse\n // documents and test the parser.\n\n //var script = stack.top;\n stack.pop();\n parser = originalInsertionMode;\n //script._prepare();\n return;\n\n // XXX: here is what this method is supposed to do\n\n // Provide a stable state.\n\n // Let script be the current node (which will be a script\n // element).\n\n // Pop the current node off the stack of open elements.\n\n // Switch the insertion mode to the original insertion mode.\n\n // Let the old insertion point have the same value as the current\n // insertion point. Let the insertion point be just before the\n // next input character.\n\n // Increment the parser's script nesting level by one.\n\n // Prepare the script. This might cause some script to execute,\n // which might cause new characters to be inserted into the\n // tokenizer, and might cause the tokenizer to output more tokens,\n // resulting in a reentrant invocation of the parser.\n\n // Decrement the parser's script nesting level by one. If the\n // parser's script nesting level is zero, then set the parser\n // pause flag to false.\n\n // Let the insertion point have the value of the old insertion\n // point. (In other words, restore the insertion point to its\n // previous value. This value might be the \"undefined\" value.)\n\n // At this stage, if there is a pending parsing-blocking script,\n // then:\n\n // If the script nesting level is not zero:\n\n // Set the parser pause flag to true, and abort the processing\n // of any nested invocations of the tokenizer, yielding\n // control back to the caller. (Tokenization will resume when\n // the caller returns to the \"outer\" tree construction stage.)\n\n // The tree construction stage of this particular parser is\n // being called reentrantly, say from a call to\n // document.write().\n\n // Otherwise:\n\n // Run these steps:\n\n // Let the script be the pending parsing-blocking\n // script. There is no longer a pending\n // parsing-blocking script.\n\n // Block the tokenizer for this instance of the HTML\n // parser, such that the event loop will not run tasks\n // that invoke the tokenizer.\n\n // If the parser's Document has a style sheet that is\n // blocking scripts or the script's \"ready to be\n // parser-executed\" flag is not set: spin the event\n // loop until the parser's Document has no style sheet\n // that is blocking scripts and the script's \"ready to\n // be parser-executed\" flag is set.\n\n // Unblock the tokenizer for this instance of the HTML\n // parser, such that tasks that invoke the tokenizer\n // can again be run.\n\n // Let the insertion point be just before the next\n // input character.\n\n // Increment the parser's script nesting level by one\n // (it should be zero before this step, so this sets\n // it to one).\n\n // Execute the script.\n\n // Decrement the parser's script nesting level by\n // one. If the parser's script nesting level is zero\n // (which it always should be at this point), then set\n // the parser pause flag to false.\n\n // Let the insertion point be undefined again.\n\n // If there is once again a pending parsing-blocking\n // script, then repeat these steps from step 1.\n\n\n }\n\n function stopParsing() {\n // XXX This is just a temporary implementation to get the parser working.\n // A full implementation involves scripts and events and the event loop.\n\n // Remove the link from document to parser.\n // This is instead of \"set the insertion point to undefined\".\n // It means that document.write() can't write into the doc anymore.\n delete doc._parser;\n\n stack.elements.length = 0; // pop everything off\n\n // If there is a window object associated with the document\n // then trigger an load event on it\n if (doc.defaultView) {\n doc.defaultView.dispatchEvent(new impl.Event(\"load\",{}));\n }\n\n }\n\n /****\n * Tokenizer states\n */\n\n /**\n * This file was partially mechanically generated from\n * http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html\n *\n * After mechanical conversion, it was further converted from\n * prose to JS by hand, but the intent is that it is a very\n * faithful rendering of the HTML tokenization spec in\n * JavaScript.\n *\n * It is not a goal of this tokenizer to detect or report\n * parse errors.\n *\n * XXX The tokenizer is supposed to work with straight UTF32\n * codepoints. But I don't think it has any dependencies on\n * any character outside of the BMP so I think it is safe to\n * pass it UTF16 characters. I don't think it will ever change\n * state in the middle of a surrogate pair.\n */\n\n /*\n * Each state is represented by a function. For most states, the\n * scanner simply passes the next character (as an integer\n * codepoint) to the current state function and automatically\n * consumes the character. If the state function can't process\n * the character it can call pushback() to push it back to the\n * scanner.\n *\n * Some states require lookahead, though. If a state function has\n * a lookahead property, then it is invoked differently. In this\n * case, the scanner invokes the function with 3 arguments: 1) the\n * next codepoint 2) a string of lookahead text 3) a boolean that\n * is true if the lookahead goes all the way to the EOF. (XXX\n * actually maybe this third is not necessary... the lookahead\n * could just include \\uFFFF?)\n *\n * If the lookahead property of a state function is an integer, it\n * specifies the number of characters required. If it is a string,\n * then the scanner will scan for that string and return all\n * characters up to and including that sequence, or up to EOF. If\n * the lookahead property is a regexp, then the scanner will match\n * the regexp at the current point and return the matching string.\n *\n * States that require lookahead are responsible for explicitly\n * consuming the characters they process. They do this by\n * incrementing nextchar by the number of processed characters.\n */\n function reconsume(c, new_state) {\n tokenizer = new_state;\n nextchar--; // pushback\n }\n\n function data_state(c) {\n switch(c) {\n case 0x0026: // AMPERSAND\n return_state = data_state;\n tokenizer = character_reference_state;\n break;\n case 0x003C: // LESS-THAN SIGN\n if (emitSimpleTag()) // Shortcut for

,

, etc.\n break;\n tokenizer = tag_open_state;\n break;\n case 0x0000: // NULL\n // Usually null characters emitted by the tokenizer will be\n // ignored by the tree builder, but sometimes they'll be\n // converted to \\uFFFD. I don't want to have the search every\n // string emitted to replace NULs, so I'll set a flag\n // if I've emitted a NUL.\n textrun.push(c);\n textIncludesNUL = true;\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n // Instead of just pushing a single character and then\n // coming back to the very same place, lookahead and\n // emit everything we can at once.\n /*jshint -W030 */\n emitCharsWhile(DATATEXT) || textrun.push(c);\n break;\n }\n }\n\n function rcdata_state(c) {\n // Save the open tag so we can find a matching close tag\n switch(c) {\n case 0x0026: // AMPERSAND\n return_state = rcdata_state;\n tokenizer = character_reference_state;\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = rcdata_less_than_sign_state;\n break;\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n textIncludesNUL = true;\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n textrun.push(c);\n break;\n }\n }\n\n function rawtext_state(c) {\n switch(c) {\n case 0x003C: // LESS-THAN SIGN\n tokenizer = rawtext_less_than_sign_state;\n break;\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n /*jshint -W030 */\n emitCharsWhile(RAWTEXT) || textrun.push(c);\n break;\n }\n }\n\n function script_data_state(c) {\n switch(c) {\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_less_than_sign_state;\n break;\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n /*jshint -W030 */\n emitCharsWhile(RAWTEXT) || textrun.push(c);\n break;\n }\n }\n\n function plaintext_state(c) {\n switch(c) {\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n /*jshint -W030 */\n emitCharsWhile(PLAINTEXT) || textrun.push(c);\n break;\n }\n }\n\n function tag_open_state(c) {\n switch(c) {\n case 0x0021: // EXCLAMATION MARK\n tokenizer = markup_declaration_open_state;\n break;\n case 0x002F: // SOLIDUS\n tokenizer = end_tag_open_state;\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginTagName();\n reconsume(c, tag_name_state);\n break;\n case 0x003F: // QUESTION MARK\n reconsume(c, bogus_comment_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, data_state);\n break;\n }\n }\n\n function end_tag_open_state(c) {\n switch(c) {\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginEndTagName();\n reconsume(c, tag_name_state);\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n break;\n case -1: // EOF\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n emitEOF();\n break;\n default:\n reconsume(c, bogus_comment_state);\n break;\n }\n }\n\n function tag_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = before_attribute_name_state;\n break;\n case 0x002F: // SOLIDUS\n tokenizer = self_closing_start_tag_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitTag();\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n tagnamebuf += String.fromCharCode(c + 0x0020);\n break;\n case 0x0000: // NULL\n tagnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n tagnamebuf += getMatchingChars(TAGNAME);\n break;\n }\n }\n\n function rcdata_less_than_sign_state(c) {\n /* identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g */\n if (c === 0x002F) { // SOLIDUS\n beginTempBuf();\n tokenizer = rcdata_end_tag_open_state;\n }\n else {\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, rcdata_state);\n }\n }\n\n function rcdata_end_tag_open_state(c) {\n /* identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g */\n switch(c) {\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginEndTagName();\n reconsume(c, rcdata_end_tag_name_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n reconsume(c, rcdata_state);\n break;\n }\n }\n\n function rcdata_end_tag_name_state(c) {\n /* identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g */\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = before_attribute_name_state;\n return;\n }\n break;\n case 0x002F: // SOLIDUS\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = self_closing_start_tag_state;\n return;\n }\n break;\n case 0x003E: // GREATER-THAN SIGN\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = data_state;\n emitTag();\n return;\n }\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n\n tagnamebuf += String.fromCharCode(c + 0x0020);\n tempbuf.push(c);\n return;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n\n tagnamebuf += String.fromCharCode(c);\n tempbuf.push(c);\n return;\n default:\n break;\n }\n\n // If we don't return in one of the cases above, then this was not\n // an appropriately matching close tag, so back out by emitting all\n // the characters as text\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n pushAll(textrun, tempbuf);\n reconsume(c, rcdata_state);\n }\n\n function rawtext_less_than_sign_state(c) {\n /* identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g\n */\n if (c === 0x002F) { // SOLIDUS\n beginTempBuf();\n tokenizer = rawtext_end_tag_open_state;\n }\n else {\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, rawtext_state);\n }\n }\n\n function rawtext_end_tag_open_state(c) {\n /* identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g */\n switch(c) {\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginEndTagName();\n reconsume(c, rawtext_end_tag_name_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n reconsume(c, rawtext_state);\n break;\n }\n }\n\n function rawtext_end_tag_name_state(c) {\n /* identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g */\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = before_attribute_name_state;\n return;\n }\n break;\n case 0x002F: // SOLIDUS\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = self_closing_start_tag_state;\n return;\n }\n break;\n case 0x003E: // GREATER-THAN SIGN\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = data_state;\n emitTag();\n return;\n }\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n tagnamebuf += String.fromCharCode(c + 0x0020);\n tempbuf.push(c);\n return;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n tagnamebuf += String.fromCharCode(c);\n tempbuf.push(c);\n return;\n default:\n break;\n }\n\n // If we don't return in one of the cases above, then this was not\n // an appropriately matching close tag, so back out by emitting all\n // the characters as text\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n pushAll(textrun,tempbuf);\n reconsume(c, rawtext_state);\n }\n\n function script_data_less_than_sign_state(c) {\n switch(c) {\n case 0x002F: // SOLIDUS\n beginTempBuf();\n tokenizer = script_data_end_tag_open_state;\n break;\n case 0x0021: // EXCLAMATION MARK\n tokenizer = script_data_escape_start_state;\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x0021); // EXCLAMATION MARK\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, script_data_state);\n break;\n }\n }\n\n function script_data_end_tag_open_state(c) {\n /* identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g */\n switch(c) {\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginEndTagName();\n reconsume(c, script_data_end_tag_name_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n reconsume(c, script_data_state);\n break;\n }\n }\n\n function script_data_end_tag_name_state(c) {\n /* identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g */\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = before_attribute_name_state;\n return;\n }\n break;\n case 0x002F: // SOLIDUS\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = self_closing_start_tag_state;\n return;\n }\n break;\n case 0x003E: // GREATER-THAN SIGN\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = data_state;\n emitTag();\n return;\n }\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n\n tagnamebuf += String.fromCharCode(c + 0x0020);\n tempbuf.push(c);\n return;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n\n tagnamebuf += String.fromCharCode(c);\n tempbuf.push(c);\n return;\n default:\n break;\n }\n\n // If we don't return in one of the cases above, then this was not\n // an appropriately matching close tag, so back out by emitting all\n // the characters as text\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n pushAll(textrun,tempbuf);\n reconsume(c, script_data_state);\n }\n\n function script_data_escape_start_state(c) {\n if (c === 0x002D) { // HYPHEN-MINUS\n tokenizer = script_data_escape_start_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n }\n else {\n reconsume(c, script_data_state);\n }\n }\n\n function script_data_escape_start_dash_state(c) {\n if (c === 0x002D) { // HYPHEN-MINUS\n tokenizer = script_data_escaped_dash_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n }\n else {\n reconsume(c, script_data_state);\n }\n }\n\n function script_data_escaped_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = script_data_escaped_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_escaped_less_than_sign_state;\n break;\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n textrun.push(c);\n break;\n }\n }\n\n function script_data_escaped_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = script_data_escaped_dash_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_escaped_less_than_sign_state;\n break;\n case 0x0000: // NULL\n tokenizer = script_data_escaped_state;\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n tokenizer = script_data_escaped_state;\n textrun.push(c);\n break;\n }\n }\n\n function script_data_escaped_dash_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_escaped_less_than_sign_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = script_data_state;\n textrun.push(0x003E); // GREATER-THAN SIGN\n break;\n case 0x0000: // NULL\n tokenizer = script_data_escaped_state;\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n tokenizer = script_data_escaped_state;\n textrun.push(c);\n break;\n }\n }\n\n function script_data_escaped_less_than_sign_state(c) {\n switch(c) {\n case 0x002F: // SOLIDUS\n beginTempBuf();\n tokenizer = script_data_escaped_end_tag_open_state;\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginTempBuf();\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, script_data_double_escape_start_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n reconsume(c, script_data_escaped_state);\n break;\n }\n }\n\n function script_data_escaped_end_tag_open_state(c) {\n switch(c) {\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n beginEndTagName();\n reconsume(c, script_data_escaped_end_tag_name_state);\n break;\n default:\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n reconsume(c, script_data_escaped_state);\n break;\n }\n }\n\n function script_data_escaped_end_tag_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = before_attribute_name_state;\n return;\n }\n break;\n case 0x002F: // SOLIDUS\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = self_closing_start_tag_state;\n return;\n }\n break;\n case 0x003E: // GREATER-THAN SIGN\n if (appropriateEndTag(tagnamebuf)) {\n tokenizer = data_state;\n emitTag();\n return;\n }\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n tagnamebuf += String.fromCharCode(c + 0x0020);\n tempbuf.push(c);\n return;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n tagnamebuf += String.fromCharCode(c);\n tempbuf.push(c);\n return;\n default:\n break;\n }\n\n // We get here in the default case, and if the closing tagname\n // is not an appropriate tagname.\n textrun.push(0x003C); // LESS-THAN SIGN\n textrun.push(0x002F); // SOLIDUS\n pushAll(textrun,tempbuf);\n reconsume(c, script_data_escaped_state);\n }\n\n function script_data_double_escape_start_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n case 0x002F: // SOLIDUS\n case 0x003E: // GREATER-THAN SIGN\n if (buf2str(tempbuf) === \"script\") {\n tokenizer = script_data_double_escaped_state;\n }\n else {\n tokenizer = script_data_escaped_state;\n }\n textrun.push(c);\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n tempbuf.push(c + 0x0020);\n textrun.push(c);\n break;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n tempbuf.push(c);\n textrun.push(c);\n break;\n default:\n reconsume(c, script_data_escaped_state);\n break;\n }\n }\n\n function script_data_double_escaped_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = script_data_double_escaped_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_double_escaped_less_than_sign_state;\n textrun.push(0x003C); // LESS-THAN SIGN\n break;\n case 0x0000: // NULL\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n textrun.push(c);\n break;\n }\n }\n\n function script_data_double_escaped_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = script_data_double_escaped_dash_dash_state;\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_double_escaped_less_than_sign_state;\n textrun.push(0x003C); // LESS-THAN SIGN\n break;\n case 0x0000: // NULL\n tokenizer = script_data_double_escaped_state;\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n tokenizer = script_data_double_escaped_state;\n textrun.push(c);\n break;\n }\n }\n\n function script_data_double_escaped_dash_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n textrun.push(0x002D); // HYPHEN-MINUS\n break;\n case 0x003C: // LESS-THAN SIGN\n tokenizer = script_data_double_escaped_less_than_sign_state;\n textrun.push(0x003C); // LESS-THAN SIGN\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = script_data_state;\n textrun.push(0x003E); // GREATER-THAN SIGN\n break;\n case 0x0000: // NULL\n tokenizer = script_data_double_escaped_state;\n textrun.push(0xFFFD); // REPLACEMENT CHARACTER\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n tokenizer = script_data_double_escaped_state;\n textrun.push(c);\n break;\n }\n }\n\n function script_data_double_escaped_less_than_sign_state(c) {\n if (c === 0x002F) { // SOLIDUS\n beginTempBuf();\n tokenizer = script_data_double_escape_end_state;\n textrun.push(0x002F); // SOLIDUS\n }\n else {\n reconsume(c, script_data_double_escaped_state);\n }\n }\n\n function script_data_double_escape_end_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n case 0x002F: // SOLIDUS\n case 0x003E: // GREATER-THAN SIGN\n if (buf2str(tempbuf) === \"script\") {\n tokenizer = script_data_escaped_state;\n }\n else {\n tokenizer = script_data_double_escaped_state;\n }\n textrun.push(c);\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n tempbuf.push(c + 0x0020);\n textrun.push(c);\n break;\n case 0x0061: // [a-z]\n case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066:\n case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B:\n case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070:\n case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075:\n case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A:\n tempbuf.push(c);\n textrun.push(c);\n break;\n default:\n reconsume(c, script_data_double_escaped_state);\n break;\n }\n }\n\n function before_attribute_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n // For SOLIDUS, GREATER-THAN SIGN, and EOF, spec says \"reconsume in\n // the after attribute name state\", but in our implementation that\n // state always has an active attribute in attrnamebuf. Just clone\n // the rules here, without the addAttribute business.\n case 0x002F: // SOLIDUS\n tokenizer = self_closing_start_tag_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitTag();\n break;\n case -1: // EOF\n emitEOF();\n break;\n case 0x003D: // EQUALS SIGN\n beginAttrName();\n attrnamebuf += String.fromCharCode(c);\n tokenizer = attribute_name_state;\n break;\n default:\n if (handleSimpleAttribute()) break;\n beginAttrName();\n reconsume(c, attribute_name_state);\n break;\n }\n }\n\n // beginAttrName() must have been called before this point\n // There is an active attribute in attrnamebuf (but not attrvaluebuf)\n function attribute_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n case 0x002F: // SOLIDUS\n case 0x003E: // GREATER-THAN SIGN\n case -1: // EOF\n reconsume(c, after_attribute_name_state);\n break;\n case 0x003D: // EQUALS SIGN\n tokenizer = before_attribute_value_state;\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n attrnamebuf += String.fromCharCode(c + 0x0020);\n break;\n case 0x0000: // NULL\n attrnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case 0x0022: // QUOTATION MARK\n case 0x0027: // APOSTROPHE\n case 0x003C: // LESS-THAN SIGN\n /* falls through */\n default:\n attrnamebuf += getMatchingChars(ATTRNAME);\n break;\n }\n }\n\n // There is an active attribute in attrnamebuf, but not yet in attrvaluebuf.\n function after_attribute_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n case 0x002F: // SOLIDUS\n // Keep in sync with before_attribute_name_state.\n addAttribute(attrnamebuf);\n tokenizer = self_closing_start_tag_state;\n break;\n case 0x003D: // EQUALS SIGN\n tokenizer = before_attribute_value_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n // Keep in sync with before_attribute_name_state.\n tokenizer = data_state;\n addAttribute(attrnamebuf);\n emitTag();\n break;\n case -1: // EOF\n // Keep in sync with before_attribute_name_state.\n addAttribute(attrnamebuf);\n emitEOF();\n break;\n default:\n addAttribute(attrnamebuf);\n beginAttrName();\n reconsume(c, attribute_name_state);\n break;\n }\n }\n\n function before_attribute_value_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n case 0x0022: // QUOTATION MARK\n beginAttrValue();\n tokenizer = attribute_value_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginAttrValue();\n tokenizer = attribute_value_single_quoted_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n /* falls through */\n default:\n beginAttrValue();\n reconsume(c, attribute_value_unquoted_state);\n break;\n }\n }\n\n function attribute_value_double_quoted_state(c) {\n switch(c) {\n case 0x0022: // QUOTATION MARK\n addAttribute(attrnamebuf, attrvaluebuf);\n tokenizer = after_attribute_value_quoted_state;\n break;\n case 0x0026: // AMPERSAND\n return_state = attribute_value_double_quoted_state;\n tokenizer = character_reference_state;\n break;\n case 0x0000: // NULL\n attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n emitEOF();\n break;\n case 0x000A: // LF\n // this could be a converted \\r, so don't use getMatchingChars\n attrvaluebuf += String.fromCharCode(c);\n break;\n default:\n attrvaluebuf += getMatchingChars(DBLQUOTEATTRVAL);\n break;\n }\n }\n\n function attribute_value_single_quoted_state(c) {\n switch(c) {\n case 0x0027: // APOSTROPHE\n addAttribute(attrnamebuf, attrvaluebuf);\n tokenizer = after_attribute_value_quoted_state;\n break;\n case 0x0026: // AMPERSAND\n return_state = attribute_value_single_quoted_state;\n tokenizer = character_reference_state;\n break;\n case 0x0000: // NULL\n attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n emitEOF();\n break;\n case 0x000A: // LF\n // this could be a converted \\r, so don't use getMatchingChars\n attrvaluebuf += String.fromCharCode(c);\n break;\n default:\n attrvaluebuf += getMatchingChars(SINGLEQUOTEATTRVAL);\n break;\n }\n }\n\n function attribute_value_unquoted_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n addAttribute(attrnamebuf, attrvaluebuf);\n tokenizer = before_attribute_name_state;\n break;\n case 0x0026: // AMPERSAND\n return_state = attribute_value_unquoted_state;\n tokenizer = character_reference_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n addAttribute(attrnamebuf, attrvaluebuf);\n tokenizer = data_state;\n emitTag();\n break;\n case 0x0000: // NULL\n attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n nextchar--; // pushback\n tokenizer = data_state;\n break;\n case 0x0022: // QUOTATION MARK\n case 0x0027: // APOSTROPHE\n case 0x003C: // LESS-THAN SIGN\n case 0x003D: // EQUALS SIGN\n case 0x0060: // GRAVE ACCENT\n /* falls through */\n default:\n attrvaluebuf += getMatchingChars(UNQUOTEDATTRVAL);\n break;\n }\n }\n\n function after_attribute_value_quoted_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = before_attribute_name_state;\n break;\n case 0x002F: // SOLIDUS\n tokenizer = self_closing_start_tag_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitTag();\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n reconsume(c, before_attribute_name_state);\n break;\n }\n }\n\n function self_closing_start_tag_state(c) {\n switch(c) {\n case 0x003E: // GREATER-THAN SIGN\n // Set the self-closing flag of the current tag token.\n tokenizer = data_state;\n emitSelfClosingTag(true);\n break;\n case -1: // EOF\n emitEOF();\n break;\n default:\n reconsume(c, before_attribute_name_state);\n break;\n }\n }\n\n function bogus_comment_state(c, lookahead, eof) {\n var len = lookahead.length;\n\n if (eof) {\n nextchar += len-1; // don't consume the eof\n }\n else {\n nextchar += len;\n }\n\n var comment = lookahead.substring(0, len-1);\n\n comment = comment.replace(/\\u0000/g,\"\\uFFFD\");\n comment = comment.replace(/\\u000D\\u000A/g,\"\\u000A\");\n comment = comment.replace(/\\u000D/g,\"\\u000A\");\n\n insertToken(COMMENT, comment);\n tokenizer = data_state;\n }\n bogus_comment_state.lookahead = \">\";\n\n function markup_declaration_open_state(c, lookahead, eof) {\n if (lookahead[0] === \"-\" && lookahead[1] === \"-\") {\n nextchar += 2;\n beginComment();\n tokenizer = comment_start_state;\n return;\n }\n\n if (lookahead.toUpperCase() === \"DOCTYPE\") {\n nextchar += 7;\n tokenizer = doctype_state;\n }\n else if (lookahead === \"[CDATA[\" && cdataAllowed()) {\n nextchar += 7;\n tokenizer = cdata_section_state;\n }\n else {\n tokenizer = bogus_comment_state;\n }\n }\n markup_declaration_open_state.lookahead = 7;\n\n function comment_start_state(c) {\n beginComment();\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_start_dash_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n insertToken(COMMENT, buf2str(commentbuf));\n break; /* see comment in comment end state */\n default:\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_start_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_end_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n insertToken(COMMENT, buf2str(commentbuf));\n break;\n case -1: // EOF\n insertToken(COMMENT, buf2str(commentbuf));\n emitEOF();\n break; /* see comment in comment end state */\n default:\n commentbuf.push(0x002D /* HYPHEN-MINUS */);\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_state(c) {\n switch(c) {\n case 0x003C: // LESS-THAN SIGN\n commentbuf.push(c);\n tokenizer = comment_less_than_sign_state;\n break;\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_end_dash_state;\n break;\n case 0x0000: // NULL\n commentbuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n insertToken(COMMENT, buf2str(commentbuf));\n emitEOF();\n break; /* see comment in comment end state */\n default:\n commentbuf.push(c);\n break;\n }\n }\n\n function comment_less_than_sign_state(c) {\n switch(c) {\n case 0x0021: // EXCLAMATION MARK\n commentbuf.push(c);\n tokenizer = comment_less_than_sign_bang_state;\n break;\n case 0x003C: // LESS-THAN SIGN\n commentbuf.push(c);\n break;\n default:\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_less_than_sign_bang_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_less_than_sign_bang_dash_state;\n break;\n default:\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_less_than_sign_bang_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_less_than_sign_bang_dash_dash_state;\n break;\n default:\n reconsume(c, comment_end_dash_state);\n break;\n }\n }\n\n function comment_less_than_sign_bang_dash_dash_state(c) {\n switch(c) {\n case 0x003E: // GREATER-THAN SIGN\n case -1: // EOF\n reconsume(c, comment_end_state);\n break;\n default:\n // parse error\n reconsume(c, comment_end_state);\n break;\n }\n }\n\n function comment_end_dash_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n tokenizer = comment_end_state;\n break;\n case -1: // EOF\n insertToken(COMMENT, buf2str(commentbuf));\n emitEOF();\n break; /* see comment in comment end state */\n default:\n commentbuf.push(0x002D /* HYPHEN-MINUS */);\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_end_state(c) {\n switch(c) {\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n insertToken(COMMENT, buf2str(commentbuf));\n break;\n case 0x0021: // EXCLAMATION MARK\n tokenizer = comment_end_bang_state;\n break;\n case 0x002D: // HYPHEN-MINUS\n commentbuf.push(0x002D);\n break;\n case -1: // EOF\n insertToken(COMMENT, buf2str(commentbuf));\n emitEOF();\n break; /* For security reasons: otherwise, hostile user could put a script in a comment e.g. in a blog comment and then DOS the server so that the end tag isn't read, and then the commented script tag would be treated as live code */\n default:\n commentbuf.push(0x002D);\n commentbuf.push(0x002D);\n reconsume(c, comment_state);\n break;\n }\n }\n\n function comment_end_bang_state(c) {\n switch(c) {\n case 0x002D: // HYPHEN-MINUS\n commentbuf.push(0x002D);\n commentbuf.push(0x002D);\n commentbuf.push(0x0021);\n tokenizer = comment_end_dash_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n insertToken(COMMENT, buf2str(commentbuf));\n break;\n case -1: // EOF\n insertToken(COMMENT, buf2str(commentbuf));\n emitEOF();\n break; /* see comment in comment end state */\n default:\n commentbuf.push(0x002D);\n commentbuf.push(0x002D);\n commentbuf.push(0x0021);\n reconsume(c, comment_state);\n break;\n }\n }\n\n function doctype_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = before_doctype_name_state;\n break;\n case -1: // EOF\n beginDoctype();\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n reconsume(c, before_doctype_name_state);\n break;\n }\n }\n\n function before_doctype_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n beginDoctype();\n doctypenamebuf.push(c + 0x0020);\n tokenizer = doctype_name_state;\n break;\n case 0x0000: // NULL\n beginDoctype();\n doctypenamebuf.push(0xFFFD);\n tokenizer = doctype_name_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n beginDoctype();\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n beginDoctype();\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n beginDoctype();\n doctypenamebuf.push(c);\n tokenizer = doctype_name_state;\n break;\n }\n }\n\n function doctype_name_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = after_doctype_name_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitDoctype();\n break;\n case 0x0041: // [A-Z]\n case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046:\n case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B:\n case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050:\n case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055:\n case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A:\n doctypenamebuf.push(c + 0x0020);\n break;\n case 0x0000: // NULL\n doctypenamebuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n doctypenamebuf.push(c);\n break;\n }\n }\n\n function after_doctype_name_state(c, lookahead, eof) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n nextchar += 1;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n nextchar += 1;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n lookahead = lookahead.toUpperCase();\n if (lookahead === \"PUBLIC\") {\n nextchar += 6;\n tokenizer = after_doctype_public_keyword_state;\n }\n else if (lookahead === \"SYSTEM\") {\n nextchar += 6;\n tokenizer = after_doctype_system_keyword_state;\n }\n else {\n forcequirks();\n tokenizer = bogus_doctype_state;\n }\n break;\n }\n }\n after_doctype_name_state.lookahead = 6;\n\n function after_doctype_public_keyword_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = before_doctype_public_identifier_state;\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypePublicId();\n tokenizer = doctype_public_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypePublicId();\n tokenizer = doctype_public_identifier_single_quoted_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function before_doctype_public_identifier_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypePublicId();\n tokenizer = doctype_public_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypePublicId();\n tokenizer = doctype_public_identifier_single_quoted_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function doctype_public_identifier_double_quoted_state(c) {\n switch(c) {\n case 0x0022: // QUOTATION MARK\n tokenizer = after_doctype_public_identifier_state;\n break;\n case 0x0000: // NULL\n doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n doctypepublicbuf.push(c);\n break;\n }\n }\n\n function doctype_public_identifier_single_quoted_state(c) {\n switch(c) {\n case 0x0027: // APOSTROPHE\n tokenizer = after_doctype_public_identifier_state;\n break;\n case 0x0000: // NULL\n doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n doctypepublicbuf.push(c);\n break;\n }\n }\n\n function after_doctype_public_identifier_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = between_doctype_public_and_system_identifiers_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitDoctype();\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_single_quoted_state;\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function between_doctype_public_and_system_identifiers_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE Ignore the character.\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitDoctype();\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_single_quoted_state;\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function after_doctype_system_keyword_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n tokenizer = before_doctype_system_identifier_state;\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_single_quoted_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function before_doctype_system_identifier_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE Ignore the character.\n break;\n case 0x0022: // QUOTATION MARK\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_double_quoted_state;\n break;\n case 0x0027: // APOSTROPHE\n beginDoctypeSystemId();\n tokenizer = doctype_system_identifier_single_quoted_state;\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n forcequirks();\n tokenizer = bogus_doctype_state;\n break;\n }\n }\n\n function doctype_system_identifier_double_quoted_state(c) {\n switch(c) {\n case 0x0022: // QUOTATION MARK\n tokenizer = after_doctype_system_identifier_state;\n break;\n case 0x0000: // NULL\n doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n doctypesystembuf.push(c);\n break;\n }\n }\n\n function doctype_system_identifier_single_quoted_state(c) {\n switch(c) {\n case 0x0027: // APOSTROPHE\n tokenizer = after_doctype_system_identifier_state;\n break;\n case 0x0000: // NULL\n doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */);\n break;\n case 0x003E: // GREATER-THAN SIGN\n forcequirks();\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n doctypesystembuf.push(c);\n break;\n }\n }\n\n function after_doctype_system_identifier_state(c) {\n switch(c) {\n case 0x0009: // CHARACTER TABULATION (tab)\n case 0x000A: // LINE FEED (LF)\n case 0x000C: // FORM FEED (FF)\n case 0x0020: // SPACE\n /* Ignore the character. */\n break;\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n forcequirks();\n emitDoctype();\n emitEOF();\n break;\n default:\n tokenizer = bogus_doctype_state;\n /* This does *not* set the DOCTYPE token's force-quirks flag. */\n break;\n }\n }\n\n function bogus_doctype_state(c) {\n switch(c) {\n case 0x003E: // GREATER-THAN SIGN\n tokenizer = data_state;\n emitDoctype();\n break;\n case -1: // EOF\n emitDoctype();\n emitEOF();\n break;\n default:\n /* Ignore the character. */\n break;\n }\n }\n\n function cdata_section_state(c) {\n switch(c) {\n case 0x005D: // RIGHT SQUARE BRACKET\n tokenizer = cdata_section_bracket_state;\n break;\n case -1: // EOF\n emitEOF();\n break;\n case 0x0000: // NULL\n textIncludesNUL = true;\n /* fall through */\n default:\n // Instead of just pushing a single character and then\n // coming back to the very same place, lookahead and\n // emit everything we can at once.\n /*jshint -W030 */\n emitCharsWhile(CDATATEXT) || textrun.push(c);\n break;\n }\n }\n\n function cdata_section_bracket_state(c) {\n switch(c) {\n case 0x005D: // RIGHT SQUARE BRACKET\n tokenizer = cdata_section_end_state;\n break;\n default:\n textrun.push(0x005D);\n reconsume(c, cdata_section_state);\n break;\n }\n }\n\n function cdata_section_end_state(c) {\n switch(c) {\n case 0x005D: // RIGHT SQUARE BRACKET\n textrun.push(0x005D);\n break;\n case 0x003E: // GREATER-THAN SIGN\n flushText();\n tokenizer = data_state;\n break;\n default:\n textrun.push(0x005D);\n textrun.push(0x005D);\n reconsume(c, cdata_section_state);\n break;\n }\n }\n\n function character_reference_state(c) {\n beginTempBuf();\n tempbuf.push(0x0026);\n switch(c) {\n case 0x0009: // TAB\n case 0x000A: // LINE FEED\n case 0x000C: // FORM FEED\n case 0x0020: // SPACE\n case 0x003C: // LESS-THAN SIGN\n case 0x0026: // AMPERSAND\n case -1: // EOF\n reconsume(c, character_reference_end_state);\n break;\n case 0x0023: // NUMBER SIGN\n tempbuf.push(c);\n tokenizer = numeric_character_reference_state;\n break;\n default:\n reconsume(c, named_character_reference_state);\n break;\n }\n }\n\n function named_character_reference_state(c) {\n NAMEDCHARREF.lastIndex = nextchar; // w/ lookahead no char has been consumed\n var matched = NAMEDCHARREF.exec(chars);\n if (!matched) throw new Error(\"should never happen\");\n var name = matched[1];\n if (!name) {\n // If no match can be made, switch to the character reference end state\n tokenizer = character_reference_end_state;\n return;\n }\n\n // Consume the matched characters and append them to temporary buffer\n nextchar += name.length;\n pushAll(tempbuf, str2buf(name));\n\n switch(return_state) {\n case attribute_value_double_quoted_state:\n case attribute_value_single_quoted_state:\n case attribute_value_unquoted_state:\n // If the character reference was consumed as part of an attribute...\n if (name[name.length-1] !== ';') { // ...and the last char is not ;\n if (/[=A-Za-z0-9]/.test(chars[nextchar])) {\n tokenizer = character_reference_end_state;\n return;\n }\n }\n break;\n default:\n break;\n }\n\n beginTempBuf();\n var rv = namedCharRefs[name];\n if (typeof rv === 'number') {\n tempbuf.push(rv);\n } else {\n pushAll(tempbuf, rv);\n }\n tokenizer = character_reference_end_state;\n }\n // We might need to pause tokenization until we have enough characters\n // in the buffer for longest possible character reference.\n named_character_reference_state.lookahead = -NAMEDCHARREF_MAXLEN;\n\n function numeric_character_reference_state(c) {\n character_reference_code = 0;\n switch(c) {\n case 0x0078: // x\n case 0x0058: // X\n tempbuf.push(c);\n tokenizer = hexadecimal_character_reference_start_state;\n break;\n default:\n reconsume(c, decimal_character_reference_start_state);\n break;\n }\n }\n\n function hexadecimal_character_reference_start_state(c) {\n switch(c) {\n case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034:\n case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9]\n case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045:\n case 0x0046: // [A-F]\n case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065:\n case 0x0066: // [a-f]\n reconsume(c, hexadecimal_character_reference_state);\n break;\n default:\n reconsume(c, character_reference_end_state);\n break;\n }\n }\n\n function decimal_character_reference_start_state(c) {\n switch(c) {\n case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034:\n case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9]\n reconsume(c, decimal_character_reference_state);\n break;\n default:\n reconsume(c, character_reference_end_state);\n break;\n }\n }\n\n function hexadecimal_character_reference_state(c) {\n switch(c) {\n case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045:\n case 0x0046: // [A-F]\n character_reference_code *= 16;\n character_reference_code += (c - 0x0037);\n break;\n case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065:\n case 0x0066: // [a-f]\n character_reference_code *= 16;\n character_reference_code += (c - 0x0057);\n break;\n case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034:\n case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9]\n character_reference_code *= 16;\n character_reference_code += (c - 0x0030);\n break;\n case 0x003B: // SEMICOLON\n tokenizer = numeric_character_reference_end_state;\n break;\n default:\n reconsume(c, numeric_character_reference_end_state);\n break;\n }\n }\n\n function decimal_character_reference_state(c) {\n switch(c) {\n case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034:\n case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9]\n character_reference_code *= 10;\n character_reference_code += (c - 0x0030);\n break;\n case 0x003B: // SEMICOLON\n tokenizer = numeric_character_reference_end_state;\n break;\n default:\n reconsume(c, numeric_character_reference_end_state);\n break;\n }\n }\n\n function numeric_character_reference_end_state(c) {\n if (character_reference_code in numericCharRefReplacements) {\n character_reference_code = numericCharRefReplacements[character_reference_code];\n } else if (character_reference_code > 0x10FFFF || (character_reference_code >= 0xD800 && character_reference_code < 0xE000)) {\n character_reference_code = 0xFFFD;\n }\n\n beginTempBuf();\n if (character_reference_code <= 0xFFFF) {\n tempbuf.push(character_reference_code);\n } else {\n character_reference_code = character_reference_code - 0x10000;\n /* jshint bitwise: false */\n tempbuf.push(0xD800 + (character_reference_code >> 10));\n tempbuf.push(0xDC00 + (character_reference_code & 0x03FF));\n }\n reconsume(c, character_reference_end_state);\n }\n\n function character_reference_end_state(c) {\n switch(return_state) {\n case attribute_value_double_quoted_state:\n case attribute_value_single_quoted_state:\n case attribute_value_unquoted_state:\n // append each character to the current attribute's value\n attrvaluebuf += buf2str(tempbuf);\n break;\n default:\n pushAll(textrun, tempbuf);\n break;\n }\n reconsume(c, return_state);\n }\n\n /***\n * The tree builder insertion modes\n */\n\n // 11.2.5.4.1 The \"initial\" insertion mode\n function initial_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n value = value.replace(LEADINGWS, \"\"); // Ignore spaces\n if (value.length === 0) return; // Are we done?\n break; // Handle anything non-space text below\n case 4: // COMMENT\n doc._appendChild(doc.createComment(value));\n return;\n case 5: // DOCTYPE\n var name = value;\n var publicid = arg3;\n var systemid = arg4;\n // Use the constructor directly instead of\n // implementation.createDocumentType because the create\n // function throws errors on invalid characters, and\n // we don't want the parser to throw them.\n doc.appendChild(new DocumentType(doc, name, publicid, systemid));\n\n // Note that there is no public API for setting quirks mode We can\n // do this here because we have access to implementation details\n if (force_quirks ||\n name.toLowerCase() !== \"html\" ||\n quirkyPublicIds.test(publicid) ||\n (systemid && systemid.toLowerCase() === quirkySystemId) ||\n (systemid === undefined &&\n conditionallyQuirkyPublicIds.test(publicid)))\n doc._quirks = true;\n else if (limitedQuirkyPublicIds.test(publicid) ||\n (systemid !== undefined &&\n conditionallyQuirkyPublicIds.test(publicid)))\n doc._limitedQuirks = true;\n parser = before_html_mode;\n return;\n }\n\n // tags or non-whitespace text\n doc._quirks = true;\n parser = before_html_mode;\n parser(t,value,arg3,arg4);\n }\n\n // 11.2.5.4.2 The \"before html\" insertion mode\n function before_html_mode(t,value,arg3,arg4) {\n var elt;\n switch(t) {\n case 1: // TEXT\n value = value.replace(LEADINGWS, \"\"); // Ignore spaces\n if (value.length === 0) return; // Are we done?\n break; // Handle anything non-space text below\n case 5: // DOCTYPE\n /* ignore the token */\n return;\n case 4: // COMMENT\n doc._appendChild(doc.createComment(value));\n return;\n case 2: // TAG\n if (value === \"html\") {\n elt = createHTMLElt(doc, value, arg3);\n stack.push(elt);\n doc.appendChild(elt);\n // XXX: handle application cache here\n parser = before_head_mode;\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"html\":\n case \"head\":\n case \"body\":\n case \"br\":\n break; // fall through on these\n default:\n return; // ignore most end tags\n }\n }\n\n // Anything that didn't get handled above is handled like this:\n elt = createHTMLElt(doc, \"html\", null);\n stack.push(elt);\n doc.appendChild(elt);\n // XXX: handle application cache here\n parser = before_head_mode;\n parser(t,value,arg3,arg4);\n }\n\n // 11.2.5.4.3 The \"before head\" insertion mode\n function before_head_mode(t,value,arg3,arg4) {\n switch(t) {\n case 1: // TEXT\n value = value.replace(LEADINGWS, \"\"); // Ignore spaces\n if (value.length === 0) return; // Are we done?\n break; // Handle anything non-space text below\n case 5: // DOCTYPE\n /* ignore the token */\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t,value,arg3,arg4);\n return;\n case \"head\":\n var elt = insertHTMLElement(value, arg3);\n head_element_pointer = elt;\n parser = in_head_mode;\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"html\":\n case \"head\":\n case \"body\":\n case \"br\":\n break;\n default:\n return; // ignore most end tags\n }\n }\n\n // If not handled explicitly above\n before_head_mode(TAG, \"head\", null); // create a head tag\n parser(t, value, arg3, arg4); // then try again with this token\n }\n\n function in_head_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n var ws = value.match(LEADINGWS);\n if (ws) {\n insertText(ws[0]);\n value = value.substring(ws[0].length);\n }\n if (value.length === 0) return;\n break; // Handle non-whitespace below\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"meta\":\n // XXX:\n // May need to change the encoding based on this tag\n /* falls through */\n case \"base\":\n case \"basefont\":\n case \"bgsound\":\n case \"link\":\n insertHTMLElement(value, arg3);\n stack.pop();\n return;\n case \"title\":\n parseRCDATA(value, arg3);\n return;\n case \"noscript\":\n if (!scripting_enabled) {\n insertHTMLElement(value, arg3);\n parser = in_head_noscript_mode;\n return;\n }\n // Otherwise, if scripting is enabled...\n /* falls through */\n case \"noframes\":\n case \"style\":\n parseRawText(value,arg3);\n return;\n case \"script\":\n insertElement(function(doc) {\n var elt = createHTMLElt(doc, value, arg3);\n elt._parser_inserted = true;\n elt._force_async = false;\n if (fragment) elt._already_started = true;\n flushText();\n return elt;\n });\n tokenizer = script_data_state;\n originalInsertionMode = parser;\n parser = text_mode;\n return;\n case \"template\":\n insertHTMLElement(value, arg3);\n afe.insertMarker();\n frameset_ok = false;\n parser = in_template_mode;\n templateInsertionModes.push(parser);\n return;\n case \"head\":\n return; // ignore it\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"head\":\n stack.pop();\n parser = after_head_mode;\n return;\n case \"body\":\n case \"html\":\n case \"br\":\n break; // handle these at the bottom of the function\n case \"template\":\n if (!stack.contains(\"template\")) {\n return;\n }\n stack.generateImpliedEndTags(null, \"thorough\");\n stack.popTag(\"template\");\n afe.clearToMarker();\n templateInsertionModes.pop();\n resetInsertionMode();\n return;\n default:\n // ignore any other end tag\n return;\n }\n break;\n }\n\n // If not handled above\n in_head_mode(ENDTAG, \"head\", null); // synthetic \n parser(t, value, arg3, arg4); // Then redo this one\n }\n\n // 13.2.5.4.5 The \"in head noscript\" insertion mode\n function in_head_noscript_mode(t, value, arg3, arg4) {\n switch(t) {\n case 5: // DOCTYPE\n return;\n case 4: // COMMENT\n in_head_mode(t, value);\n return;\n case 1: // TEXT\n var ws = value.match(LEADINGWS);\n if (ws) {\n in_head_mode(t, ws[0]);\n value = value.substring(ws[0].length);\n }\n if (value.length === 0) return; // no more text\n break; // Handle non-whitespace below\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"basefont\":\n case \"bgsound\":\n case \"link\":\n case \"meta\":\n case \"noframes\":\n case \"style\":\n in_head_mode(t, value, arg3);\n return;\n case \"head\":\n case \"noscript\":\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"noscript\":\n stack.pop();\n parser = in_head_mode;\n return;\n case \"br\":\n break; // goes to the outer default\n default:\n return; // ignore other end tags\n }\n break;\n }\n\n // If not handled above\n in_head_noscript_mode(ENDTAG, \"noscript\", null);\n parser(t, value, arg3, arg4);\n }\n\n function after_head_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n var ws = value.match(LEADINGWS);\n if (ws) {\n insertText(ws[0]);\n value = value.substring(ws[0].length);\n }\n if (value.length === 0) return;\n break; // Handle non-whitespace below\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"body\":\n insertHTMLElement(value, arg3);\n frameset_ok = false;\n parser = in_body_mode;\n return;\n case \"frameset\":\n insertHTMLElement(value, arg3);\n parser = in_frameset_mode;\n return;\n case \"base\":\n case \"basefont\":\n case \"bgsound\":\n case \"link\":\n case \"meta\":\n case \"noframes\":\n case \"script\":\n case \"style\":\n case \"template\":\n case \"title\":\n stack.push(head_element_pointer);\n in_head_mode(TAG, value, arg3);\n stack.removeElement(head_element_pointer);\n return;\n case \"head\":\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"template\":\n return in_head_mode(t, value, arg3, arg4);\n case \"body\":\n case \"html\":\n case \"br\":\n break;\n default:\n return; // ignore any other end tag\n }\n break;\n }\n\n after_head_mode(TAG, \"body\", null);\n frameset_ok = true;\n parser(t, value, arg3, arg4);\n }\n\n // 13.2.5.4.7 The \"in body\" insertion mode\n function in_body_mode(t,value,arg3,arg4) {\n var body, i, node, elt;\n switch(t) {\n case 1: // TEXT\n if (textIncludesNUL) {\n value = value.replace(NULCHARS, \"\");\n if (value.length === 0) return;\n }\n // If any non-space characters\n if (frameset_ok && NONWS.test(value))\n frameset_ok = false;\n afereconstruct();\n insertText(value);\n return;\n case 5: // DOCTYPE\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case -1: // EOF\n if (templateInsertionModes.length) {\n return in_template_mode(t);\n }\n stopParsing();\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n if (stack.contains(\"template\")) {\n return;\n }\n transferAttributes(arg3, stack.elements[0]);\n return;\n case \"base\":\n case \"basefont\":\n case \"bgsound\":\n case \"link\":\n case \"meta\":\n case \"noframes\":\n case \"script\":\n case \"style\":\n case \"template\":\n case \"title\":\n in_head_mode(TAG, value, arg3);\n return;\n case \"body\":\n body = stack.elements[1];\n if (!body || !(body instanceof impl.HTMLBodyElement) ||\n stack.contains(\"template\"))\n return;\n frameset_ok = false;\n transferAttributes(arg3, body);\n return;\n case \"frameset\":\n if (!frameset_ok) return;\n body = stack.elements[1];\n if (!body || !(body instanceof impl.HTMLBodyElement))\n return;\n if (body.parentNode) body.parentNode.removeChild(body);\n while(!(stack.top instanceof impl.HTMLHtmlElement))\n stack.pop();\n insertHTMLElement(value, arg3);\n parser = in_frameset_mode;\n return;\n\n case \"address\":\n case \"article\":\n case \"aside\":\n case \"blockquote\":\n case \"center\":\n case \"details\":\n case \"dialog\":\n case \"dir\":\n case \"div\":\n case \"dl\":\n case \"fieldset\":\n case \"figcaption\":\n case \"figure\":\n case \"footer\":\n case \"header\":\n case \"hgroup\":\n case \"main\":\n case \"nav\":\n case \"ol\":\n case \"p\":\n case \"section\":\n case \"summary\":\n case \"ul\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n insertHTMLElement(value, arg3);\n return;\n\n case \"menu\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n if (isA(stack.top, 'menuitem')) {\n stack.pop();\n }\n insertHTMLElement(value, arg3);\n return;\n\n case \"h1\":\n case \"h2\":\n case \"h3\":\n case \"h4\":\n case \"h5\":\n case \"h6\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n if (stack.top instanceof impl.HTMLHeadingElement)\n stack.pop();\n insertHTMLElement(value, arg3);\n return;\n\n case \"pre\":\n case \"listing\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n insertHTMLElement(value, arg3);\n ignore_linefeed = true;\n frameset_ok = false;\n return;\n\n case \"form\":\n if (form_element_pointer && !stack.contains(\"template\")) return;\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n elt = insertHTMLElement(value, arg3);\n if (!stack.contains(\"template\"))\n form_element_pointer = elt;\n return;\n\n case \"li\":\n frameset_ok = false;\n for(i = stack.elements.length-1; i >= 0; i--) {\n node = stack.elements[i];\n if (node instanceof impl.HTMLLIElement) {\n in_body_mode(ENDTAG, \"li\");\n break;\n }\n if (isA(node, specialSet) && !isA(node, addressdivpSet))\n break;\n }\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n insertHTMLElement(value, arg3);\n return;\n\n case \"dd\":\n case \"dt\":\n frameset_ok = false;\n for(i = stack.elements.length-1; i >= 0; i--) {\n node = stack.elements[i];\n if (isA(node, dddtSet)) {\n in_body_mode(ENDTAG, node.localName);\n break;\n }\n if (isA(node, specialSet) && !isA(node, addressdivpSet))\n break;\n }\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n insertHTMLElement(value, arg3);\n return;\n\n case \"plaintext\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n insertHTMLElement(value, arg3);\n tokenizer = plaintext_state;\n return;\n\n case \"button\":\n if (stack.inScope(\"button\")) {\n in_body_mode(ENDTAG, \"button\");\n parser(t, value, arg3, arg4);\n }\n else {\n afereconstruct();\n insertHTMLElement(value, arg3);\n frameset_ok = false;\n }\n return;\n\n case \"a\":\n var activeElement = afe.findElementByTag(\"a\");\n if (activeElement) {\n in_body_mode(ENDTAG, value);\n afe.remove(activeElement);\n stack.removeElement(activeElement);\n }\n /* falls through */\n case \"b\":\n case \"big\":\n case \"code\":\n case \"em\":\n case \"font\":\n case \"i\":\n case \"s\":\n case \"small\":\n case \"strike\":\n case \"strong\":\n case \"tt\":\n case \"u\":\n afereconstruct();\n afe.push(insertHTMLElement(value,arg3), arg3);\n return;\n\n case \"nobr\":\n afereconstruct();\n\n if (stack.inScope(value)) {\n in_body_mode(ENDTAG, value);\n afereconstruct();\n }\n afe.push(insertHTMLElement(value,arg3), arg3);\n return;\n\n case \"applet\":\n case \"marquee\":\n case \"object\":\n afereconstruct();\n insertHTMLElement(value,arg3);\n afe.insertMarker();\n frameset_ok = false;\n return;\n\n case \"table\":\n if (!doc._quirks && stack.inButtonScope(\"p\")) {\n in_body_mode(ENDTAG, \"p\");\n }\n insertHTMLElement(value,arg3);\n frameset_ok = false;\n parser = in_table_mode;\n return;\n\n case \"area\":\n case \"br\":\n case \"embed\":\n case \"img\":\n case \"keygen\":\n case \"wbr\":\n afereconstruct();\n insertHTMLElement(value,arg3);\n stack.pop();\n frameset_ok = false;\n return;\n\n case \"input\":\n afereconstruct();\n elt = insertHTMLElement(value,arg3);\n stack.pop();\n var type = elt.getAttribute(\"type\");\n if (!type || type.toLowerCase() !== \"hidden\")\n frameset_ok = false;\n return;\n\n case \"param\":\n case \"source\":\n case \"track\":\n insertHTMLElement(value,arg3);\n stack.pop();\n return;\n\n case \"hr\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n if (isA(stack.top, 'menuitem')) {\n stack.pop();\n }\n insertHTMLElement(value,arg3);\n stack.pop();\n frameset_ok = false;\n return;\n\n case \"image\":\n in_body_mode(TAG, \"img\", arg3, arg4);\n return;\n\n case \"textarea\":\n insertHTMLElement(value,arg3);\n ignore_linefeed = true;\n frameset_ok = false;\n tokenizer = rcdata_state;\n originalInsertionMode = parser;\n parser = text_mode;\n return;\n\n case \"xmp\":\n if (stack.inButtonScope(\"p\")) in_body_mode(ENDTAG, \"p\");\n afereconstruct();\n frameset_ok = false;\n parseRawText(value, arg3);\n return;\n\n case \"iframe\":\n frameset_ok = false;\n parseRawText(value, arg3);\n return;\n\n case \"noembed\":\n parseRawText(value,arg3);\n return;\n\n case \"noscript\":\n if (scripting_enabled) {\n parseRawText(value,arg3);\n return;\n }\n break; // XXX Otherwise treat it as any other open tag?\n\n case \"select\":\n afereconstruct();\n insertHTMLElement(value,arg3);\n frameset_ok = false;\n if (parser === in_table_mode ||\n parser === in_caption_mode ||\n parser === in_table_body_mode ||\n parser === in_row_mode ||\n parser === in_cell_mode)\n parser = in_select_in_table_mode;\n else\n parser = in_select_mode;\n return;\n\n case \"optgroup\":\n case \"option\":\n if (stack.top instanceof impl.HTMLOptionElement) {\n in_body_mode(ENDTAG, \"option\");\n }\n afereconstruct();\n insertHTMLElement(value,arg3);\n return;\n\n case \"menuitem\":\n if (isA(stack.top, 'menuitem')) {\n stack.pop();\n }\n afereconstruct();\n insertHTMLElement(value, arg3);\n return;\n\n case \"rb\":\n case \"rtc\":\n if (stack.inScope(\"ruby\")) {\n stack.generateImpliedEndTags();\n }\n insertHTMLElement(value,arg3);\n return;\n\n case \"rp\":\n case \"rt\":\n if (stack.inScope(\"ruby\")) {\n stack.generateImpliedEndTags(\"rtc\");\n }\n insertHTMLElement(value,arg3);\n return;\n\n case \"math\":\n afereconstruct();\n adjustMathMLAttributes(arg3);\n adjustForeignAttributes(arg3);\n insertForeignElement(value, arg3, NAMESPACE.MATHML);\n if (arg4) // self-closing flag\n stack.pop();\n return;\n\n case \"svg\":\n afereconstruct();\n adjustSVGAttributes(arg3);\n adjustForeignAttributes(arg3);\n insertForeignElement(value, arg3, NAMESPACE.SVG);\n if (arg4) // self-closing flag\n stack.pop();\n return;\n\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"frame\":\n case \"head\":\n case \"tbody\":\n case \"td\":\n case \"tfoot\":\n case \"th\":\n case \"thead\":\n case \"tr\":\n // Ignore table tags if we're not in_table mode\n return;\n }\n\n // Handle any other start tag here\n // (and also noscript tags when scripting is disabled)\n afereconstruct();\n insertHTMLElement(value,arg3);\n return;\n\n case 3: // ENDTAG\n switch(value) {\n case \"template\":\n in_head_mode(ENDTAG, value, arg3);\n return;\n case \"body\":\n if (!stack.inScope(\"body\")) return;\n parser = after_body_mode;\n return;\n case \"html\":\n if (!stack.inScope(\"body\")) return;\n parser = after_body_mode;\n parser(t, value, arg3);\n return;\n\n case \"address\":\n case \"article\":\n case \"aside\":\n case \"blockquote\":\n case \"button\":\n case \"center\":\n case \"details\":\n case \"dialog\":\n case \"dir\":\n case \"div\":\n case \"dl\":\n case \"fieldset\":\n case \"figcaption\":\n case \"figure\":\n case \"footer\":\n case \"header\":\n case \"hgroup\":\n case \"listing\":\n case \"main\":\n case \"menu\":\n case \"nav\":\n case \"ol\":\n case \"pre\":\n case \"section\":\n case \"summary\":\n case \"ul\":\n // Ignore if there is not a matching open tag\n if (!stack.inScope(value)) return;\n stack.generateImpliedEndTags();\n stack.popTag(value);\n return;\n\n case \"form\":\n if (!stack.contains(\"template\")) {\n var openform = form_element_pointer;\n form_element_pointer = null;\n if (!openform || !stack.elementInScope(openform)) return;\n stack.generateImpliedEndTags();\n stack.removeElement(openform);\n } else {\n if (!stack.inScope(\"form\")) return;\n stack.generateImpliedEndTags();\n stack.popTag(\"form\");\n }\n return;\n\n case \"p\":\n if (!stack.inButtonScope(value)) {\n in_body_mode(TAG, value, null);\n parser(t, value, arg3, arg4);\n }\n else {\n stack.generateImpliedEndTags(value);\n stack.popTag(value);\n }\n return;\n\n case \"li\":\n if (!stack.inListItemScope(value)) return;\n stack.generateImpliedEndTags(value);\n stack.popTag(value);\n return;\n\n case \"dd\":\n case \"dt\":\n if (!stack.inScope(value)) return;\n stack.generateImpliedEndTags(value);\n stack.popTag(value);\n return;\n\n case \"h1\":\n case \"h2\":\n case \"h3\":\n case \"h4\":\n case \"h5\":\n case \"h6\":\n if (!stack.elementTypeInScope(impl.HTMLHeadingElement)) return;\n stack.generateImpliedEndTags();\n stack.popElementType(impl.HTMLHeadingElement);\n return;\n\n case \"sarcasm\":\n // Take a deep breath, and then:\n break;\n\n case \"a\":\n case \"b\":\n case \"big\":\n case \"code\":\n case \"em\":\n case \"font\":\n case \"i\":\n case \"nobr\":\n case \"s\":\n case \"small\":\n case \"strike\":\n case \"strong\":\n case \"tt\":\n case \"u\":\n var result = adoptionAgency(value);\n if (result) return; // If we did something we're done\n break; // Go to the \"any other end tag\" case\n\n case \"applet\":\n case \"marquee\":\n case \"object\":\n if (!stack.inScope(value)) return;\n stack.generateImpliedEndTags();\n stack.popTag(value);\n afe.clearToMarker();\n return;\n\n case \"br\":\n in_body_mode(TAG, value, null); // Turn
into
\n return;\n }\n\n // Any other end tag goes here\n for(i = stack.elements.length-1; i >= 0; i--) {\n node = stack.elements[i];\n if (isA(node, value)) {\n stack.generateImpliedEndTags(value);\n stack.popElement(node);\n break;\n }\n else if (isA(node, specialSet)) {\n return;\n }\n }\n\n return;\n }\n }\n\n function text_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n insertText(value);\n return;\n case -1: // EOF\n if (stack.top instanceof impl.HTMLScriptElement)\n stack.top._already_started = true;\n stack.pop();\n parser = originalInsertionMode;\n parser(t);\n return;\n case 3: // ENDTAG\n if (value === \"script\") {\n handleScriptEnd();\n }\n else {\n stack.pop();\n parser = originalInsertionMode;\n }\n return;\n default:\n // We should never get any other token types\n return;\n }\n }\n\n function in_table_mode(t, value, arg3, arg4) {\n function getTypeAttr(attrs) {\n for(var i = 0, n = attrs.length; i < n; i++) {\n if (attrs[i][0] === \"type\")\n return attrs[i][1].toLowerCase();\n }\n return null;\n }\n\n switch(t) {\n case 1: // TEXT\n // XXX the text_integration_mode stuff is\n // just a hack I made up\n if (text_integration_mode) {\n in_body_mode(t, value, arg3, arg4);\n return;\n }\n else if (isA(stack.top, tablesectionrowSet)) {\n pending_table_text = [];\n originalInsertionMode = parser;\n parser = in_table_text_mode;\n parser(t, value, arg3, arg4);\n return;\n }\n break;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case 2: // TAG\n switch(value) {\n case \"caption\":\n stack.clearToContext(tableContextSet);\n afe.insertMarker();\n insertHTMLElement(value,arg3);\n parser = in_caption_mode;\n return;\n case \"colgroup\":\n stack.clearToContext(tableContextSet);\n insertHTMLElement(value,arg3);\n parser = in_column_group_mode;\n return;\n case \"col\":\n in_table_mode(TAG, \"colgroup\", null);\n parser(t, value, arg3, arg4);\n return;\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n stack.clearToContext(tableContextSet);\n insertHTMLElement(value,arg3);\n parser = in_table_body_mode;\n return;\n case \"td\":\n case \"th\":\n case \"tr\":\n in_table_mode(TAG, \"tbody\", null);\n parser(t, value, arg3, arg4);\n return;\n\n case \"table\":\n if (!stack.inTableScope(value)) {\n return; // Ignore the token\n }\n in_table_mode(ENDTAG, value);\n parser(t, value, arg3, arg4);\n return;\n\n case \"style\":\n case \"script\":\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n\n case \"input\":\n var type = getTypeAttr(arg3);\n if (type !== \"hidden\") break; // to the anything else case\n insertHTMLElement(value,arg3);\n stack.pop();\n return;\n\n case \"form\":\n if (form_element_pointer || stack.contains(\"template\")) return;\n form_element_pointer = insertHTMLElement(value, arg3);\n stack.popElement(form_element_pointer);\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"table\":\n if (!stack.inTableScope(value)) return;\n stack.popTag(value);\n resetInsertionMode();\n return;\n case \"body\":\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"html\":\n case \"tbody\":\n case \"td\":\n case \"tfoot\":\n case \"th\":\n case \"thead\":\n case \"tr\":\n return;\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n\n break;\n case -1: // EOF\n in_body_mode(t, value, arg3, arg4);\n return;\n }\n\n // This is the anything else case\n foster_parent_mode = true;\n in_body_mode(t, value, arg3, arg4);\n foster_parent_mode = false;\n }\n\n function in_table_text_mode(t, value, arg3, arg4) {\n if (t === TEXT) {\n if (textIncludesNUL) {\n value = value.replace(NULCHARS, \"\");\n if (value.length === 0) return;\n }\n pending_table_text.push(value);\n }\n else {\n var s = pending_table_text.join(\"\");\n pending_table_text.length = 0;\n if (NONWS.test(s)) { // If any non-whitespace characters\n // This must be the same code as the \"anything else\"\n // case of the in_table mode above.\n foster_parent_mode = true;\n in_body_mode(TEXT, s);\n foster_parent_mode = false;\n }\n else {\n insertText(s);\n }\n parser = originalInsertionMode;\n parser(t, value, arg3, arg4);\n }\n }\n\n\n function in_caption_mode(t, value, arg3, arg4) {\n function end_caption() {\n if (!stack.inTableScope(\"caption\")) return false;\n stack.generateImpliedEndTags();\n stack.popTag(\"caption\");\n afe.clearToMarker();\n parser = in_table_mode;\n return true;\n }\n\n switch(t) {\n case 2: // TAG\n switch(value) {\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"td\":\n case \"tfoot\":\n case \"th\":\n case \"thead\":\n case \"tr\":\n if (end_caption()) parser(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"caption\":\n end_caption();\n return;\n case \"table\":\n if (end_caption()) parser(t, value, arg3, arg4);\n return;\n case \"body\":\n case \"col\":\n case \"colgroup\":\n case \"html\":\n case \"tbody\":\n case \"td\":\n case \"tfoot\":\n case \"th\":\n case \"thead\":\n case \"tr\":\n return;\n }\n break;\n }\n\n // The Anything Else case\n in_body_mode(t, value, arg3, arg4);\n }\n\n function in_column_group_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n var ws = value.match(LEADINGWS);\n if (ws) {\n insertText(ws[0]);\n value = value.substring(ws[0].length);\n }\n if (value.length === 0) return;\n break; // Handle non-whitespace below\n\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"col\":\n insertHTMLElement(value, arg3);\n stack.pop();\n return;\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"colgroup\":\n if (!isA(stack.top, 'colgroup')) {\n return; // Ignore the token.\n }\n stack.pop();\n parser = in_table_mode;\n return;\n case \"col\":\n return;\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n case -1: // EOF\n in_body_mode(t, value, arg3, arg4);\n return;\n }\n\n // Anything else\n if (!isA(stack.top, 'colgroup')) {\n return; // Ignore the token.\n }\n in_column_group_mode(ENDTAG, \"colgroup\");\n parser(t, value, arg3, arg4);\n }\n\n function in_table_body_mode(t, value, arg3, arg4) {\n function endsect() {\n if (!stack.inTableScope(\"tbody\") &&\n !stack.inTableScope(\"thead\") &&\n !stack.inTableScope(\"tfoot\"))\n return;\n stack.clearToContext(tableBodyContextSet);\n in_table_body_mode(ENDTAG, stack.top.localName, null);\n parser(t, value, arg3, arg4);\n }\n\n switch(t) {\n case 2: // TAG\n switch(value) {\n case \"tr\":\n stack.clearToContext(tableBodyContextSet);\n insertHTMLElement(value, arg3);\n parser = in_row_mode;\n return;\n case \"th\":\n case \"td\":\n in_table_body_mode(TAG, \"tr\", null);\n parser(t, value, arg3, arg4);\n return;\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n endsect();\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"table\":\n endsect();\n return;\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n if (stack.inTableScope(value)) {\n stack.clearToContext(tableBodyContextSet);\n stack.pop();\n parser = in_table_mode;\n }\n return;\n case \"body\":\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"html\":\n case \"td\":\n case \"th\":\n case \"tr\":\n return;\n }\n break;\n }\n\n // Anything else:\n in_table_mode(t, value, arg3, arg4);\n }\n\n function in_row_mode(t, value, arg3, arg4) {\n function endrow() {\n if (!stack.inTableScope(\"tr\")) return false;\n stack.clearToContext(tableRowContextSet);\n stack.pop();\n parser = in_table_body_mode;\n return true;\n }\n\n switch(t) {\n case 2: // TAG\n switch(value) {\n case \"th\":\n case \"td\":\n stack.clearToContext(tableRowContextSet);\n insertHTMLElement(value, arg3);\n parser = in_cell_mode;\n afe.insertMarker();\n return;\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n case \"tr\":\n if (endrow()) parser(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"tr\":\n endrow();\n return;\n case \"table\":\n if (endrow()) parser(t, value, arg3, arg4);\n return;\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n if (stack.inTableScope(value)) {\n if (endrow()) parser(t, value, arg3, arg4);\n }\n return;\n case \"body\":\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"html\":\n case \"td\":\n case \"th\":\n return;\n }\n break;\n }\n\n // anything else\n in_table_mode(t, value, arg3, arg4);\n }\n\n function in_cell_mode(t, value, arg3, arg4) {\n switch(t) {\n case 2: // TAG\n switch(value) {\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"tbody\":\n case \"td\":\n case \"tfoot\":\n case \"th\":\n case \"thead\":\n case \"tr\":\n if (stack.inTableScope(\"td\")) {\n in_cell_mode(ENDTAG, \"td\");\n parser(t, value, arg3, arg4);\n }\n else if (stack.inTableScope(\"th\")) {\n in_cell_mode(ENDTAG, \"th\");\n parser(t, value, arg3, arg4);\n }\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"td\":\n case \"th\":\n if (!stack.inTableScope(value)) return;\n stack.generateImpliedEndTags();\n stack.popTag(value);\n afe.clearToMarker();\n parser = in_row_mode;\n return;\n\n case \"body\":\n case \"caption\":\n case \"col\":\n case \"colgroup\":\n case \"html\":\n return;\n\n case \"table\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n case \"tr\":\n if (!stack.inTableScope(value)) return;\n in_cell_mode(ENDTAG, stack.inTableScope(\"td\") ? \"td\" : \"th\");\n parser(t, value, arg3, arg4);\n return;\n }\n break;\n }\n\n // anything else\n in_body_mode(t, value, arg3, arg4);\n }\n\n function in_select_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n if (textIncludesNUL) {\n value = value.replace(NULCHARS, \"\");\n if (value.length === 0) return;\n }\n insertText(value);\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case -1: // EOF\n in_body_mode(t, value, arg3, arg4);\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"option\":\n if (stack.top instanceof impl.HTMLOptionElement)\n in_select_mode(ENDTAG, value);\n insertHTMLElement(value, arg3);\n return;\n case \"optgroup\":\n if (stack.top instanceof impl.HTMLOptionElement)\n in_select_mode(ENDTAG, \"option\");\n if (stack.top instanceof impl.HTMLOptGroupElement)\n in_select_mode(ENDTAG, value);\n insertHTMLElement(value, arg3);\n return;\n case \"select\":\n in_select_mode(ENDTAG, value); // treat it as a close tag\n return;\n\n case \"input\":\n case \"keygen\":\n case \"textarea\":\n if (!stack.inSelectScope(\"select\")) return;\n in_select_mode(ENDTAG, \"select\");\n parser(t, value, arg3, arg4);\n return;\n\n case \"script\":\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n switch(value) {\n case \"optgroup\":\n if (stack.top instanceof impl.HTMLOptionElement &&\n stack.elements[stack.elements.length-2] instanceof\n impl.HTMLOptGroupElement) {\n in_select_mode(ENDTAG, \"option\");\n }\n if (stack.top instanceof impl.HTMLOptGroupElement)\n stack.pop();\n\n return;\n\n case \"option\":\n if (stack.top instanceof impl.HTMLOptionElement)\n stack.pop();\n return;\n\n case \"select\":\n if (!stack.inSelectScope(value)) return;\n stack.popTag(value);\n resetInsertionMode();\n return;\n\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n\n break;\n }\n\n // anything else: just ignore the token\n }\n\n function in_select_in_table_mode(t, value, arg3, arg4) {\n switch(value) {\n case \"caption\":\n case \"table\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n case \"tr\":\n case \"td\":\n case \"th\":\n switch(t) {\n case 2: // TAG\n in_select_in_table_mode(ENDTAG, \"select\");\n parser(t, value, arg3, arg4);\n return;\n case 3: // ENDTAG\n if (stack.inTableScope(value)) {\n in_select_in_table_mode(ENDTAG, \"select\");\n parser(t, value, arg3, arg4);\n }\n return;\n }\n }\n\n // anything else\n in_select_mode(t, value, arg3, arg4);\n }\n\n function in_template_mode(t, value, arg3, arg4) {\n function switchModeAndReprocess(mode) {\n parser = mode;\n templateInsertionModes[templateInsertionModes.length-1] = parser;\n parser(t, value, arg3, arg4);\n }\n switch(t) {\n case 1: // TEXT\n case 4: // COMMENT\n case 5: // DOCTYPE\n in_body_mode(t, value, arg3, arg4);\n return;\n case -1: // EOF\n if (!stack.contains(\"template\")) {\n stopParsing();\n } else {\n stack.popTag(\"template\");\n afe.clearToMarker();\n templateInsertionModes.pop();\n resetInsertionMode();\n parser(t, value, arg3, arg4);\n }\n return;\n case 2: // TAG\n switch(value) {\n case \"base\":\n case \"basefont\":\n case \"bgsound\":\n case \"link\":\n case \"meta\":\n case \"noframes\":\n case \"script\":\n case \"style\":\n case \"template\":\n case \"title\":\n in_head_mode(t, value, arg3, arg4);\n return;\n case \"caption\":\n case \"colgroup\":\n case \"tbody\":\n case \"tfoot\":\n case \"thead\":\n switchModeAndReprocess(in_table_mode);\n return;\n case \"col\":\n switchModeAndReprocess(in_column_group_mode);\n return;\n case \"tr\":\n switchModeAndReprocess(in_table_body_mode);\n return;\n case \"td\":\n case \"th\":\n switchModeAndReprocess(in_row_mode);\n return;\n }\n switchModeAndReprocess(in_body_mode);\n return;\n case 3: // ENDTAG\n switch(value) {\n case \"template\":\n in_head_mode(t, value, arg3, arg4);\n return;\n default:\n return;\n }\n }\n }\n\n function after_body_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n // If any non-space chars, handle below\n if (NONWS.test(value)) break;\n in_body_mode(t, value);\n return;\n case 4: // COMMENT\n // Append it to the element\n stack.elements[0]._appendChild(doc.createComment(value));\n return;\n case 5: // DOCTYPE\n return;\n case -1: // EOF\n stopParsing();\n return;\n case 2: // TAG\n if (value === \"html\") {\n in_body_mode(t, value, arg3, arg4);\n return;\n }\n break; // for any other tags\n case 3: // ENDTAG\n if (value === \"html\") {\n if (fragment) return;\n parser = after_after_body_mode;\n return;\n }\n break; // for any other tags\n }\n\n // anything else\n parser = in_body_mode;\n parser(t, value, arg3, arg4);\n }\n\n function in_frameset_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n // Ignore any non-space characters\n value = value.replace(ALLNONWS, \"\");\n if (value.length > 0) insertText(value);\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case -1: // EOF\n stopParsing();\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"frameset\":\n insertHTMLElement(value, arg3);\n return;\n case \"frame\":\n insertHTMLElement(value, arg3);\n stack.pop();\n return;\n case \"noframes\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n if (value === \"frameset\") {\n if (fragment && stack.top instanceof impl.HTMLHtmlElement)\n return;\n stack.pop();\n if (!fragment &&\n !(stack.top instanceof impl.HTMLFrameSetElement))\n parser = after_frameset_mode;\n return;\n }\n break;\n }\n\n // ignore anything else\n }\n\n function after_frameset_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n // Ignore any non-space characters\n value = value.replace(ALLNONWS, \"\");\n if (value.length > 0) insertText(value);\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n return;\n case -1: // EOF\n stopParsing();\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"noframes\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n case 3: // ENDTAG\n if (value === \"html\") {\n parser = after_after_frameset_mode;\n return;\n }\n break;\n }\n\n // ignore anything else\n }\n\n function after_after_body_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n // If any non-space chars, handle below\n if (NONWS.test(value)) break;\n in_body_mode(t, value, arg3, arg4);\n return;\n case 4: // COMMENT\n doc._appendChild(doc.createComment(value));\n return;\n case 5: // DOCTYPE\n in_body_mode(t, value, arg3, arg4);\n return;\n case -1: // EOF\n stopParsing();\n return;\n case 2: // TAG\n if (value === \"html\") {\n in_body_mode(t, value, arg3, arg4);\n return;\n }\n break;\n }\n\n // anything else\n parser = in_body_mode;\n parser(t, value, arg3, arg4);\n }\n\n function after_after_frameset_mode(t, value, arg3, arg4) {\n switch(t) {\n case 1: // TEXT\n // Ignore any non-space characters\n value = value.replace(ALLNONWS, \"\");\n if (value.length > 0)\n in_body_mode(t, value, arg3, arg4);\n return;\n case 4: // COMMENT\n doc._appendChild(doc.createComment(value));\n return;\n case 5: // DOCTYPE\n in_body_mode(t, value, arg3, arg4);\n return;\n case -1: // EOF\n stopParsing();\n return;\n case 2: // TAG\n switch(value) {\n case \"html\":\n in_body_mode(t, value, arg3, arg4);\n return;\n case \"noframes\":\n in_head_mode(t, value, arg3, arg4);\n return;\n }\n break;\n }\n\n // ignore anything else\n }\n\n\n // 13.2.5.5 The rules for parsing tokens in foreign content\n //\n // This is like one of the insertion modes above, but is\n // invoked somewhat differently when the current token is not HTML.\n // See the insertToken() function.\n function insertForeignToken(t, value, arg3, arg4) {\n // A tag is an HTML font tag if it has a color, font, or size\n // attribute. Otherwise we assume it is foreign content\n function isHTMLFont(attrs) {\n for(var i = 0, n = attrs.length; i < n; i++) {\n switch(attrs[i][0]) {\n case \"color\":\n case \"face\":\n case \"size\":\n return true;\n }\n }\n return false;\n }\n\n var current;\n\n switch(t) {\n case 1: // TEXT\n // If any non-space, non-nul characters\n if (frameset_ok && NONWSNONNUL.test(value))\n frameset_ok = false;\n if (textIncludesNUL) {\n value = value.replace(NULCHARS, \"\\uFFFD\");\n }\n insertText(value);\n return;\n case 4: // COMMENT\n insertComment(value);\n return;\n case 5: // DOCTYPE\n // ignore it\n return;\n case 2: // TAG\n switch(value) {\n case \"font\":\n if (!isHTMLFont(arg3)) break;\n /* falls through */\n case \"b\":\n case \"big\":\n case \"blockquote\":\n case \"body\":\n case \"br\":\n case \"center\":\n case \"code\":\n case \"dd\":\n case \"div\":\n case \"dl\":\n case \"dt\":\n case \"em\":\n case \"embed\":\n case \"h1\":\n case \"h2\":\n case \"h3\":\n case \"h4\":\n case \"h5\":\n case \"h6\":\n case \"head\":\n case \"hr\":\n case \"i\":\n case \"img\":\n case \"li\":\n case \"listing\":\n case \"menu\":\n case \"meta\":\n case \"nobr\":\n case \"ol\":\n case \"p\":\n case \"pre\":\n case \"ruby\":\n case \"s\":\n case \"small\":\n case \"span\":\n case \"strong\":\n case \"strike\":\n case \"sub\":\n case \"sup\":\n case \"table\":\n case \"tt\":\n case \"u\":\n case \"ul\":\n case \"var\":\n if (fragment) {\n break;\n }\n do {\n stack.pop();\n current = stack.top;\n } while(current.namespaceURI !== NAMESPACE.HTML &&\n !isMathmlTextIntegrationPoint(current) &&\n !isHTMLIntegrationPoint(current));\n\n insertToken(t, value, arg3, arg4); // reprocess\n return;\n }\n\n // Any other start tag case goes here\n current = (stack.elements.length===1 && fragment) ? fragmentContext :\n stack.top;\n if (current.namespaceURI === NAMESPACE.MATHML) {\n adjustMathMLAttributes(arg3);\n }\n else if (current.namespaceURI === NAMESPACE.SVG) {\n value = adjustSVGTagName(value);\n adjustSVGAttributes(arg3);\n }\n adjustForeignAttributes(arg3);\n\n insertForeignElement(value, arg3, current.namespaceURI);\n if (arg4) { // the self-closing flag\n if (value === 'script' && current.namespaceURI === NAMESPACE.SVG) {\n // XXX deal with SVG scripts here\n }\n stack.pop();\n }\n return;\n\n case 3: // ENDTAG\n current = stack.top;\n if (value === \"script\" &&\n current.namespaceURI === NAMESPACE.SVG &&\n current.localName === \"script\") {\n\n stack.pop();\n\n // XXX\n // Deal with SVG scripts here\n }\n else {\n // The any other end tag case\n var i = stack.elements.length-1;\n var node = stack.elements[i];\n for(;;) {\n if (node.localName.toLowerCase() === value) {\n stack.popElement(node);\n break;\n }\n node = stack.elements[--i];\n // If non-html, keep looping\n if (node.namespaceURI !== NAMESPACE.HTML)\n continue;\n // Otherwise process the end tag as html\n parser(t, value, arg3, arg4);\n break;\n }\n }\n return;\n }\n }\n\n /***\n * Finally, this is the end of the HTMLParser() factory function.\n * It returns the htmlparser object with the append() and end() methods.\n */\n\n // Sneak another method into the htmlparser object to allow us to run\n // tokenizer tests. This can be commented out in production code.\n // This is a hook for testing the tokenizer. It has to be here\n // because the tokenizer details are all hidden away within the closure.\n // It should return an array of tokens generated while parsing the\n // input string.\n htmlparser.testTokenizer = function(input, initialState, lastStartTag, charbychar) {\n var tokens = [];\n\n switch(initialState) {\n case \"PCDATA state\":\n tokenizer = data_state;\n break;\n case \"RCDATA state\":\n tokenizer = rcdata_state;\n break;\n case \"RAWTEXT state\":\n tokenizer = rawtext_state;\n break;\n case \"PLAINTEXT state\":\n tokenizer = plaintext_state;\n break;\n }\n\n if (lastStartTag) {\n lasttagname = lastStartTag;\n }\n\n insertToken = function(t, value, arg3, arg4) {\n flushText();\n switch(t) {\n case 1: // TEXT\n if (tokens.length > 0 &&\n tokens[tokens.length-1][0] === \"Character\") {\n tokens[tokens.length-1][1] += value;\n }\n else tokens.push([\"Character\", value]);\n break;\n case 4: // COMMENT\n tokens.push([\"Comment\", value]);\n break;\n case 5: // DOCTYPE\n tokens.push([\"DOCTYPE\", value,\n arg3 === undefined ? null : arg3,\n arg4 === undefined ? null : arg4,\n !force_quirks]);\n break;\n case 2: // TAG\n var attrs = Object.create(null);\n for(var i = 0; i < arg3.length; i++) {\n // XXX: does attribute order matter?\n var a = arg3[i];\n if (a.length === 1) {\n attrs[a[0]] = \"\";\n }\n else {\n attrs[a[0]] = a[1];\n }\n }\n var token = [\"StartTag\", value, attrs];\n if (arg4) token.push(true);\n tokens.push(token);\n break;\n case 3: // ENDTAG\n tokens.push([\"EndTag\", value]);\n break;\n case -1: // EOF\n break;\n }\n };\n\n if (!charbychar) {\n this.parse(input, true);\n }\n else {\n for(var i = 0; i < input.length; i++) {\n this.parse(input[i]);\n }\n this.parse(\"\", true);\n }\n return tokens;\n };\n\n // Return the parser object from the HTMLParser() factory function\n return htmlparser;\n}\n","\"use strict\";\nmodule.exports = Leaf;\n\nvar Node = require('./Node');\nvar NodeList = require('./NodeList');\nvar utils = require('./utils');\nvar HierarchyRequestError = utils.HierarchyRequestError;\nvar NotFoundError = utils.NotFoundError;\n\n// This class defines common functionality for node subtypes that\n// can never have children\nfunction Leaf() {\n Node.call(this);\n}\n\nLeaf.prototype = Object.create(Node.prototype, {\n hasChildNodes: { value: function() { return false; }},\n firstChild: { value: null },\n lastChild: { value: null },\n insertBefore: { value: function(node, child) {\n if (!node.nodeType) throw new TypeError('not a node');\n HierarchyRequestError();\n }},\n replaceChild: { value: function(node, child) {\n if (!node.nodeType) throw new TypeError('not a node');\n HierarchyRequestError();\n }},\n removeChild: { value: function(node) {\n if (!node.nodeType) throw new TypeError('not a node');\n NotFoundError();\n }},\n removeChildren: { value: function() { /* no op */ }},\n childNodes: { get: function() {\n if (!this._childNodes) this._childNodes = new NodeList();\n return this._childNodes;\n }}\n});\n","\"use strict\";\nvar utils = require('./utils');\n\nvar LinkedList = module.exports = {\n // basic validity tests on a circular linked list a\n valid: function(a) {\n utils.assert(a, \"list falsy\");\n utils.assert(a._previousSibling, \"previous falsy\");\n utils.assert(a._nextSibling, \"next falsy\");\n // xxx check that list is actually circular\n return true;\n },\n // insert a before b\n insertBefore: function(a, b) {\n utils.assert(LinkedList.valid(a) && LinkedList.valid(b));\n var a_first = a, a_last = a._previousSibling;\n var b_first = b, b_last = b._previousSibling;\n a_first._previousSibling = b_last;\n a_last._nextSibling = b_first;\n b_last._nextSibling = a_first;\n b_first._previousSibling = a_last;\n utils.assert(LinkedList.valid(a) && LinkedList.valid(b));\n },\n // replace a single node a with a list b (which could be null)\n replace: function(a, b) {\n utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b)));\n if (b!==null) {\n LinkedList.insertBefore(b, a);\n }\n LinkedList.remove(a);\n utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b)));\n },\n // remove single node a from its list\n remove: function(a) {\n utils.assert(LinkedList.valid(a));\n var prev = a._previousSibling;\n if (prev === a) { return; }\n var next = a._nextSibling;\n prev._nextSibling = next;\n next._previousSibling = prev;\n a._previousSibling = a._nextSibling = a;\n utils.assert(LinkedList.valid(a));\n }\n};\n","\"use strict\";\nvar URL = require('./URL');\nvar URLUtils = require('./URLUtils');\n\nmodule.exports = Location;\n\nfunction Location(window, href) {\n this._window = window;\n this._href = href;\n}\n\nLocation.prototype = Object.create(URLUtils.prototype, {\n constructor: { value: Location },\n\n // Special behavior when href is set\n href: {\n get: function() { return this._href; },\n set: function(v) { this.assign(v); }\n },\n\n assign: { value: function(url) {\n // Resolve the new url against the current one\n // XXX:\n // This is not actually correct. It should be resolved against\n // the URL of the document of the script. For now, though, I only\n // support a single window and there is only one base url.\n // So this is good enough for now.\n var current = new URL(this._href);\n var newurl = current.resolve(url);\n\n // Save the new url\n this._href = newurl;\n\n // Start loading the new document!\n // XXX\n // This is just something hacked together.\n // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate\n }},\n\n replace: { value: function(url) {\n // XXX\n // Since we aren't tracking history yet, replace is the same as assign\n this.assign(url);\n }},\n\n reload: { value: function() {\n // XXX:\n // Actually, the spec is a lot more complicated than this\n this.assign(this.href);\n }},\n\n toString: { value: function() {\n return this.href;\n }}\n\n});\n","\"use strict\";\nvar UIEvent = require('./UIEvent');\n\nmodule.exports = MouseEvent;\n\nfunction MouseEvent() {\n // Just use the superclass constructor to initialize\n UIEvent.call(this);\n\n this.screenX = this.screenY = this.clientX = this.clientY = 0;\n this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false;\n this.button = 0;\n this.buttons = 1;\n this.relatedTarget = null;\n}\nMouseEvent.prototype = Object.create(UIEvent.prototype, {\n constructor: { value: MouseEvent },\n initMouseEvent: { value: function(type, bubbles, cancelable,\n view, detail,\n screenX, screenY, clientX, clientY,\n ctrlKey, altKey, shiftKey, metaKey,\n button, relatedTarget) {\n\n this.initEvent(type, bubbles, cancelable, view, detail);\n this.screenX = screenX;\n this.screenY = screenY;\n this.clientX = clientX;\n this.clientY = clientY;\n this.ctrlKey = ctrlKey;\n this.altKey = altKey;\n this.shiftKey = shiftKey;\n this.metaKey = metaKey;\n this.button = button;\n switch(button) {\n case 0: this.buttons = 1; break;\n case 1: this.buttons = 4; break;\n case 2: this.buttons = 2; break;\n default: this.buttons = 0; break;\n }\n this.relatedTarget = relatedTarget;\n }},\n\n getModifierState: { value: function(key) {\n switch(key) {\n case \"Alt\": return this.altKey;\n case \"Control\": return this.ctrlKey;\n case \"Shift\": return this.shiftKey;\n case \"Meta\": return this.metaKey;\n default: return false;\n }\n }}\n});\n","\"use strict\";\nmodule.exports = {\n VALUE: 1, // The value of a Text, Comment or PI node changed\n ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed\n REMOVE_ATTR: 3, // An attribute was removed\n REMOVE: 4, // A node was removed\n MOVE: 5, // A node was moved\n INSERT: 6 // A node (or a subtree of nodes) was inserted\n};","\"use strict\";\nmodule.exports = NamedNodeMap;\n\nvar utils = require('./utils');\n\n/* This is a hacky implementation of NamedNodeMap, intended primarily to\n * satisfy clients (like dompurify and the web-platform-tests) which check\n * to ensure that Node#attributes instanceof NamedNodeMap. */\n\nfunction NamedNodeMap(element) {\n this.element = element;\n}\nObject.defineProperties(NamedNodeMap.prototype, {\n length: { get: utils.shouldOverride },\n item: { value: utils.shouldOverride },\n\n getNamedItem: { value: function getNamedItem(qualifiedName) {\n return this.element.getAttributeNode(qualifiedName);\n } },\n getNamedItemNS: { value: function getNamedItemNS(namespace, localName) {\n return this.element.getAttributeNodeNS(namespace, localName);\n } },\n setNamedItem: { value: utils.nyi },\n setNamedItemNS: { value: utils.nyi },\n removeNamedItem: { value: function removeNamedItem(qualifiedName) {\n var attr = this.element.getAttributeNode(qualifiedName);\n if (attr) {\n this.element.removeAttribute(qualifiedName);\n return attr;\n }\n utils.NotFoundError();\n } },\n removeNamedItemNS: { value: function removeNamedItemNS(ns, lname) {\n var attr = this.element.getAttributeNodeNS(ns, lname);\n if (attr) {\n this.element.removeAttributeNS(ns, lname);\n return attr;\n }\n utils.NotFoundError();\n } },\n});\n","\"use strict\";\n\n// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid\nvar NavigatorID = Object.create(null, {\n appCodeName: { value: \"Mozilla\" },\n appName: { value: \"Netscape\" },\n appVersion: { value: \"4.0\" },\n platform: { value: \"\" },\n product: { value: \"Gecko\" },\n productSub: { value: \"20100101\" },\n userAgent: { value: \"\" },\n vendor: { value: \"\" },\n vendorSub: { value: \"\" },\n taintEnabled: { value: function() { return false; } }\n});\n\nmodule.exports = NavigatorID;\n","\"use strict\";\nmodule.exports = Node;\n\nvar EventTarget = require('./EventTarget');\nvar LinkedList = require('./LinkedList');\nvar NodeUtils = require('./NodeUtils');\nvar utils = require('./utils');\n\n// All nodes have a nodeType and an ownerDocument.\n// Once inserted, they also have a parentNode.\n// This is an abstract class; all nodes in a document are instances\n// of a subtype, so all the properties are defined by more specific\n// constructors.\nfunction Node() {\n EventTarget.call(this);\n this.parentNode = null;\n this._nextSibling = this._previousSibling = this;\n this._index = undefined;\n}\n\nvar ELEMENT_NODE = Node.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = Node.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = Node.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = Node.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = Node.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = Node.NOTATION_NODE = 12;\n\nvar DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 0x01;\nvar DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 0x02;\nvar DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 0x04;\nvar DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 0x08;\nvar DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10;\nvar DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;\n\nNode.prototype = Object.create(EventTarget.prototype, {\n\n // Node that are not inserted into the tree inherit a null parent\n\n // XXX: the baseURI attribute is defined by dom core, but\n // a correct implementation of it requires HTML features, so\n // we'll come back to this later.\n baseURI: { get: utils.nyi },\n\n parentElement: { get: function() {\n return (this.parentNode && this.parentNode.nodeType===ELEMENT_NODE) ? this.parentNode : null;\n }},\n\n hasChildNodes: { value: utils.shouldOverride },\n\n firstChild: { get: utils.shouldOverride },\n\n lastChild: { get: utils.shouldOverride },\n\n previousSibling: { get: function() {\n var parent = this.parentNode;\n if (!parent) return null;\n if (this === parent.firstChild) return null;\n return this._previousSibling;\n }},\n\n nextSibling: { get: function() {\n var parent = this.parentNode, next = this._nextSibling;\n if (!parent) return null;\n if (next === parent.firstChild) return null;\n return next;\n }},\n\n textContent: {\n // Should override for DocumentFragment/Element/Attr/Text/PI/Comment\n get: function() { return null; },\n set: function(v) { /* do nothing */ },\n },\n\n _countChildrenOfType: { value: function(type) {\n var sum = 0;\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === type) sum++;\n }\n return sum;\n }},\n\n _ensureInsertValid: { value: function _ensureInsertValid(node, child, isPreinsert) {\n var parent = this, i, kid;\n if (!node.nodeType) throw new TypeError('not a node');\n // 1. If parent is not a Document, DocumentFragment, or Element\n // node, throw a HierarchyRequestError.\n switch (parent.nodeType) {\n case DOCUMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n case ELEMENT_NODE:\n break;\n default: utils.HierarchyRequestError();\n }\n // 2. If node is a host-including inclusive ancestor of parent,\n // throw a HierarchyRequestError.\n if (node.isAncestor(parent)) utils.HierarchyRequestError();\n // 3. If child is not null and its parent is not parent, then\n // throw a NotFoundError. (replaceChild omits the 'child is not null'\n // and throws a TypeError here if child is null.)\n if (child !== null || !isPreinsert) {\n if (child.parentNode !== parent) utils.NotFoundError();\n }\n // 4. If node is not a DocumentFragment, DocumentType, Element,\n // Text, ProcessingInstruction, or Comment node, throw a\n // HierarchyRequestError.\n switch (node.nodeType) {\n case DOCUMENT_FRAGMENT_NODE:\n case DOCUMENT_TYPE_NODE:\n case ELEMENT_NODE:\n case TEXT_NODE:\n case PROCESSING_INSTRUCTION_NODE:\n case COMMENT_NODE:\n break;\n default: utils.HierarchyRequestError();\n }\n // 5. If either node is a Text node and parent is a document, or\n // node is a doctype and parent is not a document, throw a\n // HierarchyRequestError.\n // 6. If parent is a document, and any of the statements below, switched\n // on node, are true, throw a HierarchyRequestError.\n if (parent.nodeType === DOCUMENT_NODE) {\n switch (node.nodeType) {\n case TEXT_NODE:\n utils.HierarchyRequestError();\n break;\n case DOCUMENT_FRAGMENT_NODE:\n // 6a1. If node has more than one element child or has a Text\n // node child.\n if (node._countChildrenOfType(TEXT_NODE) > 0)\n utils.HierarchyRequestError();\n switch (node._countChildrenOfType(ELEMENT_NODE)) {\n case 0:\n break;\n case 1:\n // 6a2. Otherwise, if node has one element child and either\n // parent has an element child, child is a doctype, or child\n // is not null and a doctype is following child. [preinsert]\n // 6a2. Otherwise, if node has one element child and either\n // parent has an element child that is not child or a\n // doctype is following child. [replaceWith]\n if (child !== null /* always true here for replaceWith */) {\n if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)\n utils.HierarchyRequestError();\n for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === DOCUMENT_TYPE_NODE)\n utils.HierarchyRequestError();\n }\n }\n i = parent._countChildrenOfType(ELEMENT_NODE);\n if (isPreinsert) {\n // \"parent has an element child\"\n if (i > 0)\n utils.HierarchyRequestError();\n } else {\n // \"parent has an element child that is not child\"\n if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE))\n utils.HierarchyRequestError();\n }\n break;\n default: // 6a1, continued. (more than one Element child)\n utils.HierarchyRequestError();\n }\n break;\n case ELEMENT_NODE:\n // 6b. parent has an element child, child is a doctype, or\n // child is not null and a doctype is following child. [preinsert]\n // 6b. parent has an element child that is not child or a\n // doctype is following child. [replaceWith]\n if (child !== null /* always true here for replaceWith */) {\n if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE)\n utils.HierarchyRequestError();\n for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === DOCUMENT_TYPE_NODE)\n utils.HierarchyRequestError();\n }\n }\n i = parent._countChildrenOfType(ELEMENT_NODE);\n if (isPreinsert) {\n // \"parent has an element child\"\n if (i > 0)\n utils.HierarchyRequestError();\n } else {\n // \"parent has an element child that is not child\"\n if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE))\n utils.HierarchyRequestError();\n }\n break;\n case DOCUMENT_TYPE_NODE:\n // 6c. parent has a doctype child, child is non-null and an\n // element is preceding child, or child is null and parent has\n // an element child. [preinsert]\n // 6c. parent has a doctype child that is not child, or an\n // element is preceding child. [replaceWith]\n if (child === null) {\n if (parent._countChildrenOfType(ELEMENT_NODE))\n utils.HierarchyRequestError();\n } else {\n // child is always non-null for [replaceWith] case\n for (kid = parent.firstChild; kid !== null; kid = kid.nextSibling) {\n if (kid === child) break;\n if (kid.nodeType === ELEMENT_NODE)\n utils.HierarchyRequestError();\n }\n }\n i = parent._countChildrenOfType(DOCUMENT_TYPE_NODE);\n if (isPreinsert) {\n // \"parent has an doctype child\"\n if (i > 0)\n utils.HierarchyRequestError();\n } else {\n // \"parent has an doctype child that is not child\"\n if (i > 1 || (i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE))\n utils.HierarchyRequestError();\n }\n break;\n }\n } else {\n // 5, continued: (parent is not a document)\n if (node.nodeType === DOCUMENT_TYPE_NODE) utils.HierarchyRequestError();\n }\n }},\n\n insertBefore: { value: function insertBefore(node, child) {\n var parent = this;\n // 1. Ensure pre-insertion validity\n parent._ensureInsertValid(node, child, true);\n // 2. Let reference child be child.\n var refChild = child;\n // 3. If reference child is node, set it to node's next sibling\n if (refChild === node) { refChild = node.nextSibling; }\n // 4. Adopt node into parent's node document.\n parent.doc.adoptNode(node);\n // 5. Insert node into parent before reference child.\n node._insertOrReplace(parent, refChild, false);\n // 6. Return node\n return node;\n }},\n\n\n appendChild: { value: function(child) {\n // This invokes _appendChild after doing validity checks.\n return this.insertBefore(child, null);\n }},\n\n _appendChild: { value: function(child) {\n child._insertOrReplace(this, null, false);\n }},\n\n removeChild: { value: function removeChild(child) {\n var parent = this;\n if (!child.nodeType) throw new TypeError('not a node');\n if (child.parentNode !== parent) utils.NotFoundError();\n child.remove();\n return child;\n }},\n\n // To replace a `child` with `node` within a `parent` (this)\n replaceChild: { value: function replaceChild(node, child) {\n var parent = this;\n // Ensure validity (slight differences from pre-insertion check)\n parent._ensureInsertValid(node, child, false);\n // Adopt node into parent's node document.\n if (node.doc !== parent.doc) {\n // XXX adoptNode has side-effect of removing node from its parent\n // and generating a mutation event, thus causing the _insertOrReplace\n // to generate two deletes and an insert instead of a 'move'\n // event. It looks like the new MutationObserver stuff avoids\n // this problem, but for now let's only adopt (ie, remove `node`\n // from its parent) here if we need to.\n parent.doc.adoptNode(node);\n }\n // Do the replace.\n node._insertOrReplace(parent, child, true);\n return child;\n }},\n\n // See: http://ejohn.org/blog/comparing-document-position/\n contains: { value: function contains(node) {\n if (node === null) { return false; }\n if (this === node) { return true; /* inclusive descendant */ }\n /* jshint bitwise: false */\n return (this.compareDocumentPosition(node) &\n DOCUMENT_POSITION_CONTAINED_BY) !== 0;\n }},\n\n compareDocumentPosition: { value: function compareDocumentPosition(that){\n // Basic algorithm for finding the relative position of two nodes.\n // Make a list the ancestors of each node, starting with the\n // document element and proceeding down to the nodes themselves.\n // Then, loop through the lists, looking for the first element\n // that differs. The order of those two elements give the\n // order of their descendant nodes. Or, if one list is a prefix\n // of the other one, then that node contains the other.\n\n if (this === that) return 0;\n\n // If they're not owned by the same document or if one is rooted\n // and one is not, then they're disconnected.\n if (this.doc !== that.doc ||\n this.rooted !== that.rooted)\n return (DOCUMENT_POSITION_DISCONNECTED +\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);\n\n // Get arrays of ancestors for this and that\n var these = [], those = [];\n for(var n = this; n !== null; n = n.parentNode) these.push(n);\n for(n = that; n !== null; n = n.parentNode) those.push(n);\n these.reverse(); // So we start with the outermost\n those.reverse();\n\n if (these[0] !== those[0]) // No common ancestor\n return (DOCUMENT_POSITION_DISCONNECTED +\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC);\n\n n = Math.min(these.length, those.length);\n for(var i = 1; i < n; i++) {\n if (these[i] !== those[i]) {\n // We found two different ancestors, so compare\n // their positions\n if (these[i].index < those[i].index)\n return DOCUMENT_POSITION_FOLLOWING;\n else\n return DOCUMENT_POSITION_PRECEDING;\n }\n }\n\n // If we get to here, then one of the nodes (the one with the\n // shorter list of ancestors) contains the other one.\n if (these.length < those.length)\n return (DOCUMENT_POSITION_FOLLOWING +\n DOCUMENT_POSITION_CONTAINED_BY);\n else\n return (DOCUMENT_POSITION_PRECEDING +\n DOCUMENT_POSITION_CONTAINS);\n }},\n\n isSameNode: {value : function isSameNode(node) {\n return this === node;\n }},\n\n\n // This method implements the generic parts of node equality testing\n // and defers to the (non-recursive) type-specific isEqual() method\n // defined by subclasses\n isEqualNode: { value: function isEqualNode(node) {\n if (!node) return false;\n if (node.nodeType !== this.nodeType) return false;\n\n // Check type-specific properties for equality\n if (!this.isEqual(node)) return false;\n\n // Now check children for number and equality\n for (var c1 = this.firstChild, c2 = node.firstChild;\n c1 && c2;\n c1 = c1.nextSibling, c2 = c2.nextSibling) {\n if (!c1.isEqualNode(c2)) return false;\n }\n return c1 === null && c2 === null;\n }},\n\n // This method delegates shallow cloning to a clone() method\n // that each concrete subclass must implement\n cloneNode: { value: function(deep) {\n // Clone this node\n var clone = this.clone();\n\n // Handle the recursive case if necessary\n if (deep) {\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n clone._appendChild(kid.cloneNode(true));\n }\n }\n\n return clone;\n }},\n\n lookupPrefix: { value: function lookupPrefix(ns) {\n var e;\n if (ns === '' || ns === null || ns === undefined) return null;\n switch(this.nodeType) {\n case ELEMENT_NODE:\n return this._lookupNamespacePrefix(ns, this);\n case DOCUMENT_NODE:\n e = this.documentElement;\n return e ? e.lookupPrefix(ns) : null;\n case ENTITY_NODE:\n case NOTATION_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n case DOCUMENT_TYPE_NODE:\n return null;\n case ATTRIBUTE_NODE:\n e = this.ownerElement;\n return e ? e.lookupPrefix(ns) : null;\n default:\n e = this.parentElement;\n return e ? e.lookupPrefix(ns) : null;\n }\n }},\n\n\n lookupNamespaceURI: {value: function lookupNamespaceURI(prefix) {\n if (prefix === '' || prefix === undefined) { prefix = null; }\n var e;\n switch(this.nodeType) {\n case ELEMENT_NODE:\n return utils.shouldOverride();\n case DOCUMENT_NODE:\n e = this.documentElement;\n return e ? e.lookupNamespaceURI(prefix) : null;\n case ENTITY_NODE:\n case NOTATION_NODE:\n case DOCUMENT_TYPE_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n return null;\n case ATTRIBUTE_NODE:\n e = this.ownerElement;\n return e ? e.lookupNamespaceURI(prefix) : null;\n default:\n e = this.parentElement;\n return e ? e.lookupNamespaceURI(prefix) : null;\n }\n }},\n\n isDefaultNamespace: { value: function isDefaultNamespace(ns) {\n if (ns === '' || ns === undefined) { ns = null; }\n var defaultNamespace = this.lookupNamespaceURI(null);\n return (defaultNamespace === ns);\n }},\n\n // Utility methods for nodes. Not part of the DOM\n\n // Return the index of this node in its parent.\n // Throw if no parent, or if this node is not a child of its parent\n index: { get: function() {\n var parent = this.parentNode;\n if (this === parent.firstChild) return 0; // fast case\n var kids = parent.childNodes;\n if (this._index === undefined || kids[this._index] !== this) {\n // Ensure that we don't have an O(N^2) blowup if none of the\n // kids have defined indices yet and we're traversing via\n // nextSibling or previousSibling\n for (var i=0; i 2 ? spliceArgs[2] : null);\n } else if (len > 2 && n !== null) {\n LinkedList.insertBefore(spliceArgs[2], n);\n }\n if (parent._childNodes) {\n spliceArgs[0] = (before === null) ?\n parent._childNodes.length : before._index;\n parent._childNodes.splice.apply(parent._childNodes, spliceArgs);\n for (i=2; i 2) {\n parent._firstChild = spliceArgs[2];\n } else if (isReplace) {\n parent._firstChild = null;\n }\n }\n // Remove all nodes from the document fragment\n if (child._childNodes) {\n child._childNodes.length = 0;\n } else {\n child._firstChild = null;\n }\n // Call the mutation handlers\n // Use spliceArgs since the original array has been destroyed. The\n // liveness guarantee requires us to clone the array so that\n // references to the childNodes of the DocumentFragment will be empty\n // when the insertion handlers are called.\n if (parent.rooted) {\n parent.modify();\n for (i = 2; i < len; i++) {\n parent.doc.mutateInsert(spliceArgs[i]);\n }\n }\n } else {\n if (before === child) { return; }\n if (bothRooted) {\n // Remove the child from its current position in the tree\n // without calling remove(), since we don't want to uproot it.\n child._remove();\n } else if (child.parentNode) {\n child.remove();\n }\n\n // Insert it as a child of its new parent\n child.parentNode = parent;\n if (isReplace) {\n LinkedList.replace(n, child);\n if (parent._childNodes) {\n child._index = before_index;\n parent._childNodes[before_index] = child;\n } else if (parent._firstChild === before) {\n parent._firstChild = child;\n }\n } else {\n if (n !== null) {\n LinkedList.insertBefore(child, n);\n }\n if (parent._childNodes) {\n child._index = before_index;\n parent._childNodes.splice(before_index, 0, child);\n } else if (parent._firstChild === before) {\n parent._firstChild = child;\n }\n }\n if (bothRooted) {\n parent.modify();\n // Generate a move mutation event\n parent.doc.mutateMove(child);\n } else if (parent.rooted) {\n parent.modify();\n parent.doc.mutateInsert(child);\n }\n }\n }},\n\n\n // Return the lastModTime value for this node. (For use as a\n // cache invalidation mechanism. If the node does not already\n // have one, initialize it from the owner document's modclock\n // property. (Note that modclock does not return the actual\n // time; it is simply a counter incremented on each document\n // modification)\n lastModTime: { get: function() {\n if (!this._lastModTime) {\n this._lastModTime = this.doc.modclock;\n }\n return this._lastModTime;\n }},\n\n // Increment the owner document's modclock and use the new\n // value to update the lastModTime value for this node and\n // all of its ancestors. Nodes that have never had their\n // lastModTime value queried do not need to have a\n // lastModTime property set on them since there is no\n // previously queried value to ever compare the new value\n // against, so only update nodes that already have a\n // _lastModTime property.\n modify: { value: function() {\n if (this.doc.modclock) { // Skip while doc.modclock == 0\n var time = ++this.doc.modclock;\n for(var n = this; n; n = n.parentElement) {\n if (n._lastModTime) {\n n._lastModTime = time;\n }\n }\n }\n }},\n\n // This attribute is not part of the DOM but is quite helpful.\n // It returns the document with which a node is associated. Usually\n // this is the ownerDocument. But ownerDocument is null for the\n // document object itself, so this is a handy way to get the document\n // regardless of the node type\n doc: { get: function() {\n return this.ownerDocument || this;\n }},\n\n\n // If the node has a nid (node id), then it is rooted in a document\n rooted: { get: function() {\n return !!this._nid;\n }},\n\n normalize: { value: function() {\n var next;\n for (var child=this.firstChild; child !== null; child=next) {\n next = child.nextSibling;\n\n if (child.normalize) {\n child.normalize();\n }\n\n if (child.nodeType !== Node.TEXT_NODE) {\n continue;\n }\n\n if (child.nodeValue === \"\") {\n this.removeChild(child);\n continue;\n }\n\n var prevChild = child.previousSibling;\n if (prevChild === null) {\n continue;\n } else if (prevChild.nodeType === Node.TEXT_NODE) {\n // merge this with previous and remove the child\n prevChild.appendData(child.nodeValue);\n this.removeChild(child);\n }\n }\n }},\n\n // Convert the children of a node to an HTML string.\n // This is used by the innerHTML getter\n // The serialization spec is at:\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments\n //\n // The serialization logic is intentionally implemented in a separate\n // `NodeUtils` helper instead of the more obvious choice of a private\n // `_serializeOne()` method on the `Node.prototype` in order to avoid\n // the megamorphic `this._serializeOne` property access, which reduces\n // performance unnecessarily. If you need specialized behavior for a\n // certain subclass, you'll need to implement that in `NodeUtils`.\n // See https://github.com/fgnass/domino/pull/142 for more information.\n serialize: { value: function() {\n var s = '';\n for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) {\n s += NodeUtils.serializeOne(kid, this);\n }\n return s;\n }},\n\n // Non-standard, but often useful for debugging.\n outerHTML: {\n get: function() {\n return NodeUtils.serializeOne(this, { nodeType: 0 });\n },\n set: utils.nyi,\n },\n\n // mirror node type properties in the prototype, so they are present\n // in instances of Node (and subclasses)\n ELEMENT_NODE: { value: ELEMENT_NODE },\n ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE },\n TEXT_NODE: { value: TEXT_NODE },\n CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE },\n ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE },\n ENTITY_NODE: { value: ENTITY_NODE },\n PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE },\n COMMENT_NODE: { value: COMMENT_NODE },\n DOCUMENT_NODE: { value: DOCUMENT_NODE },\n DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE },\n DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE },\n NOTATION_NODE: { value: NOTATION_NODE },\n\n DOCUMENT_POSITION_DISCONNECTED: { value: DOCUMENT_POSITION_DISCONNECTED },\n DOCUMENT_POSITION_PRECEDING: { value: DOCUMENT_POSITION_PRECEDING },\n DOCUMENT_POSITION_FOLLOWING: { value: DOCUMENT_POSITION_FOLLOWING },\n DOCUMENT_POSITION_CONTAINS: { value: DOCUMENT_POSITION_CONTAINS },\n DOCUMENT_POSITION_CONTAINED_BY: { value: DOCUMENT_POSITION_CONTAINED_BY },\n DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC },\n});\n","\"use strict\";\nvar NodeFilter = {\n // Constants for acceptNode()\n FILTER_ACCEPT: 1,\n FILTER_REJECT: 2,\n FILTER_SKIP: 3,\n\n // Constants for whatToShow\n SHOW_ALL: 0xFFFFFFFF,\n SHOW_ELEMENT: 0x1,\n SHOW_ATTRIBUTE: 0x2, // historical\n SHOW_TEXT: 0x4,\n SHOW_CDATA_SECTION: 0x8, // historical\n SHOW_ENTITY_REFERENCE: 0x10, // historical\n SHOW_ENTITY: 0x20, // historical\n SHOW_PROCESSING_INSTRUCTION: 0x40,\n SHOW_COMMENT: 0x80,\n SHOW_DOCUMENT: 0x100,\n SHOW_DOCUMENT_TYPE: 0x200,\n SHOW_DOCUMENT_FRAGMENT: 0x400,\n SHOW_NOTATION: 0x800 // historical\n};\n\nmodule.exports = (NodeFilter.constructor = NodeFilter.prototype = NodeFilter);\n","\"use strict\";\nmodule.exports = NodeIterator;\n\nvar NodeFilter = require('./NodeFilter');\nvar NodeTraversal = require('./NodeTraversal');\nvar utils = require('./utils');\n\n/* Private methods and helpers */\n\n/**\n * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51\n */\nfunction move(node, stayWithin, directionIsNext) {\n if (directionIsNext) {\n return NodeTraversal.next(node, stayWithin);\n } else {\n if (node === stayWithin) {\n return null;\n }\n return NodeTraversal.previous(node, null);\n }\n}\n\nfunction isInclusiveAncestor(node, possibleChild) {\n for ( ; possibleChild; possibleChild = possibleChild.parentNode) {\n if (node === possibleChild) { return true; }\n }\n return false;\n}\n\n/**\n * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse\n * @method\n * @access private\n * @param {NodeIterator} ni\n * @param {string} direction One of 'next' or 'previous'.\n * @return {Node|null}\n */\nfunction traverse(ni, directionIsNext) {\n var node, beforeNode;\n node = ni._referenceNode;\n beforeNode = ni._pointerBeforeReferenceNode;\n while (true) {\n if (beforeNode === directionIsNext) {\n beforeNode = !beforeNode;\n } else {\n node = move(node, ni._root, directionIsNext);\n if (node === null) {\n return null;\n }\n }\n var result = ni._internalFilter(node);\n if (result === NodeFilter.FILTER_ACCEPT) {\n break;\n }\n }\n ni._referenceNode = node;\n ni._pointerBeforeReferenceNode = beforeNode;\n return node;\n}\n\n/* Public API */\n\n/**\n * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator\n * Latest version: http://www.w3.org/TR/dom/#nodeiterator\n *\n * @constructor\n * @param {Node} root\n * @param {number} whatToShow [optional]\n * @param {Function|NodeFilter} filter [optional]\n * @throws Error\n */\nfunction NodeIterator(root, whatToShow, filter) {\n if (!root || !root.nodeType) {\n utils.NotSupportedError();\n }\n\n // Read-only properties\n this._root = root;\n this._referenceNode = root;\n this._pointerBeforeReferenceNode = true;\n this._whatToShow = Number(whatToShow) || 0;\n this._filter = filter || null;\n this._active = false;\n // Record active node iterators in the document, in order to perform\n // \"node iterator pre-removal steps\".\n root.doc._attachNodeIterator(this);\n}\n\nObject.defineProperties(NodeIterator.prototype, {\n root: { get: function root() {\n return this._root;\n } },\n referenceNode: { get: function referenceNode() {\n return this._referenceNode;\n } },\n pointerBeforeReferenceNode: { get: function pointerBeforeReferenceNode() {\n return this._pointerBeforeReferenceNode;\n } },\n whatToShow: { get: function whatToShow() {\n return this._whatToShow;\n } },\n filter: { get: function filter() {\n return this._filter;\n } },\n\n /**\n * @method\n * @param {Node} node\n * @return {Number} Constant NodeFilter.FILTER_ACCEPT,\n * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP.\n */\n _internalFilter: { value: function _internalFilter(node) {\n /* jshint bitwise: false */\n var result, filter;\n if (this._active) {\n utils.InvalidStateError();\n }\n\n // Maps nodeType to whatToShow\n if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) {\n return NodeFilter.FILTER_SKIP;\n }\n\n filter = this._filter;\n if (filter === null) {\n result = NodeFilter.FILTER_ACCEPT;\n } else {\n this._active = true;\n try {\n if (typeof filter === 'function') {\n result = filter(node);\n } else {\n result = filter.acceptNode(node);\n }\n } finally {\n this._active = false;\n }\n }\n\n // Note that coercing to a number means that\n // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT)\n // `false` becomes `0` (neither accept, reject, or skip)\n return (+result);\n } },\n\n /**\n * @spec https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps\n * @method\n * @return void\n */\n _preremove: { value: function _preremove(toBeRemovedNode) {\n if (isInclusiveAncestor(toBeRemovedNode, this._root)) { return; }\n if (!isInclusiveAncestor(toBeRemovedNode, this._referenceNode)) { return; }\n if (this._pointerBeforeReferenceNode) {\n var next = toBeRemovedNode;\n while (next.lastChild) {\n next = next.lastChild;\n }\n next = NodeTraversal.next(next, this.root);\n if (next) {\n this._referenceNode = next;\n return;\n }\n this._pointerBeforeReferenceNode = false;\n // fall through\n }\n if (toBeRemovedNode.previousSibling === null) {\n this._referenceNode = toBeRemovedNode.parentNode;\n } else {\n this._referenceNode = toBeRemovedNode.previousSibling;\n var lastChild;\n for (lastChild = this._referenceNode.lastChild;\n lastChild;\n lastChild = this._referenceNode.lastChild) {\n this._referenceNode = lastChild;\n }\n }\n } },\n\n /**\n * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode\n * @method\n * @return {Node|null}\n */\n nextNode: { value: function nextNode() {\n return traverse(this, true);\n } },\n\n /**\n * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode\n * @method\n * @return {Node|null}\n */\n previousNode: { value: function previousNode() {\n return traverse(this, false);\n } },\n\n /**\n * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach\n * @method\n * @return void\n */\n detach: { value: function detach() {\n /* \"The detach() method must do nothing.\n * Its functionality (disabling a NodeIterator object) was removed,\n * but the method itself is preserved for compatibility.\n */\n } },\n\n /** For compatibility with web-platform-tests. */\n toString: { value: function toString() {\n return \"[object NodeIterator]\";\n } },\n});\n","\"use strict\";\n\n// No support for subclassing array, return an actual Array object.\nfunction item(i) {\n /* jshint validthis: true */\n return this[i] || null;\n}\n\nfunction NodeList(a) {\n if (!a) a = [];\n a.item = item;\n return a;\n}\n\nmodule.exports = NodeList;\n","/* jshint esversion: 6 */\n\"use strict\";\n\nmodule.exports = class NodeList extends Array {\n constructor(a) {\n super((a && a.length) || 0);\n if (a) {\n for (var idx in a) { this[idx] = a[idx]; }\n }\n }\n item(i) { return this[i] || null; }\n};\n","\"use strict\";\n\nvar NodeList;\n\ntry {\n // Attempt to use ES6-style Array subclass if possible.\n NodeList = require('./NodeList.es6.js');\n} catch (e) {\n // No support for subclassing array, return an actual Array object.\n NodeList = require('./NodeList.es5.js');\n}\n\nmodule.exports = NodeList;\n","\"use strict\";\n/* exported NodeTraversal */\nvar NodeTraversal = module.exports = {\n nextSkippingChildren: nextSkippingChildren,\n nextAncestorSibling: nextAncestorSibling,\n next: next,\n previous: previous,\n deepLastChild: deepLastChild\n};\n\n/**\n * @based on WebKit's NodeTraversal::nextSkippingChildren\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L109\n */\nfunction nextSkippingChildren(node, stayWithin) {\n if (node === stayWithin) {\n return null;\n }\n if (node.nextSibling !== null) {\n return node.nextSibling;\n }\n return nextAncestorSibling(node, stayWithin);\n}\n\n/**\n * @based on WebKit's NodeTraversal::nextAncestorSibling\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L93\n */\nfunction nextAncestorSibling(node, stayWithin) {\n for (node = node.parentNode; node !== null; node = node.parentNode) {\n if (node === stayWithin) {\n return null;\n }\n if (node.nextSibling !== null) {\n return node.nextSibling;\n }\n }\n return null;\n}\n\n/**\n * @based on WebKit's NodeTraversal::next\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L99\n */\nfunction next(node, stayWithin) {\n var n;\n n = node.firstChild;\n if (n !== null) {\n return n;\n }\n if (node === stayWithin) {\n return null;\n }\n n = node.nextSibling;\n if (n !== null) {\n return n;\n }\n return nextAncestorSibling(node, stayWithin);\n}\n\n/**\n * @based on WebKit's NodeTraversal::deepLastChild\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L116\n */\nfunction deepLastChild(node) {\n while (node.lastChild) {\n node = node.lastChild;\n }\n return node;\n}\n\n/**\n * @based on WebKit's NodeTraversal::previous\n * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L121\n */\nfunction previous(node, stayWithin) {\n var p;\n p = node.previousSibling;\n if (p !== null) {\n return deepLastChild(p);\n }\n p = node.parentNode;\n if (p === stayWithin) {\n return null;\n }\n return p;\n}\n","\"use strict\";\nmodule.exports = {\n // NOTE: The `serializeOne()` function used to live on the `Node.prototype`\n // as a private method `Node#_serializeOne(child)`, however that requires\n // a megamorphic property access `this._serializeOne` just to get to the\n // method, and this is being done on lots of different `Node` subclasses,\n // which puts a lot of pressure on V8's megamorphic stub cache. So by\n // moving the helper off of the `Node.prototype` and into a separate\n // function in this helper module, we get a monomorphic property access\n // `NodeUtils.serializeOne` to get to the function and reduce pressure\n // on the megamorphic stub cache.\n // See https://github.com/fgnass/domino/pull/142 for more information.\n serializeOne: serializeOne\n};\n\nvar utils = require('./utils');\nvar NAMESPACE = utils.NAMESPACE;\n\nvar hasRawContent = {\n STYLE: true,\n SCRIPT: true,\n XMP: true,\n IFRAME: true,\n NOEMBED: true,\n NOFRAMES: true,\n PLAINTEXT: true\n};\n\nvar emptyElements = {\n area: true,\n base: true,\n basefont: true,\n bgsound: true,\n br: true,\n col: true,\n embed: true,\n frame: true,\n hr: true,\n img: true,\n input: true,\n keygen: true,\n link: true,\n meta: true,\n param: true,\n source: true,\n track: true,\n wbr: true\n};\n\nvar extraNewLine = {\n /* Removed in https://github.com/whatwg/html/issues/944\n pre: true,\n textarea: true,\n listing: true\n */\n};\n\nfunction escape(s) {\n return s.replace(/[&<>\\u00A0]/g, function(c) {\n switch(c) {\n case '&': return '&';\n case '<': return '<';\n case '>': return '>';\n case '\\u00A0': return ' ';\n }\n });\n}\n\nfunction escapeAttr(s) {\n var toEscape = /[&\"\\u00A0]/g;\n if (!toEscape.test(s)) {\n // nothing to do, fast path\n return s;\n } else {\n return s.replace(toEscape, function(c) {\n switch(c) {\n case '&': return '&';\n case '\"': return '"';\n case '\\u00A0': return ' ';\n }\n });\n }\n}\n\nfunction attrname(a) {\n var ns = a.namespaceURI;\n if (!ns)\n return a.localName;\n if (ns === NAMESPACE.XML)\n return 'xml:' + a.localName;\n if (ns === NAMESPACE.XLINK)\n return 'xlink:' + a.localName;\n\n if (ns === NAMESPACE.XMLNS) {\n if (a.localName === 'xmlns') return 'xmlns';\n else return 'xmlns:' + a.localName;\n }\n return a.name;\n}\n\nfunction serializeOne(kid, parent) {\n var s = '';\n switch(kid.nodeType) {\n case 1: //ELEMENT_NODE\n var ns = kid.namespaceURI;\n var html = ns === NAMESPACE.HTML;\n var tagname = (html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML) ? kid.localName : kid.tagName;\n\n s += '<' + tagname;\n\n for(var j = 0, k = kid._numattrs; j < k; j++) {\n var a = kid._attr(j);\n s += ' ' + attrname(a);\n if (a.value !== undefined) s += '=\"' + escapeAttr(a.value) + '\"';\n }\n s += '>';\n\n if (!(html && emptyElements[tagname])) {\n var ss = kid.serialize();\n if (html && extraNewLine[tagname] && ss.charAt(0)==='\\n') s += '\\n';\n // Serialize children and add end tag for all others\n s += ss;\n s += '';\n }\n break;\n case 3: //TEXT_NODE\n case 4: //CDATA_SECTION_NODE\n var parenttag;\n if (parent.nodeType === 1 /*ELEMENT_NODE*/ &&\n parent.namespaceURI === NAMESPACE.HTML)\n parenttag = parent.tagName;\n else\n parenttag = '';\n\n if (hasRawContent[parenttag] ||\n (parenttag==='NOSCRIPT' && parent.ownerDocument._scripting_enabled)) {\n s += kid.data;\n } else {\n s += escape(kid.data);\n }\n break;\n case 8: //COMMENT_NODE\n s += '';\n break;\n case 7: //PROCESSING_INSTRUCTION_NODE\n s += '';\n break;\n case 10: //DOCUMENT_TYPE_NODE\n s += '';\n break;\n default:\n utils.InvalidStateError();\n }\n return s;\n}\n","\"use strict\";\nvar Node = require('./Node');\n\nvar NonDocumentTypeChildNode = {\n\n nextElementSibling: { get: function() {\n if (this.parentNode) {\n for (var kid = this.nextSibling; kid !== null; kid = kid.nextSibling) {\n if (kid.nodeType === Node.ELEMENT_NODE) return kid;\n }\n }\n return null;\n }},\n\n previousElementSibling: { get: function() {\n if (this.parentNode) {\n for (var kid = this.previousSibling; kid !== null; kid = kid.previousSibling) {\n if (kid.nodeType === Node.ELEMENT_NODE) return kid;\n }\n }\n return null;\n }}\n\n};\n\nmodule.exports = NonDocumentTypeChildNode;\n","\"use strict\";\nmodule.exports = ProcessingInstruction;\n\nvar Node = require('./Node');\nvar CharacterData = require('./CharacterData');\n\nfunction ProcessingInstruction(doc, target, data) {\n CharacterData.call(this);\n this.nodeType = Node.PROCESSING_INSTRUCTION_NODE;\n this.ownerDocument = doc;\n this.target = target;\n this._data = data;\n}\n\nvar nodeValue = {\n get: function() { return this._data; },\n set: function(v) {\n if (v === null || v === undefined) { v = ''; } else { v = String(v); }\n this._data = v;\n if (this.rooted) this.ownerDocument.mutateValue(this);\n }\n};\n\nProcessingInstruction.prototype = Object.create(CharacterData.prototype, {\n nodeName: { get: function() { return this.target; }},\n nodeValue: nodeValue,\n textContent: nodeValue,\n data: {\n get: nodeValue.get,\n set: function(v) {\n nodeValue.set.call(this, v===null ? '' : String(v));\n },\n },\n\n // Utility methods\n clone: { value: function clone() {\n return new ProcessingInstruction(this.ownerDocument, this.target, this._data);\n }},\n isEqual: { value: function isEqual(n) {\n return this.target === n.target && this._data === n._data;\n }}\n\n});\n","\"use strict\";\nmodule.exports = Text;\n\nvar utils = require('./utils');\nvar Node = require('./Node');\nvar CharacterData = require('./CharacterData');\n\nfunction Text(doc, data) {\n CharacterData.call(this);\n this.nodeType = Node.TEXT_NODE;\n this.ownerDocument = doc;\n this._data = data;\n this._index = undefined;\n}\n\nvar nodeValue = {\n get: function() { return this._data; },\n set: function(v) {\n if (v === null || v === undefined) { v = ''; } else { v = String(v); }\n if (v === this._data) return;\n this._data = v;\n if (this.rooted)\n this.ownerDocument.mutateValue(this);\n if (this.parentNode &&\n this.parentNode._textchangehook)\n this.parentNode._textchangehook(this);\n }\n};\n\nText.prototype = Object.create(CharacterData.prototype, {\n nodeName: { value: \"#text\" },\n // These three attributes are all the same.\n // The data attribute has a [TreatNullAs=EmptyString] but we'll\n // implement that at the interface level\n nodeValue: nodeValue,\n textContent: nodeValue,\n data: {\n get: nodeValue.get,\n set: function(v) {\n nodeValue.set.call(this, v===null ? '' : String(v));\n },\n },\n\n splitText: { value: function splitText(offset) {\n if (offset > this._data.length || offset < 0) utils.IndexSizeError();\n\n var newdata = this._data.substring(offset),\n newnode = this.ownerDocument.createTextNode(newdata);\n this.data = this.data.substring(0, offset);\n\n var parent = this.parentNode;\n if (parent !== null)\n parent.insertBefore(newnode, this.nextSibling);\n\n return newnode;\n }},\n\n wholeText: { get: function wholeText() {\n var result = this.textContent;\n for (var next = this.nextSibling; next; next = next.nextSibling) {\n if (next.nodeType !== Node.TEXT_NODE) { break; }\n result += next.textContent;\n }\n return result;\n }},\n // Obsolete, removed from spec.\n replaceWholeText: { value: utils.nyi },\n\n // Utility methods\n clone: { value: function clone() {\n return new Text(this.ownerDocument, this._data);\n }},\n\n});\n","\"use strict\";\nmodule.exports = TreeWalker;\n\nvar Node = require('./Node');\nvar NodeFilter = require('./NodeFilter');\nvar NodeTraversal = require('./NodeTraversal');\nvar utils = require('./utils');\n\nvar mapChild = {\n first: 'firstChild',\n last: 'lastChild',\n next: 'firstChild',\n previous: 'lastChild'\n};\n\nvar mapSibling = {\n first: 'nextSibling',\n last: 'previousSibling',\n next: 'nextSibling',\n previous: 'previousSibling'\n};\n\n/* Private methods and helpers */\n\n/**\n * @spec https://dom.spec.whatwg.org/#concept-traverse-children\n * @method\n * @access private\n * @param {TreeWalker} tw\n * @param {string} type One of 'first' or 'last'.\n * @return {Node|null}\n */\nfunction traverseChildren(tw, type) {\n var child, node, parent, result, sibling;\n node = tw._currentNode[mapChild[type]];\n while (node !== null) {\n result = tw._internalFilter(node);\n if (result === NodeFilter.FILTER_ACCEPT) {\n tw._currentNode = node;\n return node;\n }\n if (result === NodeFilter.FILTER_SKIP) {\n child = node[mapChild[type]];\n if (child !== null) {\n node = child;\n continue;\n }\n }\n while (node !== null) {\n sibling = node[mapSibling[type]];\n if (sibling !== null) {\n node = sibling;\n break;\n }\n parent = node.parentNode;\n if (parent === null || parent === tw.root || parent === tw._currentNode) {\n return null;\n } else {\n node = parent;\n }\n }\n }\n return null;\n}\n\n/**\n * @spec https://dom.spec.whatwg.org/#concept-traverse-siblings\n * @method\n * @access private\n * @param {TreeWalker} tw\n * @param {TreeWalker} type One of 'next' or 'previous'.\n * @return {Node|nul}\n */\nfunction traverseSiblings(tw, type) {\n var node, result, sibling;\n node = tw._currentNode;\n if (node === tw.root) {\n return null;\n }\n while (true) {\n sibling = node[mapSibling[type]];\n while (sibling !== null) {\n node = sibling;\n result = tw._internalFilter(node);\n if (result === NodeFilter.FILTER_ACCEPT) {\n tw._currentNode = node;\n return node;\n }\n sibling = node[mapChild[type]];\n if (result === NodeFilter.FILTER_REJECT || sibling === null) {\n sibling = node[mapSibling[type]];\n }\n }\n node = node.parentNode;\n if (node === null || node === tw.root) {\n return null;\n }\n if (tw._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {\n return null;\n }\n }\n}\n\n\n/* Public API */\n\n/**\n * Latest version: https://dom.spec.whatwg.org/#treewalker\n *\n * @constructor\n * @param {Node} root\n * @param {number} whatToShow [optional]\n * @param {Function|NodeFilter} filter [optional]\n * @throws Error\n */\nfunction TreeWalker(root, whatToShow, filter) {\n if (!root || !root.nodeType) {\n utils.NotSupportedError();\n }\n\n // Read-only properties\n this._root = root;\n this._whatToShow = Number(whatToShow) || 0;\n this._filter = filter || null;\n this._active = false;\n // Read-write property\n this._currentNode = root;\n}\n\nObject.defineProperties(TreeWalker.prototype, {\n root: { get: function() { return this._root; } },\n whatToShow: { get: function() { return this._whatToShow; } },\n filter: { get: function() { return this._filter; } },\n\n currentNode: {\n get: function currentNode() {\n return this._currentNode;\n },\n set: function setCurrentNode(v) {\n if (!(v instanceof Node)) {\n throw new TypeError(\"Not a Node\"); // `null` is also not a node\n }\n this._currentNode = v;\n },\n },\n\n /**\n * @method\n * @param {Node} node\n * @return {Number} Constant NodeFilter.FILTER_ACCEPT,\n * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP.\n */\n _internalFilter: { value: function _internalFilter(node) {\n /* jshint bitwise: false */\n var result, filter;\n if (this._active) {\n utils.InvalidStateError();\n }\n\n // Maps nodeType to whatToShow\n if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) {\n return NodeFilter.FILTER_SKIP;\n }\n\n filter = this._filter;\n if (filter === null) {\n result = NodeFilter.FILTER_ACCEPT;\n } else {\n this._active = true;\n try {\n if (typeof filter === 'function') {\n result = filter(node);\n } else {\n result = filter.acceptNode(node);\n }\n } finally {\n this._active = false;\n }\n }\n\n // Note that coercing to a number means that\n // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT)\n // `false` becomes `0` (neither accept, reject, or skip)\n return (+result);\n }},\n\n /**\n * @spec https://dom.spec.whatwg.org/#dom-treewalker-parentnode\n * @based on WebKit's TreeWalker::parentNode\n * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L50\n * @method\n * @return {Node|null}\n */\n parentNode: { value: function parentNode() {\n var node = this._currentNode;\n while (node !== this.root) {\n node = node.parentNode;\n if (node === null) {\n return null;\n }\n if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {\n this._currentNode = node;\n return node;\n }\n }\n return null;\n }},\n\n /**\n * @spec https://dom.spec.whatwg.org/#dom-treewalker-firstchild\n * @method\n * @return {Node|null}\n */\n firstChild: { value: function firstChild() {\n return traverseChildren(this, 'first');\n }},\n\n /**\n * @spec https://dom.spec.whatwg.org/#dom-treewalker-lastchild\n * @method\n * @return {Node|null}\n */\n lastChild: { value: function lastChild() {\n return traverseChildren(this, 'last');\n }},\n\n /**\n * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling\n * @method\n * @return {Node|null}\n */\n previousSibling: { value: function previousSibling() {\n return traverseSiblings(this, 'previous');\n }},\n\n /**\n * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling\n * @method\n * @return {Node|null}\n */\n nextSibling: { value: function nextSibling() {\n return traverseSiblings(this, 'next');\n }},\n\n /**\n * @spec https://dom.spec.whatwg.org/#dom-treewalker-previousnode\n * @based on WebKit's TreeWalker::previousNode\n * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L181\n * @method\n * @return {Node|null}\n */\n previousNode: { value: function previousNode() {\n var node, result, previousSibling, lastChild;\n node = this._currentNode;\n while (node !== this._root) {\n for (previousSibling = node.previousSibling;\n previousSibling;\n previousSibling = node.previousSibling) {\n node = previousSibling;\n result = this._internalFilter(node);\n if (result === NodeFilter.FILTER_REJECT) {\n continue;\n }\n for (lastChild = node.lastChild;\n lastChild;\n lastChild = node.lastChild) {\n node = lastChild;\n result = this._internalFilter(node);\n if (result === NodeFilter.FILTER_REJECT) {\n break;\n }\n }\n if (result === NodeFilter.FILTER_ACCEPT) {\n this._currentNode = node;\n return node;\n }\n }\n if (node === this.root || node.parentNode === null) {\n return null;\n }\n node = node.parentNode;\n if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) {\n this._currentNode = node;\n return node;\n }\n }\n return null;\n }},\n\n /**\n * @spec https://dom.spec.whatwg.org/#dom-treewalker-nextnode\n * @based on WebKit's TreeWalker::nextNode\n * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L228\n * @method\n * @return {Node|null}\n */\n nextNode: { value: function nextNode() {\n var node, result, firstChild, nextSibling;\n node = this._currentNode;\n result = NodeFilter.FILTER_ACCEPT;\n\n CHILDREN:\n while (true) {\n for (firstChild = node.firstChild;\n firstChild;\n firstChild = node.firstChild) {\n node = firstChild;\n result = this._internalFilter(node);\n if (result === NodeFilter.FILTER_ACCEPT) {\n this._currentNode = node;\n return node;\n } else if (result === NodeFilter.FILTER_REJECT) {\n break;\n }\n }\n for (nextSibling = NodeTraversal.nextSkippingChildren(node, this.root);\n nextSibling;\n nextSibling = NodeTraversal.nextSkippingChildren(node, this.root)) {\n node = nextSibling;\n result = this._internalFilter(node);\n if (result === NodeFilter.FILTER_ACCEPT) {\n this._currentNode = node;\n return node;\n } else if (result === NodeFilter.FILTER_SKIP) {\n continue CHILDREN;\n }\n }\n return null;\n }\n }},\n\n /** For compatibility with web-platform-tests. */\n toString: { value: function toString() {\n return \"[object TreeWalker]\";\n }},\n});\n","\"use strict\";\nvar Event = require('./Event');\n\nmodule.exports = UIEvent;\n\nfunction UIEvent() {\n // Just use the superclass constructor to initialize\n Event.call(this);\n this.view = null; // FF uses the current window\n this.detail = 0;\n}\nUIEvent.prototype = Object.create(Event.prototype, {\n constructor: { value: UIEvent },\n initUIEvent: { value: function(type, bubbles, cancelable, view, detail) {\n this.initEvent(type, bubbles, cancelable);\n this.view = view;\n this.detail = detail;\n }}\n});\n","\"use strict\";\nmodule.exports = URL;\n\nfunction URL(url) {\n if (!url) return Object.create(URL.prototype);\n // Can't use String.trim() since it defines whitespace differently than HTML\n this.url = url.replace(/^[ \\t\\n\\r\\f]+|[ \\t\\n\\r\\f]+$/g, \"\");\n\n // See http://tools.ietf.org/html/rfc3986#appendix-B\n // and https://url.spec.whatwg.org/#parsing\n var match = URL.pattern.exec(this.url);\n if (match) {\n if (match[2]) this.scheme = match[2];\n if (match[4]) {\n // parse username/password\n var userinfo = match[4].match(URL.userinfoPattern);\n if (userinfo) {\n this.username = userinfo[1];\n this.password = userinfo[3];\n match[4] = match[4].substring(userinfo[0].length);\n }\n if (match[4].match(URL.portPattern)) {\n var pos = match[4].lastIndexOf(':');\n this.host = match[4].substring(0, pos);\n this.port = match[4].substring(pos+1);\n }\n else {\n this.host = match[4];\n }\n }\n if (match[5]) this.path = match[5];\n if (match[6]) this.query = match[7];\n if (match[8]) this.fragment = match[9];\n }\n}\n\nURL.pattern = /^(([^:\\/?#]+):)?(\\/\\/([^\\/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/;\nURL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/;\nURL.portPattern = /:\\d+$/;\nURL.authorityPattern = /^[^:\\/?#]+:\\/\\//;\nURL.hierarchyPattern = /^[^:\\/?#]+:\\//;\n\n// Return a percentEncoded version of s.\n// S should be a single-character string\n// XXX: needs to do utf-8 encoding?\nURL.percentEncode = function percentEncode(s) {\n var c = s.charCodeAt(0);\n if (c < 256) return \"%\" + c.toString(16);\n else throw Error(\"can't percent-encode codepoints > 255 yet\");\n};\n\nURL.prototype = {\n constructor: URL,\n\n // XXX: not sure if this is the precise definition of absolute\n isAbsolute: function() { return !!this.scheme; },\n isAuthorityBased: function() {\n return URL.authorityPattern.test(this.url);\n },\n isHierarchical: function() {\n return URL.hierarchyPattern.test(this.url);\n },\n\n toString: function() {\n var s = \"\";\n if (this.scheme !== undefined) s += this.scheme + \":\";\n if (this.isAbsolute()) {\n s += '//';\n if (this.username || this.password) {\n s += this.username || '';\n if (this.password) {\n s += ':' + this.password;\n }\n s += '@';\n }\n if (this.host) {\n s += this.host;\n }\n }\n if (this.port !== undefined) s += \":\" + this.port;\n if (this.path !== undefined) s += this.path;\n if (this.query !== undefined) s += \"?\" + this.query;\n if (this.fragment !== undefined) s += \"#\" + this.fragment;\n return s;\n },\n\n // See: http://tools.ietf.org/html/rfc3986#section-5.2\n // and https://url.spec.whatwg.org/#constructors\n resolve: function(relative) {\n var base = this; // The base url we're resolving against\n var r = new URL(relative); // The relative reference url to resolve\n var t = new URL(); // The absolute target url we will return\n\n if (r.scheme !== undefined) {\n t.scheme = r.scheme;\n t.username = r.username;\n t.password = r.password;\n t.host = r.host;\n t.port = r.port;\n t.path = remove_dot_segments(r.path);\n t.query = r.query;\n }\n else {\n t.scheme = base.scheme;\n if (r.host !== undefined) {\n t.username = r.username;\n t.password = r.password;\n t.host = r.host;\n t.port = r.port;\n t.path = remove_dot_segments(r.path);\n t.query = r.query;\n }\n else {\n t.username = base.username;\n t.password = base.password;\n t.host = base.host;\n t.port = base.port;\n if (!r.path) { // undefined or empty\n t.path = base.path;\n if (r.query !== undefined)\n t.query = r.query;\n else\n t.query = base.query;\n }\n else {\n if (r.path.charAt(0) === \"/\") {\n t.path = remove_dot_segments(r.path);\n }\n else {\n t.path = merge(base.path, r.path);\n t.path = remove_dot_segments(t.path);\n }\n t.query = r.query;\n }\n }\n }\n t.fragment = r.fragment;\n\n return t.toString();\n\n\n function merge(basepath, refpath) {\n if (base.host !== undefined && !base.path)\n return \"/\" + refpath;\n\n var lastslash = basepath.lastIndexOf(\"/\");\n if (lastslash === -1)\n return refpath;\n else\n return basepath.substring(0, lastslash+1) + refpath;\n }\n\n function remove_dot_segments(path) {\n if (!path) return path; // For \"\" or undefined\n\n var output = \"\";\n while(path.length > 0) {\n if (path === \".\" || path === \"..\") {\n path = \"\";\n break;\n }\n\n var twochars = path.substring(0,2);\n var threechars = path.substring(0,3);\n var fourchars = path.substring(0,4);\n if (threechars === \"../\") {\n path = path.substring(3);\n }\n else if (twochars === \"./\") {\n path = path.substring(2);\n }\n else if (threechars === \"/./\") {\n path = \"/\" + path.substring(3);\n }\n else if (twochars === \"/.\" && path.length === 2) {\n path = \"/\";\n }\n else if (fourchars === \"/../\" ||\n (threechars === \"/..\" && path.length === 3)) {\n path = \"/\" + path.substring(4);\n\n output = output.replace(/\\/?[^\\/]*$/, \"\");\n }\n else {\n var segment = path.match(/(\\/?([^\\/]*))/)[0];\n output += segment;\n path = path.substring(segment.length);\n }\n }\n\n return output;\n }\n },\n};\n","\"use strict\";\nvar URL = require('./URL');\n\nmodule.exports = URLUtils;\n\n// Allow the `x == null` pattern. This is eslint's \"null: 'ignore'\" option,\n// but jshint doesn't support this.\n/* jshint eqeqeq: false */\n\n// This is an abstract superclass for Location, HTMLAnchorElement and\n// other types that have the standard complement of \"URL decomposition\n// IDL attributes\". This is now standardized as URLUtils, see:\n// https://url.spec.whatwg.org/#urlutils\n// Subclasses must define a getter/setter on href.\n// The getter and setter methods parse and rebuild the URL on each\n// invocation; there is no attempt to cache the value and be more efficient\nfunction URLUtils() {}\nURLUtils.prototype = Object.create(Object.prototype, {\n\n _url: { get: function() {\n // XXX: this should do the \"Reinitialize url\" steps, and \"null\" should\n // be a valid return value.\n return new URL(this.href);\n } },\n\n protocol: {\n get: function() {\n var url = this._url;\n if (url && url.scheme) return url.scheme + \":\";\n else return \":\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute()) {\n v = v.replace(/:+$/, \"\");\n v = v.replace(/[^-+\\.a-zA-Z0-9]/g, URL.percentEncode);\n if (v.length > 0) {\n url.scheme = v;\n output = url.toString();\n }\n }\n this.href = output;\n },\n },\n\n host: {\n get: function() {\n var url = this._url;\n if (url.isAbsolute() && url.isAuthorityBased())\n return url.host + (url.port ? (\":\" + url.port) : \"\");\n else\n return \"\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute() && url.isAuthorityBased()) {\n v = v.replace(/[^-+\\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);\n if (v.length > 0) {\n url.host = v;\n delete url.port;\n output = url.toString();\n }\n }\n this.href = output;\n },\n },\n\n hostname: {\n get: function() {\n var url = this._url;\n if (url.isAbsolute() && url.isAuthorityBased())\n return url.host;\n else\n return \"\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute() && url.isAuthorityBased()) {\n v = v.replace(/^\\/+/, \"\");\n v = v.replace(/[^-+\\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode);\n if (v.length > 0) {\n url.host = v;\n output = url.toString();\n }\n }\n this.href = output;\n },\n },\n\n port: {\n get: function() {\n var url = this._url;\n if (url.isAbsolute() && url.isAuthorityBased() && url.port!==undefined)\n return url.port;\n else\n return \"\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute() && url.isAuthorityBased()) {\n v = '' + v;\n v = v.replace(/[^0-9].*$/, \"\");\n v = v.replace(/^0+/, \"\");\n if (v.length === 0) v = \"0\";\n if (parseInt(v, 10) <= 65535) {\n url.port = v;\n output = url.toString();\n }\n }\n this.href = output;\n },\n },\n\n pathname: {\n get: function() {\n var url = this._url;\n if (url.isAbsolute() && url.isHierarchical())\n return url.path;\n else\n return \"\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute() && url.isHierarchical()) {\n if (v.charAt(0) !== \"/\")\n v = \"/\" + v;\n v = v.replace(/[^-+\\._~!$&'()*,;:=@\\/a-zA-Z0-9]/g, URL.percentEncode);\n url.path = v;\n output = url.toString();\n }\n this.href = output;\n },\n },\n\n search: {\n get: function() {\n var url = this._url;\n if (url.isAbsolute() && url.isHierarchical() && url.query!==undefined)\n return \"?\" + url.query;\n else\n return \"\";\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute() && url.isHierarchical()) {\n if (v.charAt(0) === \"?\") v = v.substring(1);\n v = v.replace(/[^-+\\._~!$&'()*,;:=@\\/?a-zA-Z0-9]/g, URL.percentEncode);\n url.query = v;\n output = url.toString();\n }\n this.href = output;\n },\n },\n\n hash: {\n get: function() {\n var url = this._url;\n if (url == null || url.fragment == null || url.fragment === '') {\n return \"\";\n } else {\n return \"#\" + url.fragment;\n }\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n\n if (v.charAt(0) === \"#\") v = v.substring(1);\n v = v.replace(/[^-+\\._~!$&'()*,;:=@\\/?a-zA-Z0-9]/g, URL.percentEncode);\n url.fragment = v;\n output = url.toString();\n\n this.href = output;\n },\n },\n\n username: {\n get: function() {\n var url = this._url;\n return url.username || '';\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute()) {\n v = v.replace(/[\\x00-\\x1F\\x7F-\\uFFFF \"#<>?`\\/@\\\\:]/g, URL.percentEncode);\n url.username = v;\n output = url.toString();\n }\n this.href = output;\n },\n },\n\n password: {\n get: function() {\n var url = this._url;\n return url.password || '';\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n if (url.isAbsolute()) {\n if (v==='') {\n url.password = null;\n } else {\n v = v.replace(/[\\x00-\\x1F\\x7F-\\uFFFF \"#<>?`\\/@\\\\]/g, URL.percentEncode);\n url.password = v;\n }\n output = url.toString();\n }\n this.href = output;\n },\n },\n\n origin: { get: function() {\n var url = this._url;\n if (url == null) { return ''; }\n var originForPort = function(defaultPort) {\n var origin = [url.scheme, url.host, +url.port || defaultPort];\n // XXX should be \"unicode serialization\"\n return origin[0] + '://' + origin[1] +\n (origin[2] === defaultPort ? '' : (':' + origin[2]));\n };\n switch (url.scheme) {\n case 'ftp':\n return originForPort(21);\n case 'gopher':\n return originForPort(70);\n case 'http':\n case 'ws':\n return originForPort(80);\n case 'https':\n case 'wss':\n return originForPort(443);\n default:\n // this is what chrome does\n return url.scheme + '://';\n }\n } },\n\n /*\n searchParams: {\n get: function() {\n var url = this._url;\n // XXX\n },\n set: function(v) {\n var output = this.href;\n var url = new URL(output);\n // XXX\n this.href = output;\n },\n },\n */\n});\n\nURLUtils._inherit = function(proto) {\n // copy getters/setters from URLUtils to o.\n Object.getOwnPropertyNames(URLUtils.prototype).forEach(function(p) {\n if (p==='constructor' || p==='href') { return; }\n var desc = Object.getOwnPropertyDescriptor(URLUtils.prototype, p);\n Object.defineProperty(proto, p, desc);\n });\n};\n","\"use strict\";\nvar DOMImplementation = require('./DOMImplementation');\nvar EventTarget = require('./EventTarget');\nvar Location = require('./Location');\nvar sloppy = require('./sloppy');\nvar utils = require('./utils');\n\nmodule.exports = Window;\n\nfunction Window(document) {\n this.document = document || new DOMImplementation(null).createHTMLDocument(\"\");\n this.document._scripting_enabled = true;\n this.document.defaultView = this;\n this.location = new Location(this, this.document._address || 'about:blank');\n}\n\nWindow.prototype = Object.create(EventTarget.prototype, {\n _run: { value: sloppy.Window_run },\n console: { value: console },\n history: { value: {\n back: utils.nyi,\n forward: utils.nyi,\n go: utils.nyi\n }},\n navigator: { value: require(\"./NavigatorID\") },\n\n // Self-referential properties\n window: { get: function() { return this; }},\n self: { get: function() { return this; }},\n frames: { get: function() { return this; }},\n\n // Self-referential properties for a top-level window\n parent: { get: function() { return this; }},\n top: { get: function() { return this; }},\n\n // We don't support any other windows for now\n length: { value: 0 }, // no frames\n frameElement: { value: null }, // not part of a frame\n opener: { value: null }, // not opened by another window\n\n // The onload event handler.\n // XXX: need to support a bunch of other event types, too,\n // and have them interoperate with document.body.\n\n onload: {\n get: function() {\n return this._getEventHandler(\"load\");\n },\n set: function(v) {\n this._setEventHandler(\"load\", v);\n }\n },\n\n // XXX This is a completely broken implementation\n getComputedStyle: { value: function getComputedStyle(elt) {\n return elt.style;\n }}\n\n});\n\nutils.expose(require('./WindowTimers'), Window);\nutils.expose(require('./impl'), Window);\n","\"use strict\";\n\n// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers\nvar WindowTimers = {\n setTimeout: setTimeout,\n clearTimeout: clearTimeout,\n setInterval: setInterval,\n clearInterval: clearInterval\n};\n\nmodule.exports = WindowTimers;\n","\"use strict\";\nvar utils = require('./utils');\n\nexports.property = function(attr) {\n if (Array.isArray(attr.type)) {\n var valid = Object.create(null);\n attr.type.forEach(function(val) {\n valid[val.value || val] = val.alias || val;\n });\n var missingValueDefault = attr.missing;\n if (missingValueDefault===undefined) { missingValueDefault = null; }\n var invalidValueDefault = attr.invalid;\n if (invalidValueDefault===undefined) { invalidValueDefault = missingValueDefault; }\n return {\n get: function() {\n var v = this._getattr(attr.name);\n if (v === null) return missingValueDefault;\n\n v = valid[v.toLowerCase()];\n if (v !== undefined) return v;\n if (invalidValueDefault !== null) return invalidValueDefault;\n return v;\n },\n set: function(v) {\n this._setattr(attr.name, v);\n }\n };\n }\n else if (attr.type === Boolean) {\n return {\n get: function() {\n return this.hasAttribute(attr.name);\n },\n set: function(v) {\n if (v) {\n this._setattr(attr.name, '');\n }\n else {\n this.removeAttribute(attr.name);\n }\n }\n };\n }\n else if (attr.type === Number ||\n attr.type === \"long\" ||\n attr.type === \"unsigned long\" ||\n attr.type === \"limited unsigned long with fallback\") {\n return numberPropDesc(attr);\n }\n else if (!attr.type || attr.type === String) {\n return {\n get: function() { return this._getattr(attr.name) || ''; },\n set: function(v) {\n if (attr.treatNullAsEmptyString && v === null) { v = ''; }\n this._setattr(attr.name, v);\n }\n };\n }\n else if (typeof attr.type === 'function') {\n return attr.type(attr.name, attr);\n }\n throw new Error('Invalid attribute definition');\n};\n\n// See http://www.whatwg.org/specs/web-apps/current-work/#reflect\n//\n// defval is the default value. If it is a function, then that function\n// will be invoked as a method of the element to obtain the default.\n// If no default is specified for a given attribute, then the default\n// depends on the type of the attribute, but since this function handles\n// 4 integer cases, you must specify the default value in each call\n//\n// min and max define a valid range for getting the attribute.\n//\n// setmin defines a minimum value when setting. If the value is less\n// than that, then throw INDEX_SIZE_ERR.\n//\n// Conveniently, JavaScript's parseInt function appears to be\n// compatible with HTML's 'rules for parsing integers'\nfunction numberPropDesc(a) {\n var def;\n if(typeof a.default === 'function') {\n def = a.default;\n }\n else if(typeof a.default === 'number') {\n def = function() { return a.default; };\n }\n else {\n def = function() { utils.assert(false, typeof a.default); };\n }\n var unsigned_long = (a.type === 'unsigned long');\n var signed_long = (a.type === 'long');\n var unsigned_fallback = (a.type === 'limited unsigned long with fallback');\n var min = a.min, max = a.max, setmin = a.setmin;\n if (min === undefined) {\n if (unsigned_long) min = 0;\n if (signed_long) min = -0x80000000;\n if (unsigned_fallback) min = 1;\n }\n if (max === undefined) {\n if (unsigned_long || signed_long || unsigned_fallback) max = 0x7FFFFFFF;\n }\n\n return {\n get: function() {\n var v = this._getattr(a.name);\n var n = a.float ? parseFloat(v) : parseInt(v, 10);\n if (v === null || !isFinite(n) || (min !== undefined && n < min) || (max !== undefined && n > max)) {\n return def.call(this);\n }\n if (unsigned_long || signed_long || unsigned_fallback) {\n if (!/^[ \\t\\n\\f\\r]*[-+]?[0-9]/.test(v)) { return def.call(this); }\n n = n|0; // jshint ignore:line\n }\n return n;\n },\n set: function(v) {\n if (!a.float) { v = Math.floor(v); }\n if (setmin !== undefined && v < setmin) {\n utils.IndexSizeError(a.name + ' set to ' + v);\n }\n if (unsigned_long) {\n v = (v < 0 || v > 0x7FFFFFFF) ? def.call(this) :\n (v|0); // jshint ignore:line\n } else if (unsigned_fallback) {\n v = (v < 1 || v > 0x7FFFFFFF) ? def.call(this) :\n (v|0); // jshint ignore:line\n } else if (signed_long) {\n v = (v < -0x80000000 || v > 0x7FFFFFFF) ? def.call(this) :\n (v|0); // jshint ignore:line\n }\n this._setattr(a.name, String(v));\n }\n };\n}\n\n// This is a utility function for setting up change handler functions\n// for attributes like 'id' that require special handling when they change.\nexports.registerChangeHandler = function(c, name, handler) {\n var p = c.prototype;\n\n // If p does not already have its own _attributeChangeHandlers\n // then create one for it, inheriting from the inherited\n // _attributeChangeHandlers. At the top (for the Element class) the\n // _attributeChangeHandlers object will be created with a null prototype.\n if (!Object.prototype.hasOwnProperty.call(p, '_attributeChangeHandlers')) {\n p._attributeChangeHandlers =\n Object.create(p._attributeChangeHandlers || null);\n }\n\n p._attributeChangeHandlers[name] = handler;\n};\n","/*\n * This file defines Domino behaviour that can be externally configured.\n * To change these settings, set the relevant global property *before*\n * you call `require(\"domino\")`.\n */\n\nexports.isApiWritable = !global.__domino_frozen__;\n","/* jshint node:true, latedef:false */\n\"use strict\"; // jshint ignore:line\n/*!\nParser-Lib\nCopyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n*/\n/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */\nvar parserlib = Object.create(null);\n(function(){\n\n/**\n * A generic base to inherit from for any object\n * that needs event handling.\n * @class EventTarget\n * @constructor\n */\nfunction EventTarget(){\n\n /**\n * The array of listeners for various events.\n * @type Object\n * @property _listeners\n * @private\n */\n this._listeners = Object.create(null);\n}\n\nEventTarget.prototype = {\n\n //restore constructor\n constructor: EventTarget,\n\n /**\n * Adds a listener for a given event type.\n * @param {String} type The type of event to add a listener for.\n * @param {Function} listener The function to call when the event occurs.\n * @return {void}\n * @method addListener\n */\n addListener: function(type, listener){\n if (!this._listeners[type]){\n this._listeners[type] = [];\n }\n\n this._listeners[type].push(listener);\n },\n\n /**\n * Fires an event based on the passed-in object.\n * @param {Object|String} event An object with at least a 'type' attribute\n * or a string indicating the event name.\n * @return {void}\n * @method fire\n */\n fire: function(event){\n if (typeof event === \"string\"){\n event = { type: event };\n }\n if (typeof event.target !== \"undefined\"){\n event.target = this;\n }\n\n if (typeof event.type === \"undefined\"){\n throw new Error(\"Event object missing 'type' property.\");\n }\n\n if (this._listeners[event.type]){\n\n //create a copy of the array and use that so listeners can't chane\n var listeners = this._listeners[event.type].concat();\n for (var i=0, len=listeners.length; i < len; i++){\n listeners[i].call(this, event);\n }\n }\n },\n\n /**\n * Removes a listener for a given event type.\n * @param {String} type The type of event to remove a listener from.\n * @param {Function} listener The function to remove from the event.\n * @return {void}\n * @method removeListener\n */\n removeListener: function(type, listener){\n if (this._listeners[type]){\n var listeners = this._listeners[type];\n for (var i=0, len=listeners.length; i < len; i++){\n if (listeners[i] === listener){\n listeners.splice(i, 1);\n break;\n }\n }\n\n\n }\n }\n};\n/**\n * Convenient way to read through strings.\n * @namespace parserlib.util\n * @class StringReader\n * @constructor\n * @param {String} text The text to read.\n */\nfunction StringReader(text){\n\n /**\n * The input text with line endings normalized.\n * @property _input\n * @type String\n * @private\n */\n this._input = text.replace(/(\\r|\\n){1,2}/g, \"\\n\");\n\n\n /**\n * The row for the character to be read next.\n * @property _line\n * @type int\n * @private\n */\n this._line = 1;\n\n\n /**\n * The column for the character to be read next.\n * @property _col\n * @type int\n * @private\n */\n this._col = 1;\n\n /**\n * The index of the character in the input to be read next.\n * @property _cursor\n * @type int\n * @private\n */\n this._cursor = 0;\n}\n\nStringReader.prototype = {\n\n //restore constructor\n constructor: StringReader,\n\n //-------------------------------------------------------------------------\n // Position info\n //-------------------------------------------------------------------------\n\n /**\n * Returns the column of the character to be read next.\n * @return {int} The column of the character to be read next.\n * @method getCol\n */\n getCol: function(){\n return this._col;\n },\n\n /**\n * Returns the row of the character to be read next.\n * @return {int} The row of the character to be read next.\n * @method getLine\n */\n getLine: function(){\n return this._line ;\n },\n\n /**\n * Determines if you're at the end of the input.\n * @return {Boolean} True if there's no more input, false otherwise.\n * @method eof\n */\n eof: function(){\n return (this._cursor === this._input.length);\n },\n\n //-------------------------------------------------------------------------\n // Basic reading\n //-------------------------------------------------------------------------\n\n /**\n * Reads the next character without advancing the cursor.\n * @param {int} count How many characters to look ahead (default is 1).\n * @return {String} The next character or null if there is no next character.\n * @method peek\n */\n peek: function(count){\n var c = null;\n count = (typeof count === \"undefined\" ? 1 : count);\n\n //if we're not at the end of the input...\n if (this._cursor < this._input.length){\n\n //get character and increment cursor and column\n c = this._input.charAt(this._cursor + count - 1);\n }\n\n return c;\n },\n\n /**\n * Reads the next character from the input and adjusts the row and column\n * accordingly.\n * @return {String} The next character or null if there is no next character.\n * @method read\n */\n read: function(){\n var c = null;\n\n //if we're not at the end of the input...\n if (this._cursor < this._input.length){\n\n //if the last character was a newline, increment row count\n //and reset column count\n if (this._input.charAt(this._cursor) === \"\\n\"){\n this._line++;\n this._col=1;\n } else {\n this._col++;\n }\n\n //get character and increment cursor and column\n c = this._input.charAt(this._cursor++);\n }\n\n return c;\n },\n\n //-------------------------------------------------------------------------\n // Misc\n //-------------------------------------------------------------------------\n\n /**\n * Saves the current location so it can be returned to later.\n * @method mark\n * @return {void}\n */\n mark: function(){\n this._bookmark = {\n cursor: this._cursor,\n line: this._line,\n col: this._col\n };\n },\n\n reset: function(){\n if (this._bookmark){\n this._cursor = this._bookmark.cursor;\n this._line = this._bookmark.line;\n this._col = this._bookmark.col;\n delete this._bookmark;\n }\n },\n\n //-------------------------------------------------------------------------\n // Advanced reading\n //-------------------------------------------------------------------------\n\n /**\n * Reads up to and including the given string. Throws an error if that\n * string is not found.\n * @param {String} pattern The string to read.\n * @return {String} The string when it is found.\n * @throws Error when the string pattern is not found.\n * @method readTo\n */\n readTo: function(pattern){\n\n var buffer = \"\",\n c;\n\n /*\n * First, buffer must be the same length as the pattern.\n * Then, buffer must end with the pattern or else reach the\n * end of the input.\n */\n while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){\n c = this.read();\n if (c){\n buffer += c;\n } else {\n throw new Error(\"Expected \\\"\" + pattern + \"\\\" at line \" + this._line + \", col \" + this._col + \".\");\n }\n }\n\n return buffer;\n\n },\n\n /**\n * Reads characters while each character causes the given\n * filter function to return true. The function is passed\n * in each character and either returns true to continue\n * reading or false to stop.\n * @param {Function} filter The function to read on each character.\n * @return {String} The string made up of all characters that passed the\n * filter check.\n * @method readWhile\n */\n readWhile: function(filter){\n\n var buffer = \"\",\n c = this.read();\n\n while(c !== null && filter(c)){\n buffer += c;\n c = this.read();\n }\n\n return buffer;\n\n },\n\n /**\n * Reads characters that match either text or a regular expression and\n * returns those characters. If a match is found, the row and column\n * are adjusted; if no match is found, the reader's state is unchanged.\n * reading or false to stop.\n * @param {String|RegExp} matchter If a string, then the literal string\n * value is searched for. If a regular expression, then any string\n * matching the pattern is search for.\n * @return {String} The string made up of all characters that matched or\n * null if there was no match.\n * @method readMatch\n */\n readMatch: function(matcher){\n\n var source = this._input.substring(this._cursor),\n value = null;\n\n //if it's a string, just do a straight match\n if (typeof matcher === \"string\"){\n if (source.indexOf(matcher) === 0){\n value = this.readCount(matcher.length);\n }\n } else if (matcher instanceof RegExp){\n if (matcher.test(source)){\n value = this.readCount(RegExp.lastMatch.length);\n }\n }\n\n return value;\n },\n\n\n /**\n * Reads a given number of characters. If the end of the input is reached,\n * it reads only the remaining characters and does not throw an error.\n * @param {int} count The number of characters to read.\n * @return {String} The string made up the read characters.\n * @method readCount\n */\n readCount: function(count){\n var buffer = \"\";\n\n while(count--){\n buffer += this.read();\n }\n\n return buffer;\n }\n\n};\n/**\n * Type to use when a syntax error occurs.\n * @class SyntaxError\n * @namespace parserlib.util\n * @constructor\n * @param {String} message The error message.\n * @param {int} line The line at which the error occurred.\n * @param {int} col The column at which the error occurred.\n */\nfunction SyntaxError(message, line, col){\n Error.call(this);\n this.name = this.constructor.name;\n\n /**\n * The column at which the error occurred.\n * @type int\n * @property col\n */\n this.col = col;\n\n /**\n * The line at which the error occurred.\n * @type int\n * @property line\n */\n this.line = line;\n\n /**\n * The text representation of the unit.\n * @type String\n * @property text\n */\n this.message = message;\n\n}\n\n//inherit from Error\nSyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line\nSyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line\n/**\n * Base type to represent a single syntactic unit.\n * @class SyntaxUnit\n * @namespace parserlib.util\n * @constructor\n * @param {String} text The text of the unit.\n * @param {int} line The line of text on which the unit resides.\n * @param {int} col The column of text on which the unit resides.\n */\nfunction SyntaxUnit(text, line, col, type){\n\n\n /**\n * The column of text on which the unit resides.\n * @type int\n * @property col\n */\n this.col = col;\n\n /**\n * The line of text on which the unit resides.\n * @type int\n * @property line\n */\n this.line = line;\n\n /**\n * The text representation of the unit.\n * @type String\n * @property text\n */\n this.text = text;\n\n /**\n * The type of syntax unit.\n * @type int\n * @property type\n */\n this.type = type;\n}\n\n/**\n * Create a new syntax unit based solely on the given token.\n * Convenience method for creating a new syntax unit when\n * it represents a single token instead of multiple.\n * @param {Object} token The token object to represent.\n * @return {parserlib.util.SyntaxUnit} The object representing the token.\n * @static\n * @method fromToken\n */\nSyntaxUnit.fromToken = function(token){\n return new SyntaxUnit(token.value, token.startLine, token.startCol);\n};\n\nSyntaxUnit.prototype = {\n\n //restore constructor\n constructor: SyntaxUnit,\n\n /**\n * Returns the text representation of the unit.\n * @return {String} The text representation of the unit.\n * @method valueOf\n */\n valueOf: function(){\n return this.toString();\n },\n\n /**\n * Returns the text representation of the unit.\n * @return {String} The text representation of the unit.\n * @method toString\n */\n toString: function(){\n return this.text;\n }\n\n};\n\n/**\n * Generic TokenStream providing base functionality.\n * @class TokenStreamBase\n * @namespace parserlib.util\n * @constructor\n * @param {String|StringReader} input The text to tokenize or a reader from\n * which to read the input.\n */\nfunction TokenStreamBase(input, tokenData){\n\n /**\n * The string reader for easy access to the text.\n * @type StringReader\n * @property _reader\n * @private\n */\n this._reader = input ? new StringReader(input.toString()) : null;\n\n /**\n * Token object for the last consumed token.\n * @type Token\n * @property _token\n * @private\n */\n this._token = null;\n\n /**\n * The array of token information.\n * @type Array\n * @property _tokenData\n * @private\n */\n this._tokenData = tokenData;\n\n /**\n * Lookahead token buffer.\n * @type Array\n * @property _lt\n * @private\n */\n this._lt = [];\n\n /**\n * Lookahead token buffer index.\n * @type int\n * @property _ltIndex\n * @private\n */\n this._ltIndex = 0;\n\n this._ltIndexCache = [];\n}\n\n/**\n * Accepts an array of token information and outputs\n * an array of token data containing key-value mappings\n * and matching functions that the TokenStream needs.\n * @param {Array} tokens An array of token descriptors.\n * @return {Array} An array of processed token data.\n * @method createTokenData\n * @static\n */\nTokenStreamBase.createTokenData = function(tokens){\n\n var nameMap = [],\n typeMap = Object.create(null),\n tokenData = tokens.concat([]),\n i = 0,\n len = tokenData.length+1;\n\n tokenData.UNKNOWN = -1;\n tokenData.unshift({name:\"EOF\"});\n\n for (; i < len; i++){\n nameMap.push(tokenData[i].name);\n tokenData[tokenData[i].name] = i;\n if (tokenData[i].text){\n typeMap[tokenData[i].text] = i;\n }\n }\n\n tokenData.name = function(tt){\n return nameMap[tt];\n };\n\n tokenData.type = function(c){\n return typeMap[c];\n };\n\n return tokenData;\n};\n\nTokenStreamBase.prototype = {\n\n //restore constructor\n constructor: TokenStreamBase,\n\n //-------------------------------------------------------------------------\n // Matching methods\n //-------------------------------------------------------------------------\n\n /**\n * Determines if the next token matches the given token type.\n * If so, that token is consumed; if not, the token is placed\n * back onto the token stream. You can pass in any number of\n * token types and this will return true if any of the token\n * types is found.\n * @param {int|int[]} tokenTypes Either a single token type or an array of\n * token types that the next token might be. If an array is passed,\n * it's assumed that the token can be any of these.\n * @param {variant} channel (Optional) The channel to read from. If not\n * provided, reads from the default (unnamed) channel.\n * @return {Boolean} True if the token type matches, false if not.\n * @method match\n */\n match: function(tokenTypes, channel){\n\n //always convert to an array, makes things easier\n if (!(tokenTypes instanceof Array)){\n tokenTypes = [tokenTypes];\n }\n\n var tt = this.get(channel),\n i = 0,\n len = tokenTypes.length;\n\n while(i < len){\n if (tt === tokenTypes[i++]){\n return true;\n }\n }\n\n //no match found, put the token back\n this.unget();\n return false;\n },\n\n /**\n * Determines if the next token matches the given token type.\n * If so, that token is consumed; if not, an error is thrown.\n * @param {int|int[]} tokenTypes Either a single token type or an array of\n * token types that the next token should be. If an array is passed,\n * it's assumed that the token must be one of these.\n * @param {variant} channel (Optional) The channel to read from. If not\n * provided, reads from the default (unnamed) channel.\n * @return {void}\n * @method mustMatch\n */\n mustMatch: function(tokenTypes, channel){\n\n var token;\n\n //always convert to an array, makes things easier\n if (!(tokenTypes instanceof Array)){\n tokenTypes = [tokenTypes];\n }\n\n if (!this.match.apply(this, arguments)){\n token = this.LT(1);\n throw new SyntaxError(\"Expected \" + this._tokenData[tokenTypes[0]].name +\n \" at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n }\n },\n\n //-------------------------------------------------------------------------\n // Consuming methods\n //-------------------------------------------------------------------------\n\n /**\n * Keeps reading from the token stream until either one of the specified\n * token types is found or until the end of the input is reached.\n * @param {int|int[]} tokenTypes Either a single token type or an array of\n * token types that the next token should be. If an array is passed,\n * it's assumed that the token must be one of these.\n * @param {variant} channel (Optional) The channel to read from. If not\n * provided, reads from the default (unnamed) channel.\n * @return {void}\n * @method advance\n */\n advance: function(tokenTypes, channel){\n\n while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){\n this.get();\n }\n\n return this.LA(0);\n },\n\n /**\n * Consumes the next token from the token stream.\n * @return {int} The token type of the token that was just consumed.\n * @method get\n */\n get: function(channel){\n\n var tokenInfo = this._tokenData,\n i =0,\n token,\n info;\n\n //check the lookahead buffer first\n if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){\n\n i++;\n this._token = this._lt[this._ltIndex++];\n info = tokenInfo[this._token.type];\n\n //obey channels logic\n while((info.channel !== undefined && channel !== info.channel) &&\n this._ltIndex < this._lt.length){\n this._token = this._lt[this._ltIndex++];\n info = tokenInfo[this._token.type];\n i++;\n }\n\n //here be dragons\n if ((info.channel === undefined || channel === info.channel) &&\n this._ltIndex <= this._lt.length){\n this._ltIndexCache.push(i);\n return this._token.type;\n }\n }\n\n //call token retriever method\n token = this._getToken();\n\n //if it should be hidden, don't save a token\n if (token.type > -1 && !tokenInfo[token.type].hide){\n\n //apply token channel\n token.channel = tokenInfo[token.type].channel;\n\n //save for later\n this._token = token;\n this._lt.push(token);\n\n //save space that will be moved (must be done before array is truncated)\n this._ltIndexCache.push(this._lt.length - this._ltIndex + i);\n\n //keep the buffer under 5 items\n if (this._lt.length > 5){\n this._lt.shift();\n }\n\n //also keep the shift buffer under 5 items\n if (this._ltIndexCache.length > 5){\n this._ltIndexCache.shift();\n }\n\n //update lookahead index\n this._ltIndex = this._lt.length;\n }\n\n /*\n * Skip to the next token if:\n * 1. The token type is marked as hidden.\n * 2. The token type has a channel specified and it isn't the current channel.\n */\n info = tokenInfo[token.type];\n if (info &&\n (info.hide ||\n (info.channel !== undefined && channel !== info.channel))){\n return this.get(channel);\n } else {\n //return just the type\n return token.type;\n }\n },\n\n /**\n * Looks ahead a certain number of tokens and returns the token type at\n * that position. This will throw an error if you lookahead past the\n * end of input, past the size of the lookahead buffer, or back past\n * the first token in the lookahead buffer.\n * @param {int} The index of the token type to retrieve. 0 for the\n * current token, 1 for the next, -1 for the previous, etc.\n * @return {int} The token type of the token in the given position.\n * @method LA\n */\n LA: function(index){\n var total = index,\n tt;\n if (index > 0){\n //TODO: Store 5 somewhere\n if (index > 5){\n throw new Error(\"Too much lookahead.\");\n }\n\n //get all those tokens\n while(total){\n tt = this.get();\n total--;\n }\n\n //unget all those tokens\n while(total < index){\n this.unget();\n total++;\n }\n } else if (index < 0){\n\n if(this._lt[this._ltIndex+index]){\n tt = this._lt[this._ltIndex+index].type;\n } else {\n throw new Error(\"Too much lookbehind.\");\n }\n\n } else {\n tt = this._token.type;\n }\n\n return tt;\n\n },\n\n /**\n * Looks ahead a certain number of tokens and returns the token at\n * that position. This will throw an error if you lookahead past the\n * end of input, past the size of the lookahead buffer, or back past\n * the first token in the lookahead buffer.\n * @param {int} The index of the token type to retrieve. 0 for the\n * current token, 1 for the next, -1 for the previous, etc.\n * @return {Object} The token of the token in the given position.\n * @method LA\n */\n LT: function(index){\n\n //lookahead first to prime the token buffer\n this.LA(index);\n\n //now find the token, subtract one because _ltIndex is already at the next index\n return this._lt[this._ltIndex+index-1];\n },\n\n /**\n * Returns the token type for the next token in the stream without\n * consuming it.\n * @return {int} The token type of the next token in the stream.\n * @method peek\n */\n peek: function(){\n return this.LA(1);\n },\n\n /**\n * Returns the actual token object for the last consumed token.\n * @return {Token} The token object for the last consumed token.\n * @method token\n */\n token: function(){\n return this._token;\n },\n\n /**\n * Returns the name of the token for the given token type.\n * @param {int} tokenType The type of token to get the name of.\n * @return {String} The name of the token or \"UNKNOWN_TOKEN\" for any\n * invalid token type.\n * @method tokenName\n */\n tokenName: function(tokenType){\n if (tokenType < 0 || tokenType > this._tokenData.length){\n return \"UNKNOWN_TOKEN\";\n } else {\n return this._tokenData[tokenType].name;\n }\n },\n\n /**\n * Returns the token type value for the given token name.\n * @param {String} tokenName The name of the token whose value should be returned.\n * @return {int} The token type value for the given token name or -1\n * for an unknown token.\n * @method tokenName\n */\n tokenType: function(tokenName){\n return this._tokenData[tokenName] || -1;\n },\n\n /**\n * Returns the last consumed token to the token stream.\n * @method unget\n */\n unget: function(){\n //if (this._ltIndex > -1){\n if (this._ltIndexCache.length){\n this._ltIndex -= this._ltIndexCache.pop();//--;\n this._token = this._lt[this._ltIndex - 1];\n } else {\n throw new Error(\"Too much lookahead.\");\n }\n }\n\n};\n\n\nparserlib.util = {\n__proto__ : null,\nStringReader: StringReader,\nSyntaxError : SyntaxError,\nSyntaxUnit : SyntaxUnit,\nEventTarget : EventTarget,\nTokenStreamBase : TokenStreamBase\n};\n})();\n/*\nParser-Lib\nCopyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n*/\n/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */\n(function(){\nvar EventTarget = parserlib.util.EventTarget,\nTokenStreamBase = parserlib.util.TokenStreamBase,\nStringReader = parserlib.util.StringReader, // jshint ignore:line\nSyntaxError = parserlib.util.SyntaxError,\nSyntaxUnit = parserlib.util.SyntaxUnit;\n\nvar Colors = {\n __proto__ :null,\n aliceblue :\"#f0f8ff\",\n antiquewhite :\"#faebd7\",\n aqua :\"#00ffff\",\n aquamarine :\"#7fffd4\",\n azure :\"#f0ffff\",\n beige :\"#f5f5dc\",\n bisque :\"#ffe4c4\",\n black :\"#000000\",\n blanchedalmond :\"#ffebcd\",\n blue :\"#0000ff\",\n blueviolet :\"#8a2be2\",\n brown :\"#a52a2a\",\n burlywood :\"#deb887\",\n cadetblue :\"#5f9ea0\",\n chartreuse :\"#7fff00\",\n chocolate :\"#d2691e\",\n coral :\"#ff7f50\",\n cornflowerblue :\"#6495ed\",\n cornsilk :\"#fff8dc\",\n crimson :\"#dc143c\",\n cyan :\"#00ffff\",\n darkblue :\"#00008b\",\n darkcyan :\"#008b8b\",\n darkgoldenrod :\"#b8860b\",\n darkgray :\"#a9a9a9\",\n darkgrey :\"#a9a9a9\",\n darkgreen :\"#006400\",\n darkkhaki :\"#bdb76b\",\n darkmagenta :\"#8b008b\",\n darkolivegreen :\"#556b2f\",\n darkorange :\"#ff8c00\",\n darkorchid :\"#9932cc\",\n darkred :\"#8b0000\",\n darksalmon :\"#e9967a\",\n darkseagreen :\"#8fbc8f\",\n darkslateblue :\"#483d8b\",\n darkslategray :\"#2f4f4f\",\n darkslategrey :\"#2f4f4f\",\n darkturquoise :\"#00ced1\",\n darkviolet :\"#9400d3\",\n deeppink :\"#ff1493\",\n deepskyblue :\"#00bfff\",\n dimgray :\"#696969\",\n dimgrey :\"#696969\",\n dodgerblue :\"#1e90ff\",\n firebrick :\"#b22222\",\n floralwhite :\"#fffaf0\",\n forestgreen :\"#228b22\",\n fuchsia :\"#ff00ff\",\n gainsboro :\"#dcdcdc\",\n ghostwhite :\"#f8f8ff\",\n gold :\"#ffd700\",\n goldenrod :\"#daa520\",\n gray :\"#808080\",\n grey :\"#808080\",\n green :\"#008000\",\n greenyellow :\"#adff2f\",\n honeydew :\"#f0fff0\",\n hotpink :\"#ff69b4\",\n indianred :\"#cd5c5c\",\n indigo :\"#4b0082\",\n ivory :\"#fffff0\",\n khaki :\"#f0e68c\",\n lavender :\"#e6e6fa\",\n lavenderblush :\"#fff0f5\",\n lawngreen :\"#7cfc00\",\n lemonchiffon :\"#fffacd\",\n lightblue :\"#add8e6\",\n lightcoral :\"#f08080\",\n lightcyan :\"#e0ffff\",\n lightgoldenrodyellow :\"#fafad2\",\n lightgray :\"#d3d3d3\",\n lightgrey :\"#d3d3d3\",\n lightgreen :\"#90ee90\",\n lightpink :\"#ffb6c1\",\n lightsalmon :\"#ffa07a\",\n lightseagreen :\"#20b2aa\",\n lightskyblue :\"#87cefa\",\n lightslategray :\"#778899\",\n lightslategrey :\"#778899\",\n lightsteelblue :\"#b0c4de\",\n lightyellow :\"#ffffe0\",\n lime :\"#00ff00\",\n limegreen :\"#32cd32\",\n linen :\"#faf0e6\",\n magenta :\"#ff00ff\",\n maroon :\"#800000\",\n mediumaquamarine:\"#66cdaa\",\n mediumblue :\"#0000cd\",\n mediumorchid :\"#ba55d3\",\n mediumpurple :\"#9370d8\",\n mediumseagreen :\"#3cb371\",\n mediumslateblue :\"#7b68ee\",\n mediumspringgreen :\"#00fa9a\",\n mediumturquoise :\"#48d1cc\",\n mediumvioletred :\"#c71585\",\n midnightblue :\"#191970\",\n mintcream :\"#f5fffa\",\n mistyrose :\"#ffe4e1\",\n moccasin :\"#ffe4b5\",\n navajowhite :\"#ffdead\",\n navy :\"#000080\",\n oldlace :\"#fdf5e6\",\n olive :\"#808000\",\n olivedrab :\"#6b8e23\",\n orange :\"#ffa500\",\n orangered :\"#ff4500\",\n orchid :\"#da70d6\",\n palegoldenrod :\"#eee8aa\",\n palegreen :\"#98fb98\",\n paleturquoise :\"#afeeee\",\n palevioletred :\"#d87093\",\n papayawhip :\"#ffefd5\",\n peachpuff :\"#ffdab9\",\n peru :\"#cd853f\",\n pink :\"#ffc0cb\",\n plum :\"#dda0dd\",\n powderblue :\"#b0e0e6\",\n purple :\"#800080\",\n red :\"#ff0000\",\n rosybrown :\"#bc8f8f\",\n royalblue :\"#4169e1\",\n saddlebrown :\"#8b4513\",\n salmon :\"#fa8072\",\n sandybrown :\"#f4a460\",\n seagreen :\"#2e8b57\",\n seashell :\"#fff5ee\",\n sienna :\"#a0522d\",\n silver :\"#c0c0c0\",\n skyblue :\"#87ceeb\",\n slateblue :\"#6a5acd\",\n slategray :\"#708090\",\n slategrey :\"#708090\",\n snow :\"#fffafa\",\n springgreen :\"#00ff7f\",\n steelblue :\"#4682b4\",\n tan :\"#d2b48c\",\n teal :\"#008080\",\n thistle :\"#d8bfd8\",\n tomato :\"#ff6347\",\n turquoise :\"#40e0d0\",\n violet :\"#ee82ee\",\n wheat :\"#f5deb3\",\n white :\"#ffffff\",\n whitesmoke :\"#f5f5f5\",\n yellow :\"#ffff00\",\n yellowgreen :\"#9acd32\",\n //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor\n currentColor :\"The value of the 'color' property.\",\n //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system\n activeBorder :\"Active window border.\",\n activecaption :\"Active window caption.\",\n appworkspace :\"Background color of multiple document interface.\",\n background :\"Desktop background.\",\n buttonface :\"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttonhighlight :\"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttonshadow :\"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",\n buttontext :\"Text on push buttons.\",\n captiontext :\"Text in caption, size box, and scrollbar arrow box.\",\n graytext :\"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.\",\n greytext :\"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.\",\n highlight :\"Item(s) selected in a control.\",\n highlighttext :\"Text of item(s) selected in a control.\",\n inactiveborder :\"Inactive window border.\",\n inactivecaption :\"Inactive window caption.\",\n inactivecaptiontext :\"Color of text in an inactive caption.\",\n infobackground :\"Background color for tooltip controls.\",\n infotext :\"Text color for tooltip controls.\",\n menu :\"Menu background.\",\n menutext :\"Text in menus.\",\n scrollbar :\"Scroll bar gray area.\",\n threeddarkshadow :\"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedface :\"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedhighlight :\"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedlightshadow :\"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n threedshadow :\"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",\n window :\"Window background.\",\n windowframe :\"Window frame.\",\n windowtext :\"Text in windows.\"\n};\n/**\n * Represents a selector combinator (whitespace, +, >).\n * @namespace parserlib.css\n * @class Combinator\n * @extends parserlib.util.SyntaxUnit\n * @constructor\n * @param {String} text The text representation of the unit.\n * @param {int} line The line of text on which the unit resides.\n * @param {int} col The column of text on which the unit resides.\n */\nfunction Combinator(text, line, col){\n\n SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);\n\n /**\n * The type of modifier.\n * @type String\n * @property type\n */\n this.type = \"unknown\";\n\n //pretty simple\n if (/^\\s+$/.test(text)){\n this.type = \"descendant\";\n } else if (text === \">\"){\n this.type = \"child\";\n } else if (text === \"+\"){\n this.type = \"adjacent-sibling\";\n } else if (text === \"~\"){\n this.type = \"sibling\";\n }\n\n}\n\nCombinator.prototype = new SyntaxUnit();\nCombinator.prototype.constructor = Combinator;\n\n/**\n * Represents a media feature, such as max-width:500.\n * @namespace parserlib.css\n * @class MediaFeature\n * @extends parserlib.util.SyntaxUnit\n * @constructor\n * @param {SyntaxUnit} name The name of the feature.\n * @param {SyntaxUnit} value The value of the feature or null if none.\n */\nfunction MediaFeature(name, value){\n\n SyntaxUnit.call(this, \"(\" + name + (value !== null ? \":\" + value : \"\") + \")\", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);\n\n /**\n * The name of the media feature\n * @type String\n * @property name\n */\n this.name = name;\n\n /**\n * The value for the feature or null if there is none.\n * @type SyntaxUnit\n * @property value\n */\n this.value = value;\n}\n\nMediaFeature.prototype = new SyntaxUnit();\nMediaFeature.prototype.constructor = MediaFeature;\n\n/**\n * Represents an individual media query.\n * @namespace parserlib.css\n * @class MediaQuery\n * @extends parserlib.util.SyntaxUnit\n * @constructor\n * @param {String} modifier The modifier \"not\" or \"only\" (or null).\n * @param {String} mediaType The type of media (i.e., \"print\").\n * @param {Array} parts Array of selectors parts making up this selector.\n * @param {int} line The line of text on which the unit resides.\n * @param {int} col The column of text on which the unit resides.\n */\nfunction MediaQuery(modifier, mediaType, features, line, col){\n\n SyntaxUnit.call(this, (modifier ? modifier + \" \": \"\") + (mediaType ? mediaType : \"\") + (mediaType && features.length > 0 ? \" and \" : \"\") + features.join(\" and \"), line, col, Parser.MEDIA_QUERY_TYPE);\n\n /**\n * The media modifier (\"not\" or \"only\")\n * @type String\n * @property modifier\n */\n this.modifier = modifier;\n\n /**\n * The mediaType (i.e., \"print\")\n * @type String\n * @property mediaType\n */\n this.mediaType = mediaType;\n\n /**\n * The parts that make up the selector.\n * @type Array\n * @property features\n */\n this.features = features;\n\n}\n\nMediaQuery.prototype = new SyntaxUnit();\nMediaQuery.prototype.constructor = MediaQuery;\n\n\n/**\n * A CSS3 parser.\n * @namespace parserlib.css\n * @class Parser\n * @constructor\n * @param {Object} options (Optional) Various options for the parser:\n * starHack (true|false) to allow IE6 star hack as valid,\n * underscoreHack (true|false) to interpret leading underscores\n * as IE6-7 targeting for known properties, ieFilters (true|false)\n * to indicate that IE < 8 filters should be accepted and not throw\n * syntax errors.\n */\nfunction Parser(options){\n\n //inherit event functionality\n EventTarget.call(this);\n\n\n this.options = options || {};\n\n this._tokenStream = null;\n}\n\n//Static constants\nParser.DEFAULT_TYPE = 0;\nParser.COMBINATOR_TYPE = 1;\nParser.MEDIA_FEATURE_TYPE = 2;\nParser.MEDIA_QUERY_TYPE = 3;\nParser.PROPERTY_NAME_TYPE = 4;\nParser.PROPERTY_VALUE_TYPE = 5;\nParser.PROPERTY_VALUE_PART_TYPE = 6;\nParser.SELECTOR_TYPE = 7;\nParser.SELECTOR_PART_TYPE = 8;\nParser.SELECTOR_SUB_PART_TYPE = 9;\n\nParser.prototype = function(){\n\n var proto = new EventTarget(), //new prototype\n prop,\n additions = {\n __proto__: null,\n\n //restore constructor\n constructor: Parser,\n\n //instance constants - yuck\n DEFAULT_TYPE : 0,\n COMBINATOR_TYPE : 1,\n MEDIA_FEATURE_TYPE : 2,\n MEDIA_QUERY_TYPE : 3,\n PROPERTY_NAME_TYPE : 4,\n PROPERTY_VALUE_TYPE : 5,\n PROPERTY_VALUE_PART_TYPE : 6,\n SELECTOR_TYPE : 7,\n SELECTOR_PART_TYPE : 8,\n SELECTOR_SUB_PART_TYPE : 9,\n\n //-----------------------------------------------------------------\n // Grammar\n //-----------------------------------------------------------------\n\n _stylesheet: function(){\n\n /*\n * stylesheet\n * : [ CHARSET_SYM S* STRING S* ';' ]?\n * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*\n * [ namespace [S|CDO|CDC]* ]*\n * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n count,\n token,\n tt;\n\n this.fire(\"startstylesheet\");\n\n //try to read character set\n this._charset();\n\n this._skipCruft();\n\n //try to read imports - may be more than one\n while (tokenStream.peek() === Tokens.IMPORT_SYM){\n this._import();\n this._skipCruft();\n }\n\n //try to read namespaces - may be more than one\n while (tokenStream.peek() === Tokens.NAMESPACE_SYM){\n this._namespace();\n this._skipCruft();\n }\n\n //get the next token\n tt = tokenStream.peek();\n\n //try to read the rest\n while(tt > Tokens.EOF){\n\n try {\n\n switch(tt){\n case Tokens.MEDIA_SYM:\n this._media();\n this._skipCruft();\n break;\n case Tokens.PAGE_SYM:\n this._page();\n this._skipCruft();\n break;\n case Tokens.FONT_FACE_SYM:\n this._font_face();\n this._skipCruft();\n break;\n case Tokens.KEYFRAMES_SYM:\n this._keyframes();\n this._skipCruft();\n break;\n case Tokens.VIEWPORT_SYM:\n this._viewport();\n this._skipCruft();\n break;\n case Tokens.DOCUMENT_SYM:\n this._document();\n this._skipCruft();\n break;\n case Tokens.UNKNOWN_SYM: //unknown @ rule\n tokenStream.get();\n if (!this.options.strict){\n\n //fire error event\n this.fire({\n type: \"error\",\n error: null,\n message: \"Unknown @ rule: \" + tokenStream.LT(0).value + \".\",\n line: tokenStream.LT(0).startLine,\n col: tokenStream.LT(0).startCol\n });\n\n //skip braces\n count=0;\n while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){\n count++; //keep track of nesting depth\n }\n\n while(count){\n tokenStream.advance([Tokens.RBRACE]);\n count--;\n }\n\n } else {\n //not a syntax error, rethrow it\n throw new SyntaxError(\"Unknown @ rule.\", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);\n }\n break;\n case Tokens.S:\n this._readWhitespace();\n break;\n default:\n if(!this._ruleset()){\n\n //error handling for known issues\n switch(tt){\n case Tokens.CHARSET_SYM:\n token = tokenStream.LT(1);\n this._charset(false);\n throw new SyntaxError(\"@charset not allowed here.\", token.startLine, token.startCol);\n case Tokens.IMPORT_SYM:\n token = tokenStream.LT(1);\n this._import(false);\n throw new SyntaxError(\"@import not allowed here.\", token.startLine, token.startCol);\n case Tokens.NAMESPACE_SYM:\n token = tokenStream.LT(1);\n this._namespace(false);\n throw new SyntaxError(\"@namespace not allowed here.\", token.startLine, token.startCol);\n default:\n tokenStream.get(); //get the last token\n this._unexpectedToken(tokenStream.token());\n }\n\n }\n }\n } catch(ex) {\n if (ex instanceof SyntaxError && !this.options.strict){\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n });\n } else {\n throw ex;\n }\n }\n\n tt = tokenStream.peek();\n }\n\n if (tt !== Tokens.EOF){\n this._unexpectedToken(tokenStream.token());\n }\n\n this.fire(\"endstylesheet\");\n },\n\n _charset: function(emit){\n var tokenStream = this._tokenStream,\n charset,\n token,\n line,\n col;\n\n if (tokenStream.match(Tokens.CHARSET_SYM)){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this._readWhitespace();\n tokenStream.mustMatch(Tokens.STRING);\n\n token = tokenStream.token();\n charset = token.value;\n\n this._readWhitespace();\n tokenStream.mustMatch(Tokens.SEMICOLON);\n\n if (emit !== false){\n this.fire({\n type: \"charset\",\n charset:charset,\n line: line,\n col: col\n });\n }\n }\n },\n\n _import: function(emit){\n /*\n * import\n * : IMPORT_SYM S*\n * [STRING|URI] S* media_query_list? ';' S*\n */\n\n var tokenStream = this._tokenStream,\n uri,\n importToken,\n mediaList = [];\n\n //read import symbol\n tokenStream.mustMatch(Tokens.IMPORT_SYM);\n importToken = tokenStream.token();\n this._readWhitespace();\n\n tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n\n //grab the URI value\n uri = tokenStream.token().value.replace(/^(?:url\\()?[\"']?([^\"']+?)[\"']?\\)?$/, \"$1\");\n\n this._readWhitespace();\n\n mediaList = this._media_query_list();\n\n //must end with a semicolon\n tokenStream.mustMatch(Tokens.SEMICOLON);\n this._readWhitespace();\n\n if (emit !== false){\n this.fire({\n type: \"import\",\n uri: uri,\n media: mediaList,\n line: importToken.startLine,\n col: importToken.startCol\n });\n }\n\n },\n\n _namespace: function(emit){\n /*\n * namespace\n * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*\n */\n\n var tokenStream = this._tokenStream,\n line,\n col,\n prefix,\n uri;\n\n //read import symbol\n tokenStream.mustMatch(Tokens.NAMESPACE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n this._readWhitespace();\n\n //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT\n if (tokenStream.match(Tokens.IDENT)){\n prefix = tokenStream.token().value;\n this._readWhitespace();\n }\n\n tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n /*if (!tokenStream.match(Tokens.STRING)){\n tokenStream.mustMatch(Tokens.URI);\n }*/\n\n //grab the URI value\n uri = tokenStream.token().value.replace(/(?:url\\()?[\"']([^\"']+)[\"']\\)?/, \"$1\");\n\n this._readWhitespace();\n\n //must end with a semicolon\n tokenStream.mustMatch(Tokens.SEMICOLON);\n this._readWhitespace();\n\n if (emit !== false){\n this.fire({\n type: \"namespace\",\n prefix: prefix,\n uri: uri,\n line: line,\n col: col\n });\n }\n\n },\n\n _media: function(){\n /*\n * media\n * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n line,\n col,\n mediaList;// = [];\n\n //look for @media\n tokenStream.mustMatch(Tokens.MEDIA_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this._readWhitespace();\n\n mediaList = this._media_query_list();\n\n tokenStream.mustMatch(Tokens.LBRACE);\n this._readWhitespace();\n\n this.fire({\n type: \"startmedia\",\n media: mediaList,\n line: line,\n col: col\n });\n\n while(true) {\n if (tokenStream.peek() === Tokens.PAGE_SYM){\n this._page();\n } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){\n this._font_face();\n } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){\n this._viewport();\n } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){\n this._document();\n } else if (!this._ruleset()){\n break;\n }\n }\n\n tokenStream.mustMatch(Tokens.RBRACE);\n this._readWhitespace();\n\n this.fire({\n type: \"endmedia\",\n media: mediaList,\n line: line,\n col: col\n });\n },\n\n\n //CSS3 Media Queries\n _media_query_list: function(){\n /*\n * media_query_list\n * : S* [media_query [ ',' S* media_query ]* ]?\n * ;\n */\n var tokenStream = this._tokenStream,\n mediaList = [];\n\n\n this._readWhitespace();\n\n if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){\n mediaList.push(this._media_query());\n }\n\n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n mediaList.push(this._media_query());\n }\n\n return mediaList;\n },\n\n /*\n * Note: \"expression\" in the grammar maps to the _media_expression\n * method.\n\n */\n _media_query: function(){\n /*\n * media_query\n * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*\n * | expression [ AND S* expression ]*\n * ;\n */\n var tokenStream = this._tokenStream,\n type = null,\n ident = null,\n token = null,\n expressions = [];\n\n if (tokenStream.match(Tokens.IDENT)){\n ident = tokenStream.token().value.toLowerCase();\n\n //since there's no custom tokens for these, need to manually check\n if (ident !== \"only\" && ident !== \"not\"){\n tokenStream.unget();\n ident = null;\n } else {\n token = tokenStream.token();\n }\n }\n\n this._readWhitespace();\n\n if (tokenStream.peek() === Tokens.IDENT){\n type = this._media_type();\n if (token === null){\n token = tokenStream.token();\n }\n } else if (tokenStream.peek() === Tokens.LPAREN){\n if (token === null){\n token = tokenStream.LT(1);\n }\n expressions.push(this._media_expression());\n }\n\n if (type === null && expressions.length === 0){\n return null;\n } else {\n this._readWhitespace();\n while (tokenStream.match(Tokens.IDENT)){\n if (tokenStream.token().value.toLowerCase() !== \"and\"){\n this._unexpectedToken(tokenStream.token());\n }\n\n this._readWhitespace();\n expressions.push(this._media_expression());\n }\n }\n\n return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);\n },\n\n //CSS3 Media Queries\n _media_type: function(){\n /*\n * media_type\n * : IDENT\n * ;\n */\n return this._media_feature();\n },\n\n /**\n * Note: in CSS3 Media Queries, this is called \"expression\".\n * Renamed here to avoid conflict with CSS3 Selectors\n * definition of \"expression\". Also note that \"expr\" in the\n * grammar now maps to \"expression\" from CSS3 selectors.\n * @method _media_expression\n * @private\n */\n _media_expression: function(){\n /*\n * expression\n * : '(' S* media_feature S* [ ':' S* expr ]? ')' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n feature = null,\n token,\n expression = null;\n\n tokenStream.mustMatch(Tokens.LPAREN);\n\n feature = this._media_feature();\n this._readWhitespace();\n\n if (tokenStream.match(Tokens.COLON)){\n this._readWhitespace();\n token = tokenStream.LT(1);\n expression = this._expression();\n }\n\n tokenStream.mustMatch(Tokens.RPAREN);\n this._readWhitespace();\n\n return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null));\n },\n\n //CSS3 Media Queries\n _media_feature: function(){\n /*\n * media_feature\n * : IDENT\n * ;\n */\n var tokenStream = this._tokenStream;\n\n this._readWhitespace();\n\n tokenStream.mustMatch(Tokens.IDENT);\n\n return SyntaxUnit.fromToken(tokenStream.token());\n },\n\n //CSS3 Paged Media\n _page: function(){\n /*\n * page:\n * PAGE_SYM S* IDENT? pseudo_page? S*\n * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n line,\n col,\n identifier = null,\n pseudoPage = null;\n\n //look for @page\n tokenStream.mustMatch(Tokens.PAGE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this._readWhitespace();\n\n if (tokenStream.match(Tokens.IDENT)){\n identifier = tokenStream.token().value;\n\n //The value 'auto' may not be used as a page name and MUST be treated as a syntax error.\n if (identifier.toLowerCase() === \"auto\"){\n this._unexpectedToken(tokenStream.token());\n }\n }\n\n //see if there's a colon upcoming\n if (tokenStream.peek() === Tokens.COLON){\n pseudoPage = this._pseudo_page();\n }\n\n this._readWhitespace();\n\n this.fire({\n type: \"startpage\",\n id: identifier,\n pseudo: pseudoPage,\n line: line,\n col: col\n });\n\n this._readDeclarations(true, true);\n\n this.fire({\n type: \"endpage\",\n id: identifier,\n pseudo: pseudoPage,\n line: line,\n col: col\n });\n\n },\n\n //CSS3 Paged Media\n _margin: function(){\n /*\n * margin :\n * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n line,\n col,\n marginSym = this._margin_sym();\n\n if (marginSym){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this.fire({\n type: \"startpagemargin\",\n margin: marginSym,\n line: line,\n col: col\n });\n\n this._readDeclarations(true);\n\n this.fire({\n type: \"endpagemargin\",\n margin: marginSym,\n line: line,\n col: col\n });\n return true;\n } else {\n return false;\n }\n },\n\n //CSS3 Paged Media\n _margin_sym: function(){\n\n /*\n * margin_sym :\n * TOPLEFTCORNER_SYM |\n * TOPLEFT_SYM |\n * TOPCENTER_SYM |\n * TOPRIGHT_SYM |\n * TOPRIGHTCORNER_SYM |\n * BOTTOMLEFTCORNER_SYM |\n * BOTTOMLEFT_SYM |\n * BOTTOMCENTER_SYM |\n * BOTTOMRIGHT_SYM |\n * BOTTOMRIGHTCORNER_SYM |\n * LEFTTOP_SYM |\n * LEFTMIDDLE_SYM |\n * LEFTBOTTOM_SYM |\n * RIGHTTOP_SYM |\n * RIGHTMIDDLE_SYM |\n * RIGHTBOTTOM_SYM\n * ;\n */\n\n var tokenStream = this._tokenStream;\n\n if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,\n Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,\n Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM,\n Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,\n Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM,\n Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,\n Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM]))\n {\n return SyntaxUnit.fromToken(tokenStream.token());\n } else {\n return null;\n }\n\n },\n\n _pseudo_page: function(){\n /*\n * pseudo_page\n * : ':' IDENT\n * ;\n */\n\n var tokenStream = this._tokenStream;\n\n tokenStream.mustMatch(Tokens.COLON);\n tokenStream.mustMatch(Tokens.IDENT);\n\n //TODO: CSS3 Paged Media says only \"left\", \"center\", and \"right\" are allowed\n\n return tokenStream.token().value;\n },\n\n _font_face: function(){\n /*\n * font_face\n * : FONT_FACE_SYM S*\n * '{' S* declaration [ ';' S* declaration ]* '}' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n line,\n col;\n\n //look for @page\n tokenStream.mustMatch(Tokens.FONT_FACE_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this._readWhitespace();\n\n this.fire({\n type: \"startfontface\",\n line: line,\n col: col\n });\n\n this._readDeclarations(true);\n\n this.fire({\n type: \"endfontface\",\n line: line,\n col: col\n });\n },\n\n _viewport: function(){\n /*\n * viewport\n * : VIEWPORT_SYM S*\n * '{' S* declaration? [ ';' S* declaration? ]* '}' S*\n * ;\n */\n var tokenStream = this._tokenStream,\n line,\n col;\n\n tokenStream.mustMatch(Tokens.VIEWPORT_SYM);\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n\n this._readWhitespace();\n\n this.fire({\n type: \"startviewport\",\n line: line,\n col: col\n });\n\n this._readDeclarations(true);\n\n this.fire({\n type: \"endviewport\",\n line: line,\n col: col\n });\n\n },\n\n _document: function(){\n /*\n * document\n * : DOCUMENT_SYM S*\n * _document_function [ ',' S* _document_function ]* S*\n * '{' S* ruleset* '}'\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token,\n functions = [],\n prefix = \"\";\n\n tokenStream.mustMatch(Tokens.DOCUMENT_SYM);\n token = tokenStream.token();\n if (/^@\\-([^\\-]+)\\-/.test(token.value)) {\n prefix = RegExp.$1;\n }\n\n this._readWhitespace();\n functions.push(this._document_function());\n\n while(tokenStream.match(Tokens.COMMA)) {\n this._readWhitespace();\n functions.push(this._document_function());\n }\n\n tokenStream.mustMatch(Tokens.LBRACE);\n this._readWhitespace();\n\n this.fire({\n type: \"startdocument\",\n functions: functions,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n });\n\n while(true) {\n if (tokenStream.peek() === Tokens.PAGE_SYM){\n this._page();\n } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){\n this._font_face();\n } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){\n this._viewport();\n } else if (tokenStream.peek() === Tokens.MEDIA_SYM){\n this._media();\n } else if (!this._ruleset()){\n break;\n }\n }\n\n tokenStream.mustMatch(Tokens.RBRACE);\n this._readWhitespace();\n\n this.fire({\n type: \"enddocument\",\n functions: functions,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n });\n },\n\n _document_function: function(){\n /*\n * document_function\n * : function | URI S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value;\n\n if (tokenStream.match(Tokens.URI)) {\n value = tokenStream.token().value;\n this._readWhitespace();\n } else {\n value = this._function();\n }\n\n return value;\n },\n\n _operator: function(inFunction){\n\n /*\n * operator (outside function)\n * : '/' S* | ',' S* | /( empty )/\n * operator (inside function)\n * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token = null;\n\n if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||\n (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){\n token = tokenStream.token();\n this._readWhitespace();\n }\n return token ? PropertyValuePart.fromToken(token) : null;\n\n },\n\n _combinator: function(){\n\n /*\n * combinator\n * : PLUS S* | GREATER S* | TILDE S* | S+\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value = null,\n token;\n\n if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){\n token = tokenStream.token();\n value = new Combinator(token.value, token.startLine, token.startCol);\n this._readWhitespace();\n }\n\n return value;\n },\n\n _unary_operator: function(){\n\n /*\n * unary_operator\n * : '-' | '+'\n * ;\n */\n\n var tokenStream = this._tokenStream;\n\n if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){\n return tokenStream.token().value;\n } else {\n return null;\n }\n },\n\n _property: function(){\n\n /*\n * property\n * : IDENT S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value = null,\n hack = null,\n tokenValue,\n token,\n line,\n col;\n\n //check for star hack - throws error if not allowed\n if (tokenStream.peek() === Tokens.STAR && this.options.starHack){\n tokenStream.get();\n token = tokenStream.token();\n hack = token.value;\n line = token.startLine;\n col = token.startCol;\n }\n\n if(tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token();\n tokenValue = token.value;\n\n //check for underscore hack - no error if not allowed because it's valid CSS syntax\n if (tokenValue.charAt(0) === \"_\" && this.options.underscoreHack){\n hack = \"_\";\n tokenValue = tokenValue.substring(1);\n }\n\n value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol));\n this._readWhitespace();\n }\n\n return value;\n },\n\n //Augmented with CSS3 Selectors\n _ruleset: function(){\n /*\n * ruleset\n * : selectors_group\n * '{' S* declaration? [ ';' S* declaration? ]* '}' S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n tt,\n selectors;\n\n\n /*\n * Error Recovery: If even a single selector fails to parse,\n * then the entire ruleset should be thrown away.\n */\n try {\n selectors = this._selectors_group();\n } catch (ex){\n if (ex instanceof SyntaxError && !this.options.strict){\n\n //fire error event\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n });\n\n //skip over everything until closing brace\n tt = tokenStream.advance([Tokens.RBRACE]);\n if (tt === Tokens.RBRACE){\n //if there's a right brace, the rule is finished so don't do anything\n } else {\n //otherwise, rethrow the error because it wasn't handled properly\n throw ex;\n }\n\n } else {\n //not a syntax error, rethrow it\n throw ex;\n }\n\n //trigger parser to continue\n return true;\n }\n\n //if it got here, all selectors parsed\n if (selectors){\n\n this.fire({\n type: \"startrule\",\n selectors: selectors,\n line: selectors[0].line,\n col: selectors[0].col\n });\n\n this._readDeclarations(true);\n\n this.fire({\n type: \"endrule\",\n selectors: selectors,\n line: selectors[0].line,\n col: selectors[0].col\n });\n\n }\n\n return selectors;\n\n },\n\n //CSS3 Selectors\n _selectors_group: function(){\n\n /*\n * selectors_group\n * : selector [ COMMA S* selector ]*\n * ;\n */\n var tokenStream = this._tokenStream,\n selectors = [],\n selector;\n\n selector = this._selector();\n if (selector !== null){\n\n selectors.push(selector);\n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n selector = this._selector();\n if (selector !== null){\n selectors.push(selector);\n } else {\n this._unexpectedToken(tokenStream.LT(1));\n }\n }\n }\n\n return selectors.length ? selectors : null;\n },\n\n //CSS3 Selectors\n _selector: function(){\n /*\n * selector\n * : simple_selector_sequence [ combinator simple_selector_sequence ]*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n selector = [],\n nextSelector = null,\n combinator = null,\n ws = null;\n\n //if there's no simple selector, then there's no selector\n nextSelector = this._simple_selector_sequence();\n if (nextSelector === null){\n return null;\n }\n\n selector.push(nextSelector);\n\n do {\n\n //look for a combinator\n combinator = this._combinator();\n\n if (combinator !== null){\n selector.push(combinator);\n nextSelector = this._simple_selector_sequence();\n\n //there must be a next selector\n if (nextSelector === null){\n this._unexpectedToken(tokenStream.LT(1));\n } else {\n\n //nextSelector is an instance of SelectorPart\n selector.push(nextSelector);\n }\n } else {\n\n //if there's not whitespace, we're done\n if (this._readWhitespace()){\n\n //add whitespace separator\n ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);\n\n //combinator is not required\n combinator = this._combinator();\n\n //selector is required if there's a combinator\n nextSelector = this._simple_selector_sequence();\n if (nextSelector === null){\n if (combinator !== null){\n this._unexpectedToken(tokenStream.LT(1));\n }\n } else {\n\n if (combinator !== null){\n selector.push(combinator);\n } else {\n selector.push(ws);\n }\n\n selector.push(nextSelector);\n }\n } else {\n break;\n }\n\n }\n } while(true);\n\n return new Selector(selector, selector[0].line, selector[0].col);\n },\n\n //CSS3 Selectors\n _simple_selector_sequence: function(){\n /*\n * simple_selector_sequence\n * : [ type_selector | universal ]\n * [ HASH | class | attrib | pseudo | negation ]*\n * | [ HASH | class | attrib | pseudo | negation ]+\n * ;\n */\n\n var tokenStream = this._tokenStream,\n\n //parts of a simple selector\n elementName = null,\n modifiers = [],\n\n //complete selector text\n selectorText= \"\",\n\n //the different parts after the element name to search for\n components = [\n //HASH\n function(){\n return tokenStream.match(Tokens.HASH) ?\n new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n null;\n },\n this._class,\n this._attrib,\n this._pseudo,\n this._negation\n ],\n i = 0,\n len = components.length,\n component = null,\n line,\n col;\n\n\n //get starting line and column for the selector\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n\n elementName = this._type_selector();\n if (!elementName){\n elementName = this._universal();\n }\n\n if (elementName !== null){\n selectorText += elementName;\n }\n\n while(true){\n\n //whitespace means we're done\n if (tokenStream.peek() === Tokens.S){\n break;\n }\n\n //check for each component\n while(i < len && component === null){\n component = components[i++].call(this);\n }\n\n if (component === null){\n\n //we don't have a selector\n if (selectorText === \"\"){\n return null;\n } else {\n break;\n }\n } else {\n i = 0;\n modifiers.push(component);\n selectorText += component.toString();\n component = null;\n }\n }\n\n\n return selectorText !== \"\" ?\n new SelectorPart(elementName, modifiers, selectorText, line, col) :\n null;\n },\n\n //CSS3 Selectors\n _type_selector: function(){\n /*\n * type_selector\n * : [ namespace_prefix ]? element_name\n * ;\n */\n\n var tokenStream = this._tokenStream,\n ns = this._namespace_prefix(),\n elementName = this._element_name();\n\n if (!elementName){\n /*\n * Need to back out the namespace that was read due to both\n * type_selector and universal reading namespace_prefix\n * first. Kind of hacky, but only way I can figure out\n * right now how to not change the grammar.\n */\n if (ns){\n tokenStream.unget();\n if (ns.length > 1){\n tokenStream.unget();\n }\n }\n\n return null;\n } else {\n if (ns){\n elementName.text = ns + elementName.text;\n elementName.col -= ns.length;\n }\n return elementName;\n }\n },\n\n //CSS3 Selectors\n _class: function(){\n /*\n * class\n * : '.' IDENT\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token;\n\n if (tokenStream.match(Tokens.DOT)){\n tokenStream.mustMatch(Tokens.IDENT);\n token = tokenStream.token();\n return new SelectorSubPart(\".\" + token.value, \"class\", token.startLine, token.startCol - 1);\n } else {\n return null;\n }\n\n },\n\n //CSS3 Selectors\n _element_name: function(){\n /*\n * element_name\n * : IDENT\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token;\n\n if (tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token();\n return new SelectorSubPart(token.value, \"elementName\", token.startLine, token.startCol);\n\n } else {\n return null;\n }\n },\n\n //CSS3 Selectors\n _namespace_prefix: function(){\n /*\n * namespace_prefix\n * : [ IDENT | '*' ]? '|'\n * ;\n */\n var tokenStream = this._tokenStream,\n value = \"\";\n\n //verify that this is a namespace prefix\n if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){\n\n if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){\n value += tokenStream.token().value;\n }\n\n tokenStream.mustMatch(Tokens.PIPE);\n value += \"|\";\n\n }\n\n return value.length ? value : null;\n },\n\n //CSS3 Selectors\n _universal: function(){\n /*\n * universal\n * : [ namespace_prefix ]? '*'\n * ;\n */\n var tokenStream = this._tokenStream,\n value = \"\",\n ns;\n\n ns = this._namespace_prefix();\n if(ns){\n value += ns;\n }\n\n if(tokenStream.match(Tokens.STAR)){\n value += \"*\";\n }\n\n return value.length ? value : null;\n\n },\n\n //CSS3 Selectors\n _attrib: function(){\n /*\n * attrib\n * : '[' S* [ namespace_prefix ]? IDENT S*\n * [ [ PREFIXMATCH |\n * SUFFIXMATCH |\n * SUBSTRINGMATCH |\n * '=' |\n * INCLUDES |\n * DASHMATCH ] S* [ IDENT | STRING ] S*\n * ]? ']'\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value = null,\n ns,\n token;\n\n if (tokenStream.match(Tokens.LBRACKET)){\n token = tokenStream.token();\n value = token.value;\n value += this._readWhitespace();\n\n ns = this._namespace_prefix();\n\n if (ns){\n value += ns;\n }\n\n tokenStream.mustMatch(Tokens.IDENT);\n value += tokenStream.token().value;\n value += this._readWhitespace();\n\n if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH,\n Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){\n\n value += tokenStream.token().value;\n value += this._readWhitespace();\n\n tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n value += tokenStream.token().value;\n value += this._readWhitespace();\n }\n\n tokenStream.mustMatch(Tokens.RBRACKET);\n\n return new SelectorSubPart(value + \"]\", \"attribute\", token.startLine, token.startCol);\n } else {\n return null;\n }\n },\n\n //CSS3 Selectors\n _pseudo: function(){\n\n /*\n * pseudo\n * : ':' ':'? [ IDENT | functional_pseudo ]\n * ;\n */\n\n var tokenStream = this._tokenStream,\n pseudo = null,\n colons = \":\",\n line,\n col;\n\n if (tokenStream.match(Tokens.COLON)){\n\n if (tokenStream.match(Tokens.COLON)){\n colons += \":\";\n }\n\n if (tokenStream.match(Tokens.IDENT)){\n pseudo = tokenStream.token().value;\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol - colons.length;\n } else if (tokenStream.peek() === Tokens.FUNCTION){\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol - colons.length;\n pseudo = this._functional_pseudo();\n }\n\n if (pseudo){\n pseudo = new SelectorSubPart(colons + pseudo, \"pseudo\", line, col);\n }\n }\n\n return pseudo;\n },\n\n //CSS3 Selectors\n _functional_pseudo: function(){\n /*\n * functional_pseudo\n * : FUNCTION S* expression ')'\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value = null;\n\n if(tokenStream.match(Tokens.FUNCTION)){\n value = tokenStream.token().value;\n value += this._readWhitespace();\n value += this._expression();\n tokenStream.mustMatch(Tokens.RPAREN);\n value += \")\";\n }\n\n return value;\n },\n\n //CSS3 Selectors\n _expression: function(){\n /*\n * expression\n * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+\n * ;\n */\n\n var tokenStream = this._tokenStream,\n value = \"\";\n\n while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION,\n Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH,\n Tokens.FREQ, Tokens.ANGLE, Tokens.TIME,\n Tokens.RESOLUTION, Tokens.SLASH])){\n\n value += tokenStream.token().value;\n value += this._readWhitespace();\n }\n\n return value.length ? value : null;\n\n },\n\n //CSS3 Selectors\n _negation: function(){\n /*\n * negation\n * : NOT S* negation_arg S* ')'\n * ;\n */\n\n var tokenStream = this._tokenStream,\n line,\n col,\n value = \"\",\n arg,\n subpart = null;\n\n if (tokenStream.match(Tokens.NOT)){\n value = tokenStream.token().value;\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n value += this._readWhitespace();\n arg = this._negation_arg();\n value += arg;\n value += this._readWhitespace();\n tokenStream.match(Tokens.RPAREN);\n value += tokenStream.token().value;\n\n subpart = new SelectorSubPart(value, \"not\", line, col);\n subpart.args.push(arg);\n }\n\n return subpart;\n },\n\n //CSS3 Selectors\n _negation_arg: function(){\n /*\n * negation_arg\n * : type_selector | universal | HASH | class | attrib | pseudo\n * ;\n */\n\n var tokenStream = this._tokenStream,\n args = [\n this._type_selector,\n this._universal,\n function(){\n return tokenStream.match(Tokens.HASH) ?\n new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n null;\n },\n this._class,\n this._attrib,\n this._pseudo\n ],\n arg = null,\n i = 0,\n len = args.length,\n line,\n col,\n part;\n\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n\n while(i < len && arg === null){\n\n arg = args[i].call(this);\n i++;\n }\n\n //must be a negation arg\n if (arg === null){\n this._unexpectedToken(tokenStream.LT(1));\n }\n\n //it's an element name\n if (arg.type === \"elementName\"){\n part = new SelectorPart(arg, [], arg.toString(), line, col);\n } else {\n part = new SelectorPart(null, [arg], arg.toString(), line, col);\n }\n\n return part;\n },\n\n _declaration: function(){\n\n /*\n * declaration\n * : property ':' S* expr prio?\n * | /( empty )/\n * ;\n */\n\n var tokenStream = this._tokenStream,\n property = null,\n expr = null,\n prio = null,\n invalid = null,\n propertyName= \"\";\n\n property = this._property();\n if (property !== null){\n\n tokenStream.mustMatch(Tokens.COLON);\n this._readWhitespace();\n\n expr = this._expr();\n\n //if there's no parts for the value, it's an error\n if (!expr || expr.length === 0){\n this._unexpectedToken(tokenStream.LT(1));\n }\n\n prio = this._prio();\n\n /*\n * If hacks should be allowed, then only check the root\n * property. If hacks should not be allowed, treat\n * _property or *property as invalid properties.\n */\n propertyName = property.toString();\n if (this.options.starHack && property.hack === \"*\" ||\n this.options.underscoreHack && property.hack === \"_\") {\n\n propertyName = property.text;\n }\n\n try {\n this._validateProperty(propertyName, expr);\n } catch (ex) {\n invalid = ex;\n }\n\n this.fire({\n type: \"property\",\n property: property,\n value: expr,\n important: prio,\n line: property.line,\n col: property.col,\n invalid: invalid\n });\n\n return true;\n } else {\n return false;\n }\n },\n\n _prio: function(){\n /*\n * prio\n * : IMPORTANT_SYM S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n result = tokenStream.match(Tokens.IMPORTANT_SYM);\n\n this._readWhitespace();\n return result;\n },\n\n _expr: function(inFunction){\n /*\n * expr\n * : term [ operator term ]*\n * ;\n */\n\n var values = [],\n\t\t\t\t\t//valueParts\t= [],\n value = null,\n operator = null;\n\n value = this._term(inFunction);\n if (value !== null){\n\n values.push(value);\n\n do {\n operator = this._operator(inFunction);\n\n //if there's an operator, keep building up the value parts\n if (operator){\n values.push(operator);\n } /*else {\n //if there's not an operator, you have a full value\n\t\t\t\t\t\t\tvalues.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));\n\t\t\t\t\t\t\tvalueParts = [];\n\t\t\t\t\t\t}*/\n\n value = this._term(inFunction);\n\n if (value === null){\n break;\n } else {\n values.push(value);\n }\n } while(true);\n }\n\n\t\t\t\t//cleanup\n /*if (valueParts.length){\n values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));\n }*/\n\n return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;\n },\n\n _term: function(inFunction){\n\n /*\n * term\n * : unary_operator?\n * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* |\n * TIME S* | FREQ S* | function | ie_function ]\n * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor\n * ;\n */\n\n var tokenStream = this._tokenStream,\n unary = null,\n value = null,\n endChar = null,\n token,\n line,\n col;\n\n //returns the operator or null\n unary = this._unary_operator();\n if (unary !== null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n\n //exception for IE filters\n if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){\n\n value = this._ie_function();\n if (unary === null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n\n //see if it's a simple block\n } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){\n\n token = tokenStream.token();\n endChar = token.endChar;\n value = token.value + this._expr(inFunction).text;\n if (unary === null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n tokenStream.mustMatch(Tokens.type(endChar));\n value += endChar;\n this._readWhitespace();\n\n //see if there's a simple match\n } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,\n Tokens.ANGLE, Tokens.TIME,\n Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){\n\n value = tokenStream.token().value;\n if (unary === null){\n line = tokenStream.token().startLine;\n col = tokenStream.token().startCol;\n }\n this._readWhitespace();\n } else {\n\n //see if it's a color\n token = this._hexcolor();\n if (token === null){\n\n //if there's no unary, get the start of the next token for line/col info\n if (unary === null){\n line = tokenStream.LT(1).startLine;\n col = tokenStream.LT(1).startCol;\n }\n\n //has to be a function\n if (value === null){\n\n /*\n * This checks for alpha(opacity=0) style of IE\n * functions. IE_FUNCTION only presents progid: style.\n */\n if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){\n value = this._ie_function();\n } else {\n value = this._function();\n }\n }\n\n /*if (value === null){\n return null;\n //throw new Error(\"Expected identifier at line \" + tokenStream.token().startLine + \", character \" + tokenStream.token().startCol + \".\");\n }*/\n\n } else {\n value = token.value;\n if (unary === null){\n line = token.startLine;\n col = token.startCol;\n }\n }\n\n }\n\n return value !== null ?\n new PropertyValuePart(unary !== null ? unary + value : value, line, col) :\n null;\n\n },\n\n _function: function(){\n\n /*\n * function\n * : FUNCTION S* expr ')' S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n functionText = null,\n expr = null,\n lt;\n\n if (tokenStream.match(Tokens.FUNCTION)){\n functionText = tokenStream.token().value;\n this._readWhitespace();\n expr = this._expr(true);\n functionText += expr;\n\n //START: Horrible hack in case it's an IE filter\n if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){\n do {\n\n if (this._readWhitespace()){\n functionText += tokenStream.token().value;\n }\n\n //might be second time in the loop\n if (tokenStream.LA(0) === Tokens.COMMA){\n functionText += tokenStream.token().value;\n }\n\n tokenStream.match(Tokens.IDENT);\n functionText += tokenStream.token().value;\n\n tokenStream.match(Tokens.EQUALS);\n functionText += tokenStream.token().value;\n\n //functionText += this._term();\n lt = tokenStream.peek();\n while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){\n tokenStream.get();\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n }\n } while(tokenStream.match([Tokens.COMMA, Tokens.S]));\n }\n\n //END: Horrible Hack\n\n tokenStream.match(Tokens.RPAREN);\n functionText += \")\";\n this._readWhitespace();\n }\n\n return functionText;\n },\n\n _ie_function: function(){\n\n /* (My own extension)\n * ie_function\n * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n functionText = null,\n lt;\n\n //IE function can begin like a regular function, too\n if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){\n functionText = tokenStream.token().value;\n\n do {\n\n if (this._readWhitespace()){\n functionText += tokenStream.token().value;\n }\n\n //might be second time in the loop\n if (tokenStream.LA(0) === Tokens.COMMA){\n functionText += tokenStream.token().value;\n }\n\n tokenStream.match(Tokens.IDENT);\n functionText += tokenStream.token().value;\n\n tokenStream.match(Tokens.EQUALS);\n functionText += tokenStream.token().value;\n\n //functionText += this._term();\n lt = tokenStream.peek();\n while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){\n tokenStream.get();\n functionText += tokenStream.token().value;\n lt = tokenStream.peek();\n }\n } while(tokenStream.match([Tokens.COMMA, Tokens.S]));\n\n tokenStream.match(Tokens.RPAREN);\n functionText += \")\";\n this._readWhitespace();\n }\n\n return functionText;\n },\n\n _hexcolor: function(){\n /*\n * There is a constraint on the color that it must\n * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])\n * after the \"#\"; e.g., \"#000\" is OK, but \"#abcd\" is not.\n *\n * hexcolor\n * : HASH S*\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token = null,\n color;\n\n if(tokenStream.match(Tokens.HASH)){\n\n //need to do some validation here\n\n token = tokenStream.token();\n color = token.value;\n if (!/#[a-f0-9]{3,6}/i.test(color)){\n throw new SyntaxError(\"Expected a hex color but found '\" + color + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n }\n this._readWhitespace();\n }\n\n return token;\n },\n\n //-----------------------------------------------------------------\n // Animations methods\n //-----------------------------------------------------------------\n\n _keyframes: function(){\n\n /*\n * keyframes:\n * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' {\n * ;\n */\n var tokenStream = this._tokenStream,\n token,\n tt,\n name,\n prefix = \"\";\n\n tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);\n token = tokenStream.token();\n if (/^@\\-([^\\-]+)\\-/.test(token.value)) {\n prefix = RegExp.$1;\n }\n\n this._readWhitespace();\n name = this._keyframe_name();\n\n this._readWhitespace();\n tokenStream.mustMatch(Tokens.LBRACE);\n\n this.fire({\n type: \"startkeyframes\",\n name: name,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n });\n\n this._readWhitespace();\n tt = tokenStream.peek();\n\n //check for key\n while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) {\n this._keyframe_rule();\n this._readWhitespace();\n tt = tokenStream.peek();\n }\n\n this.fire({\n type: \"endkeyframes\",\n name: name,\n prefix: prefix,\n line: token.startLine,\n col: token.startCol\n });\n\n this._readWhitespace();\n tokenStream.mustMatch(Tokens.RBRACE);\n\n },\n\n _keyframe_name: function(){\n\n /*\n * keyframe_name:\n * : IDENT\n * | STRING\n * ;\n */\n var tokenStream = this._tokenStream;\n\n tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n return SyntaxUnit.fromToken(tokenStream.token());\n },\n\n _keyframe_rule: function(){\n\n /*\n * keyframe_rule:\n * : key_list S*\n * '{' S* declaration [ ';' S* declaration ]* '}' S*\n * ;\n */\n var keyList = this._key_list();\n\n this.fire({\n type: \"startkeyframerule\",\n keys: keyList,\n line: keyList[0].line,\n col: keyList[0].col\n });\n\n this._readDeclarations(true);\n\n this.fire({\n type: \"endkeyframerule\",\n keys: keyList,\n line: keyList[0].line,\n col: keyList[0].col\n });\n\n },\n\n _key_list: function(){\n\n /*\n * key_list:\n * : key [ S* ',' S* key]*\n * ;\n */\n var tokenStream = this._tokenStream,\n keyList = [];\n\n //must be least one key\n keyList.push(this._key());\n\n this._readWhitespace();\n\n while(tokenStream.match(Tokens.COMMA)){\n this._readWhitespace();\n keyList.push(this._key());\n this._readWhitespace();\n }\n\n return keyList;\n },\n\n _key: function(){\n /*\n * There is a restriction that IDENT can be only \"from\" or \"to\".\n *\n * key\n * : PERCENTAGE\n * | IDENT\n * ;\n */\n\n var tokenStream = this._tokenStream,\n token;\n\n if (tokenStream.match(Tokens.PERCENTAGE)){\n return SyntaxUnit.fromToken(tokenStream.token());\n } else if (tokenStream.match(Tokens.IDENT)){\n token = tokenStream.token();\n\n if (/from|to/i.test(token.value)){\n return SyntaxUnit.fromToken(token);\n }\n\n tokenStream.unget();\n }\n\n //if it gets here, there wasn't a valid token, so time to explode\n this._unexpectedToken(tokenStream.LT(1));\n },\n\n //-----------------------------------------------------------------\n // Helper methods\n //-----------------------------------------------------------------\n\n /**\n * Not part of CSS grammar, but useful for skipping over\n * combination of white space and HTML-style comments.\n * @return {void}\n * @method _skipCruft\n * @private\n */\n _skipCruft: function(){\n while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){\n //noop\n }\n },\n\n /**\n * Not part of CSS grammar, but this pattern occurs frequently\n * in the official CSS grammar. Split out here to eliminate\n * duplicate code.\n * @param {Boolean} checkStart Indicates if the rule should check\n * for the left brace at the beginning.\n * @param {Boolean} readMargins Indicates if the rule should check\n * for margin patterns.\n * @return {void}\n * @method _readDeclarations\n * @private\n */\n _readDeclarations: function(checkStart, readMargins){\n /*\n * Reads the pattern\n * S* '{' S* declaration [ ';' S* declaration ]* '}' S*\n * or\n * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*\n * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.\n * A semicolon is only necessary following a declaration if there's another declaration\n * or margin afterwards.\n */\n var tokenStream = this._tokenStream,\n tt;\n\n\n this._readWhitespace();\n\n if (checkStart){\n tokenStream.mustMatch(Tokens.LBRACE);\n }\n\n this._readWhitespace();\n\n try {\n\n while(true){\n\n if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){\n //noop\n } else if (this._declaration()){\n if (!tokenStream.match(Tokens.SEMICOLON)){\n break;\n }\n } else {\n break;\n }\n\n //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){\n // break;\n //}\n this._readWhitespace();\n }\n\n tokenStream.mustMatch(Tokens.RBRACE);\n this._readWhitespace();\n\n } catch (ex) {\n if (ex instanceof SyntaxError && !this.options.strict){\n\n //fire error event\n this.fire({\n type: \"error\",\n error: ex,\n message: ex.message,\n line: ex.line,\n col: ex.col\n });\n\n //see if there's another declaration\n tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);\n if (tt === Tokens.SEMICOLON){\n //if there's a semicolon, then there might be another declaration\n this._readDeclarations(false, readMargins);\n } else if (tt !== Tokens.RBRACE){\n //if there's a right brace, the rule is finished so don't do anything\n //otherwise, rethrow the error because it wasn't handled properly\n throw ex;\n }\n\n } else {\n //not a syntax error, rethrow it\n throw ex;\n }\n }\n\n },\n\n /**\n * In some cases, you can end up with two white space tokens in a\n * row. Instead of making a change in every function that looks for\n * white space, this function is used to match as much white space\n * as necessary.\n * @method _readWhitespace\n * @return {String} The white space if found, empty string if not.\n * @private\n */\n _readWhitespace: function(){\n\n var tokenStream = this._tokenStream,\n ws = \"\";\n\n while(tokenStream.match(Tokens.S)){\n ws += tokenStream.token().value;\n }\n\n return ws;\n },\n\n\n /**\n * Throws an error when an unexpected token is found.\n * @param {Object} token The token that was found.\n * @method _unexpectedToken\n * @return {void}\n * @private\n */\n _unexpectedToken: function(token){\n throw new SyntaxError(\"Unexpected token '\" + token.value + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n },\n\n /**\n * Helper method used for parsing subparts of a style sheet.\n * @return {void}\n * @method _verifyEnd\n * @private\n */\n _verifyEnd: function(){\n if (this._tokenStream.LA(1) !== Tokens.EOF){\n this._unexpectedToken(this._tokenStream.LT(1));\n }\n },\n\n //-----------------------------------------------------------------\n // Validation methods\n //-----------------------------------------------------------------\n _validateProperty: function(property, value){\n Validation.validate(property, value);\n },\n\n //-----------------------------------------------------------------\n // Parsing methods\n //-----------------------------------------------------------------\n\n parse: function(input){\n this._tokenStream = new TokenStream(input, Tokens);\n this._stylesheet();\n },\n\n parseStyleSheet: function(input){\n //just passthrough\n return this.parse(input);\n },\n\n parseMediaQuery: function(input){\n this._tokenStream = new TokenStream(input, Tokens);\n var result = this._media_query();\n\n //if there's anything more, then it's an invalid selector\n this._verifyEnd();\n\n //otherwise return result\n return result;\n },\n\n /**\n * Parses a property value (everything after the semicolon).\n * @return {parserlib.css.PropertyValue} The property value.\n * @throws parserlib.util.SyntaxError If an unexpected token is found.\n * @method parserPropertyValue\n */\n parsePropertyValue: function(input){\n\n this._tokenStream = new TokenStream(input, Tokens);\n this._readWhitespace();\n\n var result = this._expr();\n\n //okay to have a trailing white space\n this._readWhitespace();\n\n //if there's anything more, then it's an invalid selector\n this._verifyEnd();\n\n //otherwise return result\n return result;\n },\n\n /**\n * Parses a complete CSS rule, including selectors and\n * properties.\n * @param {String} input The text to parser.\n * @return {Boolean} True if the parse completed successfully, false if not.\n * @method parseRule\n */\n parseRule: function(input){\n this._tokenStream = new TokenStream(input, Tokens);\n\n //skip any leading white space\n this._readWhitespace();\n\n var result = this._ruleset();\n\n //skip any trailing white space\n this._readWhitespace();\n\n //if there's anything more, then it's an invalid selector\n this._verifyEnd();\n\n //otherwise return result\n return result;\n },\n\n /**\n * Parses a single CSS selector (no comma)\n * @param {String} input The text to parse as a CSS selector.\n * @return {Selector} An object representing the selector.\n * @throws parserlib.util.SyntaxError If an unexpected token is found.\n * @method parseSelector\n */\n parseSelector: function(input){\n\n this._tokenStream = new TokenStream(input, Tokens);\n\n //skip any leading white space\n this._readWhitespace();\n\n var result = this._selector();\n\n //skip any trailing white space\n this._readWhitespace();\n\n //if there's anything more, then it's an invalid selector\n this._verifyEnd();\n\n //otherwise return result\n return result;\n },\n\n /**\n * Parses an HTML style attribute: a set of CSS declarations\n * separated by semicolons.\n * @param {String} input The text to parse as a style attribute\n * @return {void}\n * @method parseStyleAttribute\n */\n parseStyleAttribute: function(input){\n input += \"}\"; // for error recovery in _readDeclarations()\n this._tokenStream = new TokenStream(input, Tokens);\n this._readDeclarations();\n }\n };\n\n //copy over onto prototype\n for (prop in additions){\n if (Object.prototype.hasOwnProperty.call(additions, prop)){\n proto[prop] = additions[prop];\n }\n }\n\n return proto;\n}();\n\n\n/*\nnth\n : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? |\n ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*\n ;\n*/\nvar Properties = {\n __proto__: null,\n\n //A\n \"align-items\" : \"flex-start | flex-end | center | baseline | stretch\",\n \"align-content\" : \"flex-start | flex-end | center | space-between | space-around | stretch\",\n \"align-self\" : \"auto | flex-start | flex-end | center | baseline | stretch\",\n \"-webkit-align-items\" : \"flex-start | flex-end | center | baseline | stretch\",\n \"-webkit-align-content\" : \"flex-start | flex-end | center | space-between | space-around | stretch\",\n \"-webkit-align-self\" : \"auto | flex-start | flex-end | center | baseline | stretch\",\n \"alignment-adjust\" : \"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | \",\n \"alignment-baseline\" : \"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",\n \"animation\" : 1,\n \"animation-delay\" : { multi: \"